Path: blob/main/src/netedit/elements/network/GNEEdgeTemplate.cpp
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 GNEEdgeTemplate.cpp14/// @author Pablo Alvarez Lopez15/// @date Dec 202116///17// Template for edges18/****************************************************************************/1920#include <netedit/elements/network/GNEEdge.h>2122#include "GNEEdgeTemplate.h"23#include "GNELaneTemplate.h"2425// ===========================================================================26// members methods27// ===========================================================================2829GNEEdgeTemplate::GNEEdgeTemplate(const GNEEdge* edge) :30GNEAttributeCarrier(SUMO_TAG_EDGE, edge->getNet()),31myEdge(edge) {32// update lane templates33updateLaneTemplates();34}353637GNEEdgeTemplate::~GNEEdgeTemplate() {38for (const auto& laneTemplate : myLaneTemplates) {39delete laneTemplate;40}41}424344GNEHierarchicalElement*45GNEEdgeTemplate::getHierarchicalElement() {46return nullptr;47}484950GNEMoveElement*51GNEEdgeTemplate::getMoveElement() const {52return nullptr;53}545556Parameterised*57GNEEdgeTemplate::getParameters() {58return nullptr;59}606162const Parameterised*63GNEEdgeTemplate::getParameters() const {64return nullptr;65}666768FileBucket*69GNEEdgeTemplate::getFileBucket() const {70return myEdge->getFileBucket();71}727374const std::vector<GNELaneTemplate*>&75GNEEdgeTemplate::getLaneTemplates() const {76return myLaneTemplates;77}787980void81GNEEdgeTemplate::updateLaneTemplates() {82// first remove all laneTemplates83for (const auto& laneTemplate : myLaneTemplates) {84delete laneTemplate;85}86myLaneTemplates.clear();87// now set new laneTemplates88for (const auto& lane : myEdge->getChildLanes()) {89myLaneTemplates.push_back(new GNELaneTemplate(lane));90}91}929394GUIGlObject*95GNEEdgeTemplate::getGUIGlObject() {96return nullptr;97}9899100const GUIGlObject*101GNEEdgeTemplate::getGUIGlObject() const {102return nullptr;103}104105106void107GNEEdgeTemplate::updateGeometry() {108throw InvalidArgument("cannot be called in templates");109}110111112bool113GNEEdgeTemplate::checkDrawFromContour() const {114return false;115}116117118bool119GNEEdgeTemplate::checkDrawToContour() const {120return false;121}122123124bool125GNEEdgeTemplate::checkDrawRelatedContour() const {126return false;127}128129130bool131GNEEdgeTemplate::checkDrawOverContour() const {132return false;133}134135136bool137GNEEdgeTemplate::checkDrawDeleteContour() const {138return false;139}140141142bool143GNEEdgeTemplate::checkDrawDeleteContourSmall() const {144return false;145}146147148bool149GNEEdgeTemplate::checkDrawSelectContour() const {150return false;151}152153154bool155GNEEdgeTemplate::checkDrawMoveContour() const {156return false;157}158159160std::string161GNEEdgeTemplate::getAttribute(SumoXMLAttr key) const {162return myEdge->getAttribute(key);163}164165166double167GNEEdgeTemplate::getAttributeDouble(SumoXMLAttr key) const {168return myEdge->getAttributeDouble(key);169}170171172Position173GNEEdgeTemplate::getAttributePosition(SumoXMLAttr key) const {174return getCommonAttributePosition(key);175}176177178PositionVector179GNEEdgeTemplate::getAttributePositionVector(SumoXMLAttr key) const {180return myEdge->getAttributePositionVector(key);181}182183184void185GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/, GNEUndoList* /*undoList*/) {186throw InvalidArgument("cannot be called in templates");187}188189190bool191GNEEdgeTemplate::isValid(SumoXMLAttr /*key*/, const std::string& /*value*/) {192throw InvalidArgument("cannot be called in templates");193}194195196bool197GNEEdgeTemplate::isAttributeEnabled(SumoXMLAttr /*key*/) const {198// All attributes are disabled in templates199return false;200}201202203std::string204GNEEdgeTemplate::getPopUpID() const {205return myEdge->getPopUpID();206}207208209std::string210GNEEdgeTemplate::getHierarchyName() const {211return myEdge->getHierarchyName();212}213214// ===========================================================================215// private216// ===========================================================================217218void219GNEEdgeTemplate::setAttribute(SumoXMLAttr /*key*/, const std::string& /*value*/) {220throw InvalidArgument("cannot be called in templates");221}222223/****************************************************************************/224225226