Eclipse SUMO - Simulation of Urban MObility
GUIDialog_EditViewport.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A dialog to change the viewport
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
31 class Position;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
41 class GUIDialog_EditViewport : public FXDialogBox, public GUIPersistentWindowPos {
42  // FOX-declarations
43  FXDECLARE(GUIDialog_EditViewport)
44 public:
46  enum {
47  MID_CHANGED = FXDialogBox::ID_LAST,
51  MID_SAVE
52  };
53 
54 
59  GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name);
60 
63 
65  void show();
66 
69 
71  long onCmdChanged(FXObject*, FXSelector, void*);
72 
74  long onCmdOk(FXObject*, FXSelector, void*);
75 
77  long onCmdCancel(FXObject*, FXSelector, void*);
78 
80  long onCmdLoad(FXObject*, FXSelector, void*);
81 
83  long onCmdSave(FXObject*, FXSelector, void*);
85 
87  void writeXML(OutputDevice& dev);
88 
94  void setValues(double zoom, double xoff, double yoff, double rotation);
95 
100  void setValues(const Position& lookFrom, const Position& lookAt, double rotation);
101 
106  void setOldValues(const Position& lookFrom, const Position& lookAt, double rotation);
107 
111  bool haveGrabbed() const;
112 
116  double getZoomValue() const;
117 
118 
122  void setZoomValue(double zoom);
123 
124 protected:
125  FOX_CONSTRUCTOR(GUIDialog_EditViewport)
126 
127 
128  void saveWindowPos();
129 
130 private:
133 
137 
139  FXButton* myLoadButton = nullptr;
140 
142  FXButton* mySaveButton = nullptr;
143 
145  FXRealSpinner* myZoom = nullptr;
146  FXRealSpinner* myXOff = nullptr;
147  FXRealSpinner* myYOff = nullptr;
148  FXRealSpinner* myZOff = nullptr;
149  FXRealSpinner* myRotation = nullptr;
150 
152  FXRealSpinner* myLookAtX = nullptr;
153  FXRealSpinner* myLookAtY = nullptr;
154  FXRealSpinner* myLookAtZ = nullptr;
155 
157  FXButton* myOKButton = nullptr;
158 
160  FXButton* myCancelButton = nullptr;
161 };
A dialog to change the viewport.
void setOldValues(const Position &lookFrom, const Position &lookAt, double rotation)
Resets old values.
void writeXML(OutputDevice &dev)
write the settings to the given device
FXButton * mySaveButton
save button
FXButton * myCancelButton
Cancel button.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user wants to save a viewport.
Position myOldLookFrom
The old viewport.
void setZoomValue(double zoom)
Resets the zoom spin dialer.
GUIDialog_EditViewport(GUISUMOAbstractView *parent, const char *name)
Constructor.
void setValues(double zoom, double xoff, double yoff, double rotation)
Sets the given values into the dialog.
void saveWindowPos()
save window position to the registry
FXButton * myLoadButton
load button
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user wants to load a viewport.
GUISUMOAbstractView * myParent
The calling view.
FXButton * myOKButton
OK button.
long onCmdCancel(FXObject *, FXSelector, void *)
Called when the user wants to restore the viewport.
long onCmdChanged(FXObject *, FXSelector, void *)
Called when the user changes the viewport.
FXRealSpinner * myLookAtX
The spin dialers used to change the view at (osg only)
long onCmdOk(FXObject *, FXSelector, void *)
Called when the user wants to keep the viewport.
FXRealSpinner * myZoom
The spin dialers used to change the view.
double getZoomValue() const
Returns the current zoom value stored in the corresponding spin dialer.
void show()
overload show function to focus always in OK Button
Persists window position in the registry.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37