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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The handler for parsing gui settings from xml.
18 /****************************************************************************/
19 #ifndef GUISettingsHandler_h
20 #define GUISettingsHandler_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
36 class Position;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 public:
50  GUISettingsHandler(const std::string& content, bool isFile = true, bool netedit = false);
51 
52 
55 
56 
57 
59 
60 
67  void myStartElement(int element, const SUMOSAXAttributes& attrs);
69 
70 
71 
75  std::string addSettings(GUISUMOAbstractView* view = 0) const;
76 
77 
81  void applyViewport(GUISUMOAbstractView* view) const;
82 
83 
88  void setSnapshots(GUISUMOAbstractView* view) const;
89 
90 
94  bool hasDecals() const;
95 
96 
100  const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
101 
102 
106  double getDelay() const;
107 
108 
112  const std::vector<SUMOTime>& getBreakpoints() const {
113  return myBreakpoints;
114  }
115 
116 
118  static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
119 
120 
124  const std::string& getViewType() const {
125  return myViewType;
126  }
127 
129  double getJamSoundTime() {
130  return myJamSoundTime;
131  }
132 
133 private:
136 
138  std::string myViewType;
139 
141  double myDelay;
142 
145 
148 
150  double myRotation;
151 
153  std::map<SUMOTime, std::vector<std::string> > mySnapshots;
154 
156  std::vector<GUISUMOAbstractView::Decal> myDecals;
157 
160 
163 
166 
168  std::vector<SUMOTime> myBreakpoints;
169 
171  std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
173 
174 private:
175 
178  const std::string& prefix, const SUMOSAXAttributes& attrs,
180 
183  const std::string& prefix, const SUMOSAXAttributes& attrs,
185 
186 };
187 
188 #endif
189 
190 /****************************************************************************/
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:42
GUISettingsHandler::mySettings
GUIVisualizationSettings mySettings
The settings to fill.
Definition: GUISettingsHandler.h:135
GUISettingsHandler::myLookFrom
Position myLookFrom
The viewport loaded, zoom is stored in z coordinate.
Definition: GUISettingsHandler.h:144
GUISettingsHandler::~GUISettingsHandler
~GUISettingsHandler()
Destructor.
Definition: GUISettingsHandler.cpp:64
GUISettingsHandler::getDecals
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Definition: GUISettingsHandler.cpp:412
GUISettingsHandler::mySnapshots
std::map< SUMOTime, std::vector< std::string > > mySnapshots
mappig of time steps to filenames for potential snapshots
Definition: GUISettingsHandler.h:153
GUISettingsHandler::myDelay
double myDelay
The delay loaded.
Definition: GUISettingsHandler.h:141
GUISettingsHandler::setSnapshots
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
Definition: GUISettingsHandler.cpp:394
GUISettingsHandler::myEventDistributions
std::map< std::string, RandomDistributor< std::string > > myEventDistributions
The parsed event distributions.
Definition: GUISettingsHandler.h:171
SUMOSAXHandler.h
GUIVisualizationTextSettings
Definition: GUIVisualizationSettings.h:51
RandomDistributor.h
GUISettingsHandler::myRotation
double myRotation
View rotation.
Definition: GUISettingsHandler.h:150
GUISettingsHandler::myJamSoundTime
double myJamSoundTime
Definition: GUISettingsHandler.h:172
GUIVisualizationSizeSettings
struct for size settings
Definition: GUIVisualizationSettings.h:86
GUISettingsHandler::getViewType
const std::string & getViewType() const
Returns the parsed view type.
Definition: GUISettingsHandler.h:124
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUISettingsHandler
An XML-handler for visualisation schemes.
Definition: GUISettingsHandler.h:45
GUISettingsHandler::myDecals
std::vector< GUISUMOAbstractView::Decal > myDecals
The decals list to fill.
Definition: GUISettingsHandler.h:156
GUISettingsHandler::hasDecals
bool hasDecals() const
Returns whether any decals have been parsed.
Definition: GUISettingsHandler.cpp:406
GUISettingsHandler::myCurrentScheme
GUIColorScheme * myCurrentScheme
The current color scheme.
Definition: GUISettingsHandler.h:162
GUISettingsHandler::GUISettingsHandler
GUISettingsHandler(const std::string &content, bool isFile=true, bool netedit=false)
Constructor.
Definition: GUISettingsHandler.cpp:45
GUISettingsHandler::applyViewport
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
Definition: GUISettingsHandler.cpp:384
RandomDistributor< std::string >
GUISettingsHandler::myBreakpoints
std::vector< SUMOTime > myBreakpoints
The parsed breakpoints.
Definition: GUISettingsHandler.h:168
GUISettingsHandler::myCurrentColorer
int myCurrentColorer
The last color scheme category (edges or vehicles)
Definition: GUISettingsHandler.h:159
GUISettingsHandler::parseSizeSettings
GUIVisualizationSizeSettings parseSizeSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationSizeSettings defaults)
parse attributes for sizeSettings
Definition: GUISettingsHandler.cpp:358
GUISettingsHandler::getEventDistribution
RandomDistributor< std::string > getEventDistribution(const std::string &id)
Definition: GUISettingsHandler.cpp:448
GUISettingsHandler::myCurrentScaleScheme
GUIScaleScheme * myCurrentScaleScheme
The current scaling scheme.
Definition: GUISettingsHandler.h:165
GUISettingsHandler::myViewType
std::string myViewType
The view type (osg, opengl, default) loaded.
Definition: GUISettingsHandler.h:138
config.h
GUISettingsHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag.
Definition: GUISettingsHandler.cpp:69
GUISettingsHandler::parseTextSettings
GUIVisualizationTextSettings parseTextSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationTextSettings defaults)
parse attributes for textSettings
Definition: GUISettingsHandler.cpp:344
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GUISettingsHandler::getJamSoundTime
double getJamSoundTime()
Definition: GUISettingsHandler.h:129
GUISettingsHandler::addSettings
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
Definition: GUISettingsHandler.cpp:370
GUISettingsHandler::getDelay
double getDelay() const
Returns the parsed delay.
Definition: GUISettingsHandler.cpp:418
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
GUISettingsHandler::getBreakpoints
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
Definition: GUISettingsHandler.h:112
GUISettingsHandler::loadBreakpoints
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
Definition: GUISettingsHandler.cpp:424
GUIPropertyScheme
Definition: GUIPropertyScheme.h:46
GUISettingsHandler::myLookAt
Position myLookAt
The point to look at, only needed for osg view.
Definition: GUISettingsHandler.h:147