Path: blob/main/src/netedit/elements/demand/GNEDemandElementPlan.h
185790 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 GNEDemandElementPlan.h14/// @author Pablo Alvarez Lopez15/// @date Sep 202316///17// An auxiliar, asbtract class for plan elements18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/geom/Position.h>23#include <utils/xml/SUMOXMLDefinitions.h>24#include <utils/vehicle/SUMOVehicleParameter.h>25#include <netedit/elements/moving/GNEMoveElementPlan.h>2627#include "GNEPlanParents.h"2829// ===========================================================================30// class declaration31// ===========================================================================3233class SUMOVehicleParameter;34class GNEDemandElement;35class GNEEdge;36class GNEJunction;37class GNEAdditional;38class GNERoute;3940// ===========================================================================41// class definitions42// ===========================================================================4344class GNEDemandElementPlan {4546protected:47/// @brief move element plan48GNEMoveElementPlan* myMoveElementPlan = nullptr;4950/// @brief variable used for draw central contour51GNEContour myPlanContour;5253/// @brief variable used for draw contour end54GNEContour myPlanContourEnd;5556/// @brief plan boundary57Boundary myPlanBoundary;5859/// @brief constructor60GNEDemandElementPlan(GNEDemandElement* planElement, const double departPosition, const double arrivalPosition);6162/// @brief write plan element common attributes63void writeLocationAttributes(OutputDevice& device) const;6465/// @brief write initial stop stage if plan starts at a stopping place66void writeOriginStop(OutputDevice& device) const;6768/// @brief Returns an own popup-menu69GUIGLObjectPopupMenu* getPlanPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);7071/// @name path functions72/// @{7374/// @brief get first plan path lane75GNELane* getFirstPlanPathLane() const;7677/// @brief get last plan path lane78GNELane* getLastPlanPathLane() const;7980/// @brief compute plan pathElement81void computePlanPathElement();8283/// @}8485/// @name geometry functions86/// @{8788/// @brief update pre-computed geometry information89void updatePlanGeometry();9091/// @brief get plan centering boundary92Boundary getPlanCenteringBoundary() const;9394/// @brief update plan centering boundary95void updatePlanCenteringBoundary(const bool updateGrid);9697/// @brief Returns position of additional in view98Position getPlanPositionInView() const;99100/// @}101102/// @name attribute functions103/// @{104105/// @brief get plan attribute string106std::string getPlanAttribute(SumoXMLAttr key) const;107108/// @brief get plan attribute double109double getPlanAttributeDouble(SumoXMLAttr key) const;110111/// @brief get plan attribute position112Position getPlanAttributePosition(SumoXMLAttr key) const;113114/// @brief set plan attribute115void setPlanAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);116117/// @brief check if plan attribute is valid118bool isPlanValid(SumoXMLAttr key, const std::string& value);119120/// @brief check if plan attribute is enabled121bool isPlanAttributeEnabled(SumoXMLAttr key) const;122123/// @brief set plan attribute (intern)124void setPlanAttribute(SumoXMLAttr key, const std::string& value);125126/// @brief get plan Hierarchy Name (Used in AC Hierarchy)127std::string getPlanHierarchyName() const;128129/// @}130131/// @name drawing functions132/// @{133134/// @brief check if person plan can be drawn135bool checkDrawPersonPlan() const;136137/// @brief check if container plan can be drawn138bool checkDrawContainerPlan() const;139140/// @brief draw plan141void drawPlanGL(const bool drawPlan, const GUIVisualizationSettings& s, const RGBColor& planColor, const RGBColor& planSelectedColor) const;142143/// @brief draw plan partial lane144void drawPlanLanePartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront,145const double planWidth, const RGBColor& planColor, const RGBColor& planSelectedColor) const;146147/// @brief draw plan partial junction148void drawPlanJunctionPartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront,149const double planWidth, const RGBColor& planColor, const RGBColor& planSelectedColor) const;150151/// @}152153/// @brief check if plan is valid154GNEDemandElement::Problem isPlanPersonValid() const;155156/// @brief get plan problem157std::string getPersonPlanProblem() const;158159/// @brief depart position (used in tranships)160double myDepartPosition;161162/// @brief arrival position (used in all plans over edges)163double myArrivalPosition;164165private:166/// @brief get end position radius167double getEndPosRadius(const GUIVisualizationSettings& s, const GNESegment* segment, const bool drawHalfWidth) const;168169/// @brief draw from arrow170void drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNESegment* segment) const;171172/// @brief draw to arrow173void drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNESegment* segment) const;174175/// @brief draw to arrow176void drawEndPosition(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const double endPosRadius) const;177178/// @brief replace plan parent179void replacePlanParent(const std::string& newParentID);180181/// @brief pointer to plan element182GNEDemandElement* myPlanElement;183184/// @brief arrival position diameter185static const double myArrivalPositionDiameter;186187/// @brief Invalidated copy constructor.188GNEDemandElementPlan(const GNEDemandElementPlan&) = delete;189190/// @brief Invalidated assignment operator.191GNEDemandElementPlan& operator=(const GNEDemandElementPlan&) = delete;192};193194195