Path: blob/main/src/netedit/elements/moving/GNEMoveElementLaneSingle.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 GNEMoveElementLaneSingle.h14/// @author Pablo Alvarez Lopez15/// @date Sep 202516///17// Class used for elements that can be moved over a lane with only one position18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/iodevices/OutputDevice.h>2324#include "GNEMoveElement.h"2526// ===========================================================================27// class definitions28// ===========================================================================2930class GNEMoveElementLaneSingle : public GNEMoveElement {3132public:33/// @brief move element lane double need access to set and commit shape34friend class GNEMoveElementLaneDouble;3536// declare type of moving37struct PositionType {38static const std::string SINGLE; // Element has only one position39static const std::string STARPOS; // Element's start position40static const std::string ENDPOS; // Element's end position41};4243/// @brief constructor44GNEMoveElementLaneSingle(GNEAttributeCarrier* element, SumoXMLAttr posAttr,45double& position, bool& friendlyPos,46const std::string& defaultBehavior);4748//// @brief destructor49~GNEMoveElementLaneSingle();5051/**@brief get move operation52* @note returned GNEMoveOperation can be nullptr53*/54GNEMoveOperation* getMoveOperation() override;5556/// @name functions related with moving attributes57/// @{5859/// @brief get moving attribute60std::string getMovingAttribute(SumoXMLAttr key) const override;6162/// @brief get moving attribute double63double getMovingAttributeDouble(SumoXMLAttr key) const override;6465/// @brief get moving attribute position66Position getMovingAttributePosition(SumoXMLAttr key) const override;6768/// @brief get moving attribute positionVector69PositionVector getMovingAttributePositionVector(SumoXMLAttr key) const override;7071/// @brief set moving attribute (using undo-list)72void setMovingAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;7374/// @brief check if the given moving attribute is valid75bool isMovingAttributeValid(SumoXMLAttr key, const std::string& value) const override;7677/// @brief set moving attribute78void setMovingAttribute(SumoXMLAttr key, const std::string& value) override;7980/// @}8182/// @brief remove geometry point in the clicked position83void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) override;8485/// @brief check if current moving element is valid to be written into XML86bool isMoveElementValid() const;8788/// @brief return a string with the current moving problem89std::string getMovingProblem() const;9091/// @brief fix moving problem92void fixMovingProblem();9394/// @brief write move attributes95void writeMoveAttributes(OutputDevice& device) const;9697/// @brief get fixed offset position over lane98double getFixedPositionOverLane(const bool adjustGeometryFactor) const;99100private:101/// @brief pos attribute102SumoXMLAttr myPosAttr;103104/// @brief position over lane105double& myPosOverLane;106107/// @brief friendly position108bool& myFriendlyPos;109110/// @brief default behavior111const std::string myPositionType;112113/// @brief set move shape114void setMoveShape(const GNEMoveResult& moveResult) override;115116/// @brief commit move shape117void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) override;118119/// @brief Invalidated copy constructor.120GNEMoveElementLaneSingle(const GNEMoveElementLaneSingle&) = delete;121122/// @brief Invalidated assignment operator.123GNEMoveElementLaneSingle& operator=(const GNEMoveElementLaneSingle&) = delete;124};125126127