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-2023 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 forceRefresh, 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 onCmdOpenAttributeDialog(FXObject*, FXSelector, void*);
89
91 long onCmdInspectVTypeParent(FXObject*, FXSelector, void*);
93
94 protected:
97
99 std::string stripWhitespaceAfterComma(const std::string& stringValue);
100
102 bool mergeJunction(SumoXMLAttr attr, const std::vector<GNEAttributeCarrier*>& inspectedACs, const std::string& newVal) const;
103
104 private:
107
110
113
115 FXCheckButton* myAttributeCheckButton = nullptr;
116
119
122
125
128
131
133 FXCheckButton* myValueCheckButton = nullptr;
134
137 };
138
139 // ===========================================================================
140 // class AttributesEditor
141 // ===========================================================================
142
146
147 public:
149 AttributesEditor(GNEFrame* inspectorFrameParent);
150
152 void showAttributeEditorModule(bool includeExtended);
153
156
158 void refreshAttributeEditor(bool forceRefreshShape, bool forceRefreshPosition);
159
161 GNEFrame* getFrameParent() const;
162
166 long onCmdAttributesEditorHelp(FXObject*, FXSelector, void*);
168
169 protected:
171 FOX_CONSTRUCTOR(AttributesEditor)
172
173 private:
176
179
181 std::vector<AttributesEditorRow*> myAttributesEditorRows;
182
184 FXButton* myHelpButton = nullptr;
185
188 };
189
190 // ===========================================================================
191 // class AttributesEditorExtended
192 // ===========================================================================
193
197
198 public:
201
204
207
210
214 long onCmdOpenDialog(FXObject*, FXSelector, void*);
216
217 protected:
218 FOX_CONSTRUCTOR(AttributesEditorExtended)
219
220 private:
223 };
224
225 // ===========================================================================
226 // class GenericDataAttributes
227 // ===========================================================================
228
232
233 public:
235 GenericDataAttributes(GNEFrame* frameParent);
236
239
242
245
248
251
253 std::string getParametersStr() const;
254
256 std::vector<std::pair<std::string, std::string> > getParameters() const;
257
259 void setParameters(const std::vector<std::pair<std::string, std::string> >& parameters);
260
262 GNEFrame* getFrameParent() const;
263
265 bool areAttributesValid() const;
266
270 long onCmdEditParameters(FXObject*, FXSelector, void*);
271
273 long onCmdSetParameters(FXObject*, FXSelector, void*);
275
276 protected:
277 FOX_CONSTRUCTOR(GenericDataAttributes)
278
279 private:
282
285
287 FXTextField* myTextFieldParameters = nullptr;
288
290 FXButton* myButtonEditParameters = nullptr;
291 };
292
293 // ===========================================================================
294 // class ParametersEditor
295 // ===========================================================================
296
300
301 public:
303 ParametersEditor(GNEInspectorFrame* inspectorFrameParent);
304
306 ParametersEditor(GNETypeFrame* typeFrameParent);
307
310
312 GNEViewNet* getViewNet() const;
313
316
319
322
325
328
332 long onCmdEditParameters(FXObject*, FXSelector, void*);
333
335 long onCmdSetParameters(FXObject*, FXSelector, void*);
337
338 protected:
340 FOX_CONSTRUCTOR(ParametersEditor)
341
342 private:
345
348
350 FXTextField* myTextFieldParameters = nullptr;
351
353 FXButton* myButtonEditParameters = nullptr;
354 };
355
357 static bool isSupermodeValid(const GNEViewNet* viewNet, const GNEAttributeCarrier* AC);
358
360 static bool isSupermodeValid(const GNEViewNet* viewNet, const GNEAttributeProperties& ACAttr);
361};
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
void refreshAttributesEditorRow(const std::string &value, const bool forceRefresh, const bool attributeEnabled, const bool computed, GNEAttributeCarrier *ACParent)
refresh current row
bool mergeJunction(SumoXMLAttr attr, const std::vector< GNEAttributeCarrier * > &inspectedACs, const std::string &newVal) const
check junction merging
MFXComboBoxIcon * myValueChoicesComboBox
pointer to combo box choices
long onCmdSetAttribute(FXObject *, FXSelector, void *)
try to set new attribute value
GNEAttributeCarrier * myACParent
pointer to AC Parent
const GNEAttributeProperties myACAttr
current AC Attribute
MFXButtonTooltip * myAttributeAllowButton
pointer to attributeAllowButton
std::string stripWhitespaceAfterComma(const std::string &stringValue)
removed invalid spaces of Positions and shapes
long onCmdInspectVTypeParent(FXObject *, FXSelector, void *)
inspect vType/VTypeDistribution parent
bool isAttributesEditorRowValid() const
check if current attribute of TextField/ComboBox is valid
MFXButtonTooltip * myAttributeColorButton
Button for open color editor.
void destroy()
destroy GNEAttributesCreatorRow (but don't delete)
FXCheckButton * myValueCheckButton
pointer to menu check
long onCmdOpenAttributeDialog(FXObject *, FXSelector, void *)
open model dialog for more comfortable attribute editing
MFXLabelTooltip * myAttributeLabel
pointer to attribute label
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
FXCheckButton * myAttributeCheckButton
pointer to attribute menu check
MFXButtonTooltip * myAttributeVTypeButton
Button for inspect Vtype/VtypeDistribution parent.
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