SUMO - Simulation of Urban MObility
GUISettingsHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The handler for parsing gui settings from xml.
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUISettingsHandler_h
23 #define GUISettingsHandler_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
43 class Position;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
53 public:
57  GUISettingsHandler(const std::string& content, bool isFile = true);
58 
59 
62 
63 
64 
66 
67 
74  void myStartElement(int element, const SUMOSAXAttributes& attrs);
76 
77 
78 
82  std::string addSettings(GUISUMOAbstractView* view = 0) const;
83 
84 
88  void applyViewport(GUISUMOAbstractView* view) const;
89 
90 
95  void setSnapshots(GUISUMOAbstractView* view) const;
96 
97 
101  bool hasDecals() const;
102 
103 
107  const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
108 
109 
113  double getDelay() const;
114 
115 
119  const std::vector<SUMOTime>& getBreakpoints() const {
120  return myBreakpoints;
121  }
122 
123 
125  static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
126 
127 
131  const std::string& getViewType() const {
132  return myViewType;
133  }
134 
136  double getJamSoundTime() {
137  return myJamSoundTime;
138  }
139 
140 private:
143 
145  std::string myViewType;
146 
148  double myDelay;
149 
152 
155 
157  std::map<SUMOTime, std::string> mySnapshots;
158 
160  std::vector<GUISUMOAbstractView::Decal> myDecals;
161 
164 
167 
170 
172  std::vector<SUMOTime> myBreakpoints;
173 
175  std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
177 
178 private:
179 
182  const std::string& prefix, const SUMOSAXAttributes& attrs,
184 
187  const std::string& prefix, const SUMOSAXAttributes& attrs,
189 
190 };
191 
192 #endif
193 
194 /****************************************************************************/
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
GUIScaleScheme * myCurrentScaleScheme
The current scaling scheme.
GUISettingsHandler(const std::string &content, bool isFile=true)
Constructor.
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)
std::map< SUMOTime, std::string > mySnapshots
mappig of time steps to filenames for potential snapshots
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
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< 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.