Path: blob/main/src/netedit/frames/demand/GNEStopFrame.cpp
169685 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEStopFrame.cpp14/// @author Pablo Alvarez Lopez15/// @date March 201916///17// The Widget for add Stops elements18/****************************************************************************/1920#include <netedit/GNEApplicationWindow.h>21#include <netedit/GNENet.h>22#include <netedit/GNEViewParent.h>23#include <netedit/elements/demand/GNERouteHandler.h>24#include <netedit/frames/GNEAttributesEditor.h>25#include <netedit/frames/GNEDemandSelector.h>26#include <netedit/frames/GNETagSelector.h>27#include <utils/foxtools/MFXDynamicLabel.h>28#include <utils/gui/div/GUIDesigns.h>2930#include "GNEStopFrame.h"3132// ===========================================================================33// method definitions34// ===========================================================================3536// ---------------------------------------------------------------------------37// GNEStopFrame::HelpCreation - methods38// ---------------------------------------------------------------------------3940GNEStopFrame::HelpCreation::HelpCreation(GNEStopFrame* StopFrameParent) :41MFXGroupBoxModule(StopFrameParent, TL("Help")),42myStopFrameParent(StopFrameParent) {43myInformationLabel = new MFXDynamicLabel(getCollapsableFrame(), "", 0, GUIDesignLabelFrameInformation);44}454647GNEStopFrame::HelpCreation::~HelpCreation() {}484950void51GNEStopFrame::HelpCreation::showHelpCreation() {52// first update help creation53updateHelpCreation();54// show module55show();56}575859void60GNEStopFrame::HelpCreation::hideHelpCreation() {61hide();62}636465void66GNEStopFrame::HelpCreation::updateHelpCreation() {67// create information label68std::ostringstream information;69// set text depending of selected Stop type70if (myStopFrameParent->myStopTagSelector->getCurrentTemplateAC()) {71switch (myStopFrameParent->myStopTagSelector->getCurrentTemplateAC()->getTagProperty()->getTag()) {72case GNE_TAG_STOP_BUSSTOP:73case GNE_TAG_WAYPOINT_BUSSTOP:74information75<< "- " << TL("Shift+Click to select parent") << "\n"76<< "- " << TL("Click over a bus stop to create a stop.");77break;78case GNE_TAG_STOP_TRAINSTOP:79case GNE_TAG_WAYPOINT_TRAINSTOP:80information81<< "- " << TL("Shift+Click to select parent") << "\n"82<< "- " << TL("Click over a train stop to create a stop.");83break;84case GNE_TAG_STOP_CONTAINERSTOP:85case GNE_TAG_WAYPOINT_CONTAINERSTOP:86information87<< "- " << TL("Shift+Click to select parent") << "\n"88<< "- " << TL("Click over a container stop to create a stop.");89break;90case GNE_TAG_STOP_CHARGINGSTATION:91case GNE_TAG_WAYPOINT_CHARGINGSTATION:92information93<< "- " << TL("Shift+Click to select parent") << "\n"94<< "- " << TL("Click over a charging station to create a stop.");95break;96case GNE_TAG_STOP_PARKINGAREA:97case GNE_TAG_WAYPOINT_PARKINGAREA:98information99<< "- " << TL("Shift+Click to select parent") << "\n"100<< "- " << TL("Click over a parking area to create a stop.");101break;102case GNE_TAG_STOP_LANE:103case GNE_TAG_WAYPOINT_LANE:104information105<< "- " << TL("Shift+Click to select parent") << "\n"106<< "- " << TL("Click over a lane to create a stop.");107break;108default:109information110<< "- " << TL("No stop parents in current network.");111break;112}113}114// set information label115myInformationLabel->setText(information.str().c_str());116}117118// ---------------------------------------------------------------------------119// GNEStopFrame - methods120// ---------------------------------------------------------------------------121122GNEStopFrame::GNEStopFrame(GNEViewParent* viewParent, GNEViewNet* viewNet) :123GNEFrame(viewParent, viewNet, TL("Stops")),124myStopParentBaseObject(new CommonXMLStructure::SumoBaseObject(nullptr)) {125126// Create Stop parent selector127myStopParentSelector = new GNEDemandElementSelector(this, {GNETagProperties::Type::VEHICLE, GNETagProperties::Type::ROUTE});128129// Create item Selector module for Stops130myStopTagSelector = new GNETagSelector(this, GNETagProperties::Type::STOP_VEHICLE, GNE_TAG_STOP_LANE);131132// Create attributes editor133myAttributesEditor = new GNEAttributesEditor(this, GNEAttributesEditorType::EditorType::CREATOR);134135// Create Help Creation Module136myHelpCreation = new HelpCreation(this);137138// refresh myStopParentMatchBox139myStopParentSelector->refreshDemandElementSelector();140}141142143GNEStopFrame::~GNEStopFrame() {144delete myStopParentBaseObject;145}146147148void149GNEStopFrame::show() {150// first check if stop frame modules can be shown151bool validStopParent = false;152// check if at least there an item that supports an stop153for (auto i = myStopParentSelector->getAllowedTags().begin(); (i != myStopParentSelector->getAllowedTags().end()) && (validStopParent == false); i++) {154if (myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(*i).size() > 0) {155validStopParent = true;156}157}158// show or hide modules depending of validStopParent159if (validStopParent) {160// refresh tag selector161myStopTagSelector->refreshTagSelector();162// refresh vType selector163myStopParentSelector->refreshDemandElementSelector();164// refresh tag selector165myStopTagSelector->refreshTagSelector();166// show167myStopParentSelector->showDemandElementSelector();168myStopTagSelector->showTagSelector();169} else {170// hide modules (except help creation)171myStopParentSelector->hideDemandElementSelector();172myStopTagSelector->hideTagSelector();173myAttributesEditor->hideAttributesEditor();174// show help creation module175myHelpCreation->showHelpCreation();176}177// reset last position178myLastClickedPosition = Position::INVALID;179// show frame180GNEFrame::show();181}182183184bool185GNEStopFrame::addStop(const GNEViewNetHelper::ViewObjectsSelector& viewObjects, const GNEViewNetHelper::MouseButtonKeyPressed& mouseButtonKeyPressed) {186// first check stop type187if (myStopTagSelector->getCurrentTemplateAC() == nullptr) {188WRITE_WARNING(TL("Selected Stop type isn't valid."));189return false;190}191// check last position192if ((myViewNet->getPositionInformation() == myLastClickedPosition) && !myViewNet->getMouseButtonKeyPressed().shiftKeyPressed()) {193WRITE_WARNING(TL("Shift + click to create two additionals in the same position"));194return false;195}196// check if we're selecting a new stop parent197if (mouseButtonKeyPressed.shiftKeyPressed()) {198if (viewObjects.getDemandElementFront() &&199(viewObjects.getDemandElementFront()->getTagProperty()->isVehicle() || viewObjects.getDemandElementFront()->getTagProperty()->getTag() == SUMO_TAG_ROUTE)) {200myStopParentSelector->setDemandElement(viewObjects.getDemandElementFront());201WRITE_WARNINGF(TL("Selected % '%' as stop parent."), viewObjects.getDemandElementFront()->getTagStr(), viewObjects.getDemandElementFront()->getID());202return true;203} else {204WRITE_WARNING(TL("Selected Stop parent isn't valid."));205return false;206}207} else {208// now check if stop parent selector is valid209if (myStopParentSelector->getCurrentDemandElement() == nullptr) {210WRITE_WARNING(TL("Current selected Stop parent isn't valid."));211return false;212}213// create stop base object214getStopParameter(myStopTagSelector->getCurrentTemplateAC()->getTagProperty()->getTag(),215viewObjects.getLaneFront(), viewObjects.getAdditionalFront());216if (myStopParentBaseObject->getTag() != SUMO_TAG_NOTHING) {217// declare route handler218GNERouteHandler routeHandler(myViewNet->getNet(), myStopParentBaseObject->hasStringAttribute(GNE_ATTR_DEMAND_FILE) ?219myStopParentBaseObject->getStringAttribute(GNE_ATTR_DEMAND_FILE) : "",220myViewNet->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed());221// build stop222routeHandler.buildStop(myStopParentBaseObject->getSumoBaseObjectChildren().front(), myPlanParameters,223myStopParentBaseObject->getSumoBaseObjectChildren().front()->getStopParameter());224// show all trips225if (myStopTagSelector->getCurrentTemplateAC()->getTagProperty()->isVehicleStop()) {226myViewNet->getDemandViewOptions().menuCheckShowAllTrips->setChecked(TRUE);227} else {228myViewNet->getDemandViewOptions().menuCheckShowAllPersonPlans->setChecked(TRUE);229}230// stop successfully created, then return true231return true;232} else {233return false;234}235}236}237238bool239GNEStopFrame::getStopParameter(const SumoXMLTag stopTag, const GNELane* lane, const GNEAdditional* stoppingPlace) {240// first clear containers241myStopParentBaseObject->clear();242myPlanParameters.clear();243// declare stop parameters244SUMOVehicleParameter::Stop stop;245// first check that current selected Stop is valid246if (stopTag == SUMO_TAG_NOTHING) {247WRITE_WARNING(TL("Current selected Stop type isn't valid."));248return false;249} else if ((stopTag == GNE_TAG_STOP_LANE) || (stopTag == GNE_TAG_WAYPOINT_LANE)) {250if (lane) {251stop.lane = lane->getID();252if ((stopTag == GNE_TAG_WAYPOINT_LANE) && (stop.speed == 0)) {253stop.speed = lane->getSpeed();254}255const Position viewPosSnapped = myViewNet->snapToActiveGrid(myViewNet->getPositionInformation());256const double mousePositionOverLane = lane->getLaneShape().nearest_offset_to_point2D(viewPosSnapped) / lane->getLengthGeometryFactor();257stop.startPos = mousePositionOverLane - 10;258if (stop.startPos < 0) {259stop.startPos = 0;260}261stop.parametersSet |= STOP_START_SET;262stop.endPos = mousePositionOverLane;263stop.parametersSet |= STOP_END_SET;264} else {265WRITE_WARNING("Click over a " + toString(SUMO_TAG_LANE) + " to create a stop placed in a " + toString(SUMO_TAG_LANE));266return false;267}268} else if ((stopTag == GNE_TAG_STOPPERSON_EDGE) || (stopTag == GNE_TAG_STOPCONTAINER_EDGE)) {269if (lane) {270stop.edge = lane->getParentEdge()->getID();271myPlanParameters.toEdge = stop.edge;272} else {273WRITE_WARNING("Click over a " + toString(SUMO_TAG_EDGE) + " to create a stop placed in a " + toString(SUMO_TAG_EDGE));274return false;275}276} else if (stoppingPlace) {277if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {278if ((stopTag != GNE_TAG_STOP_BUSSTOP) && (stopTag != GNE_TAG_WAYPOINT_BUSSTOP) && (stopTag != GNE_TAG_STOPPERSON_BUSSTOP)) {279WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());280return false;281} else {282stop.busstop = stoppingPlace->getID();283myPlanParameters.toBusStop = stop.busstop;284if ((stopTag == GNE_TAG_WAYPOINT_BUSSTOP) && (stop.speed == 0)) {285stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();286}287stop.startPos = 0;288stop.endPos = 0;289}290} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {291if ((stopTag != GNE_TAG_STOP_TRAINSTOP) && (stopTag != GNE_TAG_WAYPOINT_TRAINSTOP)) {292WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());293return false;294} else {295stop.busstop = stoppingPlace->getID();296myPlanParameters.toTrainStop = stop.busstop;297if ((stopTag == GNE_TAG_WAYPOINT_TRAINSTOP) && (stop.speed == 0)) {298stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();299}300stop.startPos = 0;301stop.endPos = 0;302}303} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {304if ((stopTag != GNE_TAG_STOP_CONTAINERSTOP) && (stopTag != GNE_TAG_WAYPOINT_CONTAINERSTOP)) {305WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());306return false;307} else {308stop.containerstop = stoppingPlace->getID();309myPlanParameters.toContainerStop = stop.containerstop;310if ((stopTag == GNE_TAG_WAYPOINT_CONTAINERSTOP) && (stop.speed == 0)) {311stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();312}313stop.startPos = 0;314stop.endPos = 0;315}316} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {317if ((stopTag != GNE_TAG_STOP_CHARGINGSTATION) && (stopTag != GNE_TAG_WAYPOINT_CHARGINGSTATION)) {318WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());319return false;320} else {321stop.chargingStation = stoppingPlace->getID();322myPlanParameters.toChargingStation = stop.chargingStation;323if ((stopTag == GNE_TAG_WAYPOINT_CHARGINGSTATION) && (stop.speed == 0)) {324stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();325}326stop.startPos = 0;327stop.endPos = 0;328}329} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA) {330if ((stopTag != GNE_TAG_STOP_PARKINGAREA) && (stopTag != GNE_TAG_WAYPOINT_PARKINGAREA)) {331WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());332return false;333} else {334stop.parkingarea = stoppingPlace->getID();335myPlanParameters.toParkingArea = stop.parkingarea;336if ((stopTag == GNE_TAG_WAYPOINT_PARKINGAREA) && (stop.speed == 0)) {337stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();338}339stop.startPos = 0;340stop.endPos = 0;341}342}343} else {344if ((stopTag == GNE_TAG_STOP_BUSSTOP) || (stopTag == GNE_TAG_WAYPOINT_BUSSTOP)) {345WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_BUSSTOP) + " to create a stop placed in a " + toString(GNE_TAG_STOP_BUSSTOP));346} else if ((stopTag == GNE_TAG_STOP_TRAINSTOP) || (stopTag == GNE_TAG_WAYPOINT_TRAINSTOP)) {347WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_TRAINSTOP) + " to create a stop placed in a " + toString(GNE_TAG_STOP_TRAINSTOP));348} else if ((stopTag == GNE_TAG_STOP_CONTAINERSTOP) || (stopTag == GNE_TAG_WAYPOINT_CONTAINERSTOP)) {349WRITE_WARNING("Click over a " + toString(SUMO_TAG_CONTAINER_STOP) + " to create a stop placed in a " + toString(SUMO_TAG_CONTAINER_STOP));350} else if ((stopTag == GNE_TAG_STOP_CHARGINGSTATION) || (stopTag == GNE_TAG_WAYPOINT_CHARGINGSTATION)) {351WRITE_WARNING("Click over a " + toString(SUMO_TAG_CHARGING_STATION) + " to create a stop placed in a " + toString(SUMO_TAG_CHARGING_STATION));352} else if ((stopTag == GNE_TAG_STOP_PARKINGAREA) || (stopTag == GNE_TAG_WAYPOINT_PARKINGAREA)) {353WRITE_WARNING("Click over a " + toString(SUMO_TAG_PARKING_AREA) + " to create a stop placed in a " + toString(SUMO_TAG_PARKING_AREA));354} else if (stopTag == GNE_TAG_STOPPERSON_BUSSTOP) {355WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_BUSSTOP) + " to create a person stop placed in a " + toString(GNE_TAG_STOP_BUSSTOP));356} else if (stopTag == GNE_TAG_STOPPERSON_TRAINSTOP) {357WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_TRAINSTOP) + " to create a person stop placed in a " + toString(GNE_TAG_STOP_TRAINSTOP));358}359return false;360}361// check if stop attributes are valid362if (!myAttributesEditor->checkAttributes(true)) {363return false;364}365// get stop parent366const GNEDemandElement* stopParent = myStopParentSelector->getCurrentDemandElement();367// if stopParent is a route, check that stop is placed over a route's edge368if (stopParent->isRoute() && lane) {369bool found = false;370for (const auto& edge : stopParent->getParentEdges()) {371if (edge == lane->getParentEdge()) {372found = true;373}374}375if (!found) {376WRITE_WARNING(TL("Stop must be placed over a route's edge"));377return false;378}379}380// same if stoParent is a vehicle/flow with embedded route381if (stopParent->getChildDemandElements().size() > 0 && stopParent->getChildDemandElements().front()->getTagProperty()->isRoute() && lane) {382bool found = false;383for (const auto& edge : stopParent->getChildDemandElements().front()->getParentEdges()) {384if (edge == lane->getParentEdge()) {385found = true;386}387}388if (!found) {389WRITE_WARNING(TL("Stop must be placed over an embedded route's edge"));390return false;391}392}393// set parent tag and id394myStopParentBaseObject->setTag(stopParent->getTagProperty()->getTag());395myStopParentBaseObject->addStringAttribute(SUMO_ATTR_ID, stopParent->getID());396// add route, from and to attributes397if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_ROUTE)) {398myStopParentBaseObject->addStringAttribute(SUMO_ATTR_ROUTE, stopParent->getAttribute(SUMO_ATTR_ROUTE));399}400if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_FROM)) {401myStopParentBaseObject->addStringAttribute(SUMO_ATTR_FROM, stopParent->getAttribute(SUMO_ATTR_FROM));402}403if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_TO)) {404myStopParentBaseObject->addStringAttribute(SUMO_ATTR_TO, stopParent->getAttribute(SUMO_ATTR_TO));405}406// create stop object407CommonXMLStructure::SumoBaseObject* stopBaseObject = new CommonXMLStructure::SumoBaseObject(myStopParentBaseObject);408// get stop attributes409myAttributesEditor->fillSumoBaseObject(stopBaseObject);410// obtain friendly position411if (stopBaseObject->hasBoolAttribute(SUMO_ATTR_FRIENDLY_POS)) {412stop.friendlyPos = stopBaseObject->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS);413}414// obtain posLat415if (stopBaseObject->hasStringAttribute(SUMO_ATTR_POSITION_LAT)) {416if (GNEAttributeCarrier::canParse<double>(stopBaseObject->getStringAttribute(SUMO_ATTR_POSITION_LAT))) {417stop.posLat = GNEAttributeCarrier::parse<double>(stopBaseObject->getStringAttribute(SUMO_ATTR_POSITION_LAT));418stop.parametersSet |= STOP_POSLAT_SET;419} else {420stop.posLat = INVALID_DOUBLE;421}422}423// obtain actType424if (stopBaseObject->hasStringAttribute(SUMO_ATTR_ACTTYPE)) {425stop.actType = stopBaseObject->getStringAttribute(SUMO_ATTR_ACTTYPE);426}427// fill rest of parameters depending if it was edited428if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_DURATION)) {429stop.duration = stopBaseObject->getTimeAttribute(SUMO_ATTR_DURATION);430if (stop.duration >= 0) {431stop.parametersSet |= STOP_DURATION_SET;432}433}434if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_UNTIL)) {435stop.until = stopBaseObject->getTimeAttribute(SUMO_ATTR_UNTIL);436if (stop.until >= 0) {437stop.parametersSet |= STOP_UNTIL_SET;438}439}440if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_EXTENSION)) {441stop.extension = stopBaseObject->getTimeAttribute(SUMO_ATTR_EXTENSION);442if (stop.extension >= 0) {443stop.parametersSet |= STOP_EXTENSION_SET;444}445}446if (stopBaseObject->hasStringAttribute(SUMO_ATTR_TRIGGERED)) {447if ((stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "person") || (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "true")) {448stop.parametersSet |= STOP_TRIGGER_SET;449stop.triggered = true;450} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "container") {451stop.parametersSet |= STOP_CONTAINER_TRIGGER_SET;452stop.containerTriggered = true;453} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "join") {454stop.parametersSet |= STOP_JOIN_SET;455stop.joinTriggered = true;456}457}458if (stopBaseObject->hasStringListAttribute(SUMO_ATTR_EXPECTED)) {459const auto expected = stopBaseObject->getStringListAttribute(SUMO_ATTR_EXPECTED);460if (expected.size() > 0) {461if (stop.triggered) {462for (const auto& id : expected) {463stop.awaitedPersons.insert(id);464}465stop.parametersSet |= STOP_EXPECTED_SET;466} else if (stop.containerTriggered) {467for (const auto& id : expected) {468stop.awaitedContainers.insert(id);469}470stop.parametersSet |= STOP_EXPECTED_CONTAINERS_SET;471}472}473}474if (stopBaseObject->hasStringAttribute(SUMO_ATTR_JOIN)) {475stop.join = stopBaseObject->getStringAttribute(SUMO_ATTR_JOIN);476if (stop.join.size() > 0) {477stop.parametersSet |= STOP_JOIN_SET;478}479}480if (stopBaseObject->hasStringListAttribute(SUMO_ATTR_PERMITTED)) {481const auto permitted = stopBaseObject->getStringListAttribute(SUMO_ATTR_PERMITTED);482if (permitted.size() > 0) {483stop.parametersSet |= STOP_PERMITTED_SET;484for (const auto& permit : permitted) {485stop.permitted.insert(permit);486}487}488}489if (stopBaseObject->hasStringAttribute(SUMO_ATTR_PARKING)) {490if (stopBaseObject->getStringAttribute(SUMO_ATTR_PARKING) == "true") {491stop.parking = ParkingType::ONROAD;492stop.parametersSet |= STOP_PARKING_SET;493} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_PARKING) == "opportunistic") {494stop.parking = ParkingType::OPPORTUNISTIC;495stop.parametersSet |= STOP_PARKING_SET;496} else {497stop.parking = ParkingType::OFFROAD;498}499}500if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_JUMP)) {501stop.jump = stopBaseObject->getTimeAttribute(SUMO_ATTR_JUMP);502if (stop.jump >= 0) {503stop.parametersSet |= STOP_JUMP_SET;504}505}506if (stopBaseObject->hasStringAttribute(SUMO_ATTR_SPLIT)) {507stop.split = stopBaseObject->getStringAttribute(SUMO_ATTR_SPLIT);508if (stop.split.size() > 0) {509stop.parametersSet |= STOP_SPLIT_SET;510}511}512if (stopBaseObject->hasStringAttribute(SUMO_ATTR_TRIP_ID)) {513stop.tripId = stopBaseObject->getStringAttribute(SUMO_ATTR_TRIP_ID);514if (stop.tripId.size() > 0) {515stop.parametersSet |= STOP_TRIP_ID_SET;516}517}518if (stopBaseObject->hasStringAttribute(SUMO_ATTR_LINE)) {519stop.line = stopBaseObject->getStringAttribute(SUMO_ATTR_LINE);520if (stop.line.size() > 0) {521stop.parametersSet |= STOP_LINE_SET;522}523}524if (stopBaseObject->hasBoolAttribute(SUMO_ATTR_ONDEMAND)) {525stop.onDemand = stopBaseObject->getBoolAttribute(SUMO_ATTR_ONDEMAND);526if (stop.onDemand) {527stop.parametersSet |= STOP_ONDEMAND_SET;528}529}530if (stopBaseObject->hasDoubleAttribute(SUMO_ATTR_SPEED) && (stopBaseObject->getDoubleAttribute(SUMO_ATTR_SPEED) > 0)) {531stop.speed = stopBaseObject->getDoubleAttribute(SUMO_ATTR_SPEED);532if (stop.speed > 0) {533stop.parametersSet |= STOP_SPEED_SET;534}535}536if (stopBaseObject->hasStringAttribute(SUMO_ATTR_INDEX)) {537if (stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX) == "fit") {538stop.index = STOP_INDEX_FIT;539} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX) == "end") {540stop.index = STOP_INDEX_END;541} else if (GNEAttributeCarrier::canParse<int>(stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX))) {542stop.index = GNEAttributeCarrier::parse<int>(stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX));543} else {544stop.index = STOP_INDEX_END;545}546} else {547stop.index = STOP_INDEX_END;548}549// refresh attributes editor550myAttributesEditor->refreshAttributesEditor();551// set tag552stopBaseObject->setTag(stopTag);553stopBaseObject->setStopParameter(stop);554return true;555}556557558GNEDemandElementSelector*559GNEStopFrame::getStopParentSelector() const {560return myStopParentSelector;561}562563// ===========================================================================564// protected565// ===========================================================================566567void568GNEStopFrame::tagSelected() {569if (myStopTagSelector->getCurrentTemplateAC()) {570// show Stop type selector module571myAttributesEditor->showAttributesEditor(myStopTagSelector->getCurrentTemplateAC(), true);572myHelpCreation->showHelpCreation();573} else {574// hide all modules if stop parent isn't valid575myAttributesEditor->hideAttributesEditor();576myHelpCreation->hideHelpCreation();577}578}579580581void582GNEStopFrame::demandElementSelected() {583// show or hide modules depending if current selected stop parent is valid584if (myStopParentSelector->getCurrentDemandElement()) {585myStopTagSelector->showTagSelector();586if (myStopTagSelector->getCurrentTemplateAC()) {587// show modules588myAttributesEditor->showAttributesEditor(myStopTagSelector->getCurrentTemplateAC(), true);589myHelpCreation->showHelpCreation();590} else {591myAttributesEditor->hideAttributesEditor();592myHelpCreation->hideHelpCreation();593}594} else {595// hide modules596myStopTagSelector->hideTagSelector();597myAttributesEditor->hideAttributesEditor();598myHelpCreation->hideHelpCreation();599}600}601602/****************************************************************************/603604605