SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
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),
59  FXMAPFUNC(SEL_COMMAND, MID_SHOWPARS, GUIGLObjectPopupMenu::onCmdShowPars),
62 };
63 
64 // Object implementation
65 FXIMPLEMENT(GUIGLObjectPopupMenu, FXMenuPane, GUIGLObjectPopupMenuMap, ARRAYNUMBER(GUIGLObjectPopupMenuMap))
66 
67 
68 // ===========================================================================
69 // method definitions
70 // ===========================================================================
72  GUISUMOAbstractView& parent,
73  GUIGlObject& o)
74  : FXMenuPane(&parent), myParent(&parent), myObject(&o),
75  myApplication(&app), myNetworkPosition(parent.getPositionInformation()) {
76 }
77 
78 
80 
81 
82 long
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
93  return 1;
94 }
95 
96 
97 long
100  return 1;
101 }
102 
103 
104 long
107  return 1;
108 }
109 
110 
111 long
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
124  myObject->getParameterWindow(*myApplication, *myParent); // !!! showParameterWindow would be more appropriate
125  return 1;
126 }
127 
128 
129 long
132  myParent->update();
133  return 1;
134 }
135 
136 
137 long
140  myParent->update();
141  return 1;
142 }
143 
144 
145 /****************************************************************************/
146 
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
Center view to object - popup entry.
Definition: GUIAppEnum.h:215
long onCmdAddSelected(FXObject *, FXSelector, void *)
Called if the object shall be added to the list of selected objects.
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.
#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.
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:219
GUISUMOAbstractView * myParent
The parent window.
Remove from selected items - Menu Etry.
Definition: GUIAppEnum.h:235
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
virtual ~GUIGLObjectPopupMenu()
Destructor.
Copy object name - popup entry.
Definition: GUIAppEnum.h:217
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.
Show object parameter - popup entry.
Definition: GUIAppEnum.h:225
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.
void deselect(GUIGlID id)
Deselects the object with the given id.
Add to selected items - menu entry.
Definition: GUIAppEnum.h:233
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.
Copy cursor geo-coordinate position - popup entry.
Definition: GUIAppEnum.h:223
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
Copy cursor position - popup entry.
Definition: GUIAppEnum.h:221
GUISelectedStorage gSelected
A global holder of selected objects.
FXDEFMAP(GUIGLObjectPopupMenu) GUIGLObjectPopupMenuMap[]