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.org/sumo
3 // Copyright (C) 2001-2020 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 
24 #include <fx.h>
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
30 class Position;
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
40 class GUIDialog_EditViewport : public FXDialogBox {
41  // FOX-declarations
42  FXDECLARE(GUIDialog_EditViewport)
43 public:
45  enum {
46  MID_CHANGED = FXDialogBox::ID_LAST,
50  MID_SAVE
51  };
52 
53 
60  GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name, int x, int y);
61 
64 
66  void show();
67 
70 
72  long onCmdChanged(FXObject*, FXSelector, void*);
73 
75  long onCmdOk(FXObject*, FXSelector, void*);
76 
78  long onCmdCancel(FXObject*, FXSelector, void*);
79 
81  long onCmdLoad(FXObject*, FXSelector, void*);
82 
84  long onCmdSave(FXObject*, FXSelector, void*);
86 
88  void writeXML(OutputDevice& dev);
89 
95  void setValues(double zoom, double xoff, double yoff, double rotation);
96 
101  void setValues(const Position& lookFrom, const Position& lookAt, double rotation);
102 
107  void setOldValues(const Position& lookFrom, const Position& lookAt, double rotation);
108 
112  bool haveGrabbed() const;
113 
114 protected:
115  FOX_CONSTRUCTOR(GUIDialog_EditViewport)
116 
117 
118  void saveWindowPos();
119 
120 private:
123 
127 
129  FXButton* myLoadButton;
130 
132  FXButton* mySaveButton;
133 
135  FXRealSpinner* myZoom, *myXOff, *myYOff, *myZOff, *myRotation;
136 
138  FXRealSpinner* myLookAtX, *myLookAtY, *myLookAtZ;
139 
141  FXButton* myOKButton;
142 
144  FXButton* myCancelButton;
145 };
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 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.
GUIDialog_EditViewport(GUISUMOAbstractView *parent, const char *name, int x, int y)
Constructor.
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.
void show()
overload show function to focus always in OK Button
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36