Path: blob/main/src/netedit/elements/additional/GNEMultiEntryExitDetector.h
194024 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNEMultiEntryExitDetector.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17// multi entry-exit (E3) detector18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"23#include "GNEAdditionalSquared.h"2425// ===========================================================================26// class definitions27// ===========================================================================2829class GNEMultiEntryExitDetector : public GNEAdditional, public GNEAdditionalSquared, public Parameterised {3031public:32/// @brief default constructor33GNEMultiEntryExitDetector(GNENet* net);3435/**@brief GNEMultiEntryExitDetector Constructor36* @param[in] id The name of the multi entry exit detector37* @param[in] net net in which this polygon is placed38* @param[in] fileBucket bucket in which this AttributeCarrier is stored39* @param[in] pos position (center) of the detector in the map40* @param[in] freq the aggregation period the values the detector collects shall be summed up.41* @param[in] outputFilename The path to the output file42* @param[in] vehicleTypes space separated list of vehicle type ids to consider43* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection44* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)45* @param[in] name E3 detector name46* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting47* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting48* @param[in] openEntry enable or disable open Entry49* @param[in] expectedArrival Whether no warning should be issued when a vehicle arrives within the detector area50* @param[in] parameters generic parameters51*/52GNEMultiEntryExitDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, const Position pos, const SUMOTime freq, const std::string& outputFilename,53const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,54const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry,55const bool expectedArrival, const Parameterised::Map& parameters);5657/// @brief GNEMultiEntryExitDetector Destructor58~GNEMultiEntryExitDetector();5960/// @brief methods to retrieve the elements linked to this multiEntryExitDetector61/// @{6263/// @brief get GNEMoveElement associated with this multiEntryExitDetector64GNEMoveElement* getMoveElement() const override;6566/// @brief get parameters associated with this multiEntryExitDetector67Parameterised* getParameters() override;6869/// @brief get parameters associated with this multiEntryExitDetector (constant)70const Parameterised* getParameters() const override;7172/// @}7374/// @name members and functions relative to write additionals into XML75/// @{7677/**@brief write additional element into a xml file78* @param[in] device device in which write parameters of additional element79*/80void writeAdditional(OutputDevice& device) const override;8182/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)83bool isAdditionalValid() const override;8485/// @brief return a string with the current additional problem (must be reimplemented in all detector children)86std::string getAdditionalProblem() const override;8788/// @brief fix additional problem (must be reimplemented in all detector children)89void fixAdditionalProblem() override;9091/// @}9293/// @name Function related with contour drawing94/// @{9596/// @brief check if draw move contour (red)97bool checkDrawMoveContour() const override;9899/// @}100101/// @name Functions related with geometry of element102/// @{103104/// @brief update pre-computed geometry information105void updateGeometry() override;106107/// @brief Returns position of additional in view108Position getPositionInView() const override;109110/// @brief update centering boundary (implies change in RTREE)111void updateCenteringBoundary(const bool updateGrid) override;112113/// @brief split geometry114void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;115116/// @}117118/// @name inherited from GUIGlObject119/// @{120121/// @brief Returns the name of the parent object122/// @return This object's parent id123std::string getParentName() const override;124125/**@brief Draws the object126* @param[in] s The settings for the current view (may influence drawing)127* @see GUIGlObject::drawGL128*/129void drawGL(const GUIVisualizationSettings& s) const override;130131/// @}132133/// @name inherited from GNEAttributeCarrier134/// @{135136/* @brief method for getting the Attribute of an XML key137* @param[in] key The attribute key138* @return string with the value associated to key139*/140std::string getAttribute(SumoXMLAttr key) const override;141142/* @brief method for getting the Attribute of an XML key in double format143* @param[in] key The attribute key144* @return double with the value associated to key145*/146double getAttributeDouble(SumoXMLAttr key) const override;147148/* @brief method for getting the Attribute of an XML key in position format149* @param[in] key The attribute key150* @return position with the value associated to key151*/152Position getAttributePosition(SumoXMLAttr key) const override;153154/* @brief method for getting the Attribute of an XML key in positionVector format155* @param[in] key The attribute key156* @return positionVector with the value associated to key157*/158PositionVector getAttributePositionVector(SumoXMLAttr key) const override;159160/* @brief method for setting the attribute and letting the object perform additional changes161* @param[in] key The attribute key162* @param[in] value The new value163* @param[in] undoList The undoList on which to register changes164*/165void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;166167/* @brief method for checking if the key and their conrrespond attribute are valids168* @param[in] key The attribute key169* @param[in] value The value associated to key key170* @return true if the value is valid, false in other case171*/172bool isValid(SumoXMLAttr key, const std::string& value) override;173174/// @brief get PopPup ID (Used in AC Hierarchy)175std::string getPopUpID() const override;176177/// @brief get Hierarchy Name (Used in AC Hierarchy)178std::string getHierarchyName() const override;179180/// @}181182protected:183/// @brief period of E3 detector184SUMOTime myPeriod = 0;185186/// @brief fielname of E3 detector187std::string myOutputFilename;188189/// @brief attribute vehicle types190std::vector<std::string> myVehicleTypes;191192/// @brief next edges193std::vector<std::string> myNextEdges;194195/// @brief detect persons196std::string myDetectPersons;197198/// @brief The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting199SUMOTime myTimeThreshold = 0;200201/// @brief The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting202double mySpeedThreshold = 0;203204/// @brie open entry205bool myOpenEntry = false;206207/// @brief flag for enable/disable expected arrival208bool myExpectedArrival = false;209210private:211/// @brief check restriction with the number of children212bool checkChildAdditionalRestriction() const override;213214/// @brief set attribute after validation215void setAttribute(SumoXMLAttr key, const std::string& value) override;216217/// @brief Invalidated copy constructor.218GNEMultiEntryExitDetector(const GNEMultiEntryExitDetector&) = delete;219220/// @brief Invalidated assignment operator.221GNEMultiEntryExitDetector& operator=(const GNEMultiEntryExitDetector&) = delete;222};223224225