Path: blob/main/src/netedit/elements/additional/GNEInstantInductionLoopDetector.h
193863 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 GNEInstantInductionLoopDetector.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201816///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDetector.h"2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEMoveElementLaneSingle;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEInstantInductionLoopDetector : public GNEDetector {3536public:37/// @brief default Constructor38GNEInstantInductionLoopDetector(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] filename The path to the output file.47* @param[in] vehicleTypes space separated list of vehicle type ids to consider48* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection49* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)50* @param[in] name E1 Instant detector name51* @param[in] friendlyPos enable or disable friendly positions52* @param[in] parameters generic parameters53*/54GNEInstantInductionLoopDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, const double pos,55const std::string& outputFilename, const std::vector<std::string>& vehicleTypes,56const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,57const bool friendlyPos, const Parameterised::Map& parameters);5859/// @brief Destructor60~GNEInstantInductionLoopDetector();6162/// @brief methods to retrieve the elements linked to this GNEAdditional63/// @{6465/// @brief get GNEMoveElement associated with this GNEAdditional66GNEMoveElement* getMoveElement() const override;6768/// @brief get parameters associated with this GNEAdditional69Parameterised* getParameters() override;7071/// @}7273/// @name members and functions relative to write additionals into XML74/// @{7576/**@brief write additional element into a xml file77* @param[in] device device in which write parameters of additional element78*/79void writeAdditional(OutputDevice& device) const override;8081/// @brief check if current additional is valid to be written into XML82bool isAdditionalValid() const override;8384/// @brief return a string with the current additional problem85std::string getAdditionalProblem() const override;8687/// @brief fix additional problem88void fixAdditionalProblem() override;8990/// @}9192/// @name Functions related with geometry of element93/// @{9495/// @brief update pre-computed geometry information96void updateGeometry() override;9798/// @}99100/// @name inherited from GUIGlObject101/// @{102103/**@brief Draws the object104* @param[in] s The settings for the current view (may influence drawing)105* @see GUIGlObject::drawGL106*/107void drawGL(const GUIVisualizationSettings& s) const override;108109/// @}110111/// @name inherited from GNEAttributeCarrier112/// @{113114/* @brief method for getting the Attribute of an XML key115* @param[in] key The attribute key116* @return string with the value associated to key117*/118std::string getAttribute(SumoXMLAttr key) const override;119120/* @brief method for getting the Attribute of an XML key in double format121* @param[in] key The attribute key122* @return double with the value associated to key123*/124double getAttributeDouble(SumoXMLAttr key) const override;125126/* @brief method for getting the Attribute of an XML key in position format127* @param[in] key The attribute key128* @return position with the value associated to key129*/130Position getAttributePosition(SumoXMLAttr key) const override;131132/* @brief method for setting the attribute and letting the object perform additional changes133* @param[in] key The attribute key134* @param[in] value The new value135* @param[in] undoList The undoList on which to register changes136*/137void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;138139/* @brief method for checking if the key and their correspond attribute are valids140* @param[in] key The attribute key141* @param[in] value The value associated to key key142* @return true if the value is valid, false in other case143*/144bool isValid(SumoXMLAttr key, const std::string& value) override;145146/// @}147148protected:149/// @brief position over lane150double myPosOverLane = 0;151152/// @brief friendly position153bool myFriendlyPos = false;154155/// @brief move element lane single156GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;157158private:159/// @brief set attribute after validation160void setAttribute(SumoXMLAttr key, const std::string& value) override;161162/// @brief Invalidated copy constructor.163GNEInstantInductionLoopDetector(const GNEInstantInductionLoopDetector&) = delete;164165/// @brief Invalidated assignment operator.166GNEInstantInductionLoopDetector& operator=(const GNEInstantInductionLoopDetector&) = delete;167};168169170