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
95bool
96GNEAttributesEditor::checkAttributes(const bool showWarning) {
97 if (!myBasicAttributesEditor->checkAttributes(showWarning)) {
98 return false;
99 } else if (!myExtendedAttributesEditor->checkAttributes(showWarning)) {
100 return false;
101 } else if (!myFlowAttributesEditor->checkAttributes(showWarning)) {
102 return false;
103 } else if (!myGeoAttributesEditor->checkAttributes(showWarning)) {
104 return false;
105 } else if (!myParametersAttributesEditor->checkAttributes(showWarning)) {
106 return false;
107 } else if (!myNeteditAttributesEditor->checkAttributes(showWarning)) {
108 return false;
109 } else {
110 return true;
111 }
112}
113
114
117 // check if edited AC is a vehicle (needed to avoid empty attributes in SUMOVehicleParser
118 bool useSUMOVehicleparser = false;
120 if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isVehicle()) {
121 useSUMOVehicleparser = true;
122 } else if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isPerson()) {
123 useSUMOVehicleparser = true;
124 } else if (myBasicAttributesEditor->getEditedAttributeCarriers().front()->getTagProperty()->isContainer()) {
125 useSUMOVehicleparser = true;
126 }
127 }
128 SumoXMLAttr fillResult = SUMO_ATTR_DEFAULT;
129 fillResult = myBasicAttributesEditor->fillSumoBaseObject(baseObject, !useSUMOVehicleparser);
130 if (fillResult != SUMO_ATTR_NOTHING) {
131 return fillResult;
132 }
133 fillResult = myExtendedAttributesEditor->fillSumoBaseObject(baseObject, true);
134 if (fillResult != SUMO_ATTR_NOTHING) {
135 return fillResult;
136 }
137 fillResult = myFlowAttributesEditor->fillSumoBaseObject(baseObject, true);
138 if (fillResult != SUMO_ATTR_NOTHING) {
139 return fillResult;
140 }
141 fillResult = myGeoAttributesEditor->fillSumoBaseObject(baseObject, true);
142 if (fillResult != SUMO_ATTR_NOTHING) {
143 return fillResult;
144 }
145 fillResult = myParametersAttributesEditor->fillSumoBaseObject(baseObject, true);
146 if (fillResult != SUMO_ATTR_NOTHING) {
147 return fillResult;
148 }
149 fillResult = myNeteditAttributesEditor->fillSumoBaseObject(baseObject, true);
150 if (fillResult != SUMO_ATTR_NOTHING) {
151 return fillResult;
152 }
153 return fillResult;
154}
155
156
157bool
161
162
163bool
167
168
169void
173
174
175void
179
180/****************************************************************************/
#define TL(string)
Definition MsgHandler.h:305
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
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