Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIE3Collector.h
169668 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GUIE3Collector.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Jan 2004
19
///
20
// The gui-version of a MSE3Collector
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <string>
26
#include <vector>
27
#include "GUIDetectorWrapper.h"
28
#include <microsim/output/MSE3Collector.h>
29
#include <utils/geom/PositionVector.h>
30
#include <utils/common/ValueSource.h>
31
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
/**
37
* @class GUIE3Collector
38
* @brief The gui-version of the MSE3Collector.
39
*
40
* Allows the building of a wrapper (also declared herein) which draws the
41
* detector on the gl-canvas.
42
*/
43
class GUIE3Collector : public MSE3Collector {
44
public:
45
/// @brief Constructor
46
GUIE3Collector(const std::string& id,
47
const CrossSectionVector& entries, const CrossSectionVector& exits,
48
double haltingSpeedThreshold,
49
SUMOTime haltingTimeThreshold,
50
const std::string name, const std::string& vTypes,
51
const std::string& nextEdges,
52
int detectPersons, bool openEntry, bool expectArrival);
53
54
/// @brief Destructor
55
~GUIE3Collector();
56
57
58
/** @brief Returns the list of entry points
59
* @return The list of entry points
60
*/
61
const CrossSectionVector& getEntries() const;
62
63
64
/** @brief Returns the list of exit points
65
* @return The list of exit points
66
*/
67
const CrossSectionVector& getExits() const;
68
69
70
/** @brief Returns the wrapper for this detector
71
* @return The wrapper representing the detector
72
* @see MyWrapper
73
*/
74
GUIDetectorWrapper* buildDetectorGUIRepresentation();
75
76
77
public:
78
/**
79
* @class GUIE3Collector::MyWrapper
80
* A GUIE3Collector-visualiser
81
*/
82
class MyWrapper : public GUIDetectorWrapper {
83
public:
84
/// @brief Constructor
85
MyWrapper(GUIE3Collector& detector);
86
87
/// @brief Destrutor
88
~MyWrapper();
89
90
91
/// @name inherited from GUIGlObject
92
//@{
93
94
/** @brief Returns an own parameter window
95
*
96
* @param[in] app The application needed to build the parameter window
97
* @param[in] parent The parent window needed to build the parameter window
98
* @return The built parameter window
99
* @see GUIGlObject::getParameterWindow
100
*/
101
GUIParameterTableWindow* getParameterWindow(
102
GUIMainWindow& app, GUISUMOAbstractView& parent);
103
104
/// @brief return exaggeration associated with this GLObject
105
double getExaggeration(const GUIVisualizationSettings& s) const;
106
107
/** @brief Returns the boundary to which the view shall be centered in order to show the object
108
*
109
* @return The boundary the object is within
110
* @see GUIGlObject::getCenteringBoundary
111
*/
112
Boundary getCenteringBoundary() const;
113
114
/** @brief Draws the object
115
* @param[in] s The settings for the current view (may influence drawing)
116
* @see GUIGlObject::drawGL
117
*/
118
void drawGL(const GUIVisualizationSettings& s) const;
119
//@}
120
121
122
/// @brief Returns the detector itself
123
GUIE3Collector& getDetector();
124
125
126
protected:
127
/** @struct SingleCrossingDefinition
128
* @brief Representation of a single crossing point
129
*/
130
struct SingleCrossingDefinition {
131
/// @brief The position
132
Position myFGPosition;
133
/// @brief The rotation
134
double myFGRotation;
135
};
136
137
protected:
138
/// @brief Builds the description about the position of the entry/exit point
139
SingleCrossingDefinition buildDefinition(const MSCrossSection& section);
140
141
/// @brief Draws a single entry/exit point
142
void drawSingleCrossing(const Position& pos, double rot,
143
double upscale) const;
144
145
private:
146
/// @brief The wrapped detector
147
GUIE3Collector& myDetector;
148
149
/// @brief The detector's boundary
150
Boundary myBoundary;
151
152
/// @brief Definition of a list of cross (entry/exit-point) positions
153
typedef std::vector<SingleCrossingDefinition> CrossingDefinitions;
154
155
/// @brief The list of entry positions
156
CrossingDefinitions myEntryDefinitions;
157
158
/// @brief The list of exit positions
159
CrossingDefinitions myExitDefinitions;
160
161
};
162
163
};
164
165