Path: blob/main/src/netedit/elements/additional/GNEOverheadWire.h
193964 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 GNEOverheadWire.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEMoveElementLaneDouble;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEOverheadWire : public GNEAdditional, public Parameterised {3536public:37/// @brief default Constructor38GNEOverheadWire(GNENet* net);3940/**@brief Constructor for Multi-Lane detectors41* @param[in] id The name of the overhead wire42* @param[in] net net in which this polygon is placed43* @param[in] fileBucket file in which this element is stored44* @param[in] lanes vector of lanes Lane of this OverheadWire belongs45* @param[in] lane Lane over which the segment is placed46* @param[in] substationId Substation to which the circuit is connected47* @param[in] laneIDs list of consecutive lanes of the circuit48* @param[in] startPos Starting position in the specified lane49* @param[in] endPos Ending position in the specified lane50* @param[in] friendlyPos enable or disable friendly position51* @param[in] forbiddenInnerLanes Inner lanes, where placing of overhead wire is restricted52* @param[in] parameters generic parameters53*/54GNEOverheadWire(const std::string& id, GNENet* net, FileBucket* fileBucket, std::vector<GNELane*> lanes, GNEAdditional* substation,55const double startPos, const double endPos, const bool friendlyPos, const std::vector<std::string>& forbiddenInnerLanes,56const Parameterised::Map& parameters);5758/// @brief Destructor59~GNEOverheadWire();6061/// @brief methods to retrieve the elements linked to this overheadWire62/// @{6364/// @brief get GNEMoveElement associated with this overheadWire65GNEMoveElement* getMoveElement() const override;6667/// @brief get parameters associated with this overheadWire68Parameterised* getParameters() override;6970/// @brief get parameters associated with this overheadWire (constant)71const Parameterised* getParameters() const override;7273/// @}7475/// @name members and functions relative to write additionals into XML76/// @{7778/**@brief write additional element into a xml file79* @param[in] device device in which write parameters of additional element80*/81void writeAdditional(OutputDevice& device) const override;8283/// @brief check if current additional is valid to be written into XML84bool isAdditionalValid() const override;8586/// @brief return a string with the current additional problem87std::string getAdditionalProblem() const override;8889/// @brief fix additional problem90void fixAdditionalProblem() override;9192/// @}9394/// @name Function related with contour drawing95/// @{9697/// @brief check if draw move contour (red)98bool checkDrawMoveContour() const override;99100/// @}101102/// @brief update pre-computed geometry information103void updateGeometry() override;104105/// @brief Returns position of additional in view106Position getPositionInView() const override;107108/// @brief update centering boundary (implies change in RTREE)109void updateCenteringBoundary(const bool updateGrid) override;110111/// @brief split geometry112void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;113114/// @name inherited from GUIGlObject115/// @{116117/**@brief Draws the object118* @param[in] s The settings for the current view (may influence drawing)119* @see GUIGlObject::drawGL120*/121void drawGL(const GUIVisualizationSettings& s) const override;122123/// @}124125/// @name inherited from GNEPathElement126/// @{127128/// @brief compute pathElement129void computePathElement() override;130131/**@brief Draws partial object over lane132* @param[in] s The settings for the current view (may influence drawing)133* @param[in] segment lane segment134* @param[in] offsetFront front offset135*/136void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;137138/**@brief Draws partial object over junction139* @param[in] s The settings for the current view (may influence drawing)140* @param[in] segment junction segment141* @param[in] offsetFront front offset142*/143void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;144145/// @}146147/// @name inherited from GNEAttributeCarrier148/// @{149150/* @brief method for getting the Attribute of an XML key151* @param[in] key The attribute key152* @return string with the value associated to key153*/154std::string getAttribute(SumoXMLAttr key) const override;155156/* @brief method for getting the Attribute of an XML key in double format157* @param[in] key The attribute key158* @return double with the value associated to key159*/160double getAttributeDouble(SumoXMLAttr key) const override;161162/* @brief method for getting the Attribute of an XML key in position format163* @param[in] key The attribute key164* @return position with the value associated to key165*/166Position getAttributePosition(SumoXMLAttr key) const override;167168/* @brief method for getting the Attribute of an XML key in positionVector format169* @param[in] key The attribute key170* @return positionVector with the value associated to key171*/172PositionVector getAttributePositionVector(SumoXMLAttr key) const override;173174/* @brief method for setting the attribute and letting the object perform additional changes175* @param[in] key The attribute key176* @param[in] value The new value177* @param[in] undoList The undoList on which to register changes178*/179void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;180181/* @brief method for checking if the key and their correspond attribute are valids182* @param[in] key The attribute key183* @param[in] value The value associated to key key184* @return true if the value is valid, false in other case185*/186bool isValid(SumoXMLAttr key, const std::string& value) override;187188/// @brief get PopPup ID (Used in AC Hierarchy)189std::string getPopUpID() const override;190191/// @brief get Hierarchy Name (Used in AC Hierarchy)192std::string getHierarchyName() const override;193194/// @}195196protected:197/// @brief The start position over lane198double myStartPosOverLane = 0;199200/// @brief The end position over lane201double myEndPosPosOverLane = 0;202203/// @brief Flag for friendly position204bool myFriendlyPosition = false;205206/// @brief forbidden inner lanes207std::vector<std::string> myForbiddenInnerLanes;208209/// @brif move element lane double210GNEMoveElementLaneDouble* myMoveElementLaneDouble = nullptr;211212private:213/// @brief set attribute after validation214void setAttribute(SumoXMLAttr key, const std::string& value) override;215216/// @brief Invalidated copy constructor.217GNEOverheadWire(const GNEOverheadWire&) = delete;218219/// @brief Invalidated assignment operator.220GNEOverheadWire& operator=(const GNEOverheadWire&) = delete;221};222223224