/****************************************************************************/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 GNESegment.h14/// @author Pablo Alvarez Lopez15/// @date Nov 202416///17// GNESegment used in Path Manager18/****************************************************************************/19#pragma once20#include <config.h>2122// ===========================================================================23// class declaration24// ===========================================================================2526class GNELane;27class GNEJunction;28class GNEPathElement;29class GNEPathManager;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNESegment {3637public:38/// @brief constructor for lanes39GNESegment(GNEPathManager* pathManager, GNEPathElement* element, const GNELane* lane, std::vector<GNESegment*>& segments);4041/// @brief constructor for junctions42GNESegment(GNEPathManager* pathManager, GNEPathElement* element, const GNEJunction* junction, std::vector<GNESegment*>& segments);4344/// @brief destructor45~GNESegment();4647/// @name functions related with segment contour48/// @{49/// @brief get contour associated with segment50GNEContour* getContour() const;5152/// @brief get from contour associated with segment (only if this is the first path segment)53GNEContour* getFromContour() const;5455/// @brief get to contour associated with segment (only if this is the last path segment)56GNEContour* getToContour() const;5758/// @}5960/// @brief functions related with the other paht segments61/// @{62/// @brief get next segment63GNESegment* getNextSegment() const;6465/// @brief get previous segment66GNESegment* getPreviousSegment() const;6768/// @brief check if segment is the first path's segment69bool isFirstSegment() const;7071/// @brief check if segment is the last path's segment72bool isLastSegment() const;7374/// @}7576/// @name functions related with GNE elements associated with this segment77/// @{78/// @brief get path element79GNEPathElement* getPathElement() const;8081/// @brief get lane associated with this segment82const GNELane* getLane() const;8384/// @brief get previous lane85const GNELane* getPreviousLane() const;8687/// @brief get next lane88const GNELane* getNextLane() const;8990/// @brief get lane index91int getLaneIndex() const;9293/// @brief get junction associated with this segment94const GNEJunction* getJunction() const;9596/// @brief get lane index97int getJunctionIndex() const;9899/// @}100101/// @name functions related with labeling segments (used for certain elements as E2 multilane detectors)102/// @{103104/// @brief check if segment is label segment105bool isLabelSegment() const;106107/// @brief mark segment as middle segment108void markSegmentLabel();109110/// @}111112protected:113/// @brief pointer to path manager114GNEPathManager* myPathManager;115116/// @brief path element associated with this segment117GNEPathElement* myPathElement;118119/// @brief lane associated with this segment120const GNELane* myLane;121122/// @brief junction associated with this segment123const GNEJunction* myJunction;124125/// @brief lane index126int myLaneIndex = 0;127128/// @brief junction index129int myJunctionIndex = 0;130131/// @brief pointer to next segment132GNESegment* myNextSegment;133134/// @brief pointer to previous segment135GNESegment* myPreviousSegment;136137/// @brief flag for check if this segment is a label segment138bool myLabelSegment;139140/// @brief contour associated with segment141GNEContour* myContour;142143/// @brief from contour, used for moving elements (only in the first segment)144GNEContour* myFromContour;145146/// @brief to contour, used for moving elements (only in the last segment)147GNEContour* myToContour;148149private:150/// @brief default constructor151GNESegment();152153/// @brief Invalidated copy constructor.154GNESegment(const GNESegment&) = delete;155156/// @brief Invalidated assignment operator.157GNESegment& operator=(const GNESegment&) = delete;158};159160161