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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // The handler for parsing gui settings from xml.
20 /****************************************************************************/
21 #ifndef GUISettingsHandler_h
22 #define GUISettingsHandler_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
42 class Position;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 public:
56  GUISettingsHandler(const std::string& content, bool isFile = true, bool netedit = false);
57 
58 
61 
62 
63 
65 
66 
73  void myStartElement(int element, const SUMOSAXAttributes& attrs);
75 
76 
77 
81  std::string addSettings(GUISUMOAbstractView* view = 0) const;
82 
83 
87  void applyViewport(GUISUMOAbstractView* view) const;
88 
89 
94  void setSnapshots(GUISUMOAbstractView* view) const;
95 
96 
100  bool hasDecals() const;
101 
102 
106  const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
107 
108 
112  double getDelay() const;
113 
114 
118  const std::vector<SUMOTime>& getBreakpoints() const {
119  return myBreakpoints;
120  }
121 
122 
124  static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
125 
126 
130  const std::string& getViewType() const {
131  return myViewType;
132  }
133 
135  double getJamSoundTime() {
136  return myJamSoundTime;
137  }
138 
139 private:
142 
144  std::string myViewType;
145 
147  double myDelay;
148 
151 
154 
156  std::map<SUMOTime, std::vector<std::string> > mySnapshots;
157 
159  std::vector<GUISUMOAbstractView::Decal> myDecals;
160 
163 
166 
169 
171  std::vector<SUMOTime> myBreakpoints;
172 
174  std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
176 
177 private:
178 
181  const std::string& prefix, const SUMOSAXAttributes& attrs,
183 
186  const std::string& prefix, const SUMOSAXAttributes& attrs,
188 
189 };
190 
191 #endif
192 
193 /****************************************************************************/
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
GUIScaleScheme * myCurrentScaleScheme
The current scaling scheme.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag.
int myCurrentColorer
The last color scheme category (edges or vehicles)
GUIColorScheme * myCurrentScheme
The current color scheme.
Stores the information about how to visualize structures.
std::vector< GUISUMOAbstractView::Decal > myDecals
The decals list to fill.
Position myLookAt
The point to look at, only needed for osg view.
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
bool hasDecals() const
Returns whether any decals have been parsed.
SAX-handler base for SUMO-files.
double myDelay
The delay loaded.
double getDelay() const
Returns the parsed delay.
GUIVisualizationSettings mySettings
The settings to fill.
RandomDistributor< std::string > getEventDistribution(const std::string &id)
GUISettingsHandler(const std::string &content, bool isFile=true, bool netedit=false)
Constructor.
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
GUIVisualizationTextSettings parseTextSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationTextSettings defaults)
parse attributes for textSettings
~GUISettingsHandler()
Destructor.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
std::string myViewType
The view type (osg, opengl, default) loaded.
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
std::map< SUMOTime, std::vector< std::string > > mySnapshots
mappig of time steps to filenames for potential snapshots
std::map< std::string, RandomDistributor< std::string > > myEventDistributions
The parsed event distributions.
An XML-handler for visualisation schemes.
const std::string & getViewType() const
Returns the parsed view type.
std::vector< SUMOTime > myBreakpoints
The parsed breakpoints.
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.