Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/GNEElementTree.h
169678 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 GNEElementTree.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Mar 2022
17
///
18
// Frame for show hierarchical elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <utils/foxtools/MFXGroupBoxModule.h>
24
#include <utils/foxtools/MFXTreeListDynamic.h>
25
26
// ===========================================================================
27
// class declaration
28
// ===========================================================================
29
30
class GNEAdditional;
31
class GNEConnection;
32
class GNECrossing;
33
class GNEDataInterval;
34
class GNEDataSet;
35
class GNEDataSet;
36
class GNEDemandElement;
37
class GNEEdge;
38
class GNEFrame;
39
class GNEGenericData;
40
class GNEJunction;
41
class GNELane;
42
class GNETAZSourceSink;
43
44
// ===========================================================================
45
// class definitions
46
// ===========================================================================
47
48
class GNEElementTree : public MFXGroupBoxModule {
49
/// @brief FOX-declaration
50
FXDECLARE(GNEElementTree)
51
52
public:
53
/// @brief constructor
54
GNEElementTree(GNEFrame* frameParent);
55
56
/// @brief destructor
57
~GNEElementTree();
58
59
/// @brief show GNEElementTree
60
void showHierarchicalElementTree(GNEAttributeCarrier* AC);
61
62
/// @brief hide GNEElementTree
63
void hideHierarchicalElementTree();
64
65
/// @brief refresh GNEElementTree
66
void refreshHierarchicalElementTree();
67
68
/// @brief if given AttributeCarrier is the same of myHE, set it as nullptr
69
void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier* HE);
70
71
/// @name FOX-callbacks
72
/// @{
73
/// @brief called when user press right click over an item of list of children
74
long onCmdShowChildMenu(FXObject*, FXSelector, void* data);
75
76
/// @brief called when user click over option "center" of child Menu
77
long onCmdCenterItem(FXObject*, FXSelector, void*);
78
79
/// @brief called when user click over option "inspect" of child menu
80
long onCmdInspectItem(FXObject*, FXSelector, void*);
81
82
/// @brief called when user click over option "delete" of child menu
83
long onCmdDeleteItem(FXObject*, FXSelector, void*);
84
85
/// @brief called when user click over option "Move up" of child menu
86
long onCmdMoveItemUp(FXObject*, FXSelector, void*);
87
88
/// @brief called when user click over option "Move down" of child menu
89
long onCmdMoveItemDown(FXObject*, FXSelector, void*);
90
/// @}
91
92
protected:
93
FOX_CONSTRUCTOR(GNEElementTree)
94
95
// @brief create pop-up menu in the positions X-Y for the clicked attribute carrier
96
void createPopUpMenu(int X, int Y, GNEAttributeCarrier* clickedAC);
97
98
/// @brief show child of current attributeCarrier
99
FXTreeItem* showAttributeCarrierParents();
100
101
/// @brief show children of given hierarchical element
102
void showHierarchicalElementChildren(GNEAttributeCarrier* hierarchicalElement, FXTreeItem* itemParent);
103
104
/// @brief add item into list
105
FXTreeItem* addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent = nullptr, std::string prefix = "", std::string sufix = "");
106
107
/// @brief add item into list
108
FXTreeItem* addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded);
109
110
/// @brief check if current supermode is valid for select/remove the given AC
111
bool isSupermodeValid(const GNEAttributeCarrier* AC) const;
112
113
private:
114
/// @brief frame Parent
115
GNEFrame* myFrameParent;
116
117
/// @brief hierarchical element
118
GNEAttributeCarrier* myHierarchicalElement = nullptr;
119
120
/// @brief pointer to current clicked Attribute Carrier
121
GNEAttributeCarrier* myClickedAC = nullptr;
122
123
/// @brief junction (casted from myClickedAC)
124
GNEJunction* myClickedJunction = nullptr;
125
126
/// @brief edge (casted from myClickedAC)
127
GNEEdge* myClickedEdge = nullptr;
128
129
/// @brief lane (casted from myClickedAC)
130
GNELane* myClickedLane = nullptr;
131
132
/// @brief crossing (casted from myClickedAC)
133
GNECrossing* myClickedCrossing = nullptr;
134
135
/// @brief junction (casted from myClickedAC)
136
GNEConnection* myClickedConnection = nullptr;
137
138
/// @brief additional (casted from myClickedAC)
139
GNEAdditional* myClickedAdditional = nullptr;
140
141
/// @brief sourceSink (casted from myClickedAC)
142
GNETAZSourceSink* myClickedTAZSourceSink = nullptr;
143
144
/// @brief demand element (casted from myClickedAC)
145
GNEDemandElement* myClickedDemandElement = nullptr;
146
147
/// @brief data set element (casted from myClickedAC)
148
GNEDataSet* myClickedDataSet = nullptr;
149
150
/// @brief data interval element (casted from myClickedAC)
151
GNEDataInterval* myClickedDataInterval = nullptr;
152
153
/// @brief generic data element (casted from myClickedAC)
154
GNEGenericData* myClickedGenericData = nullptr;
155
156
/// @brief tree list dynamic to show the children of the element to erase
157
MFXTreeListDynamic* myTreeListDynamic = nullptr;
158
159
/// @brief map used to save the FXTreeItems items with their vinculated AC
160
std::map<FXTreeItem*, GNEAttributeCarrier*> myTreeItemToACMap;
161
162
/// @brief set used to save tree items without AC assigned, the Incoming/Outcoming connections
163
std::set<FXTreeItem*> myTreeItemsConnections;
164
};
165
166