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-2018 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 // Stores the information about how to visualize structures
18 /****************************************************************************/
19 #ifndef GUIVisualizationSettings_h
20 #define GUIVisualizationSettings_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <vector>
30 #include <map>
31 #include <utils/common/RGBColor.h>
32 #include <utils/common/ToString.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class BaseSchemeInfoSource;
40 class OutputDevice;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
47 
48 // cannot declare this as inner class because it needs to be used in forward
49 // declaration (@todo fix inclusion order by removing references to guisim!)
51  GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color, bool _constSize = true) :
52  show(_show), size(_size), color(_color), constSize(_constSize) {}
53 
54  bool show;
55  double size;
57  bool constSize;
58 
60  return show == other.show &&
61  size == other.size &&
62  color == other.color &&
63  constSize == other.constSize;
64  }
66  return !((*this) == other);
67  }
68 
69  void print(OutputDevice& dev, const std::string& name) const {
70  dev.writeAttr(name + "_show", show);
71  dev.writeAttr(name + "_size", size);
72  dev.writeAttr(name + "_color", color);
73  dev.writeAttr(name + "_constantSize", constSize);
74  }
75 
76  double scaledSize(double scale, double constFactor = 0.1) const {
77  return constSize ? size / scale : size * constFactor;
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 
130  double angle;
131 
133  bool dither;
134 
136 
137 
141  bool showGrid;
143  double gridXSize, gridYSize;
145 
146 
148 
149 
154 
156  static bool UseMesoSim;
170  bool showRails;
171  // Setting bundles for optional drawing names with size and color
172  GUIVisualizationTextSettings edgeName, internalEdgeName, cwaEdgeName, streetName;
173 
178  double laneMinSize;
186 
187 
189 
190 
203  // Setting bundles for controling the size of the drawn vehicles
205  // Setting bundles for optional drawing vehicle names
208 
209 
211 
212 
217  // Setting bundles for controling the size of the drawn persons
219  // Setting bundles for optional drawing person names
222 
223 
225 
226 
231  // Setting bundles for controling the size of the drawn containers
233  // Setting bundles for optional drawing person names
236 
237 
239 
240 
243  // Setting bundles for optional drawing junction names and indices
244  GUIVisualizationTextSettings drawLinkTLIndex, drawLinkJunctionIndex, junctionName, internalJunctionName;
251  // Setting bundles for controling the size of the drawn junction
254 
255 
257 
258 
260  // @todo decouple addExageration for POIs, Polygons, Triggers etc
261  int addMode;
262  // Setting bundles for controling the size of additional items
264  // Setting bundles for optional drawing additional names
266  // Setting bundles for optional drawing additional full names
269 
270 
272 
273 
276  // Setting bundles for controling the size of the drawn POIs
278  // Setting bundles for optional drawing poi names
280  // Setting bundles for optional drawing poi types
282 
285  // Setting bundles for controling the size of the drawn polygons
287  // Setting bundles for optional drawing polygon names
289  // Setting bundles for optional drawing polygon types
292 
295 
297  double scale;
298 
300  bool gaming;
301 
303  int editMode;
304 
307 
310 
313 
315  void initNeteditDefaults();
316  void initSumoGuiDefaults();
317 
321  void save(OutputDevice& dev) const;
322 
326  int getLaneEdgeMode() const;
327 
331  int getLaneEdgeScaleMode() const;
332 
336  GUIColorScheme& getLaneEdgeScheme();
337 
341  GUIScaleScheme& getLaneEdgeScaleScheme();
342 
344  bool operator==(const GUIVisualizationSettings& vs2);
345 
347  static const RGBColor& getLinkColor(const LinkState& ls);
348 
351 
354 
357 
360 
363 
366 
369 
372 
375 
377  double getTextAngle(double objectAngle) const;
378 };
379 
380 
381 #endif
382 
383 /****************************************************************************/
384 
GUIVisualizationSizeSettings junctionSize
GUIVisualizationTextSettings junctionName
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
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)
static const RGBColor SUMO_color_busStop_sign
color for busStops signs
bool showBlinker
Information whether vehicle blinkers shall be drawn.
static const RGBColor SUMO_color_chargingStation_charge
color for chargingStation during charging
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)
static const RGBColor SUMO_color_chargingStation_sign
color for chargingStation sign
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
static const RGBColor SUMO_color_chargingStation
color for chargingStations
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
GUIColorer poiColorer
The POI colorer.
std::string name
The name of this setting.
static const RGBColor SUMO_color_containerStop_sign
color for containerStop signs
double minSize
The minimum size to draw this object.
double scaledSize(double scale, double constFactor=0.1) const
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 polyColorer
The polygon colorer.
GUIColorer personColorer
The person colorer.
GUIColorer junctionColorer
The junction colorer.
double angle
The current view rotation angle.
static const RGBColor SUMO_color_E3Entry
color for Entrys
static const RGBColor SUMO_color_busStop
color for busStops
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.
static const RGBColor SUMO_color_containerStop
color for containerStops
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
GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color, bool _constSize=true)
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:64
static const RGBColor SUMO_color_E3Exit
color for Exits
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.
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
bool showBikeMarkings
Information whether bicycle lane marking shall be drawn.
GUIVisualizationTextSettings polyName
GUIVisualizationTextSettings containerName