Path: blob/main/src/netedit/elements/additional/GNEInductionLoopDetector.h
193674 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 GNEInductionLoopDetector.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDetector.h"2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEMoveElementLaneSingle;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEInductionLoopDetector : public GNEDetector {3536public:37/// @brief default constructor38GNEInductionLoopDetector(GNENet* net);3940/**@brief Constructor41* @param[in] id The storage of gl-ids to get the one for this lane representation from42* @param[in] net pointer to GNENet of this additional element belongs43* @param[in] fileBucket file in which this element is stored44* @param[in] lane Lane of this StoppingPlace belongs45* @param[in] pos position of the detector on the lane46* @param[in] freq the aggregation period the values the detector collects shall be summed up.47* @param[in] filename The path to the output file.48* @param[in] name E1 detector name49* @param[in] vehicleTypes space separated list of vehicle type ids to consider50* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection51* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)52* @param[in] friendlyPos enable or disable friendly positions53* @param[in] show detector in sumo-gui54* @param[in] parameters generic parameters55*/56GNEInductionLoopDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, const double pos, const SUMOTime freq,57const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,58const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters);5960/// @brief Destructor61~GNEInductionLoopDetector();6263/// @brief methods to retrieve the elements linked to this GNEAdditional64/// @{6566/// @brief get GNEMoveElement associated with this GNEAdditional67GNEMoveElement* getMoveElement() const override;6869/// @brief get parameters associated with this GNEAdditional70Parameterised* getParameters() 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 XML83bool isAdditionalValid() const override;8485/// @brief return a string with the current additional problem86std::string getAdditionalProblem() const override;8788/// @brief fix additional problem89void fixAdditionalProblem() override;9091/// @}9293/// @brief update pre-computed geometry information94void updateGeometry() override;9596/// @name Function related with drawing97/// @{9899/// @brief check if draw related contour (cyan)100bool checkDrawRelatedContour() const override;101102/// @}103104/// @name inherited from GUIGlObject105/// @{106107/**@brief Draws the object108* @param[in] s The settings for the current view (may influence drawing)109* @see GUIGlObject::drawGL110*/111void drawGL(const GUIVisualizationSettings& s) const override;112113/// @}114115/// @name inherited from GNEAttributeCarrier116/// @{117118/* @brief method for getting the Attribute of an XML key119* @param[in] key The attribute key120* @return string with the value associated to key121*/122std::string getAttribute(SumoXMLAttr key) const override;123124/* @brief method for getting the Attribute of an XML key in double format125* @param[in] key The attribute key126* @return double with the value associated to key127*/128double getAttributeDouble(SumoXMLAttr key) const override;129130/* @brief method for getting the Attribute of an XML key in position format131* @param[in] key The attribute key132* @return position with the value associated to key133*/134Position getAttributePosition(SumoXMLAttr key) const override;135136/* @brief method for setting the attribute and letting the object perform additional changes137* @param[in] key The attribute key138* @param[in] value The new value139* @param[in] undoList The undoList on which to register changes140*/141void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;142143/* @brief method for checking if the key and their correspond attribute are valids144* @param[in] key The attribute key145* @param[in] value The value associated to key key146* @return true if the value is valid, false in other case147*/148bool isValid(SumoXMLAttr key, const std::string& value) override;149150/// @}151152protected:153/// @brief position over lane154double myPosOverLane = 0;155156/// @brief friendly position157bool myFriendlyPos = false;158159/// @brief move element lane single160GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;161162private:163/// @brief set attribute after validation164void setAttribute(SumoXMLAttr key, const std::string& value) override;165166/// @brief Invalidated copy constructor.167GNEInductionLoopDetector(const GNEInductionLoopDetector&) = delete;168169/// @brief Invalidated assignment operator.170GNEInductionLoopDetector& operator=(const GNEInductionLoopDetector&) = delete;171};172173174