Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/moving/GNEMoveElementLaneDouble.h
185851 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 GNEMoveElementLaneDouble.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2025
17
///
18
// Class used for elements that can be moved over a lane with two positions
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/iodevices/OutputDevice.h>
24
25
#include "GNEMoveElement.h"
26
27
// ===========================================================================
28
// class declaration
29
// ===========================================================================
30
31
class GNEMoveElementLaneSingle;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNEMoveElementLaneDouble : public GNEMoveElement {
38
39
public:
40
/**@brief Constructor
41
* @param[in] element moved element
42
* @param[in] startPosAttr Start position attribute
43
* @param[in] startPosValue Start position value
44
* @param[in] endPosAttr End position attribute
45
* @param[in] endPosValue End position value
46
* @param[in] friendlyPos enable or disable friendly position
47
*/
48
GNEMoveElementLaneDouble(GNEAttributeCarrier* element, SumoXMLAttr startPosAttr,
49
double& startPosValue, SumoXMLAttr endPosAttr,
50
double& endPosValue, bool& friendlyPosition);
51
52
/// @brief Destructor
53
~GNEMoveElementLaneDouble();
54
55
/**@brief get lane movable move operation for elements with
56
* @note returned GNEMoveOperation can be nullptr
57
*/
58
GNEMoveOperation* getMoveOperation() override;
59
60
/// @name functions related with moving attributes
61
/// @{
62
63
/// @brief get moving attribute
64
std::string getMovingAttribute(SumoXMLAttr key) const override;
65
66
/// @brief get moving attribute double
67
double getMovingAttributeDouble(SumoXMLAttr key) const override;
68
69
/// @brief get moving attribute position
70
Position getMovingAttributePosition(SumoXMLAttr key) const override;
71
72
/// @brief get moving attribute positionVector
73
PositionVector getMovingAttributePositionVector(SumoXMLAttr key) const override;
74
75
/// @brief set moving attribute (using undo-list)
76
void setMovingAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
77
78
/// @brief check if the given moving attribute is valid
79
bool isMovingAttributeValid(SumoXMLAttr key, const std::string& value) const override;
80
81
/// @brief set moving attribute
82
void setMovingAttribute(SumoXMLAttr key, const std::string& value) override;
83
84
/// @}
85
86
/// @brief remove geometry point in the clicked position
87
void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) override;
88
89
/// @brief check if current moving element is valid to be written into XML
90
bool isMoveElementValid() const;
91
92
/// @brief return a string with the current moving problem
93
std::string getMovingProblem() const;
94
95
/// @brief fix moving problem
96
void fixMovingProblem();
97
98
/// @brief write move attributes
99
void writeMoveAttributes(OutputDevice& device, const bool writeLength) const;
100
101
/// @brief get start offset position over lane
102
double getStartFixedPositionOverLane(const bool adjustGeometryFactor) const;
103
104
/// @brief get end offset position over lane
105
double getEndFixedPositionOverLane(const bool adjustGeometryFactor) const;
106
107
/// @brief default element size
108
static const double defaultSize;
109
110
private:
111
/// @brief start position
112
GNEMoveElementLaneSingle* myStartPos;
113
114
/// @brief end position
115
GNEMoveElementLaneSingle* myEndPos;
116
117
/// @brief size (only use in AttributeCarrier templates)
118
double myTemplateSize = defaultSize;
119
120
/// @brief force size (only used in AttributeCarrier templates
121
bool myTemplateForceSize = false;
122
123
/// @brief reference position
124
ReferencePosition myReferencePosition = ReferencePosition::CENTER;
125
126
/// @brief set move shape
127
void setMoveShape(const GNEMoveResult& moveResult) override;
128
129
/// @brief commit move shape
130
void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) override;
131
132
/// @brief set size
133
void setSize(const std::string& value, GNEUndoList* undoList);
134
135
/// @brief Invalidated copy constructor.
136
GNEMoveElementLaneDouble(const GNEMoveElementLaneDouble&) = delete;
137
138
/// @brief Invalidated assignment operator
139
GNEMoveElementLaneDouble& operator=(const GNEMoveElementLaneDouble& src) = delete;
140
};
141
142