Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/GNETagProperties.cpp
169665 views
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
/****************************************************************************/
14
/// @file GNETagProperties.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2020
17
///
18
// Abstract Base class for tag properties used in GNEAttributeCarrier
19
/****************************************************************************/
20
21
#include "GNETagProperties.h"
22
23
// ===========================================================================
24
// method definitions
25
// ===========================================================================
26
27
GNETagProperties::GNETagProperties(const SumoXMLTag tag, GNETagProperties* parent, const Type tagType,
28
const Property tagProperty, const Over myTagOver, const Conflicts conflicts,
29
const GUIIcon icon, const GUIGlObjectType GLType, const SumoXMLTag XMLTag,
30
const std::string tooltip, const std::vector<SumoXMLTag> XMLParentTags,
31
const unsigned int backgroundColor, const std::string selectorText) :
32
myTag(tag),
33
myTagStr(toString(tag)),
34
myParent(parent),
35
myTagType(tagType),
36
myTagProperty(tagProperty),
37
myTagOver(myTagOver),
38
myConflicts(conflicts),
39
myIcon(icon),
40
myGLType(GLType),
41
myXMLTag(XMLTag),
42
myTooltipText(tooltip),
43
myXMLParentTags(XMLParentTags),
44
mySelectorText(selectorText.empty() ? toString(tag) : selectorText),
45
myBackgroundColor(backgroundColor) {
46
if (parent) {
47
parent->addChild(this);
48
}
49
}
50
51
52
GNETagProperties::GNETagProperties(const SumoXMLTag tag, GNETagProperties* parent, const GUIIcon icon, const std::string tooltip,
53
const unsigned int backgroundColor, const std::string selectorText) :
54
myTag(tag),
55
myTagStr(toString(tag)),
56
myParent(parent),
57
myTagProperty(Property::HIERARCHICAL),
58
myIcon(icon),
59
myXMLTag(tag),
60
myTooltipText(tooltip),
61
mySelectorText(selectorText.empty() ? toString(tag) : selectorText),
62
myBackgroundColor(backgroundColor) {
63
if (parent) {
64
parent->addChild(this);
65
}
66
}
67
68
69
GNETagProperties::~GNETagProperties() {
70
for (const auto& attrProperties : myAttributeProperties) {
71
delete attrProperties;
72
}
73
}
74
75
76
SumoXMLTag
77
GNETagProperties::getTag() const {
78
return myTag;
79
}
80
81
82
const std::string&
83
GNETagProperties::getTagStr() const {
84
return myTagStr;
85
}
86
87
88
void
89
GNETagProperties::checkTagIntegrity() const {
90
// check integrity only in debug mode
91
#ifdef DEBUG
92
// check that this edge has parents (Except supermodes)
93
if (myTag == SUMO_TAG_ROOTFILE) {
94
if (myParent != nullptr) {
95
throw ProcessError("Root parent must be empty");
96
}
97
} else if (myParent == nullptr) {
98
throw ProcessError("No parent defined");
99
}
100
// check network parents
101
if (isNetworkElement() && (myParent->getTag() != SUMO_TAG_NET)) {
102
throw ProcessError("Invalid network element parent");
103
}
104
// check additional parents
105
if (isStoppingPlace()) {
106
if (myParent->getTag() != GNE_TAG_STOPPINGPLACES) {
107
throw ProcessError("Invalid stoppingPlace parent");
108
}
109
} else if (isDetector()) {
110
if (myParent->getTag() != GNE_TAG_DETECTORS) {
111
throw ProcessError("Invalid detector parent");
112
}
113
} else if (isWireElement()) {
114
if (myParent->getTag() != GNE_TAG_WIRES) {
115
throw ProcessError("Invalid wire parent");
116
}
117
} else if (isJuPedSimElement()) {
118
if (myParent->getTag() != GNE_TAG_JUPEDSIM) {
119
throw ProcessError("Invalid juPedSim parent");
120
}
121
} else if (isTAZElement()) {
122
if (myParent->getTag() != GNE_TAG_TAZS) {
123
throw ProcessError("Invalid TAZ parent");
124
}
125
} else if (isShapeElement()) {
126
if (myParent->getTag() != GNE_TAG_SHAPES) {
127
throw ProcessError("Invalid shape parent");
128
}
129
} else if (isAdditionalElement()) {
130
if (myParent->getTag() != SUMO_TAG_VIEWSETTINGS_ADDITIONALS) {
131
throw ProcessError("Invalid additional parent");
132
}
133
}
134
// check demand parents
135
if (isVehicle()) {
136
if (myParent->getTag() != SUMO_TAG_VIEWSETTINGS_VEHICLES) {
137
throw ProcessError("Invalid vehicle parent");
138
}
139
} else if (isVehicleStop()) {
140
if (myParent->getTag() != GNE_TAG_STOPS) {
141
throw ProcessError("Invalid vehicle stop parent");
142
}
143
} else if (isPlanPersonTrip()) {
144
if (myParent->getTag() != GNE_TAG_PERSONTRIPS) {
145
throw ProcessError("Invalid person trip parent");
146
}
147
} else if (isPlanRide()) {
148
if (myParent->getTag() != GNE_TAG_RIDES) {
149
throw ProcessError("Invalid ride parent");
150
}
151
} else if (isPlanWalk()) {
152
if (myParent->getTag() != GNE_TAG_WALKS) {
153
throw ProcessError("Invalid walk parent");
154
}
155
} else if (isPlanStopPerson()) {
156
if (myParent->getTag() != GNE_TAG_PERSONSTOPS) {
157
throw ProcessError("Invalid person stop parent");
158
}
159
} else if (isPlanPerson()) {
160
if (myParent->getTag() != GNE_TAG_PERSONPLANS) {
161
throw ProcessError("Invalid person plan parent");
162
}
163
} else if (isPlanTransport()) {
164
if (myParent->getTag() != GNE_TAG_TRANSPORTS) {
165
throw ProcessError("Invalid ride parent");
166
}
167
} else if (isPlanTranship()) {
168
if (myParent->getTag() != GNE_TAG_TRANSHIPS) {
169
throw ProcessError("Invalid walk parent");
170
}
171
} else if (isPlanStopContainer()) {
172
if (myParent->getTag() != GNE_TAG_CONTAINERSTOPS) {
173
throw ProcessError("Invalid container stop parent");
174
}
175
} else if (isPlanContainer()) {
176
if (myParent->getTag() != GNE_TAG_CONTAINERPLANS) {
177
throw ProcessError("Invalid container plan parent");
178
}
179
} else if (isDemandElement()) {
180
if (myParent->getTag() != GNE_TAG_SUPERMODE_DEMAND) {
181
throw ProcessError("Invalid supermode demand parent");
182
}
183
}
184
// check data parents
185
if (isGenericData()) {
186
if (myParent->getTag() != GNE_TAG_DATAS) {
187
throw ProcessError("Invalid generic data parent");
188
}
189
} else if (isDataElement()) {
190
if (myParent->getTag() != GNE_TAG_SUPERMODE_DATA) {
191
throw ProcessError("Invalid supermode data parent");
192
}
193
}
194
// check that element must ist at least networkElement, Additional, or shape
195
if (!isNetworkElement() && !isAdditionalElement() && !isDemandElement() && !isDataElement() && !isMeanData() && !isInternalLane() && !isOtherElement()) {
196
throw ProcessError("no basic type property defined");
197
}
198
// check that element only is networkElement, Additional, or shape at the same time
199
if ((isNetworkElement() + isAdditionalElement() + isDemandElement() + isDataElement() + isMeanData() + isOtherElement()) > 1) {
200
throw ProcessError("multiple basic type properties defined");
201
}
202
// check that element only is shape, TAZ, or wire at the same time
203
if ((isShapeElement() + isTAZElement() + isWireElement()) > 1) {
204
throw ProcessError("element can be either shape or TAZ or wire element at the same time");
205
}
206
// check that master tag is valid
207
if (isChild() && myXMLParentTags.empty()) {
208
throw FormatException("Parent tags cannot be empty");
209
}
210
// check that master was defined
211
if (!isChild() && !myXMLParentTags.empty()) {
212
throw FormatException("Element doesn't support parent elements");
213
}
214
// check reparent
215
if (!isChild() && canBeReparent()) {
216
throw FormatException("Only Child elements can be reparent");
217
}
218
// check vClass icons
219
if (vClassIcon() && !hasAttribute(SUMO_ATTR_VCLASS)) {
220
throw FormatException("Element require attribute SUMO_ATTR_VCLASS");
221
}
222
// check glType
223
if (!isHierarchicalTag() && (myGLType == GUIGlObjectType::GLO_MAX)) {
224
throw FormatException("Only hierarchical tags can have a GLType GLO_MAX");
225
}
226
// check integrity of all attributes
227
for (const auto& attributeProperty : myAttributeProperties) {
228
attributeProperty->checkAttributeIntegrity();
229
// check that if attribute is vehicle classes, own a combination of Allow/disallow attribute
230
if (attributeProperty->isSVCPermission()) {
231
if ((attributeProperty->getAttr() != SUMO_ATTR_ALLOW) && (attributeProperty->getAttr() != SUMO_ATTR_DISALLOW) &&
232
(attributeProperty->getAttr() != SUMO_ATTR_CHANGE_LEFT) && (attributeProperty->getAttr() != SUMO_ATTR_CHANGE_RIGHT) &&
233
(attributeProperty->getAttr() != GNE_ATTR_STOPOEXCEPTION)) {
234
throw ProcessError("Attributes aren't combinables");
235
} else if ((attributeProperty->getAttr() == SUMO_ATTR_ALLOW) && !hasAttribute(SUMO_ATTR_DISALLOW)) {
236
throw ProcessError("allow need a disallow attribute in the same tag");
237
} else if ((attributeProperty->getAttr() == SUMO_ATTR_DISALLOW) && !hasAttribute(SUMO_ATTR_ALLOW)) {
238
throw ProcessError("disallow need an allow attribute in the same tag");
239
}
240
}
241
}
242
#endif // DEBUG
243
}
244
245
246
const std::string&
247
GNETagProperties::getDefaultStringValue(SumoXMLAttr attr) const {
248
// iterate over attribute properties
249
for (const auto& attributeProperty : myAttributeProperties) {
250
if (attributeProperty->getAttr() == attr) {
251
return attributeProperty->getDefaultStringValue();
252
}
253
}
254
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
255
}
256
257
258
int
259
GNETagProperties::getDefaultIntValue(SumoXMLAttr attr) const {
260
// iterate over attribute properties
261
for (const auto& attributeProperty : myAttributeProperties) {
262
if (attributeProperty->getAttr() == attr) {
263
return attributeProperty->getDefaultIntValue();
264
}
265
}
266
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
267
}
268
269
270
double
271
GNETagProperties::getDefaultDoubleValue(SumoXMLAttr attr) const {
272
// iterate over attribute properties
273
for (const auto& attributeProperty : myAttributeProperties) {
274
if (attributeProperty->getAttr() == attr) {
275
return attributeProperty->getDefaultDoubleValue();
276
}
277
}
278
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
279
}
280
281
282
SUMOTime
283
GNETagProperties::getDefaultTimeValue(SumoXMLAttr attr) const {
284
// iterate over attribute properties
285
for (const auto& attributeProperty : myAttributeProperties) {
286
if (attributeProperty->getAttr() == attr) {
287
return attributeProperty->getDefaultTimeValue();
288
}
289
}
290
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
291
}
292
293
294
bool
295
GNETagProperties::getDefaultBoolValue(SumoXMLAttr attr) const {
296
// iterate over attribute properties
297
for (const auto& attributeProperty : myAttributeProperties) {
298
if (attributeProperty->getAttr() == attr) {
299
return attributeProperty->getDefaultBoolValue();
300
}
301
}
302
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
303
}
304
305
306
const RGBColor&
307
GNETagProperties::getDefaultColorValue(SumoXMLAttr attr) const {
308
// iterate over attribute properties
309
for (const auto& attributeProperty : myAttributeProperties) {
310
if (attributeProperty->getAttr() == attr) {
311
return attributeProperty->getDefaultColorValue();
312
}
313
}
314
throw ProcessError(TLF("Attribute '%' not defined", toString(attr)));
315
}
316
317
318
const std::string&
319
GNETagProperties::getSelectorText() const {
320
return mySelectorText;
321
}
322
323
324
const std::string&
325
GNETagProperties::getTooltipText() const {
326
return myTooltipText;
327
}
328
329
330
unsigned int
331
GNETagProperties::getBackGroundColor() const {
332
return myBackgroundColor;
333
}
334
335
336
const std::vector<const GNEAttributeProperties*>&
337
GNETagProperties::getAttributeProperties() const {
338
return myAttributeProperties;
339
}
340
341
342
const GNEAttributeProperties*
343
GNETagProperties::getAttributeProperties(SumoXMLAttr attr) const {
344
// iterate over attribute properties
345
for (const auto& attributeProperty : myAttributeProperties) {
346
if ((attributeProperty->getAttr() == attr) || (attributeProperty->hasAttrSynonym() && (attributeProperty->getAttrSynonym() == attr))) {
347
return attributeProperty;
348
}
349
}
350
// throw error if these attribute doesn't exist
351
throw ProcessError(TLF("Attribute '%' doesn't exist", toString(attr)));
352
}
353
354
355
const GNEAttributeProperties*
356
GNETagProperties::getAttributeProperties(const int index) const {
357
if (index < 0 || index >= (int)myAttributeProperties.size()) {
358
throw ProcessError(TLF("Invalid index '%' used in getAttributeProperties(int)", toString(index)));
359
} else {
360
return myAttributeProperties.at(index);
361
}
362
}
363
364
365
const GNEAttributeProperties*
366
GNETagProperties::at(int index) const {
367
return myAttributeProperties.at(index);
368
}
369
370
371
bool
372
GNETagProperties::hasAttribute(SumoXMLAttr attr) const {
373
// iterate over attribute properties
374
for (const auto& attributeProperty : myAttributeProperties) {
375
if (attributeProperty->getAttr() == attr) {
376
return true;
377
}
378
}
379
return false;
380
}
381
382
383
int
384
GNETagProperties::getNumberOfAttributes() const {
385
return (int)myAttributeProperties.size();
386
}
387
388
389
GUIIcon
390
GNETagProperties::getGUIIcon() const {
391
return myIcon;
392
}
393
394
395
GUIGlObjectType
396
GNETagProperties::getGLType() const {
397
return myGLType;
398
}
399
400
401
SumoXMLTag
402
GNETagProperties::getXMLTag() const {
403
return myXMLTag;
404
}
405
406
407
const std::vector<SumoXMLTag>&
408
GNETagProperties::getXMLParentTags() const {
409
return myXMLParentTags;
410
}
411
412
413
const GNETagProperties*
414
GNETagProperties::getHierarchicalParent() const {
415
return myParent;
416
}
417
418
419
const std::vector<const GNETagProperties*>
420
GNETagProperties::getHierarchicalParentsRecuersively() const {
421
// get the list of all roots
422
std::vector<const GNETagProperties*> parents;
423
parents.push_back(this);
424
while (parents.back()->myParent != nullptr) {
425
parents.push_back(parents.back()->myParent);
426
}
427
std::reverse(parents.begin(), parents.end());
428
return parents;
429
}
430
431
432
const std::vector<const GNETagProperties*>&
433
GNETagProperties::getHierarchicalChildren() const {
434
return myChildren;
435
}
436
437
438
std::vector<const GNETagProperties*>
439
GNETagProperties::getHierarchicalChildrenRecursively() const {
440
std::vector<const GNETagProperties*> children;
441
// obtain all tags recursively (including this)
442
getChildrenTagProperties(this, children);
443
return children;
444
}
445
446
447
std::map<std::string, const GNEAttributeProperties*>
448
GNETagProperties::getHierarchicalChildrenAttributesRecursively(const bool onlyCommon, const bool onlyDrawables) const {
449
std::map<std::string, const GNEAttributeProperties*> allChildrenAttributes;
450
// obtain all children attributes recursively (including this)
451
getChildrenAttributes(this, allChildrenAttributes, onlyDrawables);
452
// check if get only commons
453
if (onlyCommon) {
454
std::map<std::string, const GNEAttributeProperties*> commonChildrenAttributes;
455
// get all tag children and take only the common attributes
456
const auto tagChildren = getHierarchicalChildrenRecursively();
457
// iterate over all children and check if exist in child tag
458
for (const auto& attributeChild : allChildrenAttributes) {
459
bool isCommon = true;
460
for (const auto tagChild : tagChildren) {
461
if ((!onlyDrawables || tagChild->isDrawable()) && // filter only drawables
462
!tagChild->isHierarchicalTag() && // hierarchical tags doesn't have attirbutes
463
!tagChild->hasAttribute(attributeChild.second->getAttr())) {
464
isCommon = false;
465
}
466
}
467
if (isCommon) {
468
commonChildrenAttributes.insert(attributeChild);
469
}
470
}
471
return commonChildrenAttributes;
472
} else {
473
return allChildrenAttributes;
474
}
475
}
476
477
478
Supermode
479
GNETagProperties::getSupermode() const {
480
if (myParent == nullptr) {
481
throw ProcessError("Root doesn't have an associated supermode");
482
} else {
483
auto parents = getHierarchicalParentsRecuersively();
484
// continue depending of supermode
485
if (parents.at(1)->getTag() == GNE_TAG_SUPERMODE_NETWORK) {
486
return Supermode::NETWORK;
487
} else if (parents.at(1)->getTag() == GNE_TAG_SUPERMODE_DEMAND) {
488
return Supermode::DEMAND;
489
} else if (parents.at(1)->getTag() == GNE_TAG_SUPERMODE_DATA) {
490
return Supermode::DATA;
491
} else {
492
throw ProcessError("Invalid supermode");
493
}
494
}
495
}
496
497
498
bool
499
GNETagProperties::isHierarchicalTag() const {
500
return myTagProperty & Property::HIERARCHICAL;
501
}
502
503
504
bool
505
GNETagProperties::isNetworkElement() const {
506
return myTagType & Type::NETWORKELEMENT;
507
}
508
509
510
bool
511
GNETagProperties::isAdditionalElement() const {
512
return myTagType & Type::ADDITIONALELEMENT;
513
}
514
515
516
bool
517
GNETagProperties::isAdditionalPureElement() const {
518
return (isAdditionalElement() && !isShapeElement() && !isTAZElement() && !isWireElement());
519
}
520
521
522
bool
523
GNETagProperties::isDemandElement() const {
524
return myTagType & Type::DEMANDELEMENT;
525
}
526
527
528
bool
529
GNETagProperties::isDataElement() const {
530
return myTagType & Type::DATAELEMENT;
531
}
532
533
534
bool
535
GNETagProperties::isOtherElement() const {
536
return myTagType & Type::OTHER;
537
}
538
539
540
bool
541
GNETagProperties::isStoppingPlace() const {
542
return myTagType & Type::STOPPINGPLACE;
543
}
544
545
546
bool
547
GNETagProperties::isDetector() const {
548
return myTagType & Type::DETECTOR;
549
}
550
551
552
bool
553
GNETagProperties::isCalibrator() const {
554
return myTagType & Type::CALIBRATOR;
555
}
556
557
558
bool
559
GNETagProperties::isShapeElement() const {
560
return myTagType & Type::SHAPE;
561
}
562
563
564
bool
565
GNETagProperties::isTAZElement() const {
566
return myTagType & Type::TAZELEMENT;
567
}
568
569
570
bool
571
GNETagProperties::isWireElement() const {
572
return myTagType & Type::WIRE;
573
}
574
575
576
bool
577
GNETagProperties::isJuPedSimElement() const {
578
return myTagType & Type::JUPEDSIM;
579
}
580
581
582
bool
583
GNETagProperties::isType() const {
584
return myTagType & Type::VTYPE;
585
}
586
587
bool
588
GNETagProperties::isTypeDist() const {
589
return myTag == SUMO_TAG_VTYPE_DISTRIBUTION;
590
}
591
592
bool
593
GNETagProperties::isVehicle() const {
594
return myTagType & Type::VEHICLE;
595
}
596
597
598
bool
599
GNETagProperties::isRoute() const {
600
return myTagType & Type::ROUTE;
601
}
602
603
604
bool
605
GNETagProperties::isVehicleStop() const {
606
return myTagType & Type::STOP_VEHICLE;
607
}
608
609
610
bool
611
GNETagProperties::isVehicleWaypoint() const {
612
return myTagType & Type::WAYPOINT_VEHICLE;
613
}
614
615
616
bool
617
GNETagProperties::isFlow() const {
618
return myTagType & Type::FLOW;
619
}
620
621
622
bool
623
GNETagProperties::isPerson() const {
624
return myTagType & Type::PERSON;
625
}
626
627
628
bool
629
GNETagProperties::isContainer() const {
630
return myTagType & Type::CONTAINER;
631
}
632
633
634
bool
635
GNETagProperties::hasTypeParent() const {
636
return isVehicle() || isPerson() || isContainer();
637
}
638
639
640
bool
641
GNETagProperties::isPlan() const {
642
return isPlanPerson() || isPlanContainer();
643
}
644
645
646
bool
647
GNETagProperties::isPlanPerson() const {
648
return myTagType & Type::PERSONPLAN;
649
}
650
651
652
bool
653
GNETagProperties::isPlanContainer() const {
654
return myTagType & Type::CONTAINERPLAN;
655
}
656
657
658
bool
659
GNETagProperties::isPlanPersonTrip() const {
660
return myTagType & Type::PERSONTRIP;
661
}
662
663
664
bool
665
GNETagProperties::isPlanWalk() const {
666
return myTagType & Type::WALK;
667
}
668
669
670
bool
671
GNETagProperties::isPlanRide() const {
672
return myTagType & Type::RIDE;
673
}
674
675
676
bool
677
GNETagProperties::isPlanTransport() const {
678
return myTagType & Type::TRANSPORT;
679
}
680
681
682
bool
683
GNETagProperties::isPlanTranship() const {
684
return myTagType & Type::TRANSHIP;
685
}
686
687
688
bool
689
GNETagProperties::isPlanStop() const {
690
return isPlanStopPerson() || isPlanStopContainer();
691
}
692
693
694
bool
695
GNETagProperties::isPlanStopPerson() const {
696
return myTagType & Type::STOP_PERSON;
697
}
698
699
700
bool
701
GNETagProperties::isPlanStopContainer() const {
702
return myTagType & Type::STOP_CONTAINER;
703
}
704
705
706
bool
707
GNETagProperties::isGenericData() const {
708
return myTagType & Type::GENERICDATA;
709
}
710
711
712
bool
713
GNETagProperties::isMeanData() const {
714
return myTagType & Type::MEANDATA;
715
}
716
717
718
bool
719
GNETagProperties::vehicleRoute() const {
720
return isVehicle() && (myTagOver & Over::ROUTE);
721
}
722
723
724
bool
725
GNETagProperties::vehicleRouteEmbedded() const {
726
return isVehicle() && (myTagOver & Over::ROUTE_EMBEDDED);
727
}
728
729
730
bool
731
GNETagProperties::vehicleEdges() const {
732
return isVehicle() && (myTagOver & Over::FROM_EDGE) && (myTagOver & Over::TO_EDGE);
733
}
734
735
736
bool
737
GNETagProperties::vehicleJunctions() const {
738
return isVehicle() && (myTagOver & Over::FROM_JUNCTION) && (myTagOver & Over::TO_JUNCTION);
739
}
740
741
742
bool
743
GNETagProperties::vehicleTAZs() const {
744
return isVehicle() && (myTagOver & Over::FROM_TAZ) && (myTagOver & Over::TO_TAZ);
745
}
746
747
748
bool
749
GNETagProperties::planConsecutiveEdges() const {
750
return isPlan() && (myTagOver & Over::CONSECUTIVE_EDGES);
751
}
752
753
754
bool
755
GNETagProperties::planRoute() const {
756
return isPlan() && (myTagOver & Over::ROUTE);
757
}
758
759
760
bool
761
GNETagProperties::planEdge() const {
762
return isPlan() && (myTagOver & Over::EDGE);
763
}
764
765
766
bool
767
GNETagProperties::planBusStop() const {
768
return isPlan() && (myTagOver & Over::BUSSTOP);
769
}
770
771
772
bool
773
GNETagProperties::planTrainStop() const {
774
return isPlan() && (myTagOver & Over::TRAINSTOP);
775
}
776
777
778
bool
779
GNETagProperties::planContainerStop() const {
780
return isPlan() && (myTagOver & Over::CONTAINERSTOP);
781
}
782
783
784
bool
785
GNETagProperties::planChargingStation() const {
786
return isPlan() && (myTagOver & Over::CHARGINGSTATION);
787
}
788
789
790
bool
791
GNETagProperties::planParkingArea() const {
792
return isPlan() && (myTagOver & Over::PARKINGAREA);
793
}
794
795
796
bool
797
GNETagProperties::planStoppingPlace() const {
798
return planBusStop() || planTrainStop() || planContainerStop() ||
799
planChargingStation() || planParkingArea();
800
}
801
802
803
bool
804
GNETagProperties::planFromTo() const {
805
return planFromEdge() || planToEdge() ||
806
planFromJunction() || planToJunction() ||
807
planFromTAZ() || planToTAZ() ||
808
planFromStoppingPlace() || planToStoppingPlace();
809
}
810
811
812
bool
813
GNETagProperties::planFromEdge() const {
814
return (myTagOver & Over::FROM_EDGE);
815
}
816
817
818
bool
819
GNETagProperties::planFromTAZ() const {
820
return isPlan() && (myTagOver & Over::FROM_TAZ);
821
}
822
823
824
bool
825
GNETagProperties::planFromJunction() const {
826
return isPlan() && (myTagOver & Over::FROM_JUNCTION);
827
}
828
829
830
bool
831
GNETagProperties::planFromBusStop() const {
832
return isPlan() && (myTagOver & Over::FROM_BUSSTOP);
833
}
834
835
836
bool
837
GNETagProperties::planFromTrainStop() const {
838
return isPlan() && (myTagOver & Over::FROM_TRAINSTOP);
839
}
840
841
842
bool
843
GNETagProperties::planFromContainerStop() const {
844
return isPlan() && (myTagOver & Over::FROM_CONTAINERSTOP);
845
}
846
847
848
bool
849
GNETagProperties::planFromChargingStation() const {
850
return isPlan() && (myTagOver & Over::FROM_CHARGINGSTATION);
851
}
852
853
854
bool
855
GNETagProperties::planFromParkingArea() const {
856
return isPlan() && (myTagOver & Over::FROM_PARKINGAREA);
857
}
858
859
860
bool
861
GNETagProperties::planFromStoppingPlace() const {
862
return planFromBusStop() || planFromTrainStop() || planFromContainerStop() ||
863
planFromChargingStation() || planFromParkingArea();
864
}
865
866
867
bool
868
GNETagProperties::planToEdge() const {
869
return isPlan() && (myTagOver & Over::TO_EDGE);
870
}
871
872
873
bool
874
GNETagProperties::planToTAZ() const {
875
return isPlan() && (myTagOver & Over::TO_TAZ);
876
}
877
878
879
bool
880
GNETagProperties::planToJunction() const {
881
return isPlan() && (myTagOver & Over::TO_JUNCTION);
882
}
883
884
bool
885
GNETagProperties::planToBusStop() const {
886
return isPlan() && (myTagOver & Over::TO_BUSSTOP);
887
}
888
889
890
bool
891
GNETagProperties::planToTrainStop() const {
892
return isPlan() && (myTagOver & Over::TO_TRAINSTOP);
893
}
894
895
896
bool
897
GNETagProperties::planToContainerStop() const {
898
return isPlan() && (myTagOver & Over::TO_CONTAINERSTOP);
899
}
900
901
902
bool
903
GNETagProperties::planToChargingStation() const {
904
return isPlan() && (myTagOver & Over::TO_CHARGINGSTATION);
905
}
906
907
908
bool
909
GNETagProperties::planToParkingArea() const {
910
return isPlan() && (myTagOver & Over::TO_PARKINGAREA);
911
}
912
913
914
bool
915
GNETagProperties::planToStoppingPlace() const {
916
return planToBusStop() || planToTrainStop() || planToContainerStop() ||
917
planToChargingStation() || planToParkingArea();
918
}
919
920
921
bool
922
GNETagProperties::isChild() const {
923
return (myTagProperty & Property::XMLCHILD) ;
924
}
925
926
927
bool
928
GNETagProperties::isSymbol() const {
929
return (myTagProperty & Property::SYMBOL) ;
930
}
931
932
933
bool
934
GNETagProperties::isInternalLane() const {
935
return (myTagType & Type::INTERNALLANE) ;
936
}
937
938
939
bool
940
GNETagProperties::isDrawable() const {
941
return (myTagProperty & Property::NOTDRAWABLE) == false;
942
}
943
944
945
bool
946
GNETagProperties::isSelectable() const {
947
// note: By default all elements can be selected, except Tags with "NOTSELECTABLE"
948
return (myTagProperty & Property::NOTSELECTABLE) == false;
949
}
950
951
952
bool
953
GNETagProperties::hasGEOShape() const {
954
return (myTagProperty & Property::GEOSHAPE) ;
955
}
956
957
958
bool
959
GNETagProperties::hasDialog() const {
960
return (myTagProperty & Property::DIALOG) ;
961
}
962
963
964
bool
965
GNETagProperties::hasExtendedAttributes() const {
966
return (myTagProperty & Property::EXTENDED) ;
967
}
968
969
970
bool
971
GNETagProperties::hasParameters() const {
972
// note: By default all elements support parameters, except Tags with "NOPARAMETERS"
973
return (myTagProperty & Property::NOPARAMETERS) == false;
974
}
975
976
977
bool
978
GNETagProperties::isPlacedInRTree() const {
979
return (myTagProperty & Property::RTREE) ;
980
}
981
982
983
bool
984
GNETagProperties::isListedElement() const {
985
return (myTagProperty & Property::LISTED) ;
986
}
987
988
989
bool
990
GNETagProperties::canBeReparent() const {
991
return (myTagProperty & Property::REPARENT) ;
992
}
993
994
995
bool
996
GNETagProperties::canCenterCameraAfterCreation() const {
997
return (myTagProperty & Property::CENTERAFTERCREATION) ;
998
}
999
1000
1001
bool
1002
GNETagProperties::requireProj() const {
1003
return (myTagProperty & Property::REQUIRE_PROJ) ;
1004
}
1005
1006
1007
bool
1008
GNETagProperties::vClassIcon() const {
1009
return (myTagProperty & Property::VCLASS_ICON) ;
1010
}
1011
1012
1013
void
1014
GNETagProperties::addChild(const GNETagProperties* child) {
1015
myChildren.push_back(child);
1016
}
1017
1018
1019
void
1020
GNETagProperties::getChildrenTagProperties(const GNETagProperties* tagProperties, std::vector<const GNETagProperties*>& result) const {
1021
result.push_back(tagProperties);
1022
// call it iterative for all children
1023
for (const auto& child : tagProperties->myChildren) {
1024
getChildrenTagProperties(child, result);
1025
}
1026
}
1027
1028
1029
void
1030
GNETagProperties::getChildrenAttributes(const GNETagProperties* tagProperties, std::map<std::string, const GNEAttributeProperties*>& result, const bool onlyDrawables) const {
1031
// add every attribute only once
1032
if (!onlyDrawables || tagProperties->isDrawable()) {
1033
for (const auto& attributeProperty : tagProperties->myAttributeProperties) {
1034
result[attributeProperty->getAttrStr()] = attributeProperty;
1035
}
1036
}
1037
// call it iterative for all children
1038
for (const auto& child : tagProperties->myChildren) {
1039
getChildrenAttributes(child, result, onlyDrawables);
1040
}
1041
}
1042
1043
/****************************************************************************/
1044
1045