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 /****************************************************************************/
16 // The handler for parsing gui settings from xml.
17 /****************************************************************************/
18 #ifndef GUISettingsHandler_h
19 #define GUISettingsHandler_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
35 class Position;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
45 public:
49  GUISettingsHandler(const std::string& content, bool isFile = true, bool netedit = false);
50 
51 
54 
55 
56 
58 
59 
66  void myStartElement(int element, const SUMOSAXAttributes& attrs);
68 
69 
70 
74  std::string addSettings(GUISUMOAbstractView* view = 0) const;
75 
76 
80  void applyViewport(GUISUMOAbstractView* view) const;
81 
82 
87  void setSnapshots(GUISUMOAbstractView* view) const;
88 
89 
93  bool hasDecals() const;
94 
95 
99  const std::vector<GUISUMOAbstractView::Decal>& getDecals() const;
100 
101 
105  double getDelay() const;
106 
107 
111  const std::vector<SUMOTime>& getBreakpoints() const {
112  return myBreakpoints;
113  }
114 
115 
117  static std::vector<SUMOTime> loadBreakpoints(const std::string& file);
118 
119 
123  const std::string& getViewType() const {
124  return myViewType;
125  }
126 
128  double getJamSoundTime() {
129  return myJamSoundTime;
130  }
131 
132 private:
135 
137  std::string myViewType;
138 
140  double myDelay;
141 
144 
147 
149  double myRotation;
150 
152  std::map<SUMOTime, std::vector<std::string> > mySnapshots;
153 
155  std::vector<GUISUMOAbstractView::Decal> myDecals;
156 
159 
162 
165 
167  std::vector<SUMOTime> myBreakpoints;
168 
170  std::map<std::string, RandomDistributor<std::string> > myEventDistributions;
172 
173 private:
174 
177  const std::string& prefix, const SUMOSAXAttributes& attrs,
179 
182  const std::string& prefix, const SUMOSAXAttributes& attrs,
184 
185 };
186 
187 #endif
188 
189 /****************************************************************************/
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
GUISettingsHandler::mySettings
GUIVisualizationSettings mySettings
The settings to fill.
Definition: GUISettingsHandler.h:134
GUISettingsHandler::myLookFrom
Position myLookFrom
The viewport loaded, zoom is stored in z coordinate.
Definition: GUISettingsHandler.h:143
GUISettingsHandler::~GUISettingsHandler
~GUISettingsHandler()
Destructor.
Definition: GUISettingsHandler.cpp:63
GUISettingsHandler::getDecals
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Definition: GUISettingsHandler.cpp:410
GUISettingsHandler::mySnapshots
std::map< SUMOTime, std::vector< std::string > > mySnapshots
mappig of time steps to filenames for potential snapshots
Definition: GUISettingsHandler.h:152
GUISettingsHandler::myDelay
double myDelay
The delay loaded.
Definition: GUISettingsHandler.h:140
GUISettingsHandler::setSnapshots
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
Definition: GUISettingsHandler.cpp:392
GUISettingsHandler::myEventDistributions
std::map< std::string, RandomDistributor< std::string > > myEventDistributions
The parsed event distributions.
Definition: GUISettingsHandler.h:170
SUMOSAXHandler.h
GUIVisualizationTextSettings
Definition: GUIVisualizationSettings.h:50
RandomDistributor.h
GUISettingsHandler::myRotation
double myRotation
View rotation.
Definition: GUISettingsHandler.h:149
GUISettingsHandler::myJamSoundTime
double myJamSoundTime
Definition: GUISettingsHandler.h:171
GUIVisualizationSizeSettings
struct for size settings
Definition: GUIVisualizationSettings.h:85
GUISettingsHandler::getViewType
const std::string & getViewType() const
Returns the parsed view type.
Definition: GUISettingsHandler.h:123
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUISettingsHandler
An XML-handler for visualisation schemes.
Definition: GUISettingsHandler.h:44
GUISettingsHandler::myDecals
std::vector< GUISUMOAbstractView::Decal > myDecals
The decals list to fill.
Definition: GUISettingsHandler.h:155
GUISettingsHandler::hasDecals
bool hasDecals() const
Returns whether any decals have been parsed.
Definition: GUISettingsHandler.cpp:404
GUISettingsHandler::myCurrentScheme
GUIColorScheme * myCurrentScheme
The current color scheme.
Definition: GUISettingsHandler.h:161
GUISettingsHandler::GUISettingsHandler
GUISettingsHandler(const std::string &content, bool isFile=true, bool netedit=false)
Constructor.
Definition: GUISettingsHandler.cpp:44
GUISettingsHandler::applyViewport
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
Definition: GUISettingsHandler.cpp:382
RandomDistributor< std::string >
GUISettingsHandler::myBreakpoints
std::vector< SUMOTime > myBreakpoints
The parsed breakpoints.
Definition: GUISettingsHandler.h:167
GUISettingsHandler::myCurrentColorer
int myCurrentColorer
The last color scheme category (edges or vehicles)
Definition: GUISettingsHandler.h:158
GUISettingsHandler::parseSizeSettings
GUIVisualizationSizeSettings parseSizeSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationSizeSettings defaults)
parse attributes for sizeSettings
Definition: GUISettingsHandler.cpp:356
GUISettingsHandler::getEventDistribution
RandomDistributor< std::string > getEventDistribution(const std::string &id)
Definition: GUISettingsHandler.cpp:446
GUISettingsHandler::myCurrentScaleScheme
GUIScaleScheme * myCurrentScaleScheme
The current scaling scheme.
Definition: GUISettingsHandler.h:164
GUISettingsHandler::myViewType
std::string myViewType
The view type (osg, opengl, default) loaded.
Definition: GUISettingsHandler.h:137
config.h
GUISettingsHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag.
Definition: GUISettingsHandler.cpp:68
GUISettingsHandler::parseTextSettings
GUIVisualizationTextSettings parseTextSettings(const std::string &prefix, const SUMOSAXAttributes &attrs, GUIVisualizationTextSettings defaults)
parse attributes for textSettings
Definition: GUISettingsHandler.cpp:342
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GUISettingsHandler::getJamSoundTime
double getJamSoundTime()
Definition: GUISettingsHandler.h:128
GUISettingsHandler::addSettings
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
Definition: GUISettingsHandler.cpp:368
GUISettingsHandler::getDelay
double getDelay() const
Returns the parsed delay.
Definition: GUISettingsHandler.cpp:416
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
GUISettingsHandler::getBreakpoints
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
Definition: GUISettingsHandler.h:111
GUISettingsHandler::loadBreakpoints
static std::vector< SUMOTime > loadBreakpoints(const std::string &file)
loads breakpoints from the specified file
Definition: GUISettingsHandler.cpp:422
GUIPropertyScheme
Definition: GUIPropertyScheme.h:45
GUISettingsHandler::myLookAt
Position myLookAt
The point to look at, only needed for osg view.
Definition: GUISettingsHandler.h:146