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.dev/sumo
3 // Copyright (C) 2001-2024 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, // Inspecting element
36  REMOVE, // Mouse over element to remove
37  SELECT, // Mouse over element to select
38  MOVE, // Mouse over element to move
39  FRONT, // Element marked as "front element"
40  OVER, // Mouse over element (orange)
41  FROM, // Element marked as from (green)
42  TO, // Element marked as to (magenta)
43  RELATED, // Element marked as related (cyan)
44  NOTHING
45  };
46 
49 
50  public:
53 
55  const RGBColor getColor(const GUIVisualizationSettings& settings, DottedContourType type);
56 
58  void changeColor();
59 
61  void reset();
62 
63  private:
66 
69  };
70 
72  struct Segment {
73 
75  Segment();
76 
78  Segment(PositionVector newShape);
79 
82 
84  std::vector<double> rotations;
85 
87  std::vector<double> lengths;
88  };
89 
92 
95  PositionVector shape, const bool closeShape);
96 
99  const PositionVector& laneShape);
100 
103  PositionVector shape, const bool closeShape);
104 
107  DottedGeometryColor& dottedGeometryColor, const double lineWidth, const bool addOffset) const;
108 
110  void drawInnenGeometry(const double lineWidth) const;
111 
113  void moveShapeToSide(const double value);
114 
116  Position getFrontPosition() const;
117 
119  Position getBackPosition() const;
120 
122  const PositionVector& getUnresampledShape() const;
123 
125  void clearDottedGeometry();
126 
127 private:
130 
133 
135  std::vector<GUIDottedGeometry::Segment> myDottedGeometrySegments;
136 };
class for pack all variables related with GUIDottedGeometry color
const RGBColor getColor(const GUIVisualizationSettings &settings, DottedContourType type)
get inspected color (and change flag)
DottedGeometryColor & operator=(const DottedGeometryColor &other)=delete
Invalidated assignment operator.
void reset()
rest Dotted Geometry Color
void drawDottedGeometry(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, DottedGeometryColor &dottedGeometryColor, const double lineWidth, const bool addOffset) const
draw dotted geometry
std::vector< GUIDottedGeometry::Segment > myDottedGeometrySegments
dotted element shape (note: It's centered in 0,0 due scaling)
Position getFrontPosition() const
get front position
const PositionVector & getUnresampledShape() const
get simple shape (the shape without resampling)
void drawInnenGeometry(const double lineWidth) const
draw innen geometry
PositionVector myUnresampledShape
shape without resampling
void moveShapeToSide(const double value)
move shape to side
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
void clearDottedGeometry()
clear dotted geometry
void updateDottedGeometry(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &laneShape)
update GUIDottedGeometry (using lane shape)
GUIDottedGeometry()
constructor
Position getBackPosition() const
get back position
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
Segment()
default constructor