Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/common/GNEInspectorFrame.h
169684 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 GNEInspectorFrame.h
15
/// @author Jakob Erdmann
16
/// @author Pablo Alvarez Lopez
17
/// @date Mar 2011
18
///
19
// The Widget for modifying network-element attributes (i.e. lane speed)
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <netedit/frames/GNEFrame.h>
25
#include <netedit/GNEViewNetHelper.h>
26
27
// ===========================================================================
28
// class declaration
29
// ===========================================================================
30
31
class GNEAttributesEditor;
32
class GNEEdgeTemplate;
33
class GNEElementTree;
34
class GNEOverlappedInspection;
35
36
// ===========================================================================
37
// class definitions
38
// ===========================================================================
39
40
class GNEInspectorFrame : public GNEFrame {
41
/// @brief FOX-declaration
42
FXDECLARE(GNEInspectorFrame)
43
44
public:
45
// ===========================================================================
46
// class TemplateEditor
47
// ===========================================================================
48
49
class TemplateEditor : public MFXGroupBoxModule {
50
/// @brief FOX-declaration
51
FXDECLARE(GNEInspectorFrame::TemplateEditor)
52
53
public:
54
/// @brief constructor
55
TemplateEditor(GNEInspectorFrame* inspectorFrameParent);
56
57
/// @brief destructor
58
~TemplateEditor();
59
60
/// @brief show template editor
61
bool showTemplateEditor();
62
63
/// @brief hide template editor
64
void hideTemplateEditor();
65
66
/// @brief get edge template (to copy attributes from)
67
GNEEdgeTemplate* getEdgeTemplate() const;
68
69
/// @brief set edge template
70
void setEdgeTemplate(const GNEEdge* edge);
71
72
/// @brief update edge template
73
void updateEdgeTemplate();
74
75
/// @brief set template (used by shortcut)
76
void setTemplate();
77
78
/// @brief copy template (used by shortcut)
79
void copyTemplate();
80
81
/// @brief clear template (used by shortcut)
82
void clearTemplate();
83
84
/// @name FOX-callbacks
85
/// @{
86
/// @brief set current edge as new template
87
long onCmdSetTemplate(FXObject*, FXSelector, void*);
88
89
/// @brief copy edge attributes from edge template
90
long onCmdCopyTemplate(FXObject*, FXSelector, void*);
91
92
/// @brief clear current edge template
93
long onCmdClearTemplate(FXObject*, FXSelector, void*);
94
/// @}
95
96
protected:
97
/// @brief FOX need this
98
FOX_CONSTRUCTOR(TemplateEditor)
99
100
/// @brief update frame buttons
101
void updateButtons();
102
103
private:
104
/// @brief current GNEInspectorFrame parent
105
GNEInspectorFrame* myInspectorFrameParent;
106
107
/// @brief set template button
108
FXButton* mySetTemplateButton;
109
110
/// @brief copy template button
111
FXButton* myCopyTemplateButton;
112
113
/// @brief clear template button
114
FXButton* myClearTemplateButton;
115
116
/// @brief edge Template
117
GNEEdgeTemplate* myEdgeTemplate;
118
};
119
120
/**@brief Constructor
121
* @brief viewParent GNEViewParent in which this GNEFrame is placed
122
* @brief net net that uses this GNEFrame
123
*/
124
GNEInspectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
125
126
/// @brief Destructor
127
~GNEInspectorFrame();
128
129
/// @brief show inspector frame
130
void show();
131
132
/// @brief hide inspector frame
133
void hide();
134
135
/**@brief process click over Viewnet
136
* @param[in] viewObjects objects under cursors
137
* @return true if something was sucefully done
138
*/
139
bool inspectClickedElements(GNEViewNetHelper::ViewObjectsSelector& viewObjects, const Position& clickedPosition,
140
const bool shiftKeyPressed);
141
142
/// @brief Inspect a single element
143
void inspectElement(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousInspectedAC = nullptr);
144
145
/// @brief Inspect the given elements
146
void inspectElements(const std::vector<GNEAttributeCarrier*>& ACs, GNEAttributeCarrier* previousInspectedAC = nullptr);
147
148
/// @brief clear inspection
149
void clearInspection();
150
151
/// @brief refresh current inspection
152
void refreshInspection();
153
154
/// @brief get AttributesEditor
155
GNEAttributesEditor* getAttributesEditor() const;
156
157
/// @brief get template editor
158
TemplateEditor* getTemplateEditor() const;
159
160
/// @brief get GNEOverlappedInspection modul
161
GNEOverlappedInspection* getOverlappedInspection() const;
162
163
/// @brief get GNEElementTree modul
164
GNEElementTree* getHierarchicalElementTree() const;
165
166
/// @name FOX-callbacks
167
/// @{
168
169
/// @brief called when user press inspet previous elemnt button
170
long onCmdInspectPreviousElement(FXObject*, FXSelector, void*);
171
/// @}
172
173
/// @brief function called after undo/redo in the current frame (can be reimplemented in frame children)
174
void updateFrameAfterUndoRedo();
175
176
/// @brief open GNEAttributesCreator extended dialog (can be reimplemented in frame children)
177
void selectedOverlappedElement(GNEAttributeCarrier* AC);
178
179
protected:
180
/// @brief FOX need this
181
FOX_CONSTRUCTOR(GNEInspectorFrame)
182
183
private:
184
/// @brief Overlapped Inspection
185
GNEOverlappedInspection* myOverlappedInspection = nullptr;
186
187
/// @brief Attributes editor
188
GNEAttributesEditor* myAttributesEditor = nullptr;
189
190
/// @brief Template editor
191
TemplateEditor* myTemplateEditor = nullptr;
192
193
/// @brief Attribute Carrier Hierarchy
194
GNEElementTree* myHierarchicalElementTree = nullptr;
195
196
/// @brief Back Button
197
FXButton* myBackButton = nullptr;
198
199
/// @brief Pointer to previous element inspected
200
GNEAttributeCarrier* myPreviousInspectedAC = nullptr;
201
};
202
203