Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEFrameAttributeModules.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-2024 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// Auxiliar class for GNEFrame Modules (only for attributes edition)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
31
32// ===========================================================================
33// class declaration
34// ===========================================================================
35
36class GNEFrame;
37class GNEViewParent;
38class GNEFlowEditor;
40class GNETypeFrame;
41
42// ===========================================================================
43// class definitions
44// ===========================================================================
45
47
48public:
49 // ===========================================================================
50 // class declaration
51 // ===========================================================================
52
53 class AttributesEditor;
54 class AttributesEditorFlow;
55
56 // ===========================================================================
57 // class AttributesEditorRow
58 // ===========================================================================
59
60 class AttributesEditorRow : protected FXHorizontalFrame {
63
64 public:
66 AttributesEditorRow(AttributesEditor* attributeEditorParent, const GNEAttributeProperties& ACAttr, const std::string& value,
67 const bool attributeEnabled, const bool computed, GNEAttributeCarrier* ACParent);
68
70 void destroy();
71
73 void refreshAttributesEditorRow(const std::string& value, const bool forceRefreshAttribute, const bool attributeEnabled, const bool computed, GNEAttributeCarrier* ACParent);
74
76 bool isAttributesEditorRowValid() const;
77
80
82 long onCmdSetAttribute(FXObject*, FXSelector, void*);
83
85 long onCmdSelectCheckButton(FXObject*, FXSelector, void*);
86
88 long onCmdOpenColorDialog(FXObject*, FXSelector, void*);
89
91 long onCmdOpenAllowDialog(FXObject*, FXSelector, void*);
92
94 long onCmdInspectParent(FXObject*, FXSelector, void*);
95
97 long onCmdMoveElementLaneUp(FXObject*, FXSelector, void*);
98
100 long onCmdMoveElementLaneDown(FXObject*, FXSelector, void*);
101
103
104 protected:
107
109 std::string stripWhitespaceAfterComma(const std::string& stringValue);
110
112 bool mergeJunction(SumoXMLAttr attr, const std::string& newVal) const;
113
114 private:
117
120
123
125 FXCheckButton* myAttributeCheckButton = nullptr;
126
129
132
135
137 FXCheckButton* myValueCheckButton = nullptr;
138
141
144
147
149 void buildAttributeElements(const bool attributeEnabled, const bool computed);
150
152 void buildValueElements(const bool attributeEnabled, const bool computed);
153
155 void refreshAttributeElements(const std::string& value, const bool attributeEnabled, const bool computed);
156
158 void refreshValueElements(const std::string& value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute);
159
161 void fillComboBox(const std::string& value);
162
164 void updateMoveLaneButtons(const std::string& value);
165
168
171 };
172
173 // ===========================================================================
174 // class AttributesEditor
175 // ===========================================================================
176
180
181 public:
183 AttributesEditor(GNEFrame* inspectorFrameParent);
184
186 void showAttributeEditorModule(bool includeExtended);
187
190
192 void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition);
193
195 GNEFrame* getFrameParent() const;
196
200 long onCmdAttributesEditorHelp(FXObject*, FXSelector, void*);
202
203 protected:
205 FOX_CONSTRUCTOR(AttributesEditor)
206
207 private:
210
213
215 std::vector<AttributesEditorRow*> myAttributesEditorRows;
216
218 FXButton* myHelpButton = nullptr;
219
222 };
223
224 // ===========================================================================
225 // class AttributesEditorExtended
226 // ===========================================================================
227
231
232 public:
235
238
241
244
248 long onCmdOpenDialog(FXObject*, FXSelector, void*);
250
251 protected:
252 FOX_CONSTRUCTOR(AttributesEditorExtended)
253
254 private:
257 };
258
259 // ===========================================================================
260 // class GenericDataAttributes
261 // ===========================================================================
262
266
267 public:
269 GenericDataAttributes(GNEFrame* frameParent);
270
273
276
279
282
285
287 std::string getParametersStr() const;
288
290 std::vector<std::pair<std::string, std::string> > getParameters() const;
291
293 void setParameters(const std::vector<std::pair<std::string, std::string> >& parameters);
294
296 GNEFrame* getFrameParent() const;
297
299 bool areAttributesValid() const;
300
304 long onCmdEditParameters(FXObject*, FXSelector, void*);
305
307 long onCmdSetParameters(FXObject*, FXSelector, void*);
309
310 protected:
311 FOX_CONSTRUCTOR(GenericDataAttributes)
312
313 private:
316
319
321 FXTextField* myTextFieldParameters = nullptr;
322
324 FXButton* myButtonEditParameters = nullptr;
325 };
326
327 // ===========================================================================
328 // class ParametersEditor
329 // ===========================================================================
330
334
335 public:
337 ParametersEditor(GNEInspectorFrame* inspectorFrameParent);
338
340 ParametersEditor(GNETypeFrame* typeFrameParent);
341
344
346 GNEViewNet* getViewNet() const;
347
350
353
356
359
362
366 long onCmdEditParameters(FXObject*, FXSelector, void*);
367
369 long onCmdSetParameters(FXObject*, FXSelector, void*);
371
372 protected:
374 FOX_CONSTRUCTOR(ParametersEditor)
375
376 private:
379
382
384 FXTextField* myTextFieldParameters = nullptr;
385
387 FXButton* myButtonEditParameters = nullptr;
388 };
389
391 static bool isSupermodeValid(const GNEViewNet* viewNet, const GNEAttributeCarrier* AC);
392
394 static bool isSupermodeValid(const GNEViewNet* viewNet, const GNEAttributeProperties& ACAttr);
395};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void showAttributesEditorExtendedModule()
show AttributesEditorExtended modul
void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition)
refresh attribute editor (only the valid values will be refresh)
bool myIncludeExtended
flag used to mark if current edited ACs are bein edited including extended attribute
GNEFlowEditor * myAttributesEditorFlow
GNEFlowEditor modul.
GNEFrame * getFrameParent() const
pointer to GNEFrame parent
long onCmdAttributesEditorHelp(FXObject *, FXSelector, void *)
void showAttributeEditorModule(bool includeExtended)
show attributes of multiple ACs
std::vector< AttributesEditorRow * > myAttributesEditorRows
list of Attribute editor rows
MFXButtonTooltip * myValueLaneDownButton
Button for move lane down.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
GNEAttributeCarrier * myACParent
pointer to AC Parent
const GNEAttributeProperties myACAttr
current AC Attribute
long onCmdMoveElementLaneDown(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
MFXButtonTooltip * myAttributeButton
pointer to attributeAllowButton
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
long onCmdOpenAllowDialog(FXObject *, FXSelector, void *)
open model dialog for edit allow
AttributesEditorRow & operator=(AttributesEditorRow *)=delete
Invalidated assignment operator.
void refreshValueElements(const std::string &value, const bool attributeEnabled, const bool computed, const bool forceRefreshAttribute)
build value elements();
bool isAttributesEditorRowValid() const
check if current attribute of TextField/ComboBox is valid
bool mergeJunction(SumoXMLAttr attr, const std::string &newVal) const
check junction merging
void destroy()
destroy GNEAttributesCreatorRow (but don't delete)
FXCheckButton * myValueCheckButton
pointer to menu check
long onCmdInspectParent(FXObject *, FXSelector, void *)
inspect parent
MFXLabelTooltip * myAttributeLabel
pointer to attribute label
MFXButtonTooltip * myValueLaneUpButton
Button for move lane up.
void fillComboBox(const std::string &value)
fill comboBox with discrete values
long onCmdSelectCheckButton(FXObject *, FXSelector, void *)
called when user press a check button
AttributesEditor * myAttributesEditorParent
pointer to AttributesEditor parent
MFXTextFieldTooltip * myValueTextField
textField to modify the value of string attributes
AttributesEditorRow(AttributesEditorRow *)=delete
Invalidated copy constructor.
FXCheckButton * myAttributeCheckButton
pointer to attribute menu check
long onCmdMoveElementLaneUp(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
void buildAttributeElements(const bool attributeEnabled, const bool computed)
build Attribute elements
void refreshAttributeElements(const std::string &value, const bool attributeEnabled, const bool computed)
refresh Attribute elements
long onCmdOpenColorDialog(FXObject *, FXSelector, void *)
open model dialog for edit color
MFXComboBoxIcon * myValueComboBox
pointer to combo box choices
void updateMoveLaneButtons(const std::string &value)
update move lane buttons
void buildValueElements(const bool attributeEnabled, const bool computed)
build value elements();
void refreshAttributesEditorRow(const std::string &value, const bool forceRefreshAttribute, const bool attributeEnabled, const bool computed, GNEAttributeCarrier *ACParent)
refresh current row
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
bool areAttributesValid() const
check if current attributes are valid
const Parameterised::Map & getParametersMap() const
get parameters as map
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
FXTextField * myTextFieldParameters
text field for write parameters
void showGenericDataAttributes()
show netedit attributes EditorCreator
GNEFrame * getFrameParent() const
pointer to frame parent
std::vector< std::pair< std::string, std::string > > getParameters() const
get parameters as vector of strings
std::string getParametersStr() const
get parameters as string
Parameterised::Map myParameters
pointer to current map of parameters
void hideGenericDataAttributes()
hide netedit attributes EditorCreator
void setParameters(const std::vector< std::pair< std::string, std::string > > &parameters)
set parameters
void refreshParametersEditor()
refresh netedit attributes
long onCmdSetParameters(FXObject *, FXSelector, void *)
Called when user udpate the parameter text field.
GNEInspectorFrame * myInspectorFrameParent
FOX need this.
long onCmdEditParameters(FXObject *, FXSelector, void *)
void hideParametersEditor()
hide netedit attributes EditorInspector
GNEInspectorFrame * getInspectorFrameParent() const
get inspector frame parent
FXButton * myButtonEditParameters
button for edit parameters using specific dialog
FXTextField * myTextFieldParameters
text field for write parameters
GNETypeFrame * getTypeFrameParent() const
get type frame parent
void showParametersEditor()
show netedit attributes EditorInspector
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
A single child window which contains a view of the simulation area.
ComboBox with icon.
MFXGroupBoxModule (based on FXGroupBox)
std::map< std::string, std::string > Map
parameters map