Skip to content

Commit

Permalink
fix #14733
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 18, 2024
1 parent 3140f93 commit 94d8ea7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/netedit/elements/GNETagProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ GNETagProperties::isType() const {
return (myTagType & VTYPE) != 0;
}

bool
GNETagProperties::isTypeDist() const {
return myTag == SUMO_TAG_VTYPE_DISTRIBUTION;
}

bool
GNETagProperties::isVehicle() const {
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/elements/GNETagProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ class GNETagProperties {
/// @brief return true if tag correspond to a vehicle/person/container type element
bool isType() const;

/// @brief return true if tag correspond to a type distribution element
bool isTypeDist() const;

/// @brief return true if tag correspond to a vehicle element
bool isVehicle() const;

Expand Down
3 changes: 2 additions & 1 deletion src/netedit/elements/demand/GNEDemandElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ GNEDemandElement*
GNEDemandElement::getTypeParent() const {
if (getParentDemandElements().size() < 1) {
throw InvalidArgument("This demand element doesn't have a type parent");
} else if (!getParentDemandElements().at(0)->getTagProperty().isType()) {
} else if (!getParentDemandElements().at(0)->getTagProperty().isType()
&& !getParentDemandElements().at(0)->getTagProperty().isTypeDist()) {
throw InvalidArgument("The first parent isn't a type");
} else if (getParentDemandElements().at(0)->getTagProperty().getTag() == SUMO_TAG_VTYPE) {
return getParentDemandElements().at(0);
Expand Down

0 comments on commit 94d8ea7

Please sign in to comment.