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 class GUIGlObject;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
48 
49 // cannot declare this as inner class because it needs to be used in forward
50 // declaration (@todo fix inclusion order by removing references to guisim!)
52  GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color, RGBColor _bgColor = RGBColor(128,0,0,0), bool _constSize = true) :
53  show(_show), size(_size), color(_color), bgColor(_bgColor), constSize(_constSize) {}
54 
55  bool show;
56  double size;
59  bool constSize;
60 
62  return show == other.show &&
63  size == other.size &&
64  color == other.color &&
65  bgColor == other.bgColor &&
66  constSize == other.constSize;
67  }
69  return !((*this) == other);
70  }
71 
72  void print(OutputDevice& dev, const std::string& name) const {
73  dev.writeAttr(name + "_show", show);
74  dev.writeAttr(name + "_size", size);
75  dev.writeAttr(name + "_color", color);
76  dev.writeAttr(name + "_bgColor", bgColor);
77  dev.writeAttr(name + "_constantSize", constSize);
78  }
79 
80  double scaledSize(double scale, double constFactor = 0.1) const {
81  return constSize ? size / scale : size * constFactor;
82  }
83 };
84 
85 
87  GUIVisualizationSizeSettings(double _minSize, double _exaggeration = 1.0, bool _constantSize = false, bool _constantSizeSelected = false) :
88  minSize(_minSize), exaggeration(_exaggeration), constantSize(_constantSize), constantSizeSelected(_constantSizeSelected) {}
89 
91  double minSize;
93  double exaggeration;
94  // @brief whether the object shall be drawn with constant size regardless of zoom
96  // @brief whether only selected objects shall be drawn with constant
98 
100  return constantSize == other.constantSize &&
101  constantSizeSelected == other.constantSizeSelected &&
102  minSize == other.minSize &&
103  exaggeration == other.exaggeration;
104  }
106  return !((*this) == other);
107  }
108 
109  void print(OutputDevice& dev, const std::string& name) const {
110  dev.writeAttr(name + "_minSize", minSize);
111  dev.writeAttr(name + "_exaggeration", exaggeration);
112  dev.writeAttr(name + "_constantSize", constantSize);
113  dev.writeAttr(name + "_constantSizeSelected", constantSizeSelected);
114  }
115 
117  double getExaggeration(const GUIVisualizationSettings& s, const GUIGlObject* o, double factor = 20) const;
118 };
119 
120 
126 public:
127 
129  GUIVisualizationSettings(bool _netedit = false);
130 
132  std::string name;
133 
135  bool netedit;
136 
138  double angle;
139 
141  bool dither;
142 
144 
145 
149  bool showGrid;
151  double gridXSize, gridYSize;
153 
154 
156 
157 
162 
164  static bool UseMesoSim;
178  bool showRails;
179  // Setting bundles for optional drawing names with size and color
180  GUIVisualizationTextSettings edgeName, internalEdgeName, cwaEdgeName, streetName, edgeValue;
181 
186  double laneMinSize;
193 
195  std::string edgeParam;
196  std::string laneParam;
198 
199 
201 
202 
215  // Setting bundles for controling the size of the drawn vehicles
217  // Setting bundles for optional drawing vehicle names or color value
221 
222 
224 
225 
230  // Setting bundles for controling the size of the drawn persons
232  // Setting bundles for optional drawing person names
236 
237 
239 
240 
245  // Setting bundles for controling the size of the drawn containers
247  // Setting bundles for optional drawing person names
250 
251 
253 
254 
257  // Setting bundles for optional drawing junction names and indices
258  GUIVisualizationTextSettings drawLinkTLIndex, drawLinkJunctionIndex, junctionName, internalJunctionName;
265  // Setting bundles for controling the size of the drawn junction
268 
269 
271 
272 
274  // @todo decouple addExageration for POIs, Polygons, Triggers etc
275  int addMode;
276  // Setting bundles for controling the size of additional items
278  // Setting bundles for optional drawing additional names
280  // Setting bundles for optional drawing additional full names
283 
284 
286 
287 
290  // Setting bundles for controling the size of the drawn POIs
292  // Setting bundles for optional drawing poi names
294  // Setting bundles for optional drawing poi types
296 
299  // Setting bundles for controling the size of the drawn polygons
301  // Setting bundles for optional drawing polygon names
303  // Setting bundles for optional drawing polygon types
306 
309 
311  double scale;
312 
314  bool gaming;
315 
317  int editMode;
318 
321 
328 
331 
334 
336  void initNeteditDefaults();
337  void initSumoGuiDefaults();
338 
342  void save(OutputDevice& dev) const;
343 
347  int getLaneEdgeMode() const;
348 
352  int getLaneEdgeScaleMode() const;
353 
357  GUIColorScheme& getLaneEdgeScheme();
358 
362  GUIScaleScheme& getLaneEdgeScaleScheme();
363 
365  bool operator==(const GUIVisualizationSettings& vs2);
366 
368  static const RGBColor& getLinkColor(const LinkState& ls);
369 
372 
375 
378 
381 
384 
387 
390 
392  static const RGBColor SUMO_color_E1;
393 
396 
398  static const RGBColor SUMO_color_E2;
399 
402 
405 
406  static const std::string SCHEME_NAME_EDGE_PARAM_NUMERICAL;
407  static const std::string SCHEME_NAME_LANE_PARAM_NUMERICAL;
408 
410  double getTextAngle(double objectAngle) const;
411 };
412 
413 
414 #endif
415 
416 /****************************************************************************/
417 
GUIVisualizationSizeSettings junctionSize
GUIVisualizationTextSettings junctionName
GUIVisualizationSizeSettings(double _minSize, double _exaggeration=1.0, bool _constantSize=false, bool _constantSizeSelected=false)
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 personValue
GUIVisualizationTextSettings personName
static const RGBColor SUMO_color_E1
color for E1 detectors
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.
static const std::string SCHEME_NAME_EDGE_PARAM_NUMERICAL
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.
static const std::string SCHEME_NAME_LANE_PARAM_NUMERICAL
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.
static const RGBColor SUMO_color_E2
color for E2 detectors
GUIVisualizationSizeSettings polySize
GUIColorer vehicleColorer
The vehicle colorer.
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationSizeSettings addSize
GUIColorer poiColorer
The POI colorer.
GUIVisualizationTextSettings vehicleValue
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.
GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color, RGBColor _bgColor=RGBColor(128, 0, 0, 0), bool _constSize=true)
RGBColor selectionColor
NETEDIT special colors.
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
static const RGBColor SUMO_color_E1Instant
color for E1 Instant detectors
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 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: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