Path: blob/main/src/netedit/elements/additional/GNEMultiEntryExitDetector.h
169684 views
/****************************************************************************/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 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"2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEMultiEntryExitDetector : public GNEAdditional, public Parameterised {2930public:31/// @brief default constructor32GNEMultiEntryExitDetector(GNENet* net);3334/**@brief GNEMultiEntryExitDetector Constructor35* @param[in] id The name of the multi entry exit detector36* @param[in] net net in which this polygon is placed37* @param[in] filename file in which this element is stored38* @param[in] pos position (center) of the detector in the map39* @param[in] freq the aggregation period the values the detector collects shall be summed up.40* @param[in] outputFilename The path to the output file41* @param[in] vehicleTypes space separated list of vehicle type ids to consider42* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection43* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)44* @param[in] name E3 detector name45* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting46* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting47* @param[in] openEntry enable or disable open Entry48* @param[in] expectedArrival Whether no warning should be issued when a vehicle arrives within the detector area49* @param[in] parameters generic parameters50*/51GNEMultiEntryExitDetector(const std::string& id, GNENet* net, const std::string& filename, const Position pos, const SUMOTime freq, const std::string& outputFilename,52const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,53const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry,54const bool expectedArrival, const Parameterised::Map& parameters);5556/// @brief GNEMultiEntryExitDetector Destructor57~GNEMultiEntryExitDetector();5859/**@brief get move operation60* @note returned GNEMoveOperation can be nullptr61*/62GNEMoveOperation* getMoveOperation();6364/// @name members and functions relative to write additionals into XML65/// @{6667/**@brief write additional element into a xml file68* @param[in] device device in which write parameters of additional element69*/70void writeAdditional(OutputDevice& device) const;7172/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)73bool isAdditionalValid() const;7475/// @brief return a string with the current additional problem (must be reimplemented in all detector children)76std::string getAdditionalProblem() const;7778/// @brief fix additional problem (must be reimplemented in all detector children)79void fixAdditionalProblem();8081/// @}8283/// @name Function related with contour drawing84/// @{8586/// @brief check if draw move contour (red)87bool checkDrawMoveContour() const;8889/// @}9091/// @name Functions related with geometry of element92/// @{9394/// @brief update pre-computed geometry information95void updateGeometry();9697/// @brief Returns position of additional in view98Position getPositionInView() const;99100/// @brief update centering boundary (implies change in RTREE)101void updateCenteringBoundary(const bool updateGrid);102103/// @brief split geometry104void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);105106/// @}107108/// @name inherited from GUIGlObject109/// @{110111/// @brief Returns the name of the parent object112/// @return This object's parent id113std::string getParentName() const;114115/**@brief Draws the object116* @param[in] s The settings for the current view (may influence drawing)117* @see GUIGlObject::drawGL118*/119void drawGL(const GUIVisualizationSettings& s) const;120121/// @}122123/// @name inherited from GNEAttributeCarrier124/// @{125126/* @brief method for getting the Attribute of an XML key127* @param[in] key The attribute key128* @return string with the value associated to key129*/130std::string getAttribute(SumoXMLAttr key) const;131132/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)133* @param[in] key The attribute key134* @return double with the value associated to key135*/136double getAttributeDouble(SumoXMLAttr key) const;137138/// @brief get parameters map139const Parameterised::Map& getACParametersMap() const;140141/* @brief method for setting the attribute and letting the object perform additional changes142* @param[in] key The attribute key143* @param[in] value The new value144* @param[in] undoList The undoList on which to register changes145*/146void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);147148/* @brief method for checking if the key and their conrrespond attribute are valids149* @param[in] key The attribute key150* @param[in] value The value associated to key key151* @return true if the value is valid, false in other case152*/153bool isValid(SumoXMLAttr key, const std::string& value);154155/// @brief get PopPup ID (Used in AC Hierarchy)156std::string getPopUpID() const;157158/// @brief get Hierarchy Name (Used in AC Hierarchy)159std::string getHierarchyName() const;160161/// @}162163protected:164/// @brief position of E3 in view165Position myPosition;166167/// @brief period of E3 detector168SUMOTime myPeriod = 0;169170/// @brief fielname of E3 detector171std::string myOutputFilename;172173/// @brief attribute vehicle types174std::vector<std::string> myVehicleTypes;175176/// @brief next edges177std::vector<std::string> myNextEdges;178179/// @brief detect persons180std::string myDetectPersons;181182/// @brief The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting183SUMOTime myTimeThreshold = 0;184185/// @brief The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting186double mySpeedThreshold = 0;187188/// @brie open entry189bool myOpenEntry = false;190191/// @brief flag for enable/disable expected arrival192bool myExpectedArrival = false;193194private:195/// @brief check restriction with the number of children196bool checkChildAdditionalRestriction() const;197198/// @brief set attribute after validation199void setAttribute(SumoXMLAttr key, const std::string& value);200201/// @brief set move shape202void setMoveShape(const GNEMoveResult& moveResult);203204/// @brief commit move shape205void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);206207/// @brief Invalidated copy constructor.208GNEMultiEntryExitDetector(const GNEMultiEntryExitDetector&) = delete;209210/// @brief Invalidated assignment operator.211GNEMultiEntryExitDetector& operator=(const GNEMultiEntryExitDetector&) = delete;212};213214215