Path: blob/main/src/netedit/elements/additional/GNEInductionLoopDetector.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 GNEInductionLoopDetector.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDetector.h"2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEInductionLoopDetector : public GNEDetector {2930public:31/// @brief default constructor32GNEInductionLoopDetector(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] freq the aggregation period the values the detector collects shall be summed up.41* @param[in] filename The path to the output file.42* @param[in] name E1 detector name43* @param[in] vehicleTypes space separated list of vehicle type ids to consider44* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection45* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)46* @param[in] friendlyPos enable or disable friendly positions47* @param[in] show detector in sumo-gui48* @param[in] parameters generic parameters49*/50GNEInductionLoopDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos, const SUMOTime freq,51const std::string& outputFilename, const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,52const std::string& detectPersons, const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters);5354/// @brief Destructor55~GNEInductionLoopDetector();5657/// @name members and functions relative to write additionals into XML58/// @{5960/**@brief write additional element into a xml file61* @param[in] device device in which write parameters of additional element62*/63void writeAdditional(OutputDevice& device) const;6465/// @brief check if current additional is valid to be written into XML66bool isAdditionalValid() const;6768/// @brief return a string with the current additional problem69std::string getAdditionalProblem() const;7071/// @brief fix additional problem72void fixAdditionalProblem();7374/// @}7576/// @brief update pre-computed geometry information77void updateGeometry();7879/// @name Function related with drawing80/// @{8182/// @brief check if draw related contour (cyan)83bool checkDrawRelatedContour() const;8485/// @}8687/// @name inherited from GUIGlObject88/// @{8990/**@brief Draws the object91* @param[in] s The settings for the current view (may influence drawing)92* @see GUIGlObject::drawGL93*/94void drawGL(const GUIVisualizationSettings& s) const;9596/// @}9798/// @name inherited from GNEAttributeCarrier99/// @{100101/* @brief method for getting the Attribute of an XML key102* @param[in] key The attribute key103* @return string with the value associated to key104*/105std::string getAttribute(SumoXMLAttr key) const;106107/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)108* @param[in] key The attribute key109* @return double with the value associated to key110*/111double getAttributeDouble(SumoXMLAttr key) const;112113/* @brief method for setting the attribute and letting the object perform additional changes114* @param[in] key The attribute key115* @param[in] value The new value116* @param[in] undoList The undoList on which to register changes117*/118void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);119120/* @brief method for checking if the key and their correspond attribute are valids121* @param[in] key The attribute key122* @param[in] value The value associated to key key123* @return true if the value is valid, false in other case124*/125bool isValid(SumoXMLAttr key, const std::string& value);126127/// @}128129private:130/// @brief set attribute after validation131void setAttribute(SumoXMLAttr key, const std::string& value);132133/// @brief set move shape134void setMoveShape(const GNEMoveResult& moveResult);135136/// @brief commit move shape137void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);138139/// @brief Invalidated copy constructor.140GNEInductionLoopDetector(const GNEInductionLoopDetector&) = delete;141142/// @brief Invalidated assignment operator.143GNEInductionLoopDetector& operator=(const GNEInductionLoopDetector&) = delete;144};145146147