SUMO - Simulation of Urban MObility
 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.dlr.de/
12 // Copyright (C) 2001-2015 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>
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 #define DEBUG_VEHICLE_GUI_SELECTION 1
50 
51 // ===========================================================================
52 // FOX callback mapping
53 // ===========================================================================
54 FXDEFMAP(GUIGLObjectPopupMenu) GUIGLObjectPopupMenuMap[] = {
55  FXMAPFUNC(SEL_COMMAND, MID_CENTER, GUIGLObjectPopupMenu::onCmdCenter),
56  FXMAPFUNC(SEL_COMMAND, MID_COPY_NAME, GUIGLObjectPopupMenu::onCmdCopyName),
60  FXMAPFUNC(SEL_COMMAND, MID_SHOWPARS, GUIGLObjectPopupMenu::onCmdShowPars),
63 };
64 
65 // Object implementation
66 FXIMPLEMENT(GUIGLObjectPopupMenu, FXMenuPane, GUIGLObjectPopupMenuMap, ARRAYNUMBER(GUIGLObjectPopupMenuMap))
67 
68 
69 // ===========================================================================
70 // method definitions
71 // ===========================================================================
73  GUISUMOAbstractView& parent,
74  GUIGlObject& o)
75  : FXMenuPane(&parent), myParent(&parent), myObject(&o),
76  myApplication(&app), myNetworkPosition(parent.getPositionInformation()) {
77 }
78 
79 
81 
82 
83 long
85  // we already know where the object is since we clicked on it -> zoom on Boundary
86  myParent->centerTo(myObject->getGlID(), true, -1);
87  return 1;
88 }
89 
90 
91 long
94  return 1;
95 }
96 
97 
98 long
101  return 1;
102 }
103 
104 
105 long
108  return 1;
109 }
110 
111 
112 long
116  // formated for pasting into google maps
117  const std::string posString = toString(pos.y(), GEO_OUTPUT_ACCURACY) + ", " + toString(pos.x(), GEO_OUTPUT_ACCURACY);
118  GUIUserIO::copyToClipboard(*myParent->getApp(), posString);
119  return 1;
120 }
121 
122 
123 long
125  myObject->getParameterWindow(*myApplication, *myParent); // !!! showParameterWindow would be more appropriate
126  return 1;
127 }
128 
129 
130 long
133  myParent->update();
134 #ifdef DEBUG_VEHICLE_GUI_SELECTION
136 #endif
137  return 1;
138 }
139 
140 
141 long
144  myParent->update();
145  return 1;
146 }
147 
148 
149 /****************************************************************************/
150 
Copy cursor position - popup entry.
Definition: GUIAppEnum.h:221
long onCmdCenter(FXObject *, FXSelector, void *)
Called if the assigned objects shall be centered.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
Position myNetworkPosition
The position within the network the cursor was above when instanting the popup.
long onCmdCopyName(FXObject *, FXSelector, void *)
Called if the name shall be copied to clipboard.
static void copyToClipboard(const FXApp &app, const std::string &text)
Copies the given text to clipboard.
Definition: GUIUserIO.cpp:49
long onCmdAddSelected(FXObject *, FXSelector, void *)
Called if the object shall be added to the list of selected objects.
Copy object name - popup entry.
Definition: GUIAppEnum.h:217
virtual void centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist=20)
centers to the chosen artifact
long onCmdCopyCursorPosition(FXObject *, FXSelector, void *)
Called if the cursor position shall be copied to clipboard.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:219
#define GEO_OUTPUT_ACCURACY
Definition: config.h:16
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:146
long onCmdCopyCursorGeoPosition(FXObject *, FXSelector, void *)
Called if the cursor geo-position shall be copied to clipboard.
GUISUMOAbstractView * myParent
The parent window.
Add to selected items - menu entry.
Definition: GUIAppEnum.h:233
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:115
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
std::string gDebugSelectedVehicle
Definition: StdDefs.cpp:101
virtual ~GUIGLObjectPopupMenu()
Destructor.
Center view to object - popup entry.
Definition: GUIAppEnum.h:215
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own parameter window.
Remove from selected items - Menu Etry.
Definition: GUIAppEnum.h:235
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
long onCmdCopyTypedName(FXObject *, FXSelector, void *)
Called if the typed name shall be copied to clipboard.
Show object parameter - popup entry.
Definition: GUIAppEnum.h:225
void deselect(GUIGlID id)
Deselects the object with the given id.
Copy cursor geo-coordinate position - popup entry.
Definition: GUIAppEnum.h:223
long onCmdRemoveSelected(FXObject *, FXSelector, void *)
Called if the object shall be removed from the list of selected objects.
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
The popup menu of a globject.
long onCmdShowPars(FXObject *, FXSelector, void *)
Called if the parameter of this object shall be shown.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
GUIMainWindow * myApplication
The main application.
GUIGlObject * myObject
The object that belongs to this popup-menu.
const std::string & getFullName() const
Returns the full name appearing in the tool tip.
Definition: GUIGlObject.h:107
GUISelectedStorage gSelected
A global holder of selected objects.