Path: blob/main/src/netedit/frames/demand/GNEStopFrame.cpp
193772 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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) :41GNEGroupBoxModule(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}, {GNE_TAG_ROUTE_EMBEDDED});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(), myStopTagSelector->getCurrentTemplateAC()->getFileBucket(),219myViewNet->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed(), true);220// build stop221routeHandler.buildStop(myStopParentBaseObject->getSumoBaseObjectChildren().front(), myPlanParameters,222myStopParentBaseObject->getSumoBaseObjectChildren().front()->getStopParameter());223// show all trips224if (myStopTagSelector->getCurrentTemplateAC()->getTagProperty()->isVehicleStop()) {225myViewNet->getDemandViewOptions().menuCheckShowAllTrips->setChecked(TRUE);226} else {227myViewNet->getDemandViewOptions().menuCheckShowAllPersonPlans->setChecked(TRUE);228}229// stop successfully created, then return true230return true;231} else {232return false;233}234}235}236237bool238GNEStopFrame::getStopParameter(const SumoXMLTag stopTag, const GNELane* lane, const GNEAdditional* stoppingPlace) {239// first clear containers240myStopParentBaseObject->clear();241myPlanParameters.clear();242// declare stop parameters243SUMOVehicleParameter::Stop stop;244// first check that current selected Stop is valid245if (stopTag == SUMO_TAG_NOTHING) {246WRITE_WARNING(TL("Current selected Stop type isn't valid."));247return false;248} else if ((stopTag == GNE_TAG_STOP_LANE) || (stopTag == GNE_TAG_WAYPOINT_LANE)) {249if (lane) {250stop.lane = lane->getID();251if ((stopTag == GNE_TAG_WAYPOINT_LANE) && (stop.speed == 0)) {252stop.speed = lane->getSpeed();253}254const Position viewPosSnapped = myViewNet->snapToActiveGrid(myViewNet->getPositionInformation());255const double mousePositionOverLane = lane->getLaneShape().nearest_offset_to_point2D(viewPosSnapped) / lane->getLengthGeometryFactor();256stop.startPos = mousePositionOverLane - 10;257if (stop.startPos < 0) {258stop.startPos = 0;259}260stop.parametersSet |= STOP_START_SET;261stop.endPos = mousePositionOverLane;262stop.parametersSet |= STOP_END_SET;263} else {264WRITE_WARNING("Click over a " + toString(SUMO_TAG_LANE) + " to create a stop placed in a " + toString(SUMO_TAG_LANE));265return false;266}267} else if ((stopTag == GNE_TAG_STOPPERSON_EDGE) || (stopTag == GNE_TAG_STOPCONTAINER_EDGE)) {268if (lane) {269stop.edge = lane->getParentEdge()->getID();270myPlanParameters.toEdge = stop.edge;271} else {272WRITE_WARNING("Click over a " + toString(SUMO_TAG_EDGE) + " to create a stop placed in a " + toString(SUMO_TAG_EDGE));273return false;274}275} else if (stoppingPlace) {276if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_BUS_STOP) {277if ((stopTag != GNE_TAG_STOP_BUSSTOP) && (stopTag != GNE_TAG_WAYPOINT_BUSSTOP) && (stopTag != GNE_TAG_STOPPERSON_BUSSTOP)) {278WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());279return false;280} else {281stop.busstop = stoppingPlace->getID();282myPlanParameters.toBusStop = stop.busstop;283if ((stopTag == GNE_TAG_WAYPOINT_BUSSTOP) && (stop.speed == 0)) {284stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();285}286stop.startPos = 0;287stop.endPos = 0;288}289} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_TRAIN_STOP) {290if ((stopTag != GNE_TAG_STOP_TRAINSTOP) && (stopTag != GNE_TAG_WAYPOINT_TRAINSTOP)) {291WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());292return false;293} else {294stop.busstop = stoppingPlace->getID();295myPlanParameters.toTrainStop = stop.busstop;296if ((stopTag == GNE_TAG_WAYPOINT_TRAINSTOP) && (stop.speed == 0)) {297stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();298}299stop.startPos = 0;300stop.endPos = 0;301}302} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_CONTAINER_STOP) {303if ((stopTag != GNE_TAG_STOP_CONTAINERSTOP) && (stopTag != GNE_TAG_WAYPOINT_CONTAINERSTOP)) {304WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());305return false;306} else {307stop.containerstop = stoppingPlace->getID();308myPlanParameters.toContainerStop = stop.containerstop;309if ((stopTag == GNE_TAG_WAYPOINT_CONTAINERSTOP) && (stop.speed == 0)) {310stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();311}312stop.startPos = 0;313stop.endPos = 0;314}315} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_CHARGING_STATION) {316if ((stopTag != GNE_TAG_STOP_CHARGINGSTATION) && (stopTag != GNE_TAG_WAYPOINT_CHARGINGSTATION)) {317WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());318return false;319} else {320stop.chargingStation = stoppingPlace->getID();321myPlanParameters.toChargingStation = stop.chargingStation;322if ((stopTag == GNE_TAG_WAYPOINT_CHARGINGSTATION) && (stop.speed == 0)) {323stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();324}325stop.startPos = 0;326stop.endPos = 0;327}328} else if (stoppingPlace->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA) {329if ((stopTag != GNE_TAG_STOP_PARKINGAREA) && (stopTag != GNE_TAG_WAYPOINT_PARKINGAREA)) {330WRITE_WARNING("Invalid clicked stopping place to create a stop placed in a " + stoppingPlace->getTagProperty()->getTagStr());331return false;332} else {333stop.parkingarea = stoppingPlace->getID();334myPlanParameters.toParkingArea = stop.parkingarea;335if ((stopTag == GNE_TAG_WAYPOINT_PARKINGAREA) && (stop.speed == 0)) {336stop.speed = stoppingPlace->getParentLanes().front()->getSpeed();337}338stop.startPos = 0;339stop.endPos = 0;340}341}342} else {343if ((stopTag == GNE_TAG_STOP_BUSSTOP) || (stopTag == GNE_TAG_WAYPOINT_BUSSTOP)) {344WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_BUSSTOP) + " to create a stop placed in a " + toString(GNE_TAG_STOP_BUSSTOP));345} else if ((stopTag == GNE_TAG_STOP_TRAINSTOP) || (stopTag == GNE_TAG_WAYPOINT_TRAINSTOP)) {346WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_TRAINSTOP) + " to create a stop placed in a " + toString(GNE_TAG_STOP_TRAINSTOP));347} else if ((stopTag == GNE_TAG_STOP_CONTAINERSTOP) || (stopTag == GNE_TAG_WAYPOINT_CONTAINERSTOP)) {348WRITE_WARNING("Click over a " + toString(SUMO_TAG_CONTAINER_STOP) + " to create a stop placed in a " + toString(SUMO_TAG_CONTAINER_STOP));349} else if ((stopTag == GNE_TAG_STOP_CHARGINGSTATION) || (stopTag == GNE_TAG_WAYPOINT_CHARGINGSTATION)) {350WRITE_WARNING("Click over a " + toString(SUMO_TAG_CHARGING_STATION) + " to create a stop placed in a " + toString(SUMO_TAG_CHARGING_STATION));351} else if ((stopTag == GNE_TAG_STOP_PARKINGAREA) || (stopTag == GNE_TAG_WAYPOINT_PARKINGAREA)) {352WRITE_WARNING("Click over a " + toString(SUMO_TAG_PARKING_AREA) + " to create a stop placed in a " + toString(SUMO_TAG_PARKING_AREA));353} else if (stopTag == GNE_TAG_STOPPERSON_BUSSTOP) {354WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_BUSSTOP) + " to create a person stop placed in a " + toString(GNE_TAG_STOP_BUSSTOP));355} else if (stopTag == GNE_TAG_STOPPERSON_TRAINSTOP) {356WRITE_WARNING("Click over a " + toString(GNE_TAG_STOP_TRAINSTOP) + " to create a person stop placed in a " + toString(GNE_TAG_STOP_TRAINSTOP));357}358return false;359}360// check if stop attributes are valid361if (!myAttributesEditor->checkAttributes(true)) {362return false;363}364// get stop parent365const GNEDemandElement* stopParent = myStopParentSelector->getCurrentDemandElement();366// if stopParent is a route, check that stop is placed over a route's edge367if (stopParent->isRoute() && lane) {368bool found = false;369for (const auto& edge : stopParent->getParentEdges()) {370if (edge == lane->getParentEdge()) {371found = true;372}373}374if (!found) {375WRITE_WARNING(TL("Stop must be placed over a route's edge"));376return false;377}378}379// same if stoParent is a vehicle/flow with embedded route380if (stopParent->getChildDemandElements().size() > 0 && stopParent->getChildDemandElements().front()->getTagProperty()->isRoute() && lane) {381bool found = false;382for (const auto& edge : stopParent->getChildDemandElements().front()->getParentEdges()) {383if (edge == lane->getParentEdge()) {384found = true;385}386}387if (!found) {388WRITE_WARNING(TL("Stop must be placed over an embedded route's edge"));389return false;390}391}392// set parent tag and id393myStopParentBaseObject->setTag(stopParent->getTagProperty()->getTag());394myStopParentBaseObject->addStringAttribute(SUMO_ATTR_ID, stopParent->getID());395// add route, from and to attributes396if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_ROUTE)) {397myStopParentBaseObject->addStringAttribute(SUMO_ATTR_ROUTE, stopParent->getAttribute(SUMO_ATTR_ROUTE));398}399if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_FROM)) {400myStopParentBaseObject->addStringAttribute(SUMO_ATTR_FROM, stopParent->getAttribute(SUMO_ATTR_FROM));401}402if (stopParent->getTagProperty()->hasAttribute(SUMO_ATTR_TO)) {403myStopParentBaseObject->addStringAttribute(SUMO_ATTR_TO, stopParent->getAttribute(SUMO_ATTR_TO));404}405// create stop object406CommonXMLStructure::SumoBaseObject* stopBaseObject = new CommonXMLStructure::SumoBaseObject(myStopParentBaseObject);407// get stop attributes408myAttributesEditor->fillSumoBaseObject(stopBaseObject);409// obtain friendly position410if (stopBaseObject->hasBoolAttribute(SUMO_ATTR_FRIENDLY_POS)) {411stop.friendlyPos = stopBaseObject->getBoolAttribute(SUMO_ATTR_FRIENDLY_POS);412}413// obtain posLat414if (stopBaseObject->hasStringAttribute(SUMO_ATTR_POSITION_LAT)) {415if (GNEAttributeCarrier::canParse<double>(stopBaseObject->getStringAttribute(SUMO_ATTR_POSITION_LAT))) {416stop.posLat = GNEAttributeCarrier::parse<double>(stopBaseObject->getStringAttribute(SUMO_ATTR_POSITION_LAT));417stop.parametersSet |= STOP_POSLAT_SET;418} else {419stop.posLat = INVALID_DOUBLE;420}421}422// obtain actType423if (stopBaseObject->hasStringAttribute(SUMO_ATTR_ACTTYPE)) {424stop.actType = stopBaseObject->getStringAttribute(SUMO_ATTR_ACTTYPE);425}426// fill rest of parameters depending if it was edited427if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_DURATION)) {428stop.duration = stopBaseObject->getTimeAttribute(SUMO_ATTR_DURATION);429if (stop.duration >= 0) {430stop.parametersSet |= STOP_DURATION_SET;431}432}433if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_UNTIL)) {434stop.until = stopBaseObject->getTimeAttribute(SUMO_ATTR_UNTIL);435if (stop.until >= 0) {436stop.parametersSet |= STOP_UNTIL_SET;437}438}439if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_EXTENSION)) {440stop.extension = stopBaseObject->getTimeAttribute(SUMO_ATTR_EXTENSION);441if (stop.extension >= 0) {442stop.parametersSet |= STOP_EXTENSION_SET;443}444}445if (stopBaseObject->hasStringAttribute(SUMO_ATTR_TRIGGERED)) {446if ((stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "person") || (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "true")) {447stop.parametersSet |= STOP_TRIGGER_SET;448stop.triggered = true;449} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "container") {450stop.parametersSet |= STOP_CONTAINER_TRIGGER_SET;451stop.containerTriggered = true;452} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_TRIGGERED) == "join") {453stop.parametersSet |= STOP_JOIN_SET;454stop.joinTriggered = true;455}456}457if (stopBaseObject->hasStringListAttribute(SUMO_ATTR_EXPECTED)) {458const auto expected = stopBaseObject->getStringListAttribute(SUMO_ATTR_EXPECTED);459if (expected.size() > 0) {460if (stop.triggered) {461for (const auto& id : expected) {462stop.awaitedPersons.insert(id);463}464stop.parametersSet |= STOP_EXPECTED_SET;465} else if (stop.containerTriggered) {466for (const auto& id : expected) {467stop.awaitedContainers.insert(id);468}469stop.parametersSet |= STOP_EXPECTED_CONTAINERS_SET;470}471}472}473if (stopBaseObject->hasStringAttribute(SUMO_ATTR_JOIN)) {474stop.join = stopBaseObject->getStringAttribute(SUMO_ATTR_JOIN);475if (stop.join.size() > 0) {476stop.parametersSet |= STOP_JOIN_SET;477}478}479if (stopBaseObject->hasStringListAttribute(SUMO_ATTR_PERMITTED)) {480const auto permitted = stopBaseObject->getStringListAttribute(SUMO_ATTR_PERMITTED);481if (permitted.size() > 0) {482stop.parametersSet |= STOP_PERMITTED_SET;483for (const auto& permit : permitted) {484stop.permitted.insert(permit);485}486}487}488if (stopBaseObject->hasStringAttribute(SUMO_ATTR_PARKING)) {489if (stopBaseObject->getStringAttribute(SUMO_ATTR_PARKING) == "true") {490stop.parking = ParkingType::ONROAD;491stop.parametersSet |= STOP_PARKING_SET;492} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_PARKING) == "opportunistic") {493stop.parking = ParkingType::OPPORTUNISTIC;494stop.parametersSet |= STOP_PARKING_SET;495} else {496stop.parking = ParkingType::OFFROAD;497}498}499if (stopBaseObject->hasTimeAttribute(SUMO_ATTR_JUMP)) {500stop.jump = stopBaseObject->getTimeAttribute(SUMO_ATTR_JUMP);501if (stop.jump >= 0) {502stop.parametersSet |= STOP_JUMP_SET;503}504}505if (stopBaseObject->hasStringAttribute(SUMO_ATTR_SPLIT)) {506stop.split = stopBaseObject->getStringAttribute(SUMO_ATTR_SPLIT);507if (stop.split.size() > 0) {508stop.parametersSet |= STOP_SPLIT_SET;509}510}511if (stopBaseObject->hasStringAttribute(SUMO_ATTR_TRIP_ID)) {512stop.tripId = stopBaseObject->getStringAttribute(SUMO_ATTR_TRIP_ID);513if (stop.tripId.size() > 0) {514stop.parametersSet |= STOP_TRIP_ID_SET;515}516}517if (stopBaseObject->hasStringAttribute(SUMO_ATTR_LINE)) {518stop.line = stopBaseObject->getStringAttribute(SUMO_ATTR_LINE);519if (stop.line.size() > 0) {520stop.parametersSet |= STOP_LINE_SET;521}522}523if (stopBaseObject->hasBoolAttribute(SUMO_ATTR_ONDEMAND)) {524stop.onDemand = stopBaseObject->getBoolAttribute(SUMO_ATTR_ONDEMAND);525if (stop.onDemand) {526stop.parametersSet |= STOP_ONDEMAND_SET;527}528}529if (stopBaseObject->hasDoubleAttribute(SUMO_ATTR_SPEED) && (stopBaseObject->getDoubleAttribute(SUMO_ATTR_SPEED) > 0)) {530stop.speed = stopBaseObject->getDoubleAttribute(SUMO_ATTR_SPEED);531if (stop.speed > 0) {532stop.parametersSet |= STOP_SPEED_SET;533}534}535if (stopBaseObject->hasStringAttribute(SUMO_ATTR_INDEX)) {536if (stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX) == "fit") {537stop.index = STOP_INDEX_FIT;538} else if (stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX) == "end") {539stop.index = STOP_INDEX_END;540} else if (GNEAttributeCarrier::canParse<int>(stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX))) {541stop.index = GNEAttributeCarrier::parse<int>(stopBaseObject->getStringAttribute(SUMO_ATTR_INDEX));542} else {543stop.index = STOP_INDEX_END;544}545} else {546stop.index = STOP_INDEX_END;547}548// refresh attributes editor549myAttributesEditor->refreshAttributesEditor();550// set tag551stopBaseObject->setTag(stopTag);552stopBaseObject->setStopParameter(stop);553return true;554}555556557GNEDemandElementSelector*558GNEStopFrame::getStopParentSelector() const {559return myStopParentSelector;560}561562// ===========================================================================563// protected564// ===========================================================================565566void567GNEStopFrame::tagSelected() {568if (myStopTagSelector->getCurrentTemplateAC()) {569// show Stop type selector module570myAttributesEditor->showAttributesEditor(myStopTagSelector->getCurrentTemplateAC(), true);571myHelpCreation->showHelpCreation();572} else {573// hide all modules if stop parent isn't valid574myAttributesEditor->hideAttributesEditor();575myHelpCreation->hideHelpCreation();576}577}578579580void581GNEStopFrame::demandElementSelected() {582// show or hide modules depending if current selected stop parent is valid583if (myStopParentSelector->getCurrentDemandElement()) {584myStopTagSelector->showTagSelector();585if (myStopTagSelector->getCurrentTemplateAC()) {586// show modules587myAttributesEditor->showAttributesEditor(myStopTagSelector->getCurrentTemplateAC(), true);588myHelpCreation->showHelpCreation();589} else {590myAttributesEditor->hideAttributesEditor();591myHelpCreation->hideHelpCreation();592}593} else {594// hide modules595myStopTagSelector->hideTagSelector();596myAttributesEditor->hideAttributesEditor();597myHelpCreation->hideHelpCreation();598}599}600601/****************************************************************************/602603604