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