45 #ifdef CHECK_MEMORY_LEAKS 47 #endif // CHECK_MEMORY_LEAKS 63 FXIMPLEMENT(
GUIDialog_EditViewport, FXDialogBox, GUIDialog_EditViewportMap, ARRAYNUMBER(GUIDialog_EditViewportMap))
70 const
char* name,
int x,
int y)
71 : FXDialogBox(parent, name, DECOR_TITLE | DECOR_BORDER, x, y, 0, 0),
73 FXVerticalFrame* f1 =
new FXVerticalFrame(
this, LAYOUT_TOP | FRAME_NONE | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 1, 1);
75 FXHorizontalFrame* frame0 =
76 new FXHorizontalFrame(f1, FRAME_THICK, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2);
77 new FXButton(frame0,
"\t\tLoad viewport from file",
79 new FXButton(frame0,
"\t\tSave viewport to file",
82 FXMatrix* m1 =
new FXMatrix(f1, 2, MATRIX_BY_COLUMNS);
83 new FXLabel(m1,
"Zoom:", 0, LAYOUT_CENTER_Y);
84 myZoom =
new FXRealSpinDial(m1, 16,
this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK);
85 myZoom->setRange(0.0001, 100000);
86 myZoom->setNumberFormat(4);
87 new FXLabel(m1,
"X:", 0, LAYOUT_CENTER_Y);
89 new FXLabel(m1,
"Y:", 0, LAYOUT_CENTER_Y);
91 new FXLabel(m1,
"Z:", 0, LAYOUT_CENTER_Y);
94 new FXLabel(m1,
"LookAtX:", 0, LAYOUT_CENTER_Y);
96 new FXLabel(m1,
"LookAtY:", 0, LAYOUT_CENTER_Y);
98 new FXLabel(m1,
"LookAtZ:", 0, LAYOUT_CENTER_Y);
103 FXHorizontalFrame* f6 =
new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 0);
106 BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X,
107 0, 0, 0, 0, 4, 4, 3, 3);
109 FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X,
110 0, 0, 0, 0, 4, 4, 3, 3);
123 Position(myLookAtX->getValue(), myLookAtY->getValue(), myLookAtZ->getValue())
150 Position(myLookAtX->getValue(), myLookAtY->getValue(), myLookAtZ->getValue())
161 FXFileDialog opendialog(
this,
"Load Viewport");
163 opendialog.setSelectMode(SELECTFILE_ANY);
164 opendialog.setPatternList(
"*.xml");
168 if (opendialog.execute()) {
191 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
222 myXOff->setValue(lookFrom.
x());
223 myYOff->setValue(lookFrom.
y());
224 myZOff->setValue(lookFrom.
z());
227 myLookAtX->setValue(lookAt.
x());
228 myLookAtY->setValue(lookAt.
y());
229 myLookAtZ->setValue(lookAt.
z());
246 return myZoom->getDial().grabbed() ||
myXOff->getDial().grabbed() ||
myYOff->getDial().grabbed();
virtual SUMOReal zoom2ZPos(SUMOReal zoom) const =0
Returns the camera height at which the given zoom level is reached.
void setValues(SUMOReal zoom, SUMOReal xoff, SUMOReal yoff)
Sets the given values into the dialog.
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.
virtual void setViewportFromTo(const Position &lookFrom, const Position &lookAt)
applies the given viewport settings
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.
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
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.
virtual SUMOReal getZoom() const =0
Returns the zoom factor computed stored in this changer.
FXRealSpinDial * myZoom
The spin dialers used to change the view.
SUMOReal x() const
Returns the x-position.
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)
virtual SUMOReal zPos2Zoom(SUMOReal zPos) const =0
Returns the zoom level that is achieved at a given camera height.
virtual SUMOReal getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
#define GUIDesignHorizontalSeparator
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
A point in 2D or 3D with translation and scaling methods.
virtual SUMOReal getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
SUMOReal z() const
Returns the z-position.
~GUIDialog_EditViewport()
Destructor.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user wants to save a viewport.
GUISUMOAbstractView * myParent
The calling view.
FXDEFMAP(GUIDialog_EditViewport) GUIDialog_EditViewportMap[]
Position myOldLookFrom
The old viewport.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
SUMOReal y() const
Returns the y-position.
GUIPerspectiveChanger & getChanger() const
get changer
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
An XML-handler for visualisation schemes.
#define GUIDesignSpinDial
A dialog to change the viewport.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static const Position INVALID
used to indicate that a position is valid
void setOldValues(const Position &lookFrom, const Position &lookAt)
Resets old values.