Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIE3Collector.h
193967 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
102
103
/// @brief return exaggeration associated with this GLObject
104
double getExaggeration(const GUIVisualizationSettings& s) const override;
105
106
/** @brief Returns the boundary to which the view shall be centered in order to show the object
107
*
108
* @return The boundary the object is within
109
* @see GUIGlObject::getCenteringBoundary
110
*/
111
Boundary getCenteringBoundary() const override;
112
113
/** @brief Draws the object
114
* @param[in] s The settings for the current view (may influence drawing)
115
* @see GUIGlObject::drawGL
116
*/
117
void drawGL(const GUIVisualizationSettings& s) const override;
118
//@}
119
120
121
/// @brief Returns the detector itself
122
GUIE3Collector& getDetector();
123
124
125
protected:
126
/** @struct SingleCrossingDefinition
127
* @brief Representation of a single crossing point
128
*/
129
struct SingleCrossingDefinition {
130
/// @brief The position
131
Position myFGPosition;
132
/// @brief The rotation
133
double myFGRotation;
134
};
135
136
protected:
137
/// @brief Builds the description about the position of the entry/exit point
138
SingleCrossingDefinition buildDefinition(const MSCrossSection& section);
139
140
/// @brief Draws a single entry/exit point
141
void drawSingleCrossing(const Position& pos, double rot,
142
double upscale) const;
143
144
private:
145
/// @brief The wrapped detector
146
GUIE3Collector& myDetector;
147
148
/// @brief The detector's boundary
149
Boundary myBoundary;
150
151
/// @brief Definition of a list of cross (entry/exit-point) positions
152
typedef std::vector<SingleCrossingDefinition> CrossingDefinitions;
153
154
/// @brief The list of entry positions
155
CrossingDefinitions myEntryDefinitions;
156
157
/// @brief The list of exit positions
158
CrossingDefinitions myExitDefinitions;
159
160
};
161
162
};
163
164