SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GUIGLObjectPopupMenu.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// The popup menu of a globject
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <iostream>
34
#include <cassert>
35
#include <
utils/geom/GeoConvHelper.h
>
36
#include <
utils/gui/windows/GUISUMOAbstractView.h
>
37
#include <
utils/gui/globjects/GUIGlObject.h
>
38
#include <
utils/gui/windows/GUIAppEnum.h
>
39
#include <
utils/gui/div/GUIParameterTableWindow.h
>
40
#include <
utils/gui/div/GUIGlobalSelection.h
>
41
#include <
utils/gui/div/GUIUserIO.h
>
42
#include <
utils/common/ToString.h
>
43
#include "
GUIGLObjectPopupMenu.h
"
44
45
#ifdef CHECK_MEMORY_LEAKS
46
#include <
foreign/nvwa/debug_new.h
>
47
#endif // CHECK_MEMORY_LEAKS
48
49
50
// ===========================================================================
51
// FOX callback mapping
52
// ===========================================================================
53
FXDEFMAP
(
GUIGLObjectPopupMenu
) GUIGLObjectPopupMenuMap[] = {
54
FXMAPFUNC(SEL_COMMAND,
MID_CENTER
,
GUIGLObjectPopupMenu::onCmdCenter
),
55
FXMAPFUNC(SEL_COMMAND,
MID_COPY_NAME
,
GUIGLObjectPopupMenu::onCmdCopyName
),
56
FXMAPFUNC(SEL_COMMAND,
MID_COPY_TYPED_NAME
,
GUIGLObjectPopupMenu::onCmdCopyTypedName
),
57
FXMAPFUNC(SEL_COMMAND,
MID_COPY_CURSOR_POSITION
,
GUIGLObjectPopupMenu::onCmdCopyCursorPosition
),
58
FXMAPFUNC(SEL_COMMAND,
MID_COPY_CURSOR_GEOPOSITION
,
GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition
),
59
FXMAPFUNC(SEL_COMMAND,
MID_SHOWPARS
,
GUIGLObjectPopupMenu::onCmdShowPars
),
60
FXMAPFUNC(SEL_COMMAND,
MID_ADDSELECT
,
GUIGLObjectPopupMenu::onCmdAddSelected
),
61
FXMAPFUNC(SEL_COMMAND,
MID_REMOVESELECT
,
GUIGLObjectPopupMenu::onCmdRemoveSelected
)
62
};
63
64
// Object implementation
65
FXIMPLEMENT(
GUIGLObjectPopupMenu
,
FXMenuPane
, GUIGLObjectPopupMenuMap, ARRAYNUMBER(GUIGLObjectPopupMenuMap))
66
67
68
// ===========================================================================
69
// method definitions
70
// ===========================================================================
71
GUIGLObjectPopupMenu
::
GUIGLObjectPopupMenu
(
GUIMainWindow
& app,
72
GUISUMOAbstractView
& parent,
73
GUIGlObject
& o)
74
:
FXMenuPane
(&parent), myParent(&parent), myObject(&o),
75
myApplication(&app), myNetworkPosition(parent.getPositionInformation()) {
76
}
77
78
79
GUIGLObjectPopupMenu::~GUIGLObjectPopupMenu
() {}
80
81
82
long
83
GUIGLObjectPopupMenu::onCmdCenter
(
FXObject
*, FXSelector,
void
*) {
84
// we already know where the object is since we clicked on it -> zoom on Boundary
85
myParent
->
centerTo
(
myObject
->
getGlID
(),
true
, -1);
86
return
1;
87
}
88
89
90
long
91
GUIGLObjectPopupMenu::onCmdCopyName
(
FXObject
*, FXSelector,
void
*) {
92
GUIUserIO::copyToClipboard
(*
myParent
->getApp(),
myObject
->
getMicrosimID
());
93
return
1;
94
}
95
96
97
long
98
GUIGLObjectPopupMenu::onCmdCopyTypedName
(
FXObject
*, FXSelector,
void
*) {
99
GUIUserIO::copyToClipboard
(*
myParent
->getApp(),
myObject
->
getFullName
());
100
return
1;
101
}
102
103
104
long
105
GUIGLObjectPopupMenu::onCmdCopyCursorPosition
(
FXObject
*, FXSelector,
void
*) {
106
GUIUserIO::copyToClipboard
(*
myParent
->getApp(),
toString
(
myNetworkPosition
));
107
return
1;
108
}
109
110
111
long
112
GUIGLObjectPopupMenu::onCmdCopyCursorGeoPosition
(
FXObject
*, FXSelector,
void
*) {
113
Position
pos =
myNetworkPosition
;
114
GeoConvHelper::getFinal
().
cartesian2geo
(pos);
115
// formated for pasting into google maps
116
const
std::string posString =
toString
(pos.
y
(),
GEO_OUTPUT_ACCURACY
) +
", "
+
toString
(pos.
x
(),
GEO_OUTPUT_ACCURACY
);
117
GUIUserIO::copyToClipboard
(*
myParent
->getApp(), posString);
118
return
1;
119
}
120
121
122
long
123
GUIGLObjectPopupMenu::onCmdShowPars
(
FXObject
*, FXSelector,
void
*) {
124
myObject
->
getParameterWindow
(*
myApplication
, *
myParent
);
// !!! showParameterWindow would be more appropriate
125
return
1;
126
}
127
128
129
long
130
GUIGLObjectPopupMenu::onCmdAddSelected
(
FXObject
*, FXSelector,
void
*) {
131
gSelected
.
select
(
myObject
->
getGlID
());
132
myParent
->update();
133
return
1;
134
}
135
136
137
long
138
GUIGLObjectPopupMenu::onCmdRemoveSelected
(
FXObject
*, FXSelector,
void
*) {
139
gSelected
.
deselect
(
myObject
->
getGlID
());
140
myParent
->update();
141
return
1;
142
}
143
144
145
/****************************************************************************/
146
build
buildd
sumo-0.15.0~dfsg
src
utils
gui
globjects
GUIGLObjectPopupMenu.cpp
Generated on Wed Jul 18 2012 22:58:32 for SUMO - Simulation of Urban MObility by
1.8.1.1