Skip to content

Commit

Permalink
fix #14801
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 1, 2024
1 parent 766b994 commit 7a9d32b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
9 changes: 9 additions & 0 deletions src/netedit/GNEViewNetHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,15 @@ GNEViewNetHelper::ViewObjectsSelector::getEdges() const {
return myViewObjects.edges;
}

const std::vector<GNETAZ*>&
GNEViewNetHelper::ViewObjectsSelector::getTAZs() const {
return myViewObjects.TAZs;
}

const std::vector<GNEAdditional*>&
GNEViewNetHelper::ViewObjectsSelector::getAdditionals() const {
return myViewObjects.additionals;
}

const std::vector<GNEDemandElement*>&
GNEViewNetHelper::ViewObjectsSelector::getDemandElements() const {
Expand Down
6 changes: 6 additions & 0 deletions src/netedit/GNEViewNetHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ struct GNEViewNetHelper {
/// @brief get vector with edges
const std::vector<GNEEdge*>& getEdges() const;

/// @brief get vector with TAZs
const std::vector<GNETAZ*>& getTAZs() const;

/// @brief get vector with additionals
const std::vector<GNEAdditional*>& getAdditionals() const;

/// @brief get vector with Demand Elements
const std::vector<GNEDemandElement*>& getDemandElements() const;

Expand Down
33 changes: 19 additions & 14 deletions src/netedit/frames/demand/GNEPersonFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ GNEPersonFrame::addPerson(const GNEViewNetHelper::ViewObjectsSelector& viewObjec
}
// obtain tags (only for improve code legibility)
SumoXMLTag personTag = myPersonTagSelector->getCurrentTemplateAC()->getTagProperty().getTag();
SumoXMLTag clickedACTag = viewObjects.getAttributeCarrierFront()->getTagProperty().getTag();
// first check that current selected person is valid
if (personTag == SUMO_TAG_NOTHING) {
myViewNet->setStatusBarText(TL("Current selected person isn't valid."));
Expand All @@ -118,20 +117,26 @@ GNEPersonFrame::addPerson(const GNEViewNetHelper::ViewObjectsSelector& viewObjec
myViewNet->setStatusBarText(TL("Current selected person plan isn't valid."));
return false;
}
// add elements to path creator
if (clickedACTag == SUMO_TAG_LANE) {
return myPlanCreator->addEdge(viewObjects.getLaneFront());
} else if (viewObjects.getAttributeCarrierFront()->getTagProperty().isStoppingPlace()) {
return myPlanCreator->addStoppingPlace(viewObjects.getAdditionalFront());
} else if (clickedACTag == SUMO_TAG_ROUTE) {
return myPlanCreator->addRoute(viewObjects.getDemandElementFront());
} else if (clickedACTag == SUMO_TAG_JUNCTION) {
return myPlanCreator->addJunction(viewObjects.getJunctionFront());
} else if (clickedACTag == SUMO_TAG_TAZ) {
return myPlanCreator->addTAZ(viewObjects.getTAZFront());
} else {
return false;
for (GNEAdditional* o : viewObjects.getAdditionals()) {
if (o->getTagProperty().isStoppingPlace()) {
return myPlanCreator->addStoppingPlace(o);
}
}
for (GNEDemandElement* o : viewObjects.getDemandElements()) {
if (o->getTagProperty().getTag() == SUMO_TAG_ROUTE) {
return myPlanCreator->addRoute(o);
}
}
for (GNELane* o : viewObjects.getLanes()) {
return myPlanCreator->addEdge(o);
}
for (GNEJunction* o : viewObjects.getJunctions()) {
return myPlanCreator->addJunction(o);
}
for (GNETAZ* o : viewObjects.getTAZs()) {
return myPlanCreator->addTAZ(o);
}
return false;
}


Expand Down

0 comments on commit 7a9d32b

Please sign in to comment.