Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEAttributesEditorType.h
Go to the documentation of this file.
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/****************************************************************************/
18// Table used for pack GNEAttributeRows
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <vector>
24#include <map>
25#include <unordered_set>
29
30// ===========================================================================
31// class declaration
32// ===========================================================================
33
37class GNEFrame;
39
40// ===========================================================================
41// class GNEAttributesEditorType
42// ===========================================================================
43
48
50
51public:
52
55 CREATOR, // used in create elements frames
56 EDITOR // used in edit frames (inspector, vType..)
57 };
58
60 enum class AttributeType {
61 BASIC, // basic attributes
62 EXTENDED, // extended attributes (used in vType)
63 FLOW, // flow attributes
64 GEO, // GEO attributes (lon and lat)
65 NETEDIT, // Netedit attributes (front, select...)
66 PARAMETERS, // Generic parameters
67 };
68
70 GNEAttributesEditorType(GNEFrame* frameParent, GNEAttributesEditor* attributesEditorParent,
71 const std::string attributesEditorName, EditorType editorType,
72 AttributeType attributeType);
73
76
78 GNEFrame* getFrameParent() const;
79
81 bool isEditorTypeCreator() const;
82
84 bool isEditorTypeEditor() const;
85
87 const std::vector<GNEAttributeCarrier*>& getEditedAttributeCarriers() const;
88
90 void showAttributesEditor(GNEAttributeCarrier* AC, const bool primaryAttributeEditor);
91
93 void showAttributesEditor(const std::unordered_set<GNEAttributeCarrier*>& ACs, const bool primaryAttributeEditor);
94
97
100
103
105 bool checkAttributes(const bool showWarning);
106
108 SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject* baseObject, const bool insertDefaultValues) const;
109
113 bool isReparenting() const;
114
116 bool checkNewParent(const GNEAttributeCarrier* AC) const;
117
119 void setNewParent(const GNEAttributeCarrier* AC);
120
122 void abortReparenting();
123
125
129 long onCmdMarkAsFront(FXObject*, FXSelector, void*);
130
132 long onUpdMarkAsFront(FXObject*, FXSelector, void*);
133
135 long onCmdOpenElementDialog(FXObject*, FXSelector, void*);
136
138 long onCmdOpenExtendedAttributesDialog(FXObject*, FXSelector, void*);
139
141 long onCmdOpenEditParametersDialog(FXObject*, FXSelector, void*);
142
144 long onCmdAttributesEditorHelp(FXObject*, FXSelector, void*);
145
147 long onCmdAttributesEditorReset(FXObject*, FXSelector, void*);
148
150
151protected:
153 FOX_CONSTRUCTOR(GNEAttributesEditorType)
154
155
157
159 void setAttribute(SumoXMLAttr attr, const std::string& value);
160
162 void toggleEnableAttribute(SumoXMLAttr attr, const bool value);
163
165 void enableReparent();
166
168 void inspectParent();
169
171 void moveLaneUp();
172
174 void moveLaneDown();
175
177
180
181private:
183 typedef std::map<AttributeType, std::vector<GNEAttributesEditorRow*> > AttributesEditorRows;
184
187
190
193
196
199
202
204 FXHorizontalFrame* myFrameNeteditButtons = nullptr;
205
208
211
213 std::vector<GNEAttributeCarrier*> myEditedACs;
214
216 std::vector<GNEAttributesEditorRow*> myAttributesEditorRows;
217
220
223
226
228 static void buildRows(GNEAttributesEditorType* editorParent);
229
232
235};
const std::string invalid_return< std::string >::value
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static void buildRows(GNEAttributesEditorType *editorParent)
build rows
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject, const bool insertDefaultValues) const
fill sumo Base object
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
static AttributesEditorRows mySecondSingletonAttributesEditorRows
second singleton with attributes editor rows
GNEAttributesEditorType(GNEFrame *frameParent, GNEAttributesEditor *attributesEditorParent, const std::string attributesEditorName, EditorType editorType, AttributeType attributeType)
constructor
std::vector< GNEAttributesEditorRow * > myAttributesEditorRows
singleton with attributes editor rows
void abortReparenting()
abort selecting parent
bool isEditorTypeCreator() const
check if this is an attribute editor of type "creator"
const AttributeType myAttributeType
variable use for packing attribute type options
void setNewParent(const GNEAttributeCarrier *AC)
set new parent
MFXButtonTooltip * myFrontButton
pointer to front button
static AttributesEditorRows myFirstSingletonAttributesEditorRows
first singleton with attributes editor rows
long onCmdOpenElementDialog(FXObject *, FXSelector, void *)
called when user press the "Element dialog" button
void hideAttributesEditor()
hide attribute editor
GNEAttributesEditor * myAttributesEditorParent
pointer to GNEAttributesEditor parent
FXHorizontalFrame * myFrameNeteditButtons
frame for netedit buttons (helps and reset)
bool isEditorTypeEditor() const
check if this is an attribute editor of type "editor"
long onUpdMarkAsFront(FXObject *, FXSelector, void *)
called when user update the "Mark as front element" button
long onCmdAttributesEditorReset(FXObject *, FXSelector, void *)
called when user press the reset button
void refreshAttributesEditor()
refresh attribute editor
GNEFrame * myFrameParent
pointer to GNEFrame parent
void showAttributesEditor(GNEAttributeCarrier *AC, const bool primaryAttributeEditor)
edit attributes of the given AC (usually the edited template AC)
std::map< AttributeType, std::vector< GNEAttributesEditorRow * > > AttributesEditorRows
typedef used for pack attributes editor row
MFXButtonTooltip * myOpenDialogButton
pointer to open dialog button (usually additionals)
bool checkAttributes(const bool showWarning)
check if current edited attributes are valid
friend class GNEAttributesEditorRow
FOX-declaration.
std::vector< GNEAttributeCarrier * > myEditedACs
current edited ACs
void setAttribute(SumoXMLAttr attr, const std::string &value)
set attribute in the current ACs (Callend from row)
long onCmdOpenExtendedAttributesDialog(FXObject *, FXSelector, void *)
called when user press the "Extended attributes" button
void fillStartEndAttributes(CommonXMLStructure::SumoBaseObject *baseObject) const
fill start end attributes
void inspectParent()
inspect parent (Callend from row)
long onCmdAttributesEditorHelp(FXObject *, FXSelector, void *)
called when user press the help button
const EditorType myEditorType
variable use for packing editorType type options
long onCmdMarkAsFront(FXObject *, FXSelector, void *)
bool checkNewParent(const GNEAttributeCarrier *AC) const
check if the given AC can be a new parent
void enableReparent()
void enable reparent
const std::vector< GNEAttributeCarrier * > & getEditedAttributeCarriers() const
get edited attribute carriers
void toggleEnableAttribute(SumoXMLAttr attr, const bool value)
set attribute in the current ACs (Callend from row)
SumoXMLTag myReparentTag
check if we're reparent
MFXButtonTooltip * myOpenGenericParametersEditorButton
pointer to open generic parameters editor button
GNEAttributesEditorType(GNEAttributesEditorType *)=delete
Invalidated copy constructor.
GNEAttributesEditorType & operator=(GNEAttributesEditorType *)=delete
Invalidated assignment operator.
MFXButtonTooltip * myOpenExtendedAttributesButton
pointer to open extended attributes button
long onCmdOpenEditParametersDialog(FXObject *, FXSelector, void *)
called when user press the "Edit parameters" button
void disableAttributesEditor()
disable attribute editor
MFXGroupBoxModule(GNEFrame *frame, const std::string &text, const int options=Options::COLLAPSIBLE)
constructor for frames
every row value