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