Path: blob/main/src/utils/gui/settings/GUICompleteSchemeStorage.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 GUICompleteSchemeStorage.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date :find(mySortedSchemeNames.begin(), mySortedSchemeNames.end(), name)==mySortedSchemeNames.end()) {17///18// Storage for available visualization settings19/****************************************************************************/20#pragma once21#include <config.h>2223#include <string>24#include <vector>25#include <algorithm>26#include <map>27#include <utils/gui/windows/GUISUMOAbstractView.h>282930// ===========================================================================31// class definitions32// ===========================================================================33/**34* @class GUICompleteSchemeStorage35* @brief Storage for available visualization settings36*/37class GUICompleteSchemeStorage {38public:39/// @brief Constructor40GUICompleteSchemeStorage();414243/// @brief Destructor44~GUICompleteSchemeStorage();454647/** @brief Adds a visualization scheme48* @param[in] scheme The visualization scheme to add49*/50void add(const GUIVisualizationSettings& scheme);515253/** @brief Returns the named scheme54* @param[in] name The name of the visualization scheme to return55* @return The named visualization scheme56*/57GUIVisualizationSettings& get(const std::string& name);585960/** @brief Returns the default scheme61* @return The default visualization scheme62*/63GUIVisualizationSettings& getDefault();646566/** @brief Returns the information whether a setting with the given name is stored67* @param[in] name The name of regarded scheme68* @return Whether the named scheme is known69*/70bool contains(const std::string& name) const;717273/** @brief Removes the setting with the given name74* @param[in] name The name of the scheme to remove75*/76void remove(const std::string name);777879/** @brief Makes the scheme with the given name the default80* @param[in] name The name of the scheme to marks as default81*/82void setDefault(const std::string& name);838485/** @brief Returns a list of stored settings names86* @return The names of known schemes87*/88const std::vector<std::string>& getNames() const;899091/** @brief Returns the number of initial settings92* @return The number of default schemes93*/94int getNumInitialSettings() const;959697/** @brief Initialises the storage with some default settings98* @param[in] app The application99*/100void init(FXApp* app, bool netedit = false);101102103/** @brief Writes the current scheme into the registry104* @param[in] app The application105*/106void writeSettings(FXApp* app);107108109/** @brief Makes the given viewport the default110* @param[in] x The x-offset111* @param[in] y The y-offset112* @param[in] z The camera height113*/114void saveViewport(const double x, const double y, const double z, const double rot);115116/** @brief Makes the given decals the default117*/118void saveDecals(const std::vector<GUISUMOAbstractView::Decal>& decals);119120/** @brief Sets the default viewport121* @param[in] parent the view for which the viewport has to be set122*/123void setViewport(GUISUMOAbstractView* view);124125/** @brief Returns the default decals126*/127const std::vector<GUISUMOAbstractView::Decal>& getDecals() {128return myDecals;129}130131/** @brief Clear the default decals132*/133void clearDecals() {134myDecals.clear();135}136137protected:138/// @brief A map of settings referenced by their names139std::map<std::string, GUIVisualizationSettings*> mySettings;140141/// @brief List of known setting names142std::vector<std::string> mySortedSchemeNames;143144/// @brief Name of the default setting145std::string myDefaultSettingName;146147/// @brief The number of settings which were present at startup148int myNumInitialSettings;149150/// @brief The default viewport151Position myLookFrom, myLookAt;152double myRotation;153154/// @brief The default decals155std::vector<GUISUMOAbstractView::Decal> myDecals;156157};158159extern GUICompleteSchemeStorage gSchemeStorage;160161162