Path: blob/main/src/netedit/elements/additional/GNEParkingSpace.h
193904 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 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 GNEMoveElementViewResizable;29class GNEParkingArea;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEParkingSpace : public GNEAdditional, public Parameterised {3637public:38/// @brief Constructor39GNEParkingSpace(GNENet* net);4041/**@brief Constructor42* @param[in] parkingAreaParent pointer to Parking Area parent43* @param[in] pos position X-Y-Z44* @param[in] width ParkingArea's width45* @param[in] length ParkingArea's length46* @param[in] angle ParkingArea's angle47* @param[in] slope ParkingArea's slope (of this space)48* @param[in] name ParkingArea's name49* @param[in] parameters generic parameters50*/51GNEParkingSpace(GNEAdditional* parkingAreaParent, const Position& pos,52const double width, const double length, const double angle,53const double slope, const std::string& name,54const Parameterised::Map& parameters);5556/// @brief Destructor57~GNEParkingSpace();5859/// @brief methods to retrieve the elements linked to this space60/// @{6162/// @brief get GNEMoveElement associated with this space63GNEMoveElement* getMoveElement() const override;6465/// @brief get parameters associated with this space66Parameterised* getParameters() override;6768/// @brief get parameters associated with this space (constant)69const Parameterised* getParameters() const override;7071/// @}7273/// @name members and functions relative to write additionals into XML74/// @{7576/**@brief write additional element into a xml file77* @param[in] device device in which write parameters of additional element78*/79void writeAdditional(OutputDevice& device) const override;8081/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)82bool isAdditionalValid() const override;8384/// @brief return a string with the current additional problem (must be reimplemented in all detector children)85std::string getAdditionalProblem() const override;8687/// @brief fix additional problem (must be reimplemented in all detector children)88void fixAdditionalProblem() override;8990/// @}9192/// @name Function related with contour drawing93/// @{9495/// @brief check if draw move contour (red)96bool checkDrawMoveContour() const override;9798/// @}99100/// @name Functions related with geometry of element101/// @{102103/// @brief update pre-computed geometry information104void updateGeometry() override;105106/// @brief Returns position of additional in view107Position getPositionInView() const override;108109/// @brief update centering boundary (implies change in RTREE)110void updateCenteringBoundary(const bool updateGrid) override;111112/// @brief split geometry113void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;114115/// @}116117/// @name inherited from GUIGlObject118/// @{119120/// @brief Returns the name of the parent object121/// @return This object's parent id122std::string getParentName() const override;123124/**@brief Draws the object125* @param[in] s The settings for the current view (may influence drawing)126* @see GUIGlObject::drawGL127*/128void drawGL(const GUIVisualizationSettings& s) const override;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 override;140141/* @brief method for getting the Attribute of an XML key in double format142* @param[in] key The attribute key143* @return double with the value associated to key144*/145double getAttributeDouble(SumoXMLAttr key) const override;146147/* @brief method for getting the Attribute of an XML key in position format148* @param[in] key The attribute key149* @return position with the value associated to key150*/151Position getAttributePosition(SumoXMLAttr key) const override;152153/* @brief method for getting the Attribute of an XML key in positionVector format154* @param[in] key The attribute key155* @return positionVector with the value associated to key156*/157PositionVector getAttributePositionVector(SumoXMLAttr key) const override;158159/* @brief method for setting the attribute and letting the object perform additional changes160* @param[in] key The attribute key161* @param[in] value The new value162* @param[in] undoList The undoList on which to register changes163*/164void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;165166/* @brief method for checking if the key and their correspond attribute are valids167* @param[in] key The attribute key168* @param[in] value The value associated to key key169* @return true if the value is valid, false in other case170*/171bool isValid(SumoXMLAttr key, const std::string& value) override;172173/// @brief get PopPup ID (Used in AC Hierarchy)174std::string getPopUpID() const override;175176/// @brief get Hierarchy Name (Used in AC Hierarchy)177std::string getHierarchyName() const override;178179/// @}180181protected:182/// @brief position over view183Position myPosOverView;184185/// @brief width186double myWidth = 0;187188/// @brief length189double myLength = 0;190191/// @brief move element view resizable192GNEMoveElementViewResizable* myMoveElementViewResizable = nullptr;193194/// @brief Angle of Parking Space195double myAngle = 0;196197/// @brief Slope of Parking Space198double mySlope = 0;199200private:201/// @brief draw space202void drawSpace(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,203const double width, const bool movingGeometryPoints) const;204205/// @brief calculate space contour206void calculateSpaceContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,207const double width, const double exaggeration, const bool movingGeometryPoints) const;208209/// @brief set attribute after validation210void setAttribute(SumoXMLAttr key, const std::string& value) override;211212/// @brief Invalidated copy constructor.213GNEParkingSpace(const GNEParkingSpace&) = delete;214215/// @brief Invalidated assignment operator.216GNEParkingSpace& operator=(const GNEParkingSpace&) = delete;217};218219220