Eclipse SUMO - Simulation of Urban MObility
GUISettingsHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 // ===========================================================================
33 class Position;
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
43 public:
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);
66 
67 
68 
72  std::string addSettings(GUISUMOAbstractView* view = 0) const;
73 
74 
78  void applyViewport(GUISUMOAbstractView* view) const;
79 
80 
85  void setSnapshots(GUISUMOAbstractView* view) const;
86 
87 
91  bool hasDecals() const;
92 
93 
97  const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
98 
99 
103  double getDelay() const;
104 
105 
109  const std::vector<SUMOTime>& getBreakpoints() const {
110  return myBreakpoints;
111  }
112 
113 
115  static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
116 
117 
121  const std::string& getViewType() const {
122  return myViewType;
123  }
124 
126  double getJamSoundTime() {
127  return myJamSoundTime;
128  }
129 
130 private:
133 
135  std::string myViewType;
136 
138  double myDelay;
139 
142 
145 
147  double myRotation;
148 
150  std::map<SUMOTime, std::vector<std::string> > mySnapshots;
151 
153  std::vector<GUISUMOAbstractView::Decal> myDecals;
154 
157 
160 
163 
165  std::vector<SUMOTime> myBreakpoints;
166 
168  std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
170 
171 private:
172 
175  const std::string& prefix, const SUMOSAXAttributes& attrs,
177 
180  const std::string& prefix, const SUMOSAXAttributes& attrs,
182 
183 };
An XML-handler for visualisation schemes.
GUISettingsHandler(const std::string &content, bool isFile=true, bool netedit=false)
Constructor.
double getDelay() const
Returns the parsed delay.
const std::string & getViewType() const
Returns the parsed view type.
GUIColorScheme * myCurrentScheme
The current color scheme.
bool hasDecals() const
Returns whether any decals have been parsed.
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
std::string myViewType
The view type (osg, opengl, default) loaded.
std::map< std::string, RandomDistributor< std::string > > myEventDistributions
The parsed event distributions.
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
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.
~GUISettingsHandler()
Destructor.
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
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:36
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.