SUMO - Simulation of Urban MObility
GUIVisualizationSettings.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 // Stores the information about how to visualize structures
20 /****************************************************************************/
21 #ifndef GUIVisualizationSettings_h
22 #define GUIVisualizationSettings_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 
34 #include <string>
35 #include <vector>
36 #include <map>
37 #include <utils/common/RGBColor.h>
38 #include <utils/common/ToString.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class BaseSchemeInfoSource;
46 class OutputDevice;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
53 
54 // cannot declare this as inner class because it needs to be used in forward
55 // declaration (@todo fix inclusion order by removing references to guisim!)
57  GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color) :
58  show(_show), size(_size), color(_color) {}
59 
60  bool show;
61  double size;
63 
65  return show == other.show &&
66  size == other.size &&
67  color == other.color;
68  }
70  return !((*this) == other);
71  }
72 
73  void print(OutputDevice& dev, const std::string& name) const {
74  dev.writeAttr(name + "_show", show);
75  dev.writeAttr(name + "_size", size);
76  dev.writeAttr(name + "_color", color);
77  }
78 };
79 
80 
82  GUIVisualizationSizeSettings(double _minSize, double _exaggeration = 1.0, bool _constantSize = false) :
83  minSize(_minSize), exaggeration(_exaggeration), constantSize(_constantSize) {}
84 
86  double minSize;
88  double exaggeration;
89  // @brief whether the object shall be drawn with constant size regardless of zoom
91 
93  return constantSize == other.constantSize &&
94  minSize == other.minSize &&
95  exaggeration == other.exaggeration;
96  }
98  return !((*this) == other);
99  }
100 
101  void print(OutputDevice& dev, const std::string& name) const {
102  dev.writeAttr(name + "_minSize", minSize);
103  dev.writeAttr(name + "_exaggeration", exaggeration);
104  dev.writeAttr(name + "_constantSize", constantSize);
105  }
106 
108  double getExaggeration(const GUIVisualizationSettings& s, double factor = 20) const;
109 };
110 
111 
117 public:
118 
120  GUIVisualizationSettings(bool _netedit = false);
121 
123  std::string name;
124 
126  bool netedit;
127 
129  bool dither;
130 
132 
133 
137  bool showGrid;
139  double gridXSize, gridYSize;
141 
142 
144 
145 
150 
152  static bool UseMesoSim;
164  bool showRails;
165  // Setting bundles for optional drawing names with size and color
166  GUIVisualizationTextSettings edgeName, internalEdgeName, cwaEdgeName, streetName;
167 
172  double laneMinSize;
178 
179 
181 
182 
195  // Setting bundles for controling the size of the drawn vehicles
197  // Setting bundles for optional drawing vehicle names
200 
201 
203 
204 
209  // Setting bundles for controling the size of the drawn persons
211  // Setting bundles for optional drawing person names
214 
215 
217 
218 
223  // Setting bundles for controling the size of the drawn containers
225  // Setting bundles for optional drawing person names
228 
229 
231 
232 
235  // Setting bundles for optional drawing junction names and indices
236  GUIVisualizationTextSettings drawLinkTLIndex, drawLinkJunctionIndex, junctionName, internalJunctionName;
243  // Setting bundles for controling the size of the drawn junction
246 
247 
249 
250 
252  // @todo decouple addExageration for POIs, Polygons, Triggers etc
253  int addMode;
254  // Setting bundles for controling the size of additional items
256  // Setting bundles for optional drawing additional names
258  // Setting bundles for optional drawing additional full names
261 
262 
264 
265 
266  // Setting bundles for controling the size of the drawn POIs
268  // Setting bundles for optional drawing poi names
270  // Setting bundles for optional drawing poi types
272 
273  // Setting bundles for controling the size of the drawn polygons
275  // Setting bundles for optional drawing polygon names
277  // Setting bundles for optional drawing polygon types
280 
283 
285  double scale;
286 
288  bool gaming;
289 
291  int editMode;
292 
295 
298 
301 
303  void initNeteditDefaults();
304  void initSumoGuiDefaults();
305 
309  void save(OutputDevice& dev) const;
310 
314  int getLaneEdgeMode() const;
315 
319  int getLaneEdgeScaleMode() const;
320 
324  GUIColorScheme& getLaneEdgeScheme();
325 
329  GUIScaleScheme& getLaneEdgeScaleScheme();
330 
332  bool operator==(const GUIVisualizationSettings& vs2);
333 
334  /* @brief map from LinkState to color constants */
335  static const RGBColor& getLinkColor(const LinkState& ls);
336 
339 
340 
341 };
342 
343 
344 #endif
345 
346 /****************************************************************************/
347 
GUIVisualizationSizeSettings junctionSize
GUIVisualizationTextSettings junctionName
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:260
bool showSizeLegend
Information whether the size legend shall be drawn.
double scale
information about a lane&#39;s width (temporary, used for a single view)
GUIVisualizationTextSettings poiType
GUIVisualizationTextSettings streetName
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool showBlinker
Information whether vehicle blinkers shall be drawn.
GUIVisualizationTextSettings addName
GUIVisualizationTextSettings personName
GUIVisualizationTextSettings poiName
bool gaming
whether the application is in gaming mode or not
bool operator!=(const GUIVisualizationTextSettings &other)
bool showBTRange
Information whether the communication range shall be drawn.
double exaggeration
The size exaggeration (upscale)
bool operator==(const GUIVisualizationTextSettings &other)
GUIColorer laneColorer
The lane colorer.
GUIColorer containerColorer
The container colorer.
bool operator==(const GUIVisualizationSizeSettings &other)
Stores the information about how to visualize structures.
GUIColorer edgeColorer
The mesoscopic edge colorer.
bool drawLaneChangePreference
Information whether the lane change preference shall be drawn.
bool showRails
Information whether rails shall be drawn.
GUIVisualizationTextSettings vehicleName
int editMode
the current NETEDIT mode (temporary)
bool showLaneDirection
Whether to show direction indicators for lanes.
void print(OutputDevice &dev, const std::string &name) const
bool laneShowBorders
Information whether lane borders shall be drawn.
bool netedit
Whether the settings are for Netedit.
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
bool dither
Information whether dithering shall be enabled.
GUIVisualizationSizeSettings polySize
GUIColorer vehicleColorer
The vehicle colorer.
GUIVisualizationSizeSettings addSize
std::string name
The name of this setting.
double minSize
The minimum size to draw this object.
bool drawMinGap
Information whether the minimum gap shall be drawn.
int addMode
The additional structures visualization scheme.
GUIVisualizationTextSettings polyType
bool showSublanes
Whether to show sublane boundaries.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
GUIColorer personColorer
The person colorer.
GUIColorer junctionColorer
The junction colorer.
static const RGBColor SUMO_color_E3Entry
double laneMinSize
The minimum visual lane width for drawing.
GUIScaler edgeScaler
The mesoscopic edge scaler.
int containerQuality
The quality of container drawing.
RGBColor backgroundColor
The background color to use.
void print(OutputDevice &dev, const std::string &name) const
GUIVisualizationSizeSettings poiSize
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
double selectionScale
the current selection scaling in NETEDIT (temporary)
GUIVisualizationSizeSettings(double _minSize, double _exaggeration=1.0, bool _constantSize=false)
GUIVisualizationSizeSettings containerSize
GUIVisualizationTextSettings addFullName
GUIVisualizationSizeSettings personSize
int personQuality
The quality of person drawing.
bool showGrid
Information whether a grid shall be shown.
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
bool operator!=(const GUIVisualizationSizeSettings &other)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
static const RGBColor SUMO_color_E3Exit
GUIVisualizationSizeSettings vehicleSize
bool drawJunctionShape
whether the shape of the junction should be drawn
int vehicleQuality
The quality of vehicle drawing.
static bool UseMesoSim
this should be set at the same time as MSGlobals::gUseMesoSim
int editAdditionalMode
the current NETEDIT additional mode (temporary)
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
GUIScaler laneScaler
The lane scaler.
GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color)
GUIVisualizationTextSettings polyName
GUIVisualizationTextSettings containerName