Path: blob/main/src/netedit/elements/additional/GNEParkingSpace.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 GNEParkingSpace.h14/// @author Pablo Alvarez Lopez15/// @date Feb 201816///17// A class for visualizing ParkingSpace geometry (adapted from GUILaneWrapper)18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class declarations26// ===========================================================================2728class GNEParkingArea;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEParkingSpace : public GNEAdditional, public Parameterised {3536public:37/// @brief Constructor38GNEParkingSpace(GNENet* net);3940/**@brief Constructor41* @param[in] parkingAreaParent pointer to Parking Area parent42* @param[in] pos position X-Y-Z43* @param[in] width ParkingArea's width44* @param[in] length ParkingArea's length45* @param[in] angle ParkingArea's angle46* @param[in] slope ParkingArea's slope (of this space)47* @param[in] name ParkingArea's name48* @param[in] parameters generic parameters49*/50GNEParkingSpace(GNEAdditional* parkingAreaParent, const Position& pos, const std::string& width,51const std::string& length, const std::string& angle, double slope, const std::string& name,52const Parameterised::Map& parameters);5354/// @brief Destructor55~GNEParkingSpace();5657/**@brief get move operation58* @note returned GNEMoveOperation can be nullptr59*/60GNEMoveOperation* getMoveOperation();6162/// @name members and functions relative to write additionals into XML63/// @{6465/**@brief write additional element into a xml file66* @param[in] device device in which write parameters of additional element67*/68void writeAdditional(OutputDevice& device) const;6970/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)71bool isAdditionalValid() const;7273/// @brief return a string with the current additional problem (must be reimplemented in all detector children)74std::string getAdditionalProblem() const;7576/// @brief fix additional problem (must be reimplemented in all detector children)77void fixAdditionalProblem();7879/// @}8081/// @name Function related with contour drawing82/// @{8384/// @brief check if draw move contour (red)85bool checkDrawMoveContour() const;8687/// @}8889/// @name Functions related with geometry of element90/// @{9192/// @brief update pre-computed geometry information93void updateGeometry();9495/// @brief Returns position of additional in view96Position getPositionInView() const;9798/// @brief update centering boundary (implies change in RTREE)99void updateCenteringBoundary(const bool updateGrid);100101/// @brief split geometry102void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);103104/// @}105106/// @name inherited from GUIGlObject107/// @{108109/// @brief Returns the name of the parent object110/// @return This object's parent id111std::string getParentName() const;112113/**@brief Draws the object114* @param[in] s The settings for the current view (may influence drawing)115* @see GUIGlObject::drawGL116*/117void drawGL(const GUIVisualizationSettings& s) const;118119/// @}120121/// @name inherited from GNEAttributeCarrier122/// @{123124/* @brief method for getting the Attribute of an XML key125* @param[in] key The attribute key126* @return string with the value associated to key127*/128std::string getAttribute(SumoXMLAttr key) const;129130/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)131* @param[in] key The attribute key132* @return double with the value associated to key133*/134double getAttributeDouble(SumoXMLAttr key) const;135136/// @brief get parameters map137const Parameterised::Map& getACParametersMap() const;138139/* @brief method for setting the attribute and letting the object perform additional changes140* @param[in] key The attribute key141* @param[in] value The new value142* @param[in] undoList The undoList on which to register changes143*/144void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);145146/* @brief method for checking if the key and their correspond attribute are valids147* @param[in] key The attribute key148* @param[in] value The value associated to key key149* @return true if the value is valid, false in other case150*/151bool isValid(SumoXMLAttr key, const std::string& value);152153/// @brief get PopPup ID (Used in AC Hierarchy)154std::string getPopUpID() const;155156/// @brief get Hierarchy Name (Used in AC Hierarchy)157std::string getHierarchyName() const;158159/// @}160161protected:162/// @brief position of Parking Space in view163Position myPosition;164165/// @brief width of Parking Space166std::string myWidth;167168/// @brief Length of Parking Space169std::string myLength;170171/// @brief shape width of Parking Space172PositionVector myShapeWidth;173174/// @brief shape length of Parking Space175PositionVector myShapeLength;176177/// @brief Angle of Parking Space178std::string myAngle;179180/// @brief Slope of Parking Space181double mySlope;182183/// @brief variable used for moving contour up184GNEContour myMovingContourUp;185186/// @brief variable used for moving contour down187GNEContour myMovingContourDown;188189/// @brief variable used for moving contour left190GNEContour myMovingContourLeft;191192/// @brief variable used for moving contour right193GNEContour myMovingContourRight;194195private:196/// @brief draw space197void drawSpace(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,198const double width, const bool movingGeometryPoints) const;199200/// @brief calculate space contour201void calculateSpaceContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,202const double width, const double exaggeration, const bool movingGeometryPoints) const;203204/// @brief set attribute after validation205void setAttribute(SumoXMLAttr key, const std::string& value);206207/// @brief set move shape208void setMoveShape(const GNEMoveResult& moveResult);209210/// @brief commit move shape211void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);212213/// @brief Invalidated copy constructor.214GNEParkingSpace(const GNEParkingSpace&) = delete;215216/// @brief Invalidated assignment operator.217GNEParkingSpace& operator=(const GNEParkingSpace&) = delete;218};219220221