Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/moving/GNEMoveElementView.h
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 GNEMoveElementView.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Sep 2025
17
///
18
// Class used for elements that can be moved over view
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/elements/GNEContour.h>
24
25
#include "GNEMoveElement.h"
26
27
// ===========================================================================
28
// class definitions
29
// ===========================================================================
30
31
class GNEMoveElementView : public GNEMoveElement {
32
33
public:
34
/// @brief resizable needs access
35
friend class GNEMoveElementViewResizable;
36
37
/// @brief attributes format
38
enum class AttributesFormat {
39
POSITION, /// @brief position format
40
CARTESIAN, /// @brief cartesian format (x, y, z)
41
GEO /// @brief geo format (lon, lat, z)
42
};
43
44
/// @brief constructor for element with fixed size
45
GNEMoveElementView(GNEAttributeCarrier* element, AttributesFormat attributesFormat,
46
SumoXMLAttr posAttr, Position& position);
47
48
//// @brief empty destructor
49
~GNEMoveElementView();
50
51
/**@brief get move operation
52
* @note returned GNEMoveOperation can be nullptr
53
*/
54
GNEMoveOperation* getMoveOperation() override;
55
56
/// @name functions related with moving attributes
57
/// @{
58
59
/// @brief get moving attribute
60
std::string getMovingAttribute(SumoXMLAttr key) const override;
61
62
/// @brief get moving attribute double
63
double getMovingAttributeDouble(SumoXMLAttr key) const override;
64
65
/// @brief get moving attribute position
66
Position getMovingAttributePosition(SumoXMLAttr key) const override;
67
68
/// @brief get moving attribute positionVector
69
PositionVector getMovingAttributePositionVector(SumoXMLAttr key) const override;
70
71
/// @brief set moving attribute (using undo-list)
72
void setMovingAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
73
74
/// @brief check if the given moving attribute is valid
75
bool isMovingAttributeValid(SumoXMLAttr key, const std::string& value) const override;
76
77
/// @brief set moving attribute
78
void setMovingAttribute(SumoXMLAttr key, const std::string& value) override;
79
80
/// @}
81
82
/// @brief remove geometry point in the clicked position
83
void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) override;
84
85
/// @brief write move attributes
86
void writeMoveAttributes(OutputDevice& device) const;
87
88
private:
89
/// @brief pos attribute
90
SumoXMLAttr myPosAttr;
91
92
/// @brief position over view
93
Position& myPosOverView;
94
95
/// @brief set move shape
96
void setMoveShape(const GNEMoveResult& moveResult) override;
97
98
/// @brief commit move shape
99
void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) override;
100
101
/// @brief pos attributes format
102
AttributesFormat myAttributesFormat = AttributesFormat::POSITION;
103
104
/// @brief Invalidated copy constructor.
105
GNEMoveElementView(const GNEMoveElementView&) = delete;
106
107
/// @brief Invalidated assignment operator.
108
GNEMoveElementView& operator=(const GNEMoveElementView&) = delete;
109
};
110
111