Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/network/GNEShapeFrame.h
169686 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 GNEShapeFrame.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Aug 2017
17
///
18
// The Widget for add polygons
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/frames/GNEFrame.h>
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNEAttributesEditor;
30
class GNETagSelector;
31
class GNEDrawingShape;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNEShapeFrame : public GNEFrame {
38
39
public:
40
41
// ===========================================================================
42
// class GEOPOICreator
43
// ===========================================================================
44
45
class GEOPOICreator : public MFXGroupBoxModule {
46
/// @brief FOX-declaration
47
FXDECLARE(GNEShapeFrame::GEOPOICreator)
48
49
public:
50
/// @brief constructor
51
GEOPOICreator(GNEShapeFrame* polygonFrameParent);
52
53
/// @brief destructor
54
~GEOPOICreator();
55
56
/// @brief Show list of GEOPOICreator Module
57
void showGEOPOICreatorModule();
58
59
/// @brief hide GEOPOICreator Module
60
void hideGEOPOICreatorModule();
61
62
/// @name FOX-callbacks
63
/// @{
64
/// @brief called when user change the coordinates TextField
65
long onCmdSetCoordinates(FXObject*, FXSelector, void*);
66
67
/// @brief called when user select a format radio button
68
long onCmdSetFormat(FXObject*, FXSelector, void*);
69
70
/// @brief called when user type in search box
71
long onCmdCreateGEOPOI(FXObject*, FXSelector, void*);
72
/// @}
73
74
protected:
75
FOX_CONSTRUCTOR(GEOPOICreator)
76
77
private:
78
/// @brief pointer to Shape frame parent
79
GNEShapeFrame* myShapeFrameParent;
80
81
/// @brief radio button for the configuration lon-lat
82
FXRadioButton* myLonLatRadioButton;
83
84
/// @brief radio button for the configuration lat-lon
85
FXRadioButton* myLatLonRadioButton;
86
87
/// @brief text field for given geo coordinates
88
FXTextField* myCoordinatesTextField;
89
90
/// @brief button for enable or disable certer view after creation of GEO POI
91
FXCheckButton* myCenterViewAfterCreationCheckButton;
92
93
/// @brief button for create GEO Coordinates
94
FXButton* myCreateGEOPOIButton;
95
96
/// @brief FXLabel for the equivalent position of GEO Position in Cartesian Position
97
FXLabel* myLabelCartesianPosition;
98
};
99
100
/**@brief Constructor
101
* @brief viewParent GNEViewParent in which this GNEFrame is placed
102
* @brief viewNet viewNet that uses this GNEFrame
103
*/
104
GNEShapeFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
105
106
/// @brief Destructor
107
~GNEShapeFrame();
108
109
/// @brief show Frame
110
void show();
111
112
/**@brief process click over Viewnet
113
* @param[in] clickedPosition clicked position over ViewNet
114
* @param[in] viewObjects objects under cursor after click over view
115
* @return AddShapeStatus with the result of operation
116
*/
117
bool processClick(const Position& clickedPosition, const GNEViewNetHelper::ViewObjectsSelector& viewObjects, bool& updateTemporalShape);
118
119
/// @brief get list of selecte id's in string format
120
static std::string getIdsSelected(const FXList* list);
121
122
/// @brief get drawing mode editor
123
GNEDrawingShape* getDrawingShapeModule() const;
124
125
protected:
126
/// @brief SumoBaseObject used for create shape
127
CommonXMLStructure::SumoBaseObject* myBaseShape;
128
129
// @brief create baseShapeObject
130
void createBaseShapeObject(const SumoXMLTag shapeTag);
131
132
/**@brief build a shaped element using the drawed shape
133
* return true if was successfully created
134
* @note called when user stop drawing polygon
135
*/
136
bool shapeDrawed();
137
138
/// @brief Tag selected in GNETagSelector
139
void tagSelected();
140
141
/// @brief process click for Polygons
142
bool processClickPolygons(const Position& clickedPosition, bool& updateTemporalShape);
143
144
/// @brief process click for POIs over view
145
bool processClickPOI(SumoXMLTag POITag, const Position& clickedPosition);
146
147
/// @brief process click for POIGeo
148
bool processClickPOIGeo(const Position& clickedPosition);
149
150
/// @brief process click for POILanes
151
bool processClickPOILanes(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
152
153
private:
154
/// @brief shape tag selector
155
GNETagSelector* myShapeTagSelector;
156
157
/// @brief shape attributes editor
158
GNEAttributesEditor* myShapeAttributesEditor = nullptr;
159
160
/// @brief Drawing shape
161
GNEDrawingShape* myDrawingShape = nullptr;
162
163
/// @brief GEOPOICreator
164
GEOPOICreator* myGEOPOICreator = nullptr;
165
};
166
167