Skip to content

Commit

Permalink
Updated demand elements. Refs eclipse-sumo#11593
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Sep 14, 2022
1 parent 64fde98 commit 18dbb95
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 155 deletions.
11 changes: 6 additions & 5 deletions src/netedit/elements/demand/GNEContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ GNEContainer::GNESelectedContainersPopupMenu::onCmdTransform(FXObject* obj, FXSe
// ===========================================================================

GNEContainer::GNEContainer(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_CONTAINER, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {}, {}) {
GNEDemandElement("", net, GLO_CONTAINER, tag, GUIIconSubSys::getIcon(GUIIcon::CONTAINER),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}) {
// reset default values
resetDefaultValues();
// set end and vehPerHours
Expand All @@ -172,9 +172,10 @@ GNEContainer::GNEContainer(SumoXMLTag tag, GNENet* net) :


GNEContainer::GNEContainer(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters) :
GNEDemandElement(containerparameters.id, net, (tag == SUMO_TAG_CONTAINERFLOW) ? GLO_CONTAINERFLOW : GLO_CONTAINER, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {pType}, {}),
SUMOVehicleParameter(containerparameters) {
GNEDemandElement(containerparameters.id, net, (tag == SUMO_TAG_CONTAINERFLOW) ? GLO_CONTAINERFLOW : GLO_CONTAINER, tag,
(tag == SUMO_TAG_CONTAINERFLOW) ? GUIIconSubSys::getIcon(GUIIcon::CONTAINERFLOW) : GUIIconSubSys::getIcon(GUIIcon::CONTAINER),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {pType}, {}),
SUMOVehicleParameter(containerparameters) {
// set manually vtypeID (needed for saving)
vtypeid = pType->getID();
// adjust default flow attributes
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/demand/GNEDemandElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ const double GNEDemandElement::myPersonPlanArrivalPositionDiameter = SUMO_const_
// GNEDemandElement - methods
// ---------------------------------------------------------------------------

GNEDemandElement::GNEDemandElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int options,
GNEDemandElement::GNEDemandElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const int options,
const std::vector<GNEJunction*>& junctionParents,
const std::vector<GNEEdge*>& edgeParents,
const std::vector<GNELane*>& laneParents,
const std::vector<GNEAdditional*>& additionalParents,
const std::vector<GNEDemandElement*>& demandElementParents,
const std::vector<GNEGenericData*>& genericDataParents) :
GUIGlObject(type, id),
GUIGlObject(type, id, icon),
GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
GNEPathManager::PathElement(options),
myStackedLabelNumber(0) {
Expand All @@ -59,14 +59,14 @@ GNEDemandElement::GNEDemandElement(const std::string& id, GNENet* net, GUIGlObje
}


GNEDemandElement::GNEDemandElement(GNEDemandElement* demandElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int options,
GNEDemandElement::GNEDemandElement(GNEDemandElement* demandElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const int options,
const std::vector<GNEJunction*>& junctionParents,
const std::vector<GNEEdge*>& edgeParents,
const std::vector<GNELane*>& laneParents,
const std::vector<GNEAdditional*>& additionalParents,
const std::vector<GNEDemandElement*>& demandElementParents,
const std::vector<GNEGenericData*>& genericDataParents) :
GUIGlObject(type, demandElementParent->getID()),
GUIGlObject(type, demandElementParent->getID(), icon),
GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
GNEPathManager::PathElement(options),
myStackedLabelNumber(0) {
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/demand/GNEDemandElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class GNEDemandElement : public GUIGlObject, public GNEHierarchicalElement, publ
* @param[in] demandElementParents vector of demand element parents
* @param[in] genericDataParents vector of generic data parents
*/
GNEDemandElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int pathOptions,
GNEDemandElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const int pathOptions,
const std::vector<GNEJunction*>& junctionParents,
const std::vector<GNEEdge*>& edgeParents,
const std::vector<GNELane*>& laneParents,
Expand All @@ -101,7 +101,7 @@ class GNEDemandElement : public GUIGlObject, public GNEHierarchicalElement, publ
* @param[in] demandElementParents vector of demand element parents
* @param[in] genericDataParents vector of generic data parents
*/
GNEDemandElement(GNEDemandElement* demandElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int pathOptions,
GNEDemandElement(GNEDemandElement* demandElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, const int pathOptions,
const std::vector<GNEJunction*>& junctionParents,
const std::vector<GNEEdge*>& edgeParents,
const std::vector<GNELane*>& laneParents,
Expand Down
11 changes: 6 additions & 5 deletions src/netedit/elements/demand/GNEPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ GNEPerson::GNESelectedPersonsPopupMenu::onCmdTransform(FXObject* obj, FXSelector
// ===========================================================================

GNEPerson::GNEPerson(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_PERSON, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {}, {}) {
GNEDemandElement("", net, GLO_PERSON, tag, GUIIconSubSys::getIcon(GUIIcon::PERSON),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}) {
// reset default values
resetDefaultValues();
// set end and vehPerHours
Expand All @@ -172,9 +172,10 @@ GNEPerson::GNEPerson(SumoXMLTag tag, GNENet* net) :


GNEPerson::GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters) :
GNEDemandElement(personparameters.id, net, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {pType}, {}),
SUMOVehicleParameter(personparameters) {
GNEDemandElement(personparameters.id, net, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag,
(tag == SUMO_TAG_PERSONFLOW) ? GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW) : GUIIconSubSys::getIcon(GUIIcon::PERSON),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {pType}, {}),
SUMOVehicleParameter(personparameters) {
// set manually vtypeID (needed for saving)
vtypeid = pType->getID();
// adjust default flow attributes
Expand Down
17 changes: 8 additions & 9 deletions src/netedit/elements/demand/GNEPersonTrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
// ===========================================================================

GNEPersonTrip::GNEPersonTrip(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_PERSONTRIP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {}, {}),
GNEDemandElement("", net, GLO_PERSONTRIP, tag, GUIIconSubSys::getIcon(GUIIcon::PERSONTRIP_FROMTO),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
myArrivalPosition(0) {
// reset default values
resetDefaultValues();
Expand All @@ -47,8 +47,8 @@ GNEPersonTrip::GNEPersonTrip(SumoXMLTag tag, GNENet* net) :
GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
const std::vector<std::string>& lines) :
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_EDGE, GUIIconSubSys::getIcon(GUIIcon::PERSONTRIP_FROMTO),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myVTypes(types),
myModes(modes),
Expand All @@ -59,8 +59,8 @@ GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdg
GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
const std::vector<std::string>& lines) :
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_BUSSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {fromEdge}, {}, {toBusStop}, {personParent}, {}),
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_BUSSTOP, GUIIconSubSys::getIcon(GUIIcon::PERSONTRIP_BUSSTOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge}, {}, {toBusStop}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myVTypes(types),
myModes(modes),
Expand All @@ -71,9 +71,8 @@ GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEEdg
GNEPersonTrip::GNEPersonTrip(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction,
double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,
const std::vector<std::string>& lines) :
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_JUNCTIONS, GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {
fromJunction, toJunction
}, {}, {}, {}, {personParent}, {}),
GNEDemandElement(personParent, net, GLO_PERSONTRIP, GNE_TAG_PERSONTRIP_JUNCTIONS, GUIIconSubSys::getIcon(GUIIcon::PERSONTRIP_JUNCTIONS),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {fromJunction, toJunction}, {}, {}, {}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myVTypes(types),
myModes(modes),
Expand Down
23 changes: 12 additions & 11 deletions src/netedit/elements/demand/GNERide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,30 @@
// ===========================================================================

GNERide::GNERide(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_RIDE, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {}, {}),
myArrivalPosition(0) {
GNEDemandElement("", net, GLO_RIDE, tag, GUIIconSubSys::getIcon(GUIIcon::RIDE_FROMTO),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
myArrivalPosition(0) {
// reset default values
resetDefaultValues();
}


GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge,
double arrivalPosition, const std::vector<std::string>& lines) :
GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_EDGE, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myLines(lines) {
GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_EDGE, GUIIconSubSys::getIcon(GUIIcon::RIDE_FROMTO),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge, toEdge}, {}, {}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myLines(lines) {
}


GNERide::GNERide(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop,
double arrivalPosition, const std::vector<std::string>& lines) :
GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_BUSSTOP, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {fromEdge}, {}, {toBusStop}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myLines(lines) {
GNEDemandElement(personParent, net, GLO_RIDE, GNE_TAG_RIDE_BUSSTOP, GUIIconSubSys::getIcon(GUIIcon::RIDE_BUSSTOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {fromEdge}, {}, {toBusStop}, {personParent}, {}),
myArrivalPosition(arrivalPosition),
myLines(lines) {
}


Expand Down
9 changes: 5 additions & 4 deletions src/netedit/elements/demand/GNERoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ GNERoute::GNERoutePopupMenu::onCmdApplyDistance(FXObject*, FXSelector, void*) {
// ===========================================================================

GNERoute::GNERoute(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_ROUTE, tag,
GNEDemandElement("", net, GLO_ROUTE, tag, GUIIconSubSys::getIcon(GUIIcon::ROUTE),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT | GNEPathManager::PathElement::Options::ROUTE,
{}, {}, {}, {}, {}, {}),
Parameterised(),
Expand All @@ -90,6 +90,7 @@ myVClass(SVC_PASSENGER) {

GNERoute::GNERoute(GNENet* net) :
GNEDemandElement(net->getAttributeCarriers()->generateDemandElementID(SUMO_TAG_ROUTE), net, GLO_ROUTE, SUMO_TAG_ROUTE,
GUIIconSubSys::getIcon(GUIIcon::ROUTE),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT | GNEPathManager::PathElement::Options::ROUTE,
{}, {}, {}, {}, {}, {}),
Parameterised(),
Expand All @@ -104,7 +105,7 @@ myVClass(SVC_PASSENGER) {

GNERoute::GNERoute(GNENet* net, const std::string& id, SUMOVehicleClass vClass, const std::vector<GNEEdge*>& edges,
const RGBColor& color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters) :
GNEDemandElement(id, net, GLO_ROUTE, SUMO_TAG_ROUTE,
GNEDemandElement(id, net, GLO_ROUTE, SUMO_TAG_ROUTE, GUIIconSubSys::getIcon(GUIIcon::ROUTE),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT | GNEPathManager::PathElement::Options::ROUTE,
{}, edges, {}, {}, {}, {}),
Parameterised(parameters),
Expand All @@ -117,7 +118,7 @@ myVClass(vClass) {

GNERoute::GNERoute(GNENet* net, GNEDemandElement* vehicleParent, const std::vector<GNEEdge*>& edges,
const RGBColor& color, const int repeat, const SUMOTime cycleTime, const Parameterised::Map& parameters) :
GNEDemandElement(vehicleParent, net, GLO_ROUTE, GNE_TAG_ROUTE_EMBEDDED,
GNEDemandElement(vehicleParent, net, GLO_ROUTE, GNE_TAG_ROUTE_EMBEDDED, GUIIconSubSys::getIcon(GUIIcon::ROUTE),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT | GNEPathManager::PathElement::Options::ROUTE,
{}, edges, {}, {}, {vehicleParent}, {}),
Parameterised(parameters),
Expand All @@ -129,7 +130,7 @@ myVClass(vehicleParent->getVClass()) {


GNERoute::GNERoute(GNEDemandElement* route) :
GNEDemandElement(route, route->getNet(), GLO_ROUTE, SUMO_TAG_ROUTE,
GNEDemandElement(route, route->getNet(), GLO_ROUTE, SUMO_TAG_ROUTE, GUIIconSubSys::getIcon(GUIIcon::ROUTE),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT | GNEPathManager::PathElement::Options::ROUTE,
{}, route->getParentEdges(), {}, {}, {}, {}),
Parameterised(),
Expand Down
30 changes: 15 additions & 15 deletions src/netedit/elements/demand/GNEStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
// ===========================================================================

GNEStop::GNEStop(SumoXMLTag tag, GNENet* net) :
GNEDemandElement("", net, GLO_STOP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {}, {}, {}),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
GNEDemandElement("", net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
// reset default values
resetDefaultValues();
// enable parking for stops in parkin)gAreas
Expand All @@ -56,10 +56,10 @@ myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {


GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter) :
GNEDemandElement(stopParent, net, GLO_STOP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {}, {stoppingPlace}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {stoppingPlace}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
// enable parking for stops in parkingAreas
if ((tag == SUMO_TAG_STOP_PARKINGAREA) || (tag == GNE_TAG_WAYPOINT_PARKINGAREA)) {
parametersSet |= STOP_PARKING_SET;
Expand All @@ -76,10 +76,10 @@ myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {


GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter) :
GNEDemandElement(stopParent, net, GLO_STOP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {}, {lane}, {}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {lane}, {}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
// set flags
parking = (parametersSet & STOP_PARKING_SET);
// set tripID and line
Expand All @@ -92,10 +92,10 @@ myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {


GNEStop::GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter) :
GNEDemandElement(stopParent, net, GLO_STOP, tag, GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
{}, {edge}, {}, {}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
GNEDemandElement(stopParent, net, GLO_STOP, tag, GUIIconSubSys::getIcon(GUIIcon::STOP),
GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {edge}, {}, {}, {stopParent}, {}),
SUMOVehicleParameter::Stop(stopParameter),
myCreationIndex(myNet->getAttributeCarriers()->getStopIndex()) {
// enable parking for stops in parkingAreas
if ((tag == SUMO_TAG_STOP_PARKINGAREA) || (tag == GNE_TAG_WAYPOINT_PARKINGAREA)) {
parametersSet |= STOP_PARKING_SET;
Expand Down
Loading

0 comments on commit 18dbb95

Please sign in to comment.