Path: blob/main/src/netedit/elements/moving/GNEMoveOperation.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 GNEMoveOperation.cpp14/// @author Pablo Alvarez Lopez15/// @date Mar 202016///17// Class used for define move operation18/****************************************************************************/19#include <config.h>2021#include <netedit/changes/GNEChange_Attribute.h>2223#include "GNEMoveOperation.h"2425// ===========================================================================26// Method definitions27// ===========================================================================2829GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,30const Position _originalPosition) :31moveElement(_moveElement),32originalShape({_originalPosition}),33shapeToMove({_originalPosition}),34operationType(OperationType::POSITION) {35}363738GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,39const PositionVector _originalShape) :40moveElement(_moveElement),41originalShape(_originalShape),42shapeToMove(_originalShape),43operationType(OperationType::ENTIRE_SHAPE) {44}454647GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,48const PositionVector _originalShape,49const bool _firstGeometryPoint,50const OperationType _operationType) :51moveElement(_moveElement),52originalShape(_originalShape),53shapeToMove(_originalShape),54firstGeometryPoint(_firstGeometryPoint),55operationType(_operationType) {56}575859GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,60const PositionVector _originalShape,61const std::vector<int> _originalgeometryPoints,62const PositionVector _shapeToMove,63const std::vector<int> _geometryPointsToMove) :64moveElement(_moveElement),65originalShape(_originalShape),66originalGeometryPoints(_originalgeometryPoints),67shapeToMove(_shapeToMove),68geometryPointsToMove(_geometryPointsToMove),69operationType(OperationType::GEOMETRY_POINTS) {70}717273GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,74const GNELane* _lane,75const double _firstPosition,76const bool _allowChangeLane) :77moveElement(_moveElement),78firstLane(_lane),79firstPosition(_firstPosition * _lane->getLengthGeometryFactor()),80allowChangeLane(_allowChangeLane),81operationType(OperationType::LANE) {82}838485GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,86const GNELane* _lane,87const double _firstPosition,88const double _lastPosition,89const bool _allowChangeLane) :90moveElement(_moveElement),91firstLane(_lane),92firstPosition((_firstPosition == INVALID_DOUBLE) ? INVALID_DOUBLE : _firstPosition * _lane->getLengthGeometryFactor()),93lastPosition((_lastPosition == INVALID_DOUBLE) ? INVALID_DOUBLE : _lastPosition * _lane->getLengthGeometryFactor()),94allowChangeLane(_allowChangeLane),95operationType(OperationType::LANE) {96}979899GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,100const GNELane* _firstLane,101const double _firstStartPos,102const GNELane* _lastLane,103const double _lastStartPos,104const bool _clickedFirstLane,105const bool _allowChangeLane) :106moveElement(_moveElement),107firstLane(_firstLane),108firstPosition((_firstStartPos != INVALID_DOUBLE) ? _firstStartPos * _firstLane->getLengthGeometryFactor() : INVALID_DOUBLE),109lastLane(_lastLane),110lastPosition((_lastStartPos != INVALID_DOUBLE) ? _lastStartPos * _lastLane->getLengthGeometryFactor() : INVALID_DOUBLE),111clickedFirstLane(_clickedFirstLane),112allowChangeLane(_allowChangeLane),113operationType(OperationType::LANE) {114}115116117GNEMoveOperation::~GNEMoveOperation() {}118119/****************************************************************************/120121122