Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/moving/GNEMoveOperation.h
185833 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.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Mar 2020
17
///
18
// Class used for define move operation
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/common/StdDefs.h>
24
#include <utils/geom/PositionVector.h>
25
26
// ===========================================================================
27
// class declaration
28
// ===========================================================================
29
30
class GNELane;
31
class GNEMoveElement;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNEMoveOperation {
38
39
public:
40
enum class OperationType {
41
POSITION,
42
ENTIRE_SHAPE,
43
GEOMETRY_POINTS,
44
WIDTH,
45
HEIGHT,
46
LENGTH,
47
LANE
48
};
49
50
/// @brief constructor for values with a single position (junctions, E3, ParkingSpaces...)
51
GNEMoveOperation(GNEMoveElement* moveElement,
52
const Position originalPosition);
53
54
/// @brief constructor for entire geometries (Polygon with blocked shapes)
55
GNEMoveOperation(GNEMoveElement* moveElement,
56
const PositionVector originalShape);
57
58
/// @brief constructor for entire geometries (Polygon with blocked shapes)
59
GNEMoveOperation(GNEMoveElement* moveElement,
60
const PositionVector originalShape,
61
const bool firstGeometryPoint,
62
const OperationType operationType);
63
64
/// @brief constructor for elements with editable shapes (edges, polygons...)
65
GNEMoveOperation(GNEMoveElement* moveElement,
66
const PositionVector originalShape,
67
const std::vector<int> originalgeometryPoints,
68
const PositionVector shapeToMove,
69
const std::vector<int> geometryPointsToMove);
70
71
/// @brief constructor for elements placed over lanes with one position (detectors, vehicles...)
72
GNEMoveOperation(GNEMoveElement* moveElement,
73
const GNELane* lane,
74
const double firstPosition,
75
const bool allowChangeLane);
76
77
/// @brief constructor for elements placed over same lanes with two positions (StoppingPlaces)
78
GNEMoveOperation(GNEMoveElement* moveElement,
79
const GNELane* lane,
80
const double firstPosition,
81
const double lastPosition,
82
const bool allowChangeLane);
83
84
/// @brief constructor for elements placed over two lanes with two positions (E2 Multilane, vehicles..)
85
GNEMoveOperation(GNEMoveElement* moveElement,
86
const GNELane* firstLane,
87
const double firstStartPos,
88
const GNELane* lastLane,
89
const double lastStartPos,
90
const bool clickedFirstLane,
91
const bool allowChangeLane);
92
93
/// @brief destructor
94
~GNEMoveOperation();
95
96
/// @brief move element
97
GNEMoveElement* moveElement;
98
99
/// @brief original shape
100
const PositionVector originalShape;
101
102
/// @brief original shape points to move (of original shape)
103
const std::vector<int> originalGeometryPoints;
104
105
/// @brief original first lane
106
const GNELane* firstLane = nullptr;
107
108
/// @brief original first Position
109
const double firstPosition = INVALID_DOUBLE;
110
111
/// @brief original last lane
112
const GNELane* lastLane = nullptr;
113
114
/// @brief original last Position
115
const double lastPosition = INVALID_DOUBLE;
116
117
/// @check if clicked the first lane or the last lane (used only in multilane elements like E2)
118
const bool clickedFirstLane = false;
119
120
/**@brief shape to move
121
* @note: it can be different of originalShape, for example due a new geometry point
122
*/
123
const PositionVector shapeToMove;
124
125
/// @brief shape points to move (of shapeToMove)
126
const std::vector<int> geometryPointsToMove;
127
128
/// @brief allow change lane
129
const bool allowChangeLane = false;
130
131
/// @brief first position (used for edit with/height
132
const bool firstGeometryPoint = false;
133
134
/// @brief operation type
135
const OperationType operationType;
136
137
private:
138
/// @brief Invalidated copy constructor.
139
GNEMoveOperation(const GNEMoveOperation&) = delete;
140
141
/// @brief Invalidated assignment operator.
142
GNEMoveOperation& operator=(const GNEMoveOperation&) = delete;
143
};
144
145