Path: blob/main/src/netedit/elements/additional/GNEParkingArea.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 GNEParkingArea.h14/// @author Pablo Alvarez Lopez15/// @date Feb 201816///17// A class for visualizing ParkingArea geometry (adapted from GUILaneWrapper)18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEStoppingPlace.h"2324// ===========================================================================25// class definitions26// ===========================================================================2728class GNEParkingArea : public GNEStoppingPlace {2930public:31/// @brief default constructor32GNEParkingArea(GNENet* net);3334/**@brief Constructor35* @param[in] id parking area ID36* @param[in] net pointer to GNENet of this additional element belongs37* @param[in] filename file in which this element is stored38* @param[in] lane Lane of this StoppingPlace belongs39* @param[in] startPos Start position of the StoppingPlace40* @param[in] endPos End position of the StoppingPlace41* @param[in] departPos lane position in that vehicle must depart when leaves parkingArea42* @param[in] name Name of ParkingArea43* @param[in] badges names which grant access to the parkingArea44* @param[in] friendlyPos enable or disable friendly position45* @param[in] roadSideCapacity road side capacity of ParkingArea46* @param[in] width ParkingArea's length47* @param[in] length ParkingArea's length48* @param[in] angle ParkingArea's angle49* @param[in] lefthand enable or disable lefthand50* @param[in] parameters generic parameters51*/52GNEParkingArea(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double startPos, const double endPos,53const std::string& departPos, const std::string& name, const std::vector<std::string>& badges, const bool friendlyPosition,54const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const bool lefthand,55const Parameterised::Map& parameters);5657/// @brief Destructor58~GNEParkingArea();5960/**@brief write additional element into a xml file61* @param[in] device device in which write parameters of additional element62*/63void writeAdditional(OutputDevice& device) const;6465/// @name Functions related with geometry of element66/// @{6768/// @brief update pre-computed geometry information69void updateGeometry();7071/// @}7273/// @name inherited from GUIGlObject74/// @{7576/**@brief Draws the object77* @param[in] s The settings for the current view (may influence drawing)78* @see GUIGlObject::drawGL79*/80void drawGL(const GUIVisualizationSettings& s) const;8182/// @}8384/// @name inherited from GNEAttributeCarrier85/// @{8687/* @brief method for getting the Attribute of an XML key88* @param[in] key The attribute key89* @return string with the value associated to key90*/91std::string getAttribute(SumoXMLAttr key) const;9293/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)94* @param[in] key The attribute key95* @return double with the value associated to key96*/97double getAttributeDouble(SumoXMLAttr key) const;9899/* @brief method for setting the attribute and letting the object perform additional changes100* @param[in] key The attribute key101* @param[in] value The new value102* @param[in] undoList The undoList on which to register changes103*/104void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);105106/* @brief method for checking if the key and their correspond attribute are valids107* @param[in] key The attribute key108* @param[in] value The value associated to key key109* @return true if the value is valid, false in other case110*/111bool isValid(SumoXMLAttr key, const std::string& value);112113/// @}114115protected:116/** @struct GNELotSpaceDefinition117* @brief Representation of a single lot space in Netedit118*/119struct GNELotSpaceDefinition {120/// @brief default constructor121GNELotSpaceDefinition();122123/// @brief parameter constructor124GNELotSpaceDefinition(double x, double y, double z, double rotation, double width, double length);125126/// @brief The position of the vehicle when parking in this space127const Position position;128129/// @brief The rotation130const double rotation;131132/// @brief The width133const double width;134135/// @brief The length136const double length;137};138139/// @brief departPos140std::string myDepartPos;141142/// @brief roadside capacity of Parking Area143int myRoadSideCapacity;144145/// @brief Whether vehicles stay on the road146bool myOnRoad;147148/// @brief width of Parking Area149double myWidth;150151/// @brief Length of Parking Area (by default (endPos - startPos) / roadsideCapacity152double myLength;153154/// @brief lefthand155bool myLefthand;156157/// @brief The list of badges that allow accessing the parkingArea158std::vector<std::string> myAcceptedBadges;159160/// @brief vector with GNELotSpaceDefinition161std::vector<GNELotSpaceDefinition> myLotSpaceDefinitions;162163private:164/// @brief set attribute after validation165void setAttribute(SumoXMLAttr key, const std::string& value);166167/// @brief Invalidated copy constructor.168GNEParkingArea(const GNEParkingArea&) = delete;169170/// @brief Invalidated assignment operator.171GNEParkingArea& operator=(const GNEParkingArea&) = delete;172};173174175