Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUISettingsHandler.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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/****************************************************************************/
20// The handler for parsing gui settings from xml.
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
27
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
33class Position;
34
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
43public:
47 GUISettingsHandler(const std::string& content, bool isFile = true, bool netedit = false);
48
49
52
53
54
56
57
64 void myStartElement(int element, const SUMOSAXAttributes& attrs);
65
72 void myEndElement(int element);
74
75
76
80 const std::vector<std::string>& addSettings(GUISUMOAbstractView* view = 0) const;
81
82
86 void applyViewport(GUISUMOAbstractView* view) const;
87
88
93 void setSnapshots(GUISUMOAbstractView* view) const;
94
95
99 bool hasDecals() const;
100
101
105 const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
106
107
111 double getDelay() const;
112
113
117 const std::vector<SUMOTime>& getBreakpoints() const {
118 return myBreakpoints;
119 }
120
121
123 static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
124
125
129 const std::string& getViewType() const {
130 return myViewType;
131 }
132
135 return myJamSoundTime;
136 }
137
138 std::vector<std::string> getTrackers() {
139 return myTrackers;
140 }
141
142 const std::string& getSettingName() const {
143 return mySettings.name;
144 }
145
146private:
149
151 std::vector<std::string> myLoadedSettingNames;
152
154 std::string myViewType;
155
157 double myDelay;
158
161
164
167
170
172 double myZoom;
173
175 std::map<SUMOTime, std::vector<std::string> > mySnapshots;
176
178 std::vector<GUISUMOAbstractView::Decal> myDecals;
179
182
185
188
190 std::vector<SUMOTime> myBreakpoints;
191
193 std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
195
197 std::vector<std::string> myTrackers;
198
199private:
201 RGBColor parseColor(const SUMOSAXAttributes& attrs, const std::string attribute, const RGBColor& defaultValue) const;
202
205 const std::string& prefix, const SUMOSAXAttributes& attrs,
207
210 const std::string& prefix, const SUMOSAXAttributes& attrs,
212
215 const std::string& prefix, const SUMOSAXAttributes& attrs,
217};
GUIPropertyScheme< RGBColor > GUIColorScheme
GUIPropertyScheme< double > GUIScaleScheme
GUISettingsHandler(const std::string &content, bool isFile=true, bool netedit=false)
Constructor.
double getDelay() const
Returns the parsed delay.
std::vector< std::string > myLoadedSettingNames
names of all loaded settings
double myZoom
Zoom level.
GUIColorScheme * myCurrentScheme
The current color scheme.
bool hasDecals() const
Returns whether any decals have been parsed.
const std::vector< std::string > & addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
const std::string & getSettingName() const
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
std::string myViewType
The view type (osg, opengl, default) loaded.
RGBColor parseColor(const SUMOSAXAttributes &attrs, const std::string attribute, const RGBColor &defaultValue) const
parse color attribute
std::vector< std::string > myTrackers
list of tlsIDs to open trackers for
std::vector< std::string > getTrackers()
std::map< std::string, RandomDistributor< std::string > > myEventDistributions
The parsed event distributions.
void myEndElement(int element)
Called when a closing tag occurs.
RandomDistributor< std::string > getEventDistribution(const std::string &id)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag.
std::vector< SUMOTime > myBreakpoints
The parsed breakpoints.
const std::string & getViewType() const
Returns the parsed view type.
~GUISettingsHandler()
Destructor.
bool myZCoordSet
Whether the Z coordinate is set in 3D view.
GUIVisualizationRainbowSettings parseRainbowSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationRainbowSettings defaults)
parse attributes for rainbowSettings
double myRotation
View rotation.
std::vector< GUISUMOAbstractView::Decal > myDecals
The decals list to fill.
GUIVisualizationSettings mySettings
The settings to fill.
GUIScaleScheme * myCurrentScaleScheme
The current scaling scheme.
int myCurrentColorer
The last color scheme category (edges or vehicles).
GUIVisualizationTextSettings parseTextSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationTextSettings defaults)
parse attributes for textSettings
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
GUIVisualizationSizeSettings parseSizeSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationSizeSettings defaults)
parse attributes for sizeSettings
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
Position myLookFrom
The viewport loaded, zoom is stored in z coordinate.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
std::map< SUMOTime, std::vector< std::string > > mySnapshots
mappig of time steps to filenames for potential snapshots
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Position myLookAt
The point to look at, only needed for osg view.
double myDelay
The delay loaded.
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Represents a generic random distribution.
Encapsulated SAX-Attributes.
SUMOSAXHandler(const std::string &file="", const std::string &expectedRoot="")
Constructor.