Path: blob/main/src/utils/gui/windows/GUIDialog_EditViewport.h
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIDialog_EditViewport.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date 2005-05-0417///18// A dialog to change the viewport19/****************************************************************************/20#pragma once21#include <config.h>2223#include <utils/foxtools/fxheader.h>24#include <utils/gui/div/GUIPersistentWindowPos.h>2526// ===========================================================================27// class declarations28// ===========================================================================29class GUISUMOAbstractView;30class Position;313233// ===========================================================================34// class definitions35// ===========================================================================36/**37* @class GUIDialog_EditViewport38* @brief A dialog to change the viewport39*/40class GUIDialog_EditViewport : public FXDialogBox, public GUIPersistentWindowPos {41// FOX-declarations42FXDECLARE(GUIDialog_EditViewport)43public:44/// @brief FOX-callback enumerations45enum {46MID_CHANGED = FXDialogBox::ID_LAST,47MID_OK,48MID_CANCEL,49MID_LOAD,50MID_SAVE51};525354/** @brief Constructor55* @param[in] parent The view to change56* @param[in] name This dialog's caption57*/58GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name);5960/// @brief Destructor61~GUIDialog_EditViewport();6263/// @brief overload show function to focus always in OK Button64void show();65using FXDialogBox::show; // to silence the warning C4266 about a hidden function6667/// @name FOX-callbacks68/// @{6970/// Called when the user changes the viewport71long onCmdChanged(FXObject*, FXSelector, void*);7273/// Called when the user wants to keep the viewport74long onCmdOk(FXObject*, FXSelector, void*);7576/// Called when the user wants to restore the viewport77long onCmdCancel(FXObject*, FXSelector, void*);7879/// Called when the user wants to load a viewport80long onCmdLoad(FXObject*, FXSelector, void*);8182/// Called when the user wants to save a viewport83long onCmdSave(FXObject*, FXSelector, void*);84/// @}8586/// write the settings to the given device87void writeXML(OutputDevice& dev);8889/** @brief Sets the given values into the dialog90* @param[in] zoom Current view's zoom91* @param[in] xoff Current view's x-offset92* @param[in] yoff Current view's y-offset93*/94void setValues(double zoom, double xoff, double yoff, double rotation);9596/** @brief Sets the given values into the dialog97* @param[in] lookFrom Current viewport's from98* @param[in] lookAt Current viewport's at99*/100void setValues(const Position& lookFrom, const Position& lookAt, double rotation);101102/** @brief Resets old values103* @param[in] lookFrom Current viewport's from104* @param[in] lookAt Current viewport's at105*/106void setOldValues(const Position& lookFrom, const Position& lookAt, double rotation);107108/** @brief Returns the information whether one of the spin dialers is grabbed109* @return Whether the spin dialers are currently used110*/111bool haveGrabbed() const;112113/** @brief Returns the current zoom value stored in the corresponding spin dialer114* @return The current zoom value in the spin dialer115*/116double getZoomValue() const;117118119/** @brief Resets the zoom spin dialer120* @param[in] zoom the value to set the spin dialer to121*/122void setZoomValue(double zoom);123124protected:125FOX_CONSTRUCTOR(GUIDialog_EditViewport)126127/// @brief save window position to the registry128void saveWindowPos();129130private:131/// @brief The calling view132GUISUMOAbstractView* myParent = nullptr;133134/// @brief The old viewport135Position myOldLookFrom, myOldLookAt;136double myOldRotation;137138/// @brief load button139FXButton* myLoadButton = nullptr;140141/// @brief save button142FXButton* mySaveButton = nullptr;143144/// @brief The spin dialers used to change the view145FXRealSpinner* myZoom = nullptr;146FXRealSpinner* myXOff = nullptr;147FXRealSpinner* myYOff = nullptr;148FXRealSpinner* myZOff = nullptr;149FXRealSpinner* myRotation = nullptr;150151/// @brief The spin dialers used to change the view at (osg only)152FXRealSpinner* myLookAtX = nullptr;153FXRealSpinner* myLookAtY = nullptr;154FXRealSpinner* myLookAtZ = nullptr;155156/// @brief OK button157FXButton* myOKButton = nullptr;158159/// @brief Cancel button160FXButton* myCancelButton = nullptr;161};162163164