Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/moving/GNEMoveOperation.cpp
185790 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GNEMoveOperation.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Mar 2020
17
///
18
// Class used for define move operation
19
/****************************************************************************/
20
#include <config.h>
21
22
#include <netedit/changes/GNEChange_Attribute.h>
23
24
#include "GNEMoveOperation.h"
25
26
// ===========================================================================
27
// Method definitions
28
// ===========================================================================
29
30
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
31
const Position _originalPosition) :
32
moveElement(_moveElement),
33
originalShape({_originalPosition}),
34
shapeToMove({_originalPosition}),
35
operationType(OperationType::POSITION) {
36
}
37
38
39
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
40
const PositionVector _originalShape) :
41
moveElement(_moveElement),
42
originalShape(_originalShape),
43
shapeToMove(_originalShape),
44
operationType(OperationType::ENTIRE_SHAPE) {
45
}
46
47
48
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
49
const PositionVector _originalShape,
50
const bool _firstGeometryPoint,
51
const OperationType _operationType) :
52
moveElement(_moveElement),
53
originalShape(_originalShape),
54
shapeToMove(_originalShape),
55
firstGeometryPoint(_firstGeometryPoint),
56
operationType(_operationType) {
57
}
58
59
60
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
61
const PositionVector _originalShape,
62
const std::vector<int> _originalgeometryPoints,
63
const PositionVector _shapeToMove,
64
const std::vector<int> _geometryPointsToMove) :
65
moveElement(_moveElement),
66
originalShape(_originalShape),
67
originalGeometryPoints(_originalgeometryPoints),
68
shapeToMove(_shapeToMove),
69
geometryPointsToMove(_geometryPointsToMove),
70
operationType(OperationType::GEOMETRY_POINTS) {
71
}
72
73
74
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
75
const GNELane* _lane,
76
const double _firstPosition,
77
const bool _allowChangeLane) :
78
moveElement(_moveElement),
79
firstLane(_lane),
80
firstPosition(_firstPosition * _lane->getLengthGeometryFactor()),
81
allowChangeLane(_allowChangeLane),
82
operationType(OperationType::LANE) {
83
}
84
85
86
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
87
const GNELane* _lane,
88
const double _firstPosition,
89
const double _lastPosition,
90
const bool _allowChangeLane) :
91
moveElement(_moveElement),
92
firstLane(_lane),
93
firstPosition((_firstPosition == INVALID_DOUBLE) ? INVALID_DOUBLE : _firstPosition * _lane->getLengthGeometryFactor()),
94
lastPosition((_lastPosition == INVALID_DOUBLE) ? INVALID_DOUBLE : _lastPosition * _lane->getLengthGeometryFactor()),
95
allowChangeLane(_allowChangeLane),
96
operationType(OperationType::LANE) {
97
}
98
99
100
GNEMoveOperation::GNEMoveOperation(GNEMoveElement* _moveElement,
101
const GNELane* _firstLane,
102
const double _firstStartPos,
103
const GNELane* _lastLane,
104
const double _lastStartPos,
105
const bool _clickedFirstLane,
106
const bool _allowChangeLane) :
107
moveElement(_moveElement),
108
firstLane(_firstLane),
109
firstPosition((_firstStartPos != INVALID_DOUBLE) ? _firstStartPos * _firstLane->getLengthGeometryFactor() : INVALID_DOUBLE),
110
lastLane(_lastLane),
111
lastPosition((_lastStartPos != INVALID_DOUBLE) ? _lastStartPos * _lastLane->getLengthGeometryFactor() : INVALID_DOUBLE),
112
clickedFirstLane(_clickedFirstLane),
113
allowChangeLane(_allowChangeLane),
114
operationType(OperationType::LANE) {
115
}
116
117
118
GNEMoveOperation::~GNEMoveOperation() {}
119
120
/****************************************************************************/
121
122