Eclipse SUMO - Simulation of Urban MObility
GUIDottedGeometry.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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // File for dotted geometry classes and functions
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
29 
31 
32 public:
34  enum class DottedContourType {
35  INSPECT,
36  FRONT,
37  MOVE,
38  GREEN,
39  MAGENTA
40  };
41 
44 
45  public:
48 
51 
53  void changeColor();
54 
56  void reset();
57 
58  private:
61 
64 
67  };
68 
70  struct Segment {
72  Segment();
73 
75  Segment(PositionVector newShape);
76 
79 
81  std::vector<double> rotations;
82 
84  std::vector<double> lengths;
85 
87  double offset;
88  };
89 
92 
94  GUIDottedGeometry(const GUIVisualizationSettings& s, PositionVector shape, const bool closeShape);
95 
98  const GUIDottedGeometry& topDottedGeometry, const bool drawFirstExtrem,
99  const GUIDottedGeometry& botDottedGeometry, const bool drawLastExtrem);
100 
102  void updateDottedGeometry(const GUIVisualizationSettings& s, const PositionVector& laneShape);
103 
105  void updateDottedGeometry(const GUIVisualizationSettings& s, PositionVector shape, const bool closeShape);
106 
108  void drawDottedGeometry(DottedGeometryColor& dottedGeometryColor, GUIDottedGeometry::DottedContourType type, const double customWidth = -1) const;
109 
111  void moveShapeToSide(const double value);
112 
114  double getWidth() const;
115 
117  void setWidth(const double width);
118 
120  void invertOffset();
121 
124 
126  static void drawMovingHint(const GUIVisualizationSettings& s, const Position& mousePos, const PositionVector& shape,
127  const RGBColor& hintColor, const double radius, const double exaggeration);
128 
130  static void drawDottedContourClosedShape(const DottedContourType type, const GUIVisualizationSettings& s, const PositionVector& shape,
131  const double exaggeration, const double lineWidth = -1);
132 
134  static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings& s, const PositionVector& shape,
135  const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem,
136  const double lineWidth = -1);
137 
139  static void drawDottedContourCircle(const DottedContourType type, const GUIVisualizationSettings& s, const Position& pos,
140  const double radius, const double exaggeration);
141 
143  static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings& s, const Position& pos,
144  const double width, const double height, const double offsetX, const double offsetY,
145  const double rot, const double exaggeration);
147 
148 private:
151 
153  double myWidth;
154 
156  std::vector<GUIDottedGeometry::Segment> myDottedGeometrySegments;
157 
160 };
class for pack all variables related with GUIDottedGeometry color
DottedGeometryColor & operator=(const DottedGeometryColor &other)=delete
Invalidated assignment operator.
const RGBColor getColor(DottedContourType type)
get inspected color (and change flag)
const GUIVisualizationSettings & mySettings
pointer to GUIVisualizationSettings
void reset()
rest Dotted Geometry Color
DottedGeometryColor(const GUIVisualizationSettings &settings)
constructor
std::vector< GUIDottedGeometry::Segment > myDottedGeometrySegments
dotted element shape (note: It's centered in 0,0 due scaling)
double myWidth
geometry width
void drawDottedGeometry(DottedGeometryColor &dottedGeometryColor, GUIDottedGeometry::DottedContourType type, const double customWidth=-1) const
draw inspected dottedShape
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static void drawDottedContourCircle(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double radius, const double exaggeration)
draw dotted contour for the given Position and radius (used by Juctions and POIs)
void moveShapeToSide(const double value)
move shape to side
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
double getWidth() const
get width
static void drawMovingHint(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
void updateDottedGeometry(const GUIVisualizationSettings &s, const PositionVector &laneShape)
update GUIDottedGeometry (using lane shape)
GUIDottedGeometry & operator=(const GUIDottedGeometry &other)=delete
Invalidated assignment operator.
void invertOffset()
invert offset of all segments
void setWidth(const double width)
change default width
static void drawDottedContourClosedShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double exaggeration, const double lineWidth=-1)
draw dotted contour for the given closed shape (used by Juctions, shapes and TAZs)
GUIDottedGeometry()
constructor
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
dotted geometry segment
std::vector< double > lengths
lengths
PositionVector shape
shape
std::vector< double > rotations
rotations
double offset
drawing offset (-1 or 1 only)
Segment()
default constructor