Path: blob/main/src/netedit/elements/additional/GNEInstantInductionLoopDetector.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 GNEInstantInductionLoopDetector.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201816///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDetector.h"2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEInstantInductionLoopDetector : public GNEDetector {2930public:31/// @brief default Constructor32GNEInstantInductionLoopDetector(GNENet* net);3334/**@brief Constructor35* @param[in] id The storage of gl-ids to get the one for this lane representation from36* @param[in] net pointer to GNENet of this additional element belongs37* @param[in] filename file in which this element is stored38* @param[in] lane Lane of this StoppingPlace belongs39* @param[in] pos position of the detector on the lane40* @param[in] filename The path to the output file.41* @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 E1 Instant detector name45* @param[in] friendlyPos enable or disable friendly positions46* @param[in] parameters generic parameters47*/48GNEInstantInductionLoopDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos,49const std::string& outputFilename, const std::vector<std::string>& vehicleTypes,50const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,51const bool friendlyPos, const Parameterised::Map& parameters);5253/// @brief Destructor54~GNEInstantInductionLoopDetector();5556/// @name members and functions relative to write additionals into XML57/// @{5859/**@brief write additional element into a xml file60* @param[in] device device in which write parameters of additional element61*/62void writeAdditional(OutputDevice& device) const;6364/// @brief check if current additional is valid to be written into XML65bool isAdditionalValid() const;6667/// @brief return a string with the current additional problem68std::string getAdditionalProblem() const;6970/// @brief fix additional problem71void fixAdditionalProblem();7273/// @}7475/// @name inherited from GNEDetector76/// @{7778/// @brief check if Position of detector is fixed79bool isDetectorPositionFixed() const;8081/// @brief get lane82GNELane* getLane() const;8384/// @}8586/// @name Functions related with geometry of element87/// @{8889/// @brief update pre-computed geometry information90void updateGeometry();9192/// @}9394/// @name inherited from GUIGlObject95/// @{9697/**@brief Draws the object98* @param[in] s The settings for the current view (may influence drawing)99* @see GUIGlObject::drawGL100*/101void drawGL(const GUIVisualizationSettings& s) const;102103/// @}104105/// @name inherited from GNEAttributeCarrier106/// @{107108/* @brief method for getting the Attribute of an XML key109* @param[in] key The attribute key110* @return string with the value associated to key111*/112std::string getAttribute(SumoXMLAttr key) const;113114/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)115* @param[in] key The attribute key116* @return double with the value associated to key117*/118double getAttributeDouble(SumoXMLAttr key) const;119120/* @brief method for setting the attribute and letting the object perform additional changes121* @param[in] key The attribute key122* @param[in] value The new value123* @param[in] undoList The undoList on which to register changes124*/125void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);126127/* @brief method for checking if the key and their correspond attribute are valids128* @param[in] key The attribute key129* @param[in] value The value associated to key key130* @return true if the value is valid, false in other case131*/132bool isValid(SumoXMLAttr key, const std::string& value);133134/// @}135136private:137/// @brief set attribute after validation138void setAttribute(SumoXMLAttr key, const std::string& value);139140/// @brief set move shape141void setMoveShape(const GNEMoveResult& moveResult);142143/// @brief commit move shape144void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);145146/// @brief Invalidated copy constructor.147GNEInstantInductionLoopDetector(const GNEInstantInductionLoopDetector&) = delete;148149/// @brief Invalidated assignment operator.150GNEInstantInductionLoopDetector& operator=(const GNEInstantInductionLoopDetector&) = delete;151};152153154