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-2024 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 const std::string& getSettingName() const {
139 return mySettings.name;
140 }
141
142private:
145
147 std::vector<std::string> myLoadedSettingNames;
148
150 std::string myViewType;
151
153 double myDelay;
154
157
160
163
166
168 double myZoom;
169
171 std::map<SUMOTime, std::vector<std::string> > mySnapshots;
172
174 std::vector<GUISUMOAbstractView::Decal> myDecals;
175
178
181
184
186 std::vector<SUMOTime> myBreakpoints;
187
189 std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
191
192private:
194 RGBColor parseColor(const SUMOSAXAttributes& attrs, const std::string attribute, const RGBColor& defaultValue) const;
195
198 const std::string& prefix, const SUMOSAXAttributes& attrs,
200
203 const std::string& prefix, const SUMOSAXAttributes& attrs,
205
208 const std::string& prefix, const SUMOSAXAttributes& attrs,
210};
An XML-handler for visualisation schemes.
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::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.
std::string name
The name of this setting.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Represents a generic random distribution.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.