/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIE2Collector.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Okt 200318///19// The gui-version of the MS_E2_ZS_Collector20/****************************************************************************/21#pragma once22#include <config.h>2324#include <microsim/output/MSE2Collector.h>25#include "GUIDetectorWrapper.h"262728// ===========================================================================29// class definitions30// ===========================================================================31/**32* @class GUIE2Collector33* @brief The gui-version of the MSE2Collector34*35* Allows the building of a wrapper (also declared herein) which draws the36* detector on the gl-canvas. Beside this, the method "amVisible" is37* overridden to signalise that this detector is not used for simulation-38* -internal reasons, but is placed over the simulation by the user.39*/40class GUIE2Collector : public MSE2Collector {41public:42/** @brief Constructor with given end position and detector length43*44* @param[in] id The detector's unique id.45* @param[in] usage Information how the detector is used46* @param[in] lane The lane the detector ends47* @param[in] startPos The start position on the lane the detector is placed at48* @param[in] endPos The end position on the lane the detector is placed at49* @param[in] length The length the detector has (heuristic lane selection is done if the continuation is not unique)50* @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed51* @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed52* @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam53* @param[in] vTypes Vehicle types, that the detector takes into account54* @param[in] friendlyPositioning Whether positions should be corrected to "snap" on lane beginnings or ends if closer than POS_EPSILON55* @param[in] showDetector Whether the detector should be visible in the GUI56*57* @note Exactly one of the arguments startPos, endPos and length should be invalid (i.e. equal to std::numeric_limits<double>::max()).58* If length is invalid, it is required that 0 <= startPos < endPos <= lane->length59* If endPos is invalid, the detector may span over several lanes downstream of the lane60* If pos is invalid, the detector may span over several lanes upstream of the lane61*/62GUIE2Collector(const std::string& id, DetectorUsage usage,63MSLane* lane, double startPos, double endPos, double detLength,64SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,65const std::string name, const std::string& vTypes,66const std::string& nextEdges,67int detectPersons, bool showDetector);686970/** @brief Constructor with a sequence of lanes and given start and end position on the first and last lanes71*72* @param[in] id The detector's unique id.73* @param[in] usage Information how the detector is used74* @param[in] lanes A sequence of lanes the detector covers (must form a continuous piece)75* @param[in] startPos The position of the detector start on the first lane the detector is placed at76* @param[in] endPos The position of the detector end on the last lane the detector is placed at77* @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed78* @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed79* @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam80* @param[in] vTypes Vehicle types, that the detector takes into account81* @param[in] friendlyPositioning Whether positions should be corrected to "snap" on lane beginnings or ends if closer than POS_EPSILON82* @param[in] showDetector Whether the detector should be visible in the GUI83*/84GUIE2Collector(const std::string& id, DetectorUsage usage,85std::vector<MSLane*> lanes, double startPos, double endPos,86SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,87const std::string name, const std::string& vTypes,88const std::string& nextEdges,89int detectPersons, bool showDetector);909192/// @brief Destructor93~GUIE2Collector();949596/** @brief Returns the wrapper for this detector97* @return The wrapper representing the detector98* @see MyWrapper99*/100virtual GUIDetectorWrapper* buildDetectorGUIRepresentation();101102/// @brief whether the induction loop shall be visible103bool isVisible() const {104return myShow;105}106107/// @brief toggle visibility108void setVisible(bool show) {109myShow = show;110}111112113private:114/// @brief Whether the detector shall be drawn in the gui115bool myShow;116117public:118/**119* @class GUIE2Collector::MyWrapper120* A GUIE2Collector-visualiser121*/122class MyWrapper : public GUIDetectorWrapper {123public:124/// @brief Constructor125MyWrapper(GUIE2Collector& detector);126127/// @brief Destrutor128~MyWrapper();129130/// @name inherited from GUIGlObject131//@{132133/** @brief Returns an own parameter window134*135* @param[in] app The application needed to build the parameter window136* @param[in] parent The parent window needed to build the parameter window137* @return The built parameter window138* @see GUIGlObject::getParameterWindow139*/140GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;141142/// @brief return exaggeration associated with this GLObject143double getExaggeration(const GUIVisualizationSettings& s) const override;144145/** @brief Returns the boundary to which the view shall be centered in order to show the object146*147* @return The boundary the object is within148* @see GUIGlObject::getCenteringBoundary149*/150Boundary getCenteringBoundary() const override;151152/** @brief Draws the object153* @param[in] s The settings for the current view (may influence drawing)154* @see GUIGlObject::drawGL155*/156void drawGL(const GUIVisualizationSettings& s) const override;157//@}158159160/// @brief Returns the detector itself161GUIE2Collector& getDetector();162163protected:164/// @brief whether this detector has an active virtual detector call165bool haveOverride() const override;166167/// @brief toggle virtual detector call168void toggleOverride() const override;169170private:171/// @brief The wrapped detector172GUIE2Collector& myDetector;173174/// @brief The detector's boundary175Boundary myBoundary;176177/// @brief A sequence of positions in full-geometry mode178PositionVector myFullGeometry;179180/// @brief A sequence of lengths in full-geometry mode181std::vector<double> myShapeLengths;182183/// @brief A sequence of rotations in full-geometry mode184std::vector<double> myShapeRotations;185186private:187/// @brief Invalidated copy constructor.188MyWrapper(const MyWrapper&);189190/// @brief Invalidated assignment operator.191MyWrapper& operator=(const MyWrapper&);192193};194195};196197198