Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEAttributesEditor.cpp
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// pack of all GNEAttributesEditorTypes
19/****************************************************************************/
20
21#include "GNEAttributesEditor.h"
22
25
26// ===========================================================================
27// method definitions
28// ===========================================================================
29
38
39
40void
41GNEAttributesEditor::showAttributesEditor(GNEAttributeCarrier* AC, const bool primaryAttributeEditor) {
42 myBasicAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
43 myExtendedAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
44 myFlowAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
45 myGeoAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
46 myParametersAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
47 myNeteditAttributesEditor->showAttributesEditor(AC, primaryAttributeEditor);
48}
49
50
51void
52GNEAttributesEditor::showAttributesEditor(const std::unordered_set<GNEAttributeCarrier*>& ACs, const bool primaryAttributeEditor) {
53 myBasicAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
54 myExtendedAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
55 myFlowAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
56 myGeoAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
57 myParametersAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
58 myNeteditAttributesEditor->showAttributesEditor(ACs, primaryAttributeEditor);
59}
60
61
62void
71
72
73void
82
83
84void
93
94
99
100
101bool
103 if (!myBasicAttributesEditor->checkAttributes(showWarning)) {
104 return false;
105 } else if (!myExtendedAttributesEditor->checkAttributes(showWarning)) {
106 return false;
107 } else if (!myFlowAttributesEditor->checkAttributes(showWarning)) {
108 return false;
109 } else if (!myGeoAttributesEditor->checkAttributes(showWarning)) {
110 return false;
111 } else if (!myParametersAttributesEditor->checkAttributes(showWarning)) {
112 return false;
113 } else if (!myNeteditAttributesEditor->checkAttributes(showWarning)) {
114 return false;
115 } else {
116 return true;
117 }
118}
119
120
123 // check if edited AC is a vehicle (needed to avoid empty attributes in SUMOVehicleParser
124 bool useSUMOVehicleparser = false;
126 if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isVehicle()) {
127 useSUMOVehicleparser = true;
128 } else if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isPerson()) {
129 useSUMOVehicleparser = true;
130 } else if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isContainer()) {
131 useSUMOVehicleparser = true;
132 }
133 }
134 SumoXMLAttr fillResult = SUMO_ATTR_DEFAULT;
135 fillResult = myBasicAttributesEditor->fillSumoBaseObject(baseObject, !useSUMOVehicleparser);
136 if (fillResult != SUMO_ATTR_NOTHING) {
137 return fillResult;
138 }
139 fillResult = myExtendedAttributesEditor->fillSumoBaseObject(baseObject, true);
140 if (fillResult != SUMO_ATTR_NOTHING) {
141 return fillResult;
142 }
143 fillResult = myFlowAttributesEditor->fillSumoBaseObject(baseObject, true);
144 if (fillResult != SUMO_ATTR_NOTHING) {
145 return fillResult;
146 }
147 fillResult = myGeoAttributesEditor->fillSumoBaseObject(baseObject, true);
148 if (fillResult != SUMO_ATTR_NOTHING) {
149 return fillResult;
150 }
151 fillResult = myParametersAttributesEditor->fillSumoBaseObject(baseObject, true);
152 if (fillResult != SUMO_ATTR_NOTHING) {
153 return fillResult;
154 }
155 fillResult = myNeteditAttributesEditor->fillSumoBaseObject(baseObject, true);
156 if (fillResult != SUMO_ATTR_NOTHING) {
157 return fillResult;
158 }
159 return fillResult;
160}
161
162
163bool
167
168
169bool
173
174
175void
179
180
181void
185
186/****************************************************************************/
#define TL(string)
Definition MsgHandler.h:304
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DEFAULT
@ SUMO_ATTR_NOTHING
invalid attribute, must be the last one
GNEAttributesEditorType * myNeteditAttributesEditor
netedit attributes editor
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject) const
fill sumo Base object
GNEAttributesEditorType * myExtendedAttributesEditor
extended attributes editor
GNEAttributesEditorType * myGeoAttributesEditor
geo attributes editor
void setNewParent(const GNEAttributeCarrier *AC)
set new parent
void showAttributesEditor(GNEAttributeCarrier *AC, const bool primaryAttributeEditor)
edit attributes of the given AC (usually the edited template AC)
void refreshAttributesEditor()
refresh attribute editor
GNEAttributesEditorType * getNeteditAttributesEditor() const
get netedit attributes editor
bool checkAttributes(const bool showWarning)
check if current edited attributes are valid
bool checkNewParent(const GNEAttributeCarrier *AC) const
check if the given AC can be a new parent
GNEAttributesEditorType * myFlowAttributesEditor
flow attributes editor
void disableAttributesEditor()
disable attribute editor
GNEAttributesEditor(GNEFrame *frameParent, GNEAttributesEditorType::EditorType editorType)
constructor
void abortReparenting()
abort selecting parent
void hideAttributesEditor()
hide attribute editor
GNEAttributesEditorType * myParametersAttributesEditor
parameteres attributes editor
GNEAttributesEditorType * myBasicAttributesEditor
basic attributes editor
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject, const bool insertDefaultValues) const
fill sumo Base object
void abortReparenting()
abort selecting parent
void setNewParent(const GNEAttributeCarrier *AC)
set new parent
void hideAttributesEditor()
hide attribute editor
void refreshAttributesEditor()
refresh attribute editor
void showAttributesEditor(GNEAttributeCarrier *AC, const bool primaryAttributeEditor)
edit attributes of the given AC (usually the edited template AC)
bool checkAttributes(const bool showWarning)
check if current edited attributes are valid
bool checkNewParent(const GNEAttributeCarrier *AC) const
check if the given AC can be a new parent
const std::vector< GNEAttributeCarrier * > & getEditedAttributeCarriers() const
get edited attribute carriers
void disableAttributesEditor()
disable attribute editor