53 FXIMPLEMENT(
GUIDialog_EditViewport, FXDialogBox, GUIDialog_EditViewportMap, ARRAYNUMBER(GUIDialog_EditViewportMap))
60 FXDialogBox(parent, name,
GUIDesignDialogBox, x, y, 0, 0, 0, 0, 0, 0),
66 myLoadButton =
new FXButton(frameFiles,
"Load\t\tLoad viewport from file",
68 mySaveButton =
new FXButton(frameFiles,
"Save\t\tSave viewport to file",
80 myZoom->setRange(0.0001, 100000);
86 myXOff =
new FXRealSpinner(lookFromXFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
91 myYOff =
new FXRealSpinner(lookFromYFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
96 myZOff =
new FXRealSpinner(lookFromZFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
97 myZOff->setRange(0.12, 100000000);
102 myRotation =
new FXRealSpinner(rotationFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
111 myLookAtX =
new FXRealSpinner(lookAtXFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
116 myLookAtY =
new FXRealSpinner(lookAtYFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
121 myLookAtZ =
new FXRealSpinner(lookAtZFrame, 16,
this, MID_CHANGED,
GUIDesignSpinDial | SPIN_NOMIN | SPIN_NOMAX);
206 FXFileDialog opendialog(
this,
"Load Viewport");
208 opendialog.setSelectMode(SELECTFILE_ANY);
209 opendialog.setPatternList(
"*.xml");
213 if (opendialog.execute()) {
236 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
270 myXOff->setValue(lookFrom.
x());
271 myYOff->setValue(lookFrom.
y());
272 myZOff->setValue(lookFrom.
z());
302 getApp()->reg().writeIntEntry(
"VIEWPORT_DIALOG_SETTINGS",
"x", getX());
303 getApp()->reg().writeIntEntry(
"VIEWPORT_DIALOG_SETTINGS",
"y", getY());
long onCmdOk(FXObject *, FXSelector, void *)
Called when the user wants to keep the viewport.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void close()
Closes the device and removes it from the dictionary.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
double z() const
Returns the z-position.
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.
virtual double zoom2ZPos(double zoom) const =0
Returns the camera height at which the given zoom level is reached.
double y() const
Returns the y-position.
FXButton * myLoadButton
load button
#define GUIDesignContentsFrame
design for the main content frame of every frame/dialog
FXRealSpinner * myZoom
The spin dialers used to change the view.
double x() const
Returns the x-position.
#define GUIDesignButtonCancel
Cancel Button.
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
void setOldValues(const Position &lookFrom, const Position &lookAt, double rotation)
Resets old values.
void writeXML(OutputDevice &dev)
write the settings to the given device
FXString gCurrentFolder
The folder used as last.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user wants to load a viewport.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
#define UNUSED_PARAMETER(x)
static OptionsCont & getOptions()
Retrieves the options.
void saveWindowPos()
save window position to the registry
#define GUIDesignHorizontalSeparator
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A point in 2D or 3D with translation and scaling methods.
FXRealSpinner * myLookAtX
The spin dialers used to change the view at (osg only)
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
GUIPerspectiveChanger & getChanger() const
get changer
virtual double zPos2Zoom(double zPos) const =0
Returns the zoom level that is achieved at a given camera height.
~GUIDialog_EditViewport()
Destructor.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user wants to save a viewport.
GUISUMOAbstractView * myParent
The calling view.
virtual double getZoom() const =0
Returns the zoom factor computed stored in this changer.
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
FXButton * myOKButton
OK button.
FXDEFMAP(GUIDialog_EditViewport) GUIDialog_EditViewportMap[]
#define GUIDesignAuxiliarVerticalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames ...
void setValues(double zoom, double xoff, double yoff, double rotation)
Sets the given values into the dialog.
Position myOldLookFrom
The old viewport.
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center and height of 23 ...
#define GUIDesignDialogBox
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
FXRealSpinner * myLookAtZ
#define GUIDesignHorizontalFrameIcons
Horizontal frame used for pack icons.
void show()
overload show function to focus always in OK Button
FXRealSpinner * myRotation
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
#define GUIDesignButtonOK
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An XML-handler for visualisation schemes.
#define GUIDesignSpinDial
A dialog to change the viewport.
#define GUIDesignButtonToolbarWithText
little button with text and icon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left and height of 23 ...
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
FXRealSpinner * myLookAtY
static const Position INVALID
used to indicate that a position is valid