Path: blob/main/src/netedit/elements/additional/GNEOverheadWire.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 GNEOverheadWire.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEOverheadWire : public GNEAdditional, public Parameterised {2930public:31/// @brief default Constructor32GNEOverheadWire(GNENet* net);3334/**@brief Constructor for Multi-Lane detectors35* @param[in] id The name of the overhead wire36* @param[in] net net in which this polygon is placed37* @param[in] filename file in which this element is stored38* @param[in] lanes vector of lanes Lane of this OverheadWire belongs39* @param[in] lane Lane over which the segment is placed40* @param[in] substationId Substation to which the circuit is connected41* @param[in] laneIDs list of consecutive lanes of the circuit42* @param[in] startPos Starting position in the specified lane43* @param[in] endPos Ending position in the specified lane44* @param[in] friendlyPos enable or disable friendly position45* @param[in] forbiddenInnerLanes Inner lanes, where placing of overhead wire is restricted46* @param[in] parameters generic parameters47*/48GNEOverheadWire(const std::string& id, GNENet* net, const std::string& filename, std::vector<GNELane*> lanes, GNEAdditional* substation,49const double startPos, const double endPos, const bool friendlyPos,50const std::vector<std::string>& forbiddenInnerLanes, const Parameterised::Map& parameters);5152/// @brief Destructor53~GNEOverheadWire();5455/**@brief get move operation56* @note returned GNEMoveOperation can be nullptr57*/58GNEMoveOperation* getMoveOperation();5960/// @name members and functions relative to write additionals into XML61/// @{6263/**@brief write additional element into a xml file64* @param[in] device device in which write parameters of additional element65*/66void writeAdditional(OutputDevice& device) const;6768/// @brief check if current additional is valid to be written into XML69bool isAdditionalValid() const;7071/// @brief return a string with the current additional problem72std::string getAdditionalProblem() const;7374/// @brief fix additional problem75void fixAdditionalProblem();7677/// @}7879/// @name Function related with contour drawing80/// @{8182/// @brief check if draw move contour (red)83bool checkDrawMoveContour() const;8485/// @}8687/// @brief update pre-computed geometry information88void updateGeometry();8990/// @brief Returns position of additional in view91Position getPositionInView() const;9293/// @brief update centering boundary (implies change in RTREE)94void updateCenteringBoundary(const bool updateGrid);9596/// @brief split geometry97void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);9899/// @name inherited from GUIGlObject100/// @{101102/**@brief Draws the object103* @param[in] s The settings for the current view (may influence drawing)104* @see GUIGlObject::drawGL105*/106void drawGL(const GUIVisualizationSettings& s) const;107108/// @}109110/// @name inherited from GNEPathElement111/// @{112113/// @brief compute pathElement114void computePathElement();115116/**@brief Draws partial object over lane117* @param[in] s The settings for the current view (may influence drawing)118* @param[in] segment lane segment119* @param[in] offsetFront front offset120*/121void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;122123/**@brief Draws partial object over junction124* @param[in] s The settings for the current view (may influence drawing)125* @param[in] segment junction segment126* @param[in] offsetFront front offset127*/128void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;129130/// @}131132/// @name inherited from GNEAttributeCarrier133/// @{134135/* @brief method for getting the Attribute of an XML key136* @param[in] key The attribute key137* @return string with the value associated to key138*/139std::string getAttribute(SumoXMLAttr key) const;140141/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)142* @param[in] key The attribute key143* @return double with the value associated to key144*/145double getAttributeDouble(SumoXMLAttr key) const;146147/// @brief get parameters map148const Parameterised::Map& getACParametersMap() const;149150/* @brief method for setting the attribute and letting the object perform additional changes151* @param[in] key The attribute key152* @param[in] value The new value153* @param[in] undoList The undoList on which to register changes154*/155void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);156157/* @brief method for checking if the key and their correspond attribute are valids158* @param[in] key The attribute key159* @param[in] value The value associated to key key160* @return true if the value is valid, false in other case161*/162bool isValid(SumoXMLAttr key, const std::string& value);163164/// @brief get PopPup ID (Used in AC Hierarchy)165std::string getPopUpID() const;166167/// @brief get Hierarchy Name (Used in AC Hierarchy)168std::string getHierarchyName() const;169170/// @}171172protected:173/// @brief start position over lane174double myStartPos = 0;175176/// @brief end position over lane177double myEndPos = 0;178179/// @brief friendly position180bool myFriendlyPosition = false;181182/// @brief forbidden inner lanes183std::vector<std::string> myForbiddenInnerLanes;184185private:186/// @brief set attribute after validation187void setAttribute(SumoXMLAttr key, const std::string& value);188189/// @brief set move shape190void setMoveShape(const GNEMoveResult& moveResult);191192/// @brief commit move shape193void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);194195/// @brief get start position over lane that is applicable to the shape196double getStartGeometryPositionOverLane() const;197198/// @brief get end position over lane that is applicable to the shape199double getEndGeometryPositionOverLane() const;200201/// @brief Invalidated copy constructor.202GNEOverheadWire(const GNEOverheadWire&) = delete;203204/// @brief Invalidated assignment operator.205GNEOverheadWire& operator=(const GNEOverheadWire&) = delete;206};207208209