SUMO - Simulation of Urban MObility
GUIGlChildWindow.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 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 
38 #include "GUIGlChildWindow.h"
39 
40 
41 // ===========================================================================
42 // FOX callback mapping
43 // ===========================================================================
44 FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[] = {
48  FXMAPFUNC(SEL_COMMAND, MID_ZOOM_STYLE, GUIGlChildWindow::onCmdZoomStyle),
51 };
52 
53 FXIMPLEMENT(GUIGlChildWindow, FXMDIChild, GUIGlChildWindowMap, ARRAYNUMBER(GUIGlChildWindowMap))
54 
55 
56 // ===========================================================================
57 // member method definitions
58 // ===========================================================================
60  FXMDIClient* p,
61  GUIMainWindow* parentWindow,
62  FXMDIMenu* mdimenu, const FXString& name,
63  FXIcon* ic,
64  FXuint opts, FXint x, FXint y, FXint w, FXint h) :
65  FXMDIChild(p, name, ic, mdimenu, opts, x, y, w, h),
66  myView(0),
67  myParent(parentWindow) {
68  // Make MDI Window Menu
69  setTracking();
70  myContentFrame = new FXVerticalFrame(this, GUIDesignFrameArea);
71  // build the tool bar
72  buildNavigationToolBar(); // always there (recenter)
73  buildColoringToolBar(); // always there (coloring)
74  buildScreenshotToolBar(); // always there (screen shot)
75 }
76 
77 
79  delete myLocatorPopup;
80  delete myNavigationToolBar;
81 }
82 
83 
84 void
86  FXMDIChild::create();
87  myNavigationToolBar->create();
88  myLocatorPopup->create();
89  myView->create();
90 }
91 
92 
93 void
95  // Build navigation toolbar
97 
98  // build the view settings
99  // recenter view
100  new FXButton(myNavigationToolBar,
101  "\tRecenter View\tRecenter view to the simulated area.",
103  // add viewport button
104  new FXButton(myNavigationToolBar,
105  "\tEdit Viewport...\tOpens a menu which lets you edit the viewport.",
107  // toggle button for zooming style
109  "\tToggles Zooming Style\tToggles whether zooming is based at cursor position or at the center of the view.",
111  zoomBut->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 1) != 1);
112 
113  // build the locator popup
114  myLocatorPopup = new FXPopup(myNavigationToolBar, POPUP_VERTICAL);
115  myLocatorButton = new FXMenuButton(myNavigationToolBar, "\tLocate Structures\tLocate structures within the network.",
118  // add toggle button for tool-tips on/off
120  "\tToggles Tool Tips\tToggles whether tool tips shall be shown.",
122 
123 }
124 
125 
126 void
128  // Create Vertical separator
129  new FXVerticalSeparator(myNavigationToolBar, GUIDesignVerticalSeparator);
130 
131  // build coloring tools
132  // combo
134  // editor
135  new FXButton(myNavigationToolBar,
136  "\tEdit Coloring Schemes...\tOpens a menu which lets you edit the coloring schemes.",
138 }
139 
140 
141 void
143  // Create Vertical separator
144  new FXVerticalSeparator(myNavigationToolBar, GUIDesignVerticalSeparator);
145  // snapshot
147  "\tMake Snapshot\tMakes a snapshot of the view.",
149 }
150 
151 
152 FXGLCanvas*
154  return myView;
155 }
156 
157 
158 FXToolBar&
160  return *myNavigationToolBar;
161 }
162 
163 
164 FXPopup*
166  return myLocatorPopup;
167 }
168 
169 
170 FXComboBox&
172  return *myColoringSchemes;
173 }
174 
175 
176 long
177 GUIGlChildWindow::onCmdRecenterView(FXObject*, FXSelector, void*) {
178  myView->recenterView();
179  myView->update();
180  return 1;
181 }
182 
183 
184 long
185 GUIGlChildWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
187  return 1;
188 }
189 
190 
191 long
192 GUIGlChildWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
194  return 1;
195 }
196 
197 
198 long
199 GUIGlChildWindow::onCmdShowToolTips(FXObject* sender, FXSelector, void*) {
200  MFXCheckableButton* button = static_cast<MFXCheckableButton*>(sender);
201  button->setChecked(!button->amChecked());
202  myView->showToolTips(button->amChecked());
203  update();
204  myView->update();
205  return 1;
206 }
207 
208 
209 long
210 GUIGlChildWindow::onCmdZoomStyle(FXObject* sender, FXSelector, void*) {
211  MFXCheckableButton* button = static_cast<MFXCheckableButton*>(sender);
212  button->setChecked(!button->amChecked());
213  getApp()->reg().writeIntEntry("gui", "zoomAtCenter",
214  button->amChecked() ? 0 : 1);
215  update();
216  myView->update();
217  return 1;
218 }
219 
220 
221 long
222 GUIGlChildWindow::onCmdChangeColorScheme(FXObject*, FXSelector , void* data) {
223  myView->setColorScheme((char*) data);
224  return 1;
225 }
226 
227 
228 void
230  // this is used by the locator widget. zooming to bounding box
231  myView->centerTo(id, true, -1);
232  myView->update();
233 }
234 
235 
236 bool
238  return gSelected.isSelected(o->getType(), o->getGlID());
239 }
240 /****************************************************************************/
241 
void showToolTips(bool val)
show tool tips
Open viewport editor - button.
Definition: GUIAppEnum.h:193
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:197
FXToolBar & getNavigationToolBar(GUISUMOAbstractView &v)
virtual void recenterView()
recenters the view
#define GUIDesignVerticalSeparator
vertical separator
Definition: GUIDesigns.h:284
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:82
void setChecked(bool val)
check or uncheck this MFXCheckableButton
virtual bool isSelected(GUIGlObject *o) const
true if the object is selected (may include extra logic besides calling gSelected) ...
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
long onCmdZoomStyle(FXObject *sender, FXSelector, void *)
FXPopup * myLocatorPopup
The locator menu.
#define GUIDesignFrameArea
Definition: GUIDesigns.h:232
GUIGlID getGlID() const
Returns the numerical id of the object.
virtual FXGLCanvas * getBuildGLCanvas() const
Show tool tips - button.
Definition: GUIAppEnum.h:197
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
long onCmdShowToolTips(FXObject *sender, FXSelector, void *)
FXDEFMAP(GUIGlChildWindow) GUIGlChildWindowMap[]
#define GUIDesignButtonToolbarLocator
little checkable button with icon placed in navigation toolbar used specify for Locator ...
Definition: GUIDesigns.h:88
FXComboBox & getColoringSchemesCombo()
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Make snapshot - button.
Definition: GUIAppEnum.h:199
#define GUIDesignComboBoxStatic
Combo box static (not editable)
Definition: GUIDesigns.h:190
toogle zooming style
Definition: GUIAppEnum.h:201
FXToolBar * myNavigationToolBar
The tool bar.
virtual bool setColorScheme(const std::string &)
set color scheme
unsigned int GUIGlID
Definition: GUIGlObject.h:50
virtual void showViewportEditor()
show viewport editor
#define GUIDesignBar
Definition: GUIDesigns.h:260
void setView(GUIGlID id)
Centers the view onto the given artifact.
FXComboBox * myColoringSchemes
virtual ~GUIGlChildWindow()
#define GUIDesignButtonToolbarCheckable
little checkable button with icon placed in navigation toolbar
Definition: GUIDesigns.h:91
FXMenuButton * myLocatorButton
GUISUMOAbstractView * myView
the view
long onCmdEditViewport(FXObject *, FXSelector, void *)
Change coloring scheme - combo.
Definition: GUIAppEnum.h:223
Open view editor - button.
Definition: GUIAppEnum.h:195
long onCmdRecenterView(FXObject *, FXSelector, void *)
void showViewschemeEditor()
show viewsscheme editor
long onCmdChangeColorScheme(FXObject *, FXSelector sel, void *)
virtual void create()
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXVerticalFrame * myContentFrame
bool amChecked() const
check if this MFXCheckableButton is checked
Recenter view - button.
Definition: GUIAppEnum.h:169
FXPopup * getLocatorPopup()