SUMO - Simulation of Urban MObility
GUIVisualizationSettings.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Stores the information about how to visualize structures
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 GUIVisualizationSettings_h
23 #define GUIVisualizationSettings_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 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <utils/common/RGBColor.h>
39 #include <utils/common/ToString.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class BaseSchemeInfoSource;
47 class OutputDevice;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
54 
55 // cannot declare this as inner class because it needs to be used in forward
56 // declaration (@todo fix inclusion order by removing references to guisim!)
58  GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color) :
59  show(_show), size(_size), color(_color) {}
60 
61  bool show;
62  double size;
64 
66  return show == other.show &&
67  size == other.size &&
68  color == other.color;
69  }
71  return !((*this) == other);
72  }
73 
74  void print(OutputDevice& dev, const std::string& name) const {
75  dev.writeAttr(name + "_show", show);
76  dev.writeAttr(name + "_size", size);
77  dev.writeAttr(name + "_color", color);
78  }
79 };
80 
81 
83  GUIVisualizationSizeSettings(double _minSize, double _exaggeration = 1.0, bool _constantSize = false) :
84  minSize(_minSize), exaggeration(_exaggeration), constantSize(_constantSize) {}
85 
87  double minSize;
89  double exaggeration;
90  // @brief whether the object shall be drawn with constant size regardless of zoom
92 
94  return constantSize == other.constantSize &&
95  minSize == other.minSize &&
96  exaggeration == other.exaggeration;
97  }
99  return !((*this) == other);
100  }
101 
102  void print(OutputDevice& dev, const std::string& name) const {
103  dev.writeAttr(name + "_minSize", minSize);
104  dev.writeAttr(name + "_exaggeration", exaggeration);
105  dev.writeAttr(name + "_constantSize", constantSize);
106  }
107 
109  double getExaggeration(const GUIVisualizationSettings& s, double factor = 20) const;
110 };
111 
112 
118 public:
119 
121  GUIVisualizationSettings(bool _netedit = false);
122 
124  std::string name;
125 
127  bool netedit;
128 
132  bool dither;
133 
135 
136 
140  bool showGrid;
142  double gridXSize, gridYSize;
144 
145 
147 
148 
153 
155  static bool UseMesoSim;
167  bool showRails;
168  // Setting bundles for optional drawing names with size and color
169  GUIVisualizationTextSettings edgeName, internalEdgeName, cwaEdgeName, streetName;
170 
175  double laneMinSize;
181 
182 
184 
185 
198  // Setting bundles for controling the size of the drawn vehicles
200  // Setting bundles for optional drawing vehicle names
203 
204 
206 
207 
212  // Setting bundles for controling the size of the drawn persons
214  // Setting bundles for optional drawing person names
217 
218 
220 
221 
226  // Setting bundles for controling the size of the drawn containers
228  // Setting bundles for optional drawing person names
231 
232 
234 
235 
238  // Setting bundles for optional drawing junction names and indices
239  GUIVisualizationTextSettings drawLinkTLIndex, drawLinkJunctionIndex, junctionName, internalJunctionName;
246  // Setting bundles for controling the size of the drawn junction
249 
250 
252 
253 
255  // @todo decouple addExageration for POIs, Polygons, Triggers etc
256  int addMode;
257  // Setting bundles for controling the size of additional items
259  // Setting bundles for optional drawing additional names
262 
263 
265 
266 
267  // Setting bundles for controling the size of the drawn POIs
269  // Setting bundles for optional drawing poi names
271  // Setting bundles for optional drawing poi types
273 
274  // Setting bundles for controling the size of the drawn polygons
276  // Setting bundles for optional drawing polygon names
278  // Setting bundles for optional drawing polygon types
281 
284 
286  double scale;
287 
289  bool gaming;
290 
292  int editMode;
293 
296 
299 
302 
304  void initNeteditDefaults();
305  void initSumoGuiDefaults();
306 
310  void save(OutputDevice& dev) const;
311 
315  int getLaneEdgeMode() const;
316 
320  int getLaneEdgeScaleMode() const;
321 
325  GUIColorScheme& getLaneEdgeScheme();
326 
330  GUIScaleScheme& getLaneEdgeScaleScheme();
331 
333  bool operator==(const GUIVisualizationSettings& vs2);
334 
335  /* @brief map from LinkState to color constants */
336  static const RGBColor& getLinkColor(const LinkState& ls);
337 
338 
339 };
340 
341 
342 #endif
343 
344 /****************************************************************************/
345 
GUIVisualizationSizeSettings junctionSize
GUIVisualizationTextSettings junctionName
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:261
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)
void print(OutputDevice &dev, const std::string &name) const
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.
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.
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.
bool antialiase
Information whether antialiase shall be enabled.
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
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:71
GUIVisualizationSizeSettings vehicleSize
bool drawJunctionShape
whether the shape of the junction should be drawn
void print(OutputDevice &dev, const std::string &name) const
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