Path: blob/main/src/netedit/elements/moving/GNEMoveOperation.h
185833 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 GNEMoveOperation.h14/// @author Pablo Alvarez Lopez15/// @date Mar 202016///17// Class used for define move operation18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/common/StdDefs.h>23#include <utils/geom/PositionVector.h>2425// ===========================================================================26// class declaration27// ===========================================================================2829class GNELane;30class GNEMoveElement;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNEMoveOperation {3738public:39enum class OperationType {40POSITION,41ENTIRE_SHAPE,42GEOMETRY_POINTS,43WIDTH,44HEIGHT,45LENGTH,46LANE47};4849/// @brief constructor for values with a single position (junctions, E3, ParkingSpaces...)50GNEMoveOperation(GNEMoveElement* moveElement,51const Position originalPosition);5253/// @brief constructor for entire geometries (Polygon with blocked shapes)54GNEMoveOperation(GNEMoveElement* moveElement,55const PositionVector originalShape);5657/// @brief constructor for entire geometries (Polygon with blocked shapes)58GNEMoveOperation(GNEMoveElement* moveElement,59const PositionVector originalShape,60const bool firstGeometryPoint,61const OperationType operationType);6263/// @brief constructor for elements with editable shapes (edges, polygons...)64GNEMoveOperation(GNEMoveElement* moveElement,65const PositionVector originalShape,66const std::vector<int> originalgeometryPoints,67const PositionVector shapeToMove,68const std::vector<int> geometryPointsToMove);6970/// @brief constructor for elements placed over lanes with one position (detectors, vehicles...)71GNEMoveOperation(GNEMoveElement* moveElement,72const GNELane* lane,73const double firstPosition,74const bool allowChangeLane);7576/// @brief constructor for elements placed over same lanes with two positions (StoppingPlaces)77GNEMoveOperation(GNEMoveElement* moveElement,78const GNELane* lane,79const double firstPosition,80const double lastPosition,81const bool allowChangeLane);8283/// @brief constructor for elements placed over two lanes with two positions (E2 Multilane, vehicles..)84GNEMoveOperation(GNEMoveElement* moveElement,85const GNELane* firstLane,86const double firstStartPos,87const GNELane* lastLane,88const double lastStartPos,89const bool clickedFirstLane,90const bool allowChangeLane);9192/// @brief destructor93~GNEMoveOperation();9495/// @brief move element96GNEMoveElement* moveElement;9798/// @brief original shape99const PositionVector originalShape;100101/// @brief original shape points to move (of original shape)102const std::vector<int> originalGeometryPoints;103104/// @brief original first lane105const GNELane* firstLane = nullptr;106107/// @brief original first Position108const double firstPosition = INVALID_DOUBLE;109110/// @brief original last lane111const GNELane* lastLane = nullptr;112113/// @brief original last Position114const double lastPosition = INVALID_DOUBLE;115116/// @check if clicked the first lane or the last lane (used only in multilane elements like E2)117const bool clickedFirstLane = false;118119/**@brief shape to move120* @note: it can be different of originalShape, for example due a new geometry point121*/122const PositionVector shapeToMove;123124/// @brief shape points to move (of shapeToMove)125const std::vector<int> geometryPointsToMove;126127/// @brief allow change lane128const bool allowChangeLane = false;129130/// @brief first position (used for edit with/height131const bool firstGeometryPoint = false;132133/// @brief operation type134const OperationType operationType;135136private:137/// @brief Invalidated copy constructor.138GNEMoveOperation(const GNEMoveOperation&) = delete;139140/// @brief Invalidated assignment operator.141GNEMoveOperation& operator=(const GNEMoveOperation&) = delete;142};143144145