std::vector<SUMOTime> GUISettingsHandler::loadBreakpoints(const std::string& file) { std::vector<SUMOTime> result; std::ifstream strm(file.c_str()); while (strm.good()) { std::string val; strm >> val; if (val.length() == 0) { continue; } try { SUMOTime value = string2time(val); result.push_back(value); } catch (NumberFormatException&) { WRITE_ERROR(" A breakpoint-value must be an int, is:" + val); } catch (ProcessError&) { WRITE_ERROR(" Could not decode breakpoint '" + val + "'"); } catch (EmptyData&) {} } return result; }
bool SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id, SUMOTime& depart, DepartDefinition& dd, std::string& error) { if (val == "triggered") { dd = DEPART_TRIGGERED; } else if (val == "now") { dd = DEPART_NOW; } else { try { depart = string2time(val); dd = DEPART_GIVEN; if (depart < 0) { error = "Negative departure time in the definition of '" + id + "'."; return false; } } catch (...) { error = "Invalid departure time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"now\", or a float >= 0)"; return false; } } return true; }
void MSFrame::setMSGlobals(OptionsCont& oc) { // pre-initialise the network // set whether empty edges shall be printed on dump MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges"); #ifdef HAVE_INTERNAL_LANES // set whether internal lanes shall be used MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links"); MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ? std::numeric_limits<SUMOTime>::max() : string2time(oc.getString("ignore-junction-blocker")); #else MSGlobals::gUsingInternalLanes = false; MSGlobals::gIgnoreJunctionBlocker = 0; #endif // set the grid lock time MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport")); MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways")); MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents"); MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors"); MSGlobals::gLaneChangeDuration = string2time(oc.getString("lanechange.duration")); MSGlobals::gLateralResolution = oc.getFloat("lateral-resolution"); MSGlobals::gStateLoaded = oc.isSet("load-state"); MSGlobals::gUseMesoSim = oc.getBool("mesosim"); MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited"); MSGlobals::gMesoOvertaking = oc.getBool("meso-overtaking"); MSGlobals::gMesoTLSPenalty = oc.getFloat("meso-tls-penalty"); if (MSGlobals::gUseMesoSim) { MSGlobals::gUsingInternalLanes = false; } MSGlobals::gWaitingTimeMemory = string2time(oc.getString("waiting-time-memory")); MSAbstractLaneChangeModel::initGlobalOptions(oc); MSLane::initCollisionOptions(oc); DELTA_T = string2time(oc.getString("step-length")); #ifdef _DEBUG if (oc.isSet("movereminder-output")) { MSBaseVehicle::initMoveReminderOutput(oc); } #endif }
void RORouteHandler::closeFlow() { // @todo: consider myScale? if (myVehicleParameter->repetitionNumber == 0) { delete myVehicleParameter; myVehicleParameter = 0; return; } // let's check whether vehicles had to depart before the simulation starts myVehicleParameter->repetitionsDone = 0; const SUMOTime offsetToBegin = string2time(OptionsCont::getOptions().getString("begin")) - myVehicleParameter->depart; while (myVehicleParameter->repetitionsDone * myVehicleParameter->repetitionOffset < offsetToBegin) { myVehicleParameter->repetitionsDone++; if (myVehicleParameter->repetitionsDone == myVehicleParameter->repetitionNumber) { delete myVehicleParameter; myVehicleParameter = 0; return; } } SUMOVTypeParameter* type = myNet.getVehicleTypeSecure(myVehicleParameter->vtypeid); RORouteDef* route = myNet.getRouteDef(myVehicleParameter->routeid); if (type == 0) { myErrorOutput->inform("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); delete myVehicleParameter; myVehicleParameter = 0; return; } if (route == 0) { myErrorOutput->inform("Vehicle '" + myVehicleParameter->id + "' has no route."); delete myVehicleParameter; myVehicleParameter = 0; return; } myActiveRouteID = ""; myNet.addFlow(myVehicleParameter, OptionsCont::getOptions().getBool("randomize-flows")); registerLastDepart(); myVehicleParameter = 0; }
void SUMOVehicleParserHelper::parseVTypeEmbedded(SUMOVTypeParameter& into, int element, const SUMOSAXAttributes& attrs, bool fromVType) { const CFAttrMap& allowedAttrs = getAllowedCFModelAttrs(); CFAttrMap::const_iterator cf_it; for (cf_it = allowedAttrs.begin(); cf_it != allowedAttrs.end(); cf_it++) { if (cf_it->first == element) { break; } } if (cf_it == allowedAttrs.end()) { if (SUMOXMLDefinitions::Tags.has(element)) { WRITE_ERROR("Unknown cfmodel " + toString((SumoXMLTag)element) + " when parsing vtype '" + into.id + "'"); } else { WRITE_ERROR("Unknown cfmodel when parsing vtype '" + into.id + "'"); } throw ProcessError(); return; } if (!fromVType) { into.cfModel = cf_it->first; into.setParameter |= VTYPEPARS_CAR_FOLLOW_MODEL; } bool ok = true; for (std::set<SumoXMLAttr>::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); it++) { if (attrs.hasAttribute(*it)) { into.cfParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok); if (*it == SUMO_ATTR_TAU && string2time(into.cfParameter[*it]) < DELTA_T) { WRITE_WARNING("Value of tau=" + toString(into.cfParameter[*it]) + " in car following model '" + toString(into.cfModel) + "' lower than simulation step size may cause collisions"); } } } if (!ok) { throw ProcessError(); } }
void ROLoader::openRoutes(RONet& net) { // build loader // load sumo-routes when wished bool ok = openTypedRoutes("route-files", net); // load the XML-trip definitions when wished ok &= openTypedRoutes("trip-files", net); // load the sumo-alternative file when wished ok &= openTypedRoutes("alternative-files", net); // load the amount definitions if wished ok &= openTypedRoutes("flow-files", net); // check if (ok) { myLoaders.loadNext(string2time(myOptions.getString("begin"))); if (!MsgHandler::getErrorInstance()->wasInformed() && !net.furtherStored()) { throw ProcessError("No route input specified."); } // skip routes prior to the begin time if (!myOptions.getBool("unsorted-input")) { WRITE_MESSAGE("Skipped until: " + time2string(myLoaders.getFirstLoadTime())); } } }
void MSRouteHandler::closeFlow() { // let's check whether vehicles had to depart before the simulation starts myVehicleParameter->repetitionsDone = 0; SUMOTime offsetToBegin = string2time(OptionsCont::getOptions().getString("begin")) - myVehicleParameter->depart; while (myVehicleParameter->repetitionsDone * myVehicleParameter->repetitionOffset < offsetToBegin) { myVehicleParameter->repetitionsDone++; if (myVehicleParameter->repetitionsDone == myVehicleParameter->repetitionNumber) { return; } } if (MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid) == 0) { throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } if (MSRoute::dictionary("!" + myVehicleParameter->id) == 0) { // if not, try via the (hopefully) given route-id if (MSRoute::dictionary(myVehicleParameter->routeid) == 0) { if (myVehicleParameter->routeid != "") { throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } else { throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); } } } else { myVehicleParameter->routeid = "!" + myVehicleParameter->id; } myActiveRouteID = ""; // check whether the vehicle shall be added directly to the network or // shall stay in the internal buffer if (myAddVehiclesDirectly || checkLastDepart()) { MSNet::getInstance()->getInsertionControl().add(myVehicleParameter); registerLastDepart(); } myVehicleParameter = 0; }
FXint GUILoadThread::run() { GUINet* net = 0; int simStartTime = 0; int simEndTime = 0; std::vector<std::string> guiSettingsFiles; bool osgView = false; OptionsCont& oc = OptionsCont::getOptions(); // register message callbacks MsgHandler::getMessageInstance()->addRetriever(myMessageRetriever); MsgHandler::getErrorInstance()->addRetriever(myErrorRetriever); MsgHandler::getWarningInstance()->addRetriever(myWarningRetriever); // try to load the given configuration if (!initOptions()) { // the options are not valid but maybe we want to quit GUIGlobals::gQuitOnEnd = oc.getBool("quit-on-end"); submitEndAndCleanup(net, simStartTime, simEndTime); return 0; } // within gui-based applications, nothing is reported to the console MsgHandler::getMessageInstance()->removeRetriever(&OutputDevice::getDevice("stdout")); MsgHandler::getWarningInstance()->removeRetriever(&OutputDevice::getDevice("stderr")); MsgHandler::getErrorInstance()->removeRetriever(&OutputDevice::getDevice("stderr")); // do this once again to get parsed options MsgHandler::initOutputOptions(); XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net")); GUIGlobals::gRunAfterLoad = oc.getBool("start"); GUIGlobals::gQuitOnEnd = oc.getBool("quit-on-end"); if (!MSFrame::checkOptions()) { MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); submitEndAndCleanup(net, simStartTime, simEndTime); return 0; } // initialise global settings RandHelper::initRandGlobal(); RandHelper::initRandGlobal(&MSVehicleControl::myVehicleParamsRNG); MSFrame::setMSGlobals(oc); GUITexturesHelper::allowTextures(!oc.getBool("disable-textures")); MSVehicleControl* vehControl = 0; #ifdef HAVE_INTERNAL GUIVisualizationSettings::UseMesoSim = MSGlobals::gUseMesoSim; if (MSGlobals::gUseMesoSim) { vehControl = new GUIMEVehicleControl(); } else #endif vehControl = new GUIVehicleControl(); GUIEdgeControlBuilder* eb = 0; try { net = new GUINet( vehControl, new GUIEventControl(), new GUIEventControl(), new GUIEventControl()); eb = new GUIEdgeControlBuilder(); GUIDetectorBuilder db(*net); NLJunctionControlBuilder jb(*net, db); GUITriggerBuilder tb; NLHandler handler("", *net, db, tb, *eb, jb); tb.setHandler(&handler); NLBuilder builder(oc, *net, *eb, jb, db, handler); MsgHandler::getErrorInstance()->clear(); MsgHandler::getWarningInstance()->clear(); MsgHandler::getMessageInstance()->clear(); if (!builder.build()) { throw ProcessError(); } else { net->initGUIStructures(); simStartTime = string2time(oc.getString("begin")); simEndTime = string2time(oc.getString("end")); guiSettingsFiles = oc.getStringVector("gui-settings-file"); #ifdef HAVE_INTERNAL osgView = oc.getBool("osg-view"); #endif } } catch (ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); delete net; net = 0; #ifndef _DEBUG } catch (std::exception& e) { WRITE_ERROR(e.what()); delete net; net = 0; #endif } if (net == 0) { MSNet::clearAll(); } delete eb; submitEndAndCleanup(net, simStartTime, simEndTime, guiSettingsFiles, osgView); return 0; }
/** * Computes the routes saving them */ void computeRoutes(RONet& net, ROLoader& loader, OptionsCont& oc) { // initialise the loader loader.openRoutes(net); // build the router auto ttFunction = gWeightsRandomFactor > 1 ? &ROEdge::getTravelTimeStaticRandomized : &ROEdge::getTravelTimeStatic; SUMOAbstractRouter<ROEdge, ROVehicle>* router; const std::string measure = oc.getString("weight-attribute"); const std::string routingAlgorithm = oc.getString("routing-algorithm"); const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime end = string2time(oc.getString("end")); if (measure == "traveltime") { if (routingAlgorithm == "dijkstra") { if (net.hasPermissions()) { router = new DijkstraRouter<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttFunction); } else { router = new DijkstraRouter<ROEdge, ROVehicle, SUMOAbstractRouter<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttFunction); } } else if (routingAlgorithm == "astar") { if (net.hasPermissions()) { typedef AStarRouter<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> > AStar; std::shared_ptr<const AStar::LookupTable> lookup; if (oc.isSet("astar.all-distances")) { lookup = std::make_shared<const AStar::FLT>(oc.getString("astar.all-distances"), (int)ROEdge::getAllEdges().size()); } else if (oc.isSet("astar.landmark-distances")) { CHRouterWrapper<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> > router( ROEdge::getAllEdges(), true, &ROEdge::getTravelTimeStatic, begin, end, std::numeric_limits<int>::max(), 1); ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net); lookup = std::make_shared<const AStar::LMLT>(oc.getString("astar.landmark-distances"), ROEdge::getAllEdges(), &router, &defaultVehicle, oc.isSet("astar.save-landmark-distances") ? oc.getString("astar.save-landmark-distances") : "", oc.getInt("routing-threads")); } router = new AStar(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttFunction, lookup); } else { typedef AStarRouter<ROEdge, ROVehicle, SUMOAbstractRouter<ROEdge, ROVehicle> > AStar; std::shared_ptr<const AStar::LookupTable> lookup; if (oc.isSet("astar.all-distances")) { lookup = std::make_shared<const AStar::FLT>(oc.getString("astar.all-distances"), (int)ROEdge::getAllEdges().size()); } else if (oc.isSet("astar.landmark-distances")) { CHRouterWrapper<ROEdge, ROVehicle, SUMOAbstractRouter<ROEdge, ROVehicle> > router( ROEdge::getAllEdges(), true, &ROEdge::getTravelTimeStatic, begin, end, std::numeric_limits<int>::max(), 1); ROVehicle defaultVehicle(SUMOVehicleParameter(), nullptr, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net); lookup = std::make_shared<const AStar::LMLT>(oc.getString("astar.landmark-distances"), ROEdge::getAllEdges(), &router, &defaultVehicle, oc.isSet("astar.save-landmark-distances") ? oc.getString("astar.save-landmark-distances") : "", oc.getInt("routing-threads")); } router = new AStar(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), ttFunction, lookup); } } else if (routingAlgorithm == "CH") { const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits<int>::max()); if (net.hasPermissions()) { router = new CHRouter<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, true); } else { router = new CHRouter<ROEdge, ROVehicle, SUMOAbstractRouter<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, false); } } else if (routingAlgorithm == "CHWrapper") { const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits<int>::max()); router = new CHRouterWrapper<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, begin, end, weightPeriod, oc.getInt("routing-threads")); } else { throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!"); } } else { DijkstraRouter<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> >::Operation op; if (measure == "CO") { op = &ROEdge::getEmissionEffort<PollutantsInterface::CO>; } else if (measure == "CO2") { op = &ROEdge::getEmissionEffort<PollutantsInterface::CO2>; } else if (measure == "PMx") { op = &ROEdge::getEmissionEffort<PollutantsInterface::PM_X>; } else if (measure == "HC") { op = &ROEdge::getEmissionEffort<PollutantsInterface::HC>; } else if (measure == "NOx") { op = &ROEdge::getEmissionEffort<PollutantsInterface::NO_X>; } else if (measure == "fuel") { op = &ROEdge::getEmissionEffort<PollutantsInterface::FUEL>; } else if (measure == "electricity") { op = &ROEdge::getEmissionEffort<PollutantsInterface::ELEC>; } else if (measure == "noise") { op = &ROEdge::getNoiseEffort; } else { throw ProcessError("Unknown measure (weight attribute '" + measure + "')!"); } if (net.hasPermissions()) { router = new DijkstraRouter<ROEdge, ROVehicle, SUMOAbstractRouterPermissions<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, ttFunction); } else { router = new DijkstraRouter<ROEdge, ROVehicle, SUMOAbstractRouter<ROEdge, ROVehicle> >( ROEdge::getAllEdges(), oc.getBool("ignore-errors"), op, ttFunction); } } int carWalk = 0; for (const std::string& opt : oc.getStringVector("persontrip.transfer.car-walk")) { if (opt == "parkingAreas") { carWalk |= ROIntermodalRouter::Network::PARKING_AREAS; } else if (opt == "ptStops") { carWalk |= ROIntermodalRouter::Network::PT_STOPS; } else if (opt == "allJunctions") { carWalk |= ROIntermodalRouter::Network::ALL_JUNCTIONS; } } RORouterProvider provider(router, new PedestrianRouter<ROEdge, ROLane, RONode, ROVehicle>(), new ROIntermodalRouter(RONet::adaptIntermodalRouter, carWalk, routingAlgorithm)); // process route definitions try { net.openOutput(oc); loader.processRoutes(begin, end, string2time(oc.getString("route-steps")), net, provider); net.writeIntermodal(oc, provider.getIntermodalRouter()); // end the processing net.cleanup(); } catch (ProcessError&) { net.cleanup(); throw; } }
void MSRouteHandler::closeVehicle() { if(oc.getLoadVerbosity()>1) { std::cout << "----> void MSRouteHandler::closeVehicle()" << std::endl; } // get nested route const MSRoute* route = MSRoute::dictionary("!" + myVehicleParameter->id); MSVehicleControl& vehControl = MSNet::getInstance()->getVehicleControl(); if (myVehicleParameter->departProcedure == DEPART_GIVEN) { // let's check whether this vehicle had to depart before the simulation starts if (!checkLastDepart() || myVehicleParameter->depart < string2time(oc.getString("begin"))) { if (route != 0) { route->addReference(); route->release(); } return; } } // get the vehicle's type MSVehicleType* vtype = 0; if(myVehicleParameter->vtypeid != "") { if(oc.getLoadVerbosity()>2) { std::cout << "[110] void MSRouteHandler::closeVehicle() - myVehiclePa" << "rameter->vtypeid=" << myVehicleParameter->vtypeid << std::endl; } vtype = vehControl.getVType(myVehicleParameter->vtypeid); if(vtype == 0){ throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } } else { if(oc.getLoadVerbosity()>2) { std::cout << "[120] void MSRouteHandler::closeVehicle() - myVehiclePa" << "rameter->vtypeid=" << myVehicleParameter->vtypeid << std::endl; } // there should be one (at least the default one) vtype = vehControl.getVType(); } if(route == 0){ // if there is no nested route, try via the (hopefully) given route-id route = MSRoute::dictionary(myVehicleParameter->routeid); } if(route == 0){ // nothing found? -> error if(myVehicleParameter->routeid != "") { throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); }else{ throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); } } myActiveRouteID = ""; // try to build the vehicle SUMOVehicle* vehicle = 0; if (vehControl.getVehicle(myVehicleParameter->id) == 0) { /* (UPREGO) HERE I THINK THAT THE VEHICLE WAS BEING INSERTED * INCORRECTLY AS (ALWAYS) DEFAULT_VTYPE_ID. Now it checks and uses also * default_elecvtype_id */ /* if(myVehicleParameter->id == DEFAULT_ELECVTYPE_ID) */ /* DANGER i was mistaking myVehicleParameter->id for * myVehicleParameter->vtypeid */ /* TODO Look for this vehicle in the vehicles to track list */ //VehicleToTrack::getVehiclesToTrackWithCharacteristicsList() void *lol = VehicleToTrack::getVehiclesToTrackWithCharacteristicsList(); //if(vehControl.getVehicle(myVehicleParameter->id) == ) if(VehicleToTrack::getVehiclesToTrackWithCharacteristicsList() && VehicleToTrack::getVehiclesToTrackWithCharacteristicsList()->size()>0 ) { /* int i = 0; while(i<VehicleToTrack::getVehiclesToTrackWithCharacteristicsList()->size()) { if(VehicleToTrack::getVehiclesToTrackWithCharacteristicsList()->at(i)->getIdentifier() == myVehicleParameter->id) { // TODO TASK This vehicle has to be parametrized MSVehicleType *vtype2 = new MSVehicleType (vtype, VehicleToTrack::getVehiclesToTrackWithCharacteristicsList().at(i) ); } else i++; } */ } vehicle = vehControl.buildVehicle(myVehicleParameter, route, vtype); // maybe we do not want this vehicle to be inserted due to scaling if (myScale < 0 || vehControl.isInQuota(myScale)) { // add the vehicle to the vehicle control vehControl.addVehicle(myVehicleParameter->id, vehicle); if (myVehicleParameter->departProcedure == DEPART_TRIGGERED) { vehControl.addWaiting(*route->begin(), vehicle); vehControl.registerOneWaitingForPerson(); } myVehicleParameter = 0; } else { vehControl.deleteVehicle(vehicle); myVehicleParameter = 0; vehicle = 0; } } else { // strange: another vehicle with the same id already exists #ifdef HAVE_MESOSIM if (!MSGlobals::gStateLoaded) { #endif // and was not loaded while loading a simulation state // -> error throw ProcessError("Another vehicle with the id '" + myVehicleParameter->id + "' exists."); #ifdef HAVE_MESOSIM } else { // ok, it seems to be loaded previously while loading a simulation state vehicle = 0; } #endif } // check whether the vehicle shall be added directly to the network or // shall stay in the internal buffer if (vehicle != 0) { if (vehicle->getParameter().departProcedure == DEPART_GIVEN) { MSNet::getInstance()->getInsertionControl().add(vehicle); } } }
/* ------------------------------------------------------------------------- * main * ----------------------------------------------------------------------- */ int main(int argc, char** argv) { OptionsCont& oc = OptionsCont::getOptions(); // give some application descriptions oc.setApplicationDescription("Importer of O/D-matrices for the road traffic simulation SUMO."); oc.setApplicationName("od2trips", "SUMO od2trips Version " + (std::string)VERSION_STRING); int ret = 0; try { // initialise subsystems XMLSubSys::init(); fillOptions(); OptionsIO::getOptions(true, argc, argv); if (oc.processMetaOptions(argc < 2)) { SystemFrame::close(); return 0; } XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net")); MsgHandler::initOutputOptions(); if (!checkOptions()) { throw ProcessError(); } RandHelper::initRandGlobal(); // load the districts // check whether the user gave a net filename if (!oc.isSet("net-file")) { throw ProcessError("You must supply a network or districts file ('-n')."); } // get the file name and set it ODDistrictCont districts; districts.loadDistricts(oc.getString("net-file")); if (districts.size() == 0) { throw ProcessError("No districts loaded."); } // load the matrix ODMatrix matrix(districts); matrix.loadMatrix(oc); if (matrix.getNoLoaded() == 0) { throw ProcessError("No vehicles loaded."); } if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) { throw ProcessError("Loading failed."); } WRITE_MESSAGE(toString(matrix.getNoLoaded()) + " vehicles loaded."); // apply a curve if wished if (oc.isSet("timeline")) { matrix.applyCurve(matrix.parseTimeLine(oc.getStringVector("timeline"), oc.getBool("timeline.day-in-hours"))); } // write bool haveOutput = false; if (OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd")) { matrix.write(string2time(oc.getString("begin")), string2time(oc.getString("end")), OutputDevice::getDeviceByOption("output-file"), oc.getBool("spread.uniform"), oc.getBool("ignore-vehicle-type"), oc.getString("prefix"), !oc.getBool("no-step-log")); haveOutput = true; } if (OutputDevice::createDeviceByOption("flow-output", "routes", "routes_file.xsd")) { matrix.writeFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")), OutputDevice::getDeviceByOption("flow-output"), oc.getBool("ignore-vehicle-type"), oc.getString("prefix")); haveOutput = true; } if (!haveOutput) { throw ProcessError("No output file given."); } WRITE_MESSAGE(toString(matrix.getNoDiscarded()) + " vehicles discarded."); WRITE_MESSAGE(toString(matrix.getNoWritten()) + " vehicles written."); } catch (const ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); ret = 1; #ifndef _DEBUG } catch (const std::exception& e) { if (std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); ret = 1; } catch (...) { MsgHandler::getErrorInstance()->inform("Quitting (on unknown error).", false); ret = 1; #endif } SystemFrame::close(); if (ret == 0) { std::cout << "Success." << std::endl; } return ret; }
FXint GUILoadThread::run() { GUINet *net = 0; int simStartTime = 0; int simEndTime = 0; // remove old options OptionsCont &oc = OptionsCont::getOptions(); oc.clear(); // within gui-based applications, nothing is reported to the console MsgHandler::getErrorInstance()->report2cout(false); MsgHandler::getErrorInstance()->report2cerr(false); MsgHandler::getWarningInstance()->report2cout(false); MsgHandler::getWarningInstance()->report2cerr(false); MsgHandler::getMessageInstance()->report2cout(false); MsgHandler::getMessageInstance()->report2cerr(false); // register message callbacks MsgHandler::getMessageInstance()->addRetriever(myMessageRetriever); MsgHandler::getErrorInstance()->addRetriever(myErrorRetriever); MsgHandler::getWarningInstance()->addRetriever(myWarningRetriever); // try to load the given configuration if (!initOptions()) { // the options are not valid submitEndAndCleanup(net, simStartTime, simEndTime); return 0; } MsgHandler::initOutputOptions(true); if (!MSFrame::checkOptions()) { // the options are not valid MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); submitEndAndCleanup(net, simStartTime, simEndTime); return 0; } RandHelper::initRandGlobal(); // try to load MSFrame::setMSGlobals(oc); net = new GUINet(new GUIVehicleControl(), new GUIEventControl(), new GUIEventControl(), new GUIEventControl()); GUIEdgeControlBuilder *eb = new GUIEdgeControlBuilder(GUIGlObjectStorage::gIDStorage); NLJunctionControlBuilder jb(*net, oc); GUIDetectorBuilder db(*net); GUIGeomShapeBuilder sb(*net, GUIGlObjectStorage::gIDStorage); GUITriggerBuilder tb; NLHandler handler("", *net, db, tb, *eb, jb, sb); tb.setHandler(&handler); NLBuilder builder(oc, *net, *eb, jb, db, handler); try { MsgHandler::getErrorInstance()->clear(); MsgHandler::getWarningInstance()->clear(); MsgHandler::getMessageInstance()->clear(); if (!builder.build()) { throw ProcessError(); } else { net->initGUIStructures(); simStartTime = string2time(oc.getString("begin")); simEndTime = string2time(oc.getString("end")); } } catch (ProcessError &e) { if (std::string(e.what())!=std::string("Process Error") && std::string(e.what())!=std::string("")) { MsgHandler::getErrorInstance()->inform(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); delete net; net = 0; #ifndef _DEBUG } catch (std::exception &e) { MsgHandler::getErrorInstance()->inform(e.what()); delete net; net = 0; #endif } if (net==0) { MSNet::clearAll(); } delete eb; submitEndAndCleanup(net, simStartTime, simEndTime); return 0; }
void RORouteHandler::closeVehicle() { // get the vehicle id if (myVehicleParameter->departProcedure == DEPART_GIVEN && myVehicleParameter->depart < string2time(OptionsCont::getOptions().getString("begin"))) { return; } // get vehicle type SUMOVTypeParameter* type = myNet.getVehicleTypeSecure(myVehicleParameter->vtypeid); // get the route RORouteDef* route = myNet.getRouteDef(myVehicleParameter->routeid); if (route == 0) { myErrorOutput->inform("The route of the vehicle '" + myVehicleParameter->id + "' is not known."); return; } if (route->getID()[0] != '!') { route = route->copy("!" + myVehicleParameter->id); } // build the vehicle if (!MsgHandler::getErrorInstance()->wasInformed()) { ROVehicle* veh = new ROVehicle(*myVehicleParameter, route, type); myNet.addVehicle(myVehicleParameter->id, veh); registerLastDepart(); } }
// =========================================================================== // method definitions // =========================================================================== void MSFCDExport::write(OutputDevice& of, SUMOTime timestep, bool elevation) { const bool useGeo = OptionsCont::getOptions().getBool("fcd-output.geo"); const bool signals = OptionsCont::getOptions().getBool("fcd-output.signals"); const SUMOTime period = string2time(OptionsCont::getOptions().getString("device.fcd.period")); if (period > 0 && timestep % period != 0) { return; } of.openTag("timestep").writeAttr(SUMO_ATTR_TIME, time2string(timestep)); MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl(); for (MSVehicleControl::constVehIt it = vc.loadedVehBegin(); it != vc.loadedVehEnd(); ++it) { const SUMOVehicle* veh = it->second; const MSVehicle* microVeh = dynamic_cast<const MSVehicle*>(veh); if ((veh->isOnRoad() || veh->isParking() || veh->isRemoteControlled()) && veh->getDevice(typeid(MSDevice_FCD)) != nullptr) { Position pos = veh->getPosition(); if (useGeo) { of.setPrecision(gPrecisionGeo); GeoConvHelper::getFinal().cartesian2geo(pos); } of.openTag(SUMO_TAG_VEHICLE); of.writeAttr(SUMO_ATTR_ID, veh->getID()); of.writeAttr(SUMO_ATTR_X, pos.x()); of.writeAttr(SUMO_ATTR_Y, pos.y()); if (elevation) { of.writeAttr(SUMO_ATTR_Z, pos.z()); } of.writeAttr(SUMO_ATTR_ANGLE, GeomHelper::naviDegree(veh->getAngle())); of.writeAttr(SUMO_ATTR_TYPE, veh->getVehicleType().getID()); of.writeAttr(SUMO_ATTR_SPEED, veh->getSpeed()); of.writeAttr(SUMO_ATTR_POSITION, veh->getPositionOnLane()); if (microVeh != 0) { of.writeAttr(SUMO_ATTR_LANE, microVeh->getLane()->getID()); } of.writeAttr(SUMO_ATTR_SLOPE, veh->getSlope()); if (microVeh != 0 && signals) { of.writeAttr("signals", toString(microVeh->getSignals())); } of.closeTag(); // write persons and containers const MSEdge* edge = microVeh == 0 ? veh->getEdge() : &veh->getLane()->getEdge(); const std::vector<MSTransportable*>& persons = veh->getPersons(); for (std::vector<MSTransportable*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) { writeTransportable(of, edge, *it_p, SUMO_TAG_PERSON, useGeo, elevation); } const std::vector<MSTransportable*>& containers = veh->getContainers(); for (std::vector<MSTransportable*>::const_iterator it_c = containers.begin(); it_c != containers.end(); ++it_c) { writeTransportable(of, edge, *it_c, SUMO_TAG_CONTAINER, useGeo, elevation); } } } if (MSNet::getInstance()->getPersonControl().hasTransportables()) { // write persons MSEdgeControl& ec = MSNet::getInstance()->getEdgeControl(); const MSEdgeVector& edges = ec.getEdges(); for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) { const std::vector<MSTransportable*>& persons = (*e)->getSortedPersons(timestep); for (std::vector<MSTransportable*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) { writeTransportable(of, *e, *it_p, SUMO_TAG_PERSON, useGeo, elevation); } } } if (MSNet::getInstance()->getContainerControl().hasTransportables()) { // write containers MSEdgeControl& ec = MSNet::getInstance()->getEdgeControl(); const std::vector<MSEdge*>& edges = ec.getEdges(); for (std::vector<MSEdge*>::const_iterator e = edges.begin(); e != edges.end(); ++e) { const std::vector<MSTransportable*>& containers = (*e)->getSortedContainers(timestep); for (std::vector<MSTransportable*>::const_iterator it_c = containers.begin(); it_c != containers.end(); ++it_c) { writeTransportable(of, *e, *it_c, SUMO_TAG_CONTAINER, useGeo, elevation); } } } of.closeTag(); }
void MSRouteHandler::closeVehicle() throw(ProcessError) { if (myVehicleParameter->departProcedure == DEPART_GIVEN) { myLastDepart = myVehicleParameter->depart; // let's check whether this vehicle had to be emitted before the simulation starts if (myVehicleParameter->depart<string2time(OptionsCont::getOptions().getString("begin"))) { return; } } // get the vehicle's type MSVehicleType *vtype = 0; if (myVehicleParameter->vtypeid!="") { vtype = MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid); if (vtype==0) { throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } } else { // there should be one (at least the default one) vtype = MSNet::getInstance()->getVehicleControl().getVType(); } // get the vehicle's route // maybe it was explicitely assigned to the vehicle const MSRoute *route = MSRoute::dictionary("!" + myVehicleParameter->id); if (route==0) { // if not, try via the (hopefully) given route-id route = MSRoute::dictionary(myVehicleParameter->routeid); } if (route==0) { // nothing found? -> error if (myVehicleParameter->routeid!="") { throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } else { throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); } } myActiveRouteID = ""; // try to build the vehicle MSVehicle *vehicle = 0; if (MSNet::getInstance()->getVehicleControl().getVehicle(myVehicleParameter->id)==0) { // ok there was no other vehicle with the same id, yet // maybe we do not want this vehicle to be emitted due to using incremental dua bool add = true; if (myAmUsingIncrementalDUA) { if ((int)(myRunningVehicleNumber%myIncrementalBase)>=(int) myIncrementalStage) { add = false; } myRunningVehicleNumber++; } if (add) { vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(myVehicleParameter, route, vtype); // add the vehicle to the vehicle control MSNet::getInstance()->getVehicleControl().addVehicle(myVehicleParameter->id, vehicle); if (myVehicleParameter->departProcedure == DEPART_TRIGGERED) { MSNet::getInstance()->getVehicleControl().addWaiting(*route->begin(), vehicle); } myVehicleParameter = 0; } } else { // strange: another vehicle with the same id already exists #ifdef HAVE_MESOSIM if (!MSGlobals::gStateLoaded) { #endif // and was not loaded while loading a simulation state // -> error throw ProcessError("Another vehicle with the id '" + myVehicleParameter->id + "' exists."); #ifdef HAVE_MESOSIM } else { // ok, it seems to be loaded previously while loading a simulation state vehicle = 0; } #endif } // check whether the vehicle shall be added directly to the network or // shall stay in the internal buffer if (myAddVehiclesDirectly&&vehicle!=0) { if (vehicle->getParameter().departProcedure == DEPART_GIVEN) { MSNet::getInstance()->getEmitControl().add(vehicle); } } else { myLastReadVehicle = vehicle; } }
void MSRouteHandler::closeVehicle() { // get nested route const MSRoute* route = MSRoute::dictionary("!" + myVehicleParameter->id); MSVehicleControl& vehControl = MSNet::getInstance()->getVehicleControl(); if (myVehicleParameter->departProcedure == DEPART_GIVEN) { // let's check whether this vehicle had to depart before the simulation starts if (!(myAddVehiclesDirectly || checkLastDepart()) || myVehicleParameter->depart < string2time(OptionsCont::getOptions().getString("begin"))) { if (route != 0) { route->addReference(); route->release(); } return; } } // get the vehicle's type MSVehicleType* vtype = 0; if (myVehicleParameter->vtypeid != "") { vtype = vehControl.getVType(myVehicleParameter->vtypeid); if (vtype == 0) { throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } } else { // there should be one (at least the default one) vtype = vehControl.getVType(); } if (route == 0) { // if there is no nested route, try via the (hopefully) given route-id route = MSRoute::dictionary(myVehicleParameter->routeid); } if (route == 0) { // nothing found? -> error if (myVehicleParameter->routeid != "") { throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } else { throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); } } myActiveRouteID = ""; // try to build the vehicle SUMOVehicle* vehicle = 0; if (vehControl.getVehicle(myVehicleParameter->id) == 0) { vehicle = vehControl.buildVehicle(myVehicleParameter, route, vtype); // maybe we do not want this vehicle to be inserted due to scaling if (vehControl.isInQuota()) { // add the vehicle to the vehicle control vehControl.addVehicle(myVehicleParameter->id, vehicle); if (myVehicleParameter->departProcedure == DEPART_TRIGGERED) { vehControl.addWaiting(*route->begin(), vehicle); vehControl.registerOneWaitingForPerson(); } registerLastDepart(); myVehicleParameter = 0; } else { vehControl.deleteVehicle(vehicle, true); myVehicleParameter = 0; vehicle = 0; } } else { // strange: another vehicle with the same id already exists if (!MSGlobals::gStateLoaded) { // and was not loaded while loading a simulation state // -> error throw ProcessError("Another vehicle with the id '" + myVehicleParameter->id + "' exists."); } else { // ok, it seems to be loaded previously while loading a simulation state vehicle = 0; } } // check whether the vehicle shall be added directly to the network or // shall stay in the internal buffer if (vehicle != 0) { if (vehicle->getParameter().departProcedure == DEPART_GIVEN) { MSNet::getInstance()->getInsertionControl().add(vehicle); } } }
/* collect all crd data and write it to a syslog */ static int db_write_cdr( struct dlg_cell* dialog, struct sip_msg* message) { int m = 0; int n = 0; int i; db_func_t *df=NULL; db1_con_t *dh=NULL; void *vf=NULL; void *vh=NULL; struct timeval timeval_val; long long_val; double double_val; char * end; if(acc_cdrs_table.len<=0) return 0; if(acc_get_db_handlers(&vf, &vh)<0) { LM_ERR("cannot get db handlers\n"); return -1; } df = (db_func_t*)vf; dh = (db1_con_t*)vh; /* get default values */ m = cdr_core2strar( dialog, cdr_value_array, cdr_int_array, cdr_type_array); for(i=0; i<m; i++) { db_cdr_keys[i] = &cdr_attrs[i]; /* reset errno, some strtoX don't reset it */ errno = 0; switch(cdr_type_array[i]) { case TYPE_NULL: VAL_NULL(db_cdr_vals+i)=1; break; case TYPE_INT: VAL_TYPE(db_cdr_vals+i)=DB1_INT; VAL_NULL(db_cdr_vals+i)=0; long_val = strtol(cdr_value_array[i].s, &end, 10); if(errno && (errno != EAGAIN)) { LM_ERR("failed to convert string to integer - %d.\n", errno); goto error; } VAL_INT(db_cdr_vals+i) = long_val; break; case TYPE_STR: VAL_TYPE(db_cdr_vals+i)=DB1_STR; VAL_NULL(db_cdr_vals+i)=0; VAL_STR(db_cdr_vals+i) = cdr_value_array[i]; break; case TYPE_DATE: VAL_TYPE(db_cdr_vals+i)=DB1_DATETIME; VAL_NULL(db_cdr_vals+i)=0; if(string2time(&cdr_value_array[i], &timeval_val) < 0) { LM_ERR("failed to convert string to timeval.\n"); goto error; } VAL_TIME(db_cdr_vals+i) = timeval_val.tv_sec; break; case TYPE_DOUBLE: VAL_TYPE(db_cdr_vals+i)=DB1_DOUBLE; VAL_NULL(db_cdr_vals+i)=0; double_val = strtod(cdr_value_array[i].s, &end); if(errno && (errno != EAGAIN)) { LM_ERR("failed to convert string to double - %d.\n", errno); goto error; } VAL_DOUBLE(db_cdr_vals+i) = double_val; break; } } /* get extra values */ if (message) { n += extra2strar( cdr_extra, message, cdr_value_array + m, cdr_int_array + m, cdr_type_array + m); m += n; } else if (cdr_expired_dlg_enable){ LM_WARN( "fallback to dlg_only search because of message doesn't exist.\n"); m += extra2strar_dlg_only( cdr_extra, dialog, cdr_value_array + m, cdr_int_array + m, cdr_type_array +m, &dlgb); } for( ; i<m; i++) { db_cdr_keys[i] = &cdr_attrs[i]; VAL_TYPE(db_cdr_vals+i)=DB1_STR; VAL_NULL(db_cdr_vals+i)=0; VAL_STR(db_cdr_vals+i) = cdr_value_array[i]; } if (df->use_table(dh, &acc_cdrs_table /*table*/) < 0) { LM_ERR("error in use_table\n"); goto error; } if(acc_db_insert_mode==1 && df->insert_delayed!=NULL) { if (df->insert_delayed(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert delayed into database\n"); goto error; } } else if(acc_db_insert_mode==2 && df->insert_async!=NULL) { if (df->insert_async(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert async into database\n"); goto error; } } else { if (df->insert(dh, db_cdr_keys, db_cdr_vals, m) < 0) { LM_ERR("failed to insert into database\n"); goto error; } } /* Free memory allocated by acc_extra.c/extra2strar */ free_strar_mem( &(cdr_type_array[m-n]), &(cdr_value_array[m-n]), n, m); return 0; error: /* Free memory allocated by acc_extra.c/extra2strar */ free_strar_mem( &(cdr_type_array[m-n]), &(cdr_value_array[m-n]), n, m); return -1; }
/** * Computes the routes saving them */ void computeRoutes(RONet& net, ROLoader& loader, OptionsCont& oc) { // initialise the loader loader.openRoutes(net); // prepare the output const std::string& filename = oc.getString("output-file"); std::string altFilename = filename + ".alt"; const size_t len = filename.length(); if (len > 4 && filename.substr(len - 4) == ".xml") { altFilename = filename.substr(0, len - 4) + ".alt.xml"; } else if (len > 4 && filename.substr(len - 4) == ".sbx") { altFilename = filename.substr(0, len - 4) + ".alt.sbx"; } net.openOutput(filename, altFilename, oc.getString("vtype-output")); // build the router SUMOAbstractRouter<ROEdge, ROVehicle>* router; const std::string measure = oc.getString("weight-attribute"); const std::string routingAlgorithm = oc.getString("routing-algorithm"); if (measure == "traveltime") { if (routingAlgorithm == "dijkstra") { if (net.hasRestrictions()) { router = new DijkstraRouterTT_Direct<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime); } else { router = new DijkstraRouterTT_Direct<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime); } } else if (routingAlgorithm == "astar") { if (net.hasRestrictions()) { router = new AStarRouterTT_Direct<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime); } else { router = new AStarRouterTT_Direct<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime); } #ifdef HAVE_INTERNAL // catchall for internal stuff } else if (routingAlgorithm == "bulkstar") { if (net.hasRestrictions()) { router = new BulkStarRouterTT<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime, &ROEdge::getMinimumTravelTime); } else { router = new BulkStarRouterTT<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime, &ROEdge::getMinimumTravelTime); } } else if (routingAlgorithm == "CH") { // defaultVehicle is only in constructor and may be safely deleted // it is mainly needed for its maximum speed. @todo XXX make this configurable ROVehicle defaultVehicle(SUMOVehicleParameter(), 0, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID)); const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits<int>::max()); if (net.hasRestrictions()) { router = new CHRouter<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime, &defaultVehicle, begin, weightPeriod, true); } else { router = new CHRouter<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime, &defaultVehicle, begin, weightPeriod, false); } } else if (routingAlgorithm == "CHWrapper") { const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits<int>::max()); router = new CHRouterWrapper<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), &ROEdge::getTravelTime, begin, weightPeriod); #endif // have HAVE_INTERNAL } else { throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!"); } } else { DijkstraRouterEffort_Direct<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >::Operation op; if (measure == "CO") { op = &ROEdge::getCOEffort; } else if (measure == "CO2") { op = &ROEdge::getCO2Effort; } else if (measure == "PMx") { op = &ROEdge::getPMxEffort; } else if (measure == "HC") { op = &ROEdge::getHCEffort; } else if (measure == "NOx") { op = &ROEdge::getNOxEffort; } else if (measure == "fuel") { op = &ROEdge::getFuelEffort; } else if (measure == "noise") { op = &ROEdge::getNoiseEffort; } else { net.closeOutput(); throw ProcessError("Unknown measure (weight attribute '" + measure + "')!"); } if (net.hasRestrictions()) { router = new DijkstraRouterEffort_Direct<ROEdge, ROVehicle, prohibited_withRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTime); } else { router = new DijkstraRouterEffort_Direct<ROEdge, ROVehicle, prohibited_noRestrictions<ROEdge, ROVehicle> >( net.getEdgeNo(), oc.getBool("ignore-errors"), op, &ROEdge::getTravelTime); } } // process route definitions try { if (routingAlgorithm == "bulkstar") { #ifdef HAVE_INTERNAL // catchall for internal stuff // need to load all routes for spatial aggregation loader.processAllRoutesWithBulkRouter(string2time(oc.getString("begin")), string2time(oc.getString("end")), net, *router); #endif } else { loader.processRoutes(string2time(oc.getString("begin")), string2time(oc.getString("end")), net, *router); } // end the processing net.closeOutput(); delete router; ROCostCalculator::cleanup(); } catch (ProcessError&) { net.closeOutput(); delete router; ROCostCalculator::cleanup(); throw; } }
bool NLBuilder::build() { // try to build the net if (!load("net-file", true)) { return false; } // check whether the loaded net agrees with the simulation options if (myOptions.getBool("no-internal-links") && myXMLHandler.haveSeenInternalEdge()) { WRITE_WARNING("Network contains internal links but option --no-internal-links is set. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times."); } if (myOptions.getString("lanechange.duration") != "0" && myXMLHandler.haveSeenNeighs()) { throw ProcessError("Network contains explicit neigh lanes which do not work together with option --lanechange.duration."); } buildNet(); // @note on loading order constraints: // - additional-files before route-files and state-files due to referencing // - additional-files before weight-files since the latter might contain intermodal edge data and the intermodal net depends on the stops and public transport from the additionals // load additional net elements (sources, detectors, ...) if (myOptions.isSet("additional-files")) { if (!load("additional-files")) { return false; } // load shapes with separate handler NLShapeHandler sh("", myNet.getShapeContainer()); if (!ShapeHandler::loadFiles(myOptions.getStringVector("additional-files"), sh)) { return false; } if (myXMLHandler.haveSeenAdditionalSpeedRestrictions()) { myNet.getEdgeControl().setAdditionalRestrictions(); } } // load weights if wished if (myOptions.isSet("weight-files")) { if (!myOptions.isUsableFileList("weight-files")) { return false; } // build and prepare the weights handler std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs; // travel time, first (always used) EdgeFloatTimeLineRetriever_EdgeTravelTime ttRetriever(myNet); retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition("traveltime", true, ttRetriever)); // the measure to use, then EdgeFloatTimeLineRetriever_EdgeEffort eRetriever(myNet); std::string measure = myOptions.getString("weight-attribute"); if (!myOptions.isDefault("weight-attribute")) { if (measure == "CO" || measure == "CO2" || measure == "HC" || measure == "PMx" || measure == "NOx" || measure == "fuel" || measure == "electricity") { measure += "_perVeh"; } retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition(measure, true, eRetriever)); } // set up handler SAXWeightsHandler handler(retrieverDefs, ""); // start parsing; for each file in the list std::vector<std::string> files = myOptions.getStringVector("weight-files"); for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) { // report about loading when wished WRITE_MESSAGE("Loading weights from '" + *i + "'..."); // parse the file if (!XMLSubSys::runParser(handler, *i)) { return false; } } } // load the previous state if wished if (myOptions.isSet("load-state")) { long before = SysUtils::getCurrentMillis(); const std::string& f = myOptions.getString("load-state"); PROGRESS_BEGIN_MESSAGE("Loading state from '" + f + "'"); MSStateHandler h(f, string2time(myOptions.getString("load-state.offset"))); XMLSubSys::runParser(h, f); if (myOptions.isDefault("begin")) { myOptions.set("begin", time2string(h.getTime())); if (TraCIServer::getInstance() != 0) { TraCIServer::getInstance()->setTargetTime(h.getTime()); } } if (MsgHandler::getErrorInstance()->wasInformed()) { return false; } if (h.getTime() != string2time(myOptions.getString("begin"))) { WRITE_WARNING("State was written at a different time " + time2string(h.getTime()) + " than the begin time " + myOptions.getString("begin") + "!"); } PROGRESS_TIME_MESSAGE(before); } // load routes if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) { if (!load("route-files")) { return false; } } // optionally switch off traffic lights if (myOptions.getBool("tls.all-off")) { myNet.getTLSControl().switchOffAll(); } WRITE_MESSAGE("Loading done."); return true; }
bool MSFrame::checkOptions() { OptionsCont& oc = OptionsCont::getOptions(); bool ok = true; if (!oc.isSet("net-file")) { WRITE_ERROR("No network file (-n) specified."); ok = false; } if (!oc.isDefault("scale")) { if (oc.getFloat("scale") < 0.) { WRITE_ERROR("Invalid scaling factor."); ok = false; } } if (oc.getBool("vehroute-output.exit-times") && !oc.isSet("vehroute-output")) { WRITE_ERROR("A vehroute-output file is needed for exit times."); ok = false; } if (oc.isSet("gui-settings-file") && oc.getString("gui-settings-file") != "" && !oc.isUsableFileList("gui-settings-file")) { ok = false; } if (oc.getBool("demo") && oc.isDefault("start")) { oc.set("start", "true"); } if (oc.getBool("demo") && oc.getBool("quit-on-end")) { WRITE_ERROR("You can either restart or quit on end."); ok = false; } if (oc.getBool("meso-junction-control.limited") && !oc.getBool("meso-junction-control")) { oc.set("meso-junction-control", "true"); } const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime end = string2time(oc.getString("end")); if (begin < 0) { WRITE_ERROR("The begin time should not be negative."); ok = false; } if (end != string2time("-1")) { if (end < begin) { WRITE_ERROR("The end time should be after the begin time."); ok = false; } } if (string2time(oc.getString("step-length")) <= 0) { WRITE_ERROR("the minimum step-length is 0.001"); ok = false; } #ifdef _DEBUG if (oc.isSet("movereminder-output.vehicles") && !oc.isSet("movereminder-output")) { WRITE_ERROR("option movereminder-output.vehicles requires option movereminder-output to be set"); ok = false; } #endif if (oc.getBool("sloppy-insert")) { WRITE_WARNING("The option 'sloppy-insert' is deprecated, because it is now activated by default, see the new option 'eager-insert'."); } if (string2time(oc.getString("lanechange.duration")) > 0 && oc.getFloat("lateral-resolution") > 0) { WRITE_ERROR("Only one of the options 'lanechange.duration' or 'lateral-resolution' may be given."); } if (oc.getBool("lanechange.allow-swap")) { WRITE_WARNING("The option 'lanechange.allow-swap' is deprecated, and will not be supported in future versions of SUMO."); } if (oc.getBool("ignore-accidents")) { WRITE_WARNING("The option 'ignore-accidents' is deprecated. Use 'collision.action none' instead."); } if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) { oc.set("verbose", "true"); } ok &= MSDevice::checkOptions(oc); return ok; }
void startComputation(RODFNet* optNet, RODFDetectorFlows& flows, RODFDetectorCon& detectors, OptionsCont& oc) { if (oc.getBool("print-absolute-flows")) { flows.printAbsolute(); } // if a network was loaded... (mode1) if (optNet != 0) { if (oc.getBool("remove-empty-detectors")) { PROGRESS_BEGIN_MESSAGE("Removing empty detectors"); optNet->removeEmptyDetectors(detectors, flows); PROGRESS_DONE_MESSAGE(); } else if (oc.getBool("report-empty-detectors")) { PROGRESS_BEGIN_MESSAGE("Scanning for empty detectors"); optNet->reportEmptyDetectors(detectors, flows); PROGRESS_DONE_MESSAGE(); } // compute the detector types (optionally) if (!detectors.detectorsHaveCompleteTypes() || oc.getBool("revalidate-detectors")) { optNet->computeTypes(detectors, oc.getBool("strict-sources")); } std::vector<RODFDetector*>::const_iterator i = detectors.getDetectors().begin(); for (; i != detectors.getDetectors().end(); ++i) { if ((*i)->getType() == SOURCE_DETECTOR) { break; } } if (i == detectors.getDetectors().end() && !oc.getBool("routes-for-all")) { throw ProcessError("No source detectors found."); } // compute routes between the detectors (optionally) if (!detectors.detectorsHaveRoutes() || oc.getBool("revalidate-routes") || oc.getBool("guess-empty-flows")) { PROGRESS_BEGIN_MESSAGE("Computing routes"); optNet->buildRoutes(detectors, oc.getBool("all-end-follower"), oc.getBool("keep-unfinished-routes"), oc.getBool("routes-for-all"), !oc.getBool("keep-longer-routes"), oc.getInt("max-search-depth")); PROGRESS_DONE_MESSAGE(); } } // check // whether the detectors are valid if (!detectors.detectorsHaveCompleteTypes()) { throw ProcessError("The detector types are not defined; use in combination with a network"); } // whether the detectors have routes if (!detectors.detectorsHaveRoutes()) { throw ProcessError("The emitters have no routes; use in combination with a network"); } // save the detectors if wished if (oc.isSet("detector-output")) { detectors.save(oc.getString("detector-output")); } // save their positions as POIs if wished if (oc.isSet("detectors-poi-output")) { detectors.saveAsPOIs(oc.getString("detectors-poi-output")); } // save the routes file if it was changed or it's wished if (detectors.detectorsHaveRoutes() && oc.isSet("routes-output")) { detectors.saveRoutes(oc.getString("routes-output")); } // guess flows if wished if (oc.getBool("guess-empty-flows")) { optNet->buildDetectorDependencies(detectors); detectors.guessEmptyFlows(flows); } const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime end = string2time(oc.getString("end")); const SUMOTime step = string2time(oc.getString("time-step")); // save emitters if wished if (oc.isSet("emitters-output") || oc.isSet("emitters-poi-output")) { optNet->buildEdgeFlowMap(flows, detectors, begin, end, step); // !!! if (oc.getBool("revalidate-flows")) { PROGRESS_BEGIN_MESSAGE("Rechecking loaded flows"); optNet->revalidateFlows(detectors, flows, begin, end, step); PROGRESS_DONE_MESSAGE(); } if (oc.isSet("emitters-output")) { PROGRESS_BEGIN_MESSAGE("Writing emitters"); detectors.writeEmitters(oc.getString("emitters-output"), flows, begin, end, step, *optNet, oc.getBool("calibrator-output"), oc.getBool("include-unused-routes"), oc.getFloat("scale"), // oc.getInt("max-search-depth"), oc.getBool("emissions-only")); PROGRESS_DONE_MESSAGE(); } if (oc.isSet("emitters-poi-output")) { PROGRESS_BEGIN_MESSAGE("Writing emitter pois"); detectors.writeEmitterPOIs(oc.getString("emitters-poi-output"), flows); PROGRESS_DONE_MESSAGE(); } } // save end speed trigger if wished if (oc.isSet("variable-speed-sign-output")) { PROGRESS_BEGIN_MESSAGE("Writing speed triggers"); detectors.writeSpeedTrigger(optNet, oc.getString("variable-speed-sign-output"), flows, begin, end, step); PROGRESS_DONE_MESSAGE(); } // save checking detectors if wished if (oc.isSet("validation-output")) { PROGRESS_BEGIN_MESSAGE("Writing validation detectors"); detectors.writeValidationDetectors(oc.getString("validation-output"), oc.getBool("validation-output.add-sources"), true, true); // !!! PROGRESS_DONE_MESSAGE(); } // build global rerouter on end if wished if (oc.isSet("end-reroute-output")) { PROGRESS_BEGIN_MESSAGE("Writing highway end rerouter"); detectors.writeEndRerouterDetectors(oc.getString("end-reroute-output")); // !!! PROGRESS_DONE_MESSAGE(); } /* // save the insertion definitions if(oc.isSet("flow-definitions")) { buildVehicleEmissions(oc.getString("flow-definitions")); } */ // }
/* ------------------------------------------------------------------------- * main * ----------------------------------------------------------------------- */ int main(int argc, char** argv) { OptionsCont& oc = OptionsCont::getOptions(); // give some application descriptions oc.setApplicationDescription("Builds vehicle routes for SUMO using detector values."); oc.setApplicationName("dfrouter", "SUMO dfrouter Version " + (std::string)VERSION_STRING); int ret = 0; RODFNet* net = 0; RODFDetectorCon* detectors = 0; RODFDetectorFlows* flows = 0; try { // initialise the application system (messaging, xml, options) XMLSubSys::init(); RODFFrame::fillOptions(); OptionsIO::getOptions(true, argc, argv); if (oc.processMetaOptions(argc < 2)) { SystemFrame::close(); return 0; } XMLSubSys::setValidation(oc.getBool("xml-validation")); MsgHandler::initOutputOptions(); if (!RODFFrame::checkOptions()) { throw ProcessError(); } RandHelper::initRandGlobal(); // load data ROLoader loader(oc, false, !oc.getBool("no-step-log")); net = new RODFNet(oc.getBool("highway-mode")); RODFEdgeBuilder builder; loader.loadNet(*net, builder); net->buildApproachList(); // load detectors detectors = new RODFDetectorCon(); readDetectors(*detectors, oc, net); // load detector values flows = new RODFDetectorFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")), string2time(oc.getString("time-step"))); readDetectorFlows(*flows, oc, *detectors); // build routes startComputation(net, *flows, *detectors, oc); } catch (const ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); ret = 1; #ifndef _DEBUG } catch (const std::exception& e) { if (std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); } MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); ret = 1; } catch (...) { MsgHandler::getErrorInstance()->inform("Quitting (on unknown error).", false); ret = 1; #endif } delete net; delete flows; delete detectors; SystemFrame::close(); if (ret == 0) { std::cout << "Success." << std::endl; } return ret; }
TimeField::TimeField(const std::string& value) { _value = string2time(value); }
void TraCIServer::processCommandsUntilSimStep(SUMOTime step) { try { if (myInstance == 0) { if (!myDoCloseConnection && OptionsCont::getOptions().getInt("remote-port") != 0) { myInstance = new TraCIServer(string2time(OptionsCont::getOptions().getString("begin")), OptionsCont::getOptions().getInt("remote-port")); } else { return; } } if (myInstance->myAmEmbedded || step < myInstance->myTargetTime) { return; } // Simulation should run until // 1. end time reached or // 2. got CMD_CLOSE or // 3. Client closes socket connection if (myInstance->myDoingSimStep) { myInstance->postProcessSimulationStep2(); myInstance->myDoingSimStep = false; } while (!myDoCloseConnection) { if (!myInstance->myInputStorage.valid_pos()) { if (myInstance->myOutputStorage.size() > 0) { // send out all answers as one storage myInstance->mySocket->sendExact(myInstance->myOutputStorage); } myInstance->myInputStorage.reset(); myInstance->myOutputStorage.reset(); // Read a message myInstance->mySocket->receiveExact(myInstance->myInputStorage); } while (myInstance->myInputStorage.valid_pos() && !myDoCloseConnection) { // dispatch each command int cmd = myInstance->dispatchCommand(); if (cmd == CMD_SIMSTEP2) { myInstance->myDoingSimStep = true; for (std::map<MSNet::VehicleState, std::vector<std::string> >::iterator i = myInstance->myVehicleStateChanges.begin(); i != myInstance->myVehicleStateChanges.end(); ++i) { (*i).second.clear(); } return; } } } if (myDoCloseConnection && myInstance->myOutputStorage.size() > 0) { // send out all answers as one storage myInstance->mySocket->sendExact(myInstance->myOutputStorage); } for (std::map<MSNet::VehicleState, std::vector<std::string> >::iterator i = myInstance->myVehicleStateChanges.begin(); i != myInstance->myVehicleStateChanges.end(); ++i) { (*i).second.clear(); } } catch (std::invalid_argument& e) { throw ProcessError(e.what()); } catch (TraCIException& e) { throw ProcessError(e.what()); } catch (tcpip::SocketException& e) { throw ProcessError(e.what()); } if (myInstance != NULL) { delete myInstance; myInstance = 0; myDoCloseConnection = true; } }
void NLHandler::addEdgeLaneMeanData(const SUMOSAXAttributes& attrs, int objecttype) { bool ok = true; std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok); const SUMOReal maxTravelTime = attrs.getOpt<SUMOReal>(SUMO_ATTR_MAX_TRAVELTIME, id.c_str(), ok, 100000); const SUMOReal minSamples = attrs.getOpt<SUMOReal>(SUMO_ATTR_MIN_SAMPLES, id.c_str(), ok, 0); const SUMOReal haltingSpeedThreshold = attrs.getOpt<SUMOReal>(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, POSITION_EPS); const std::string excludeEmpty = attrs.getOpt<std::string>(SUMO_ATTR_EXCLUDE_EMPTY, id.c_str(), ok, "false"); const bool withInternal = attrs.getOpt<bool>(SUMO_ATTR_WITH_INTERNAL, id.c_str(), ok, false); const bool trackVehicles = attrs.getOpt<bool>(SUMO_ATTR_TRACK_VEHICLES, id.c_str(), ok, false); const std::string file = attrs.get<std::string>(SUMO_ATTR_FILE, id.c_str(), ok); const std::string type = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, id.c_str(), ok, "performance"); std::string vtypes = attrs.getOpt<std::string>(SUMO_ATTR_VTYPES, id.c_str(), ok, ""); const SUMOTime frequency = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, -1); const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("begin"))); const SUMOTime end = attrs.getOptSUMOTimeReporting(SUMO_ATTR_END, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("end"))); if (!ok) { return; } try { myDetectorBuilder.createEdgeLaneMeanData(id, frequency, begin, end, type, objecttype == SUMO_TAG_MEANDATA_LANE, // equivalent to TplConvert::_2bool used in SUMOSAXAttributes::getBool excludeEmpty[0] != 't' && excludeEmpty[0] != 'T' && excludeEmpty[0] != '1' && excludeEmpty[0] != 'x', excludeEmpty == "defaults", withInternal, trackVehicles, maxTravelTime, minSamples, haltingSpeedThreshold, vtypes, FileHelpers::checkForRelativity(file, getFileName())); } catch (InvalidArgument& e) { WRITE_ERROR(e.what()); } catch (IOError& e) { WRITE_ERROR(e.what()); } }
void GNEStop::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: changeDemandElementID(value); break; case SUMO_ATTR_DURATION: duration = string2time(value); break; case SUMO_ATTR_UNTIL: until = string2time(value); break; case SUMO_ATTR_INDEX: if (value == "fit") { index = STOP_INDEX_FIT; } else if (value == "end") { index = STOP_INDEX_END; } else { index = parse<int>(value); } break; case SUMO_ATTR_TRIGGERED: if (value.empty()) { parametersSet &= ~STOP_TRIGGER_SET; } else { triggered = parse<bool>(value); parametersSet |= STOP_TRIGGER_SET; } break; case SUMO_ATTR_CONTAINER_TRIGGERED: if (value.empty()) { parametersSet &= ~STOP_CONTAINER_TRIGGER_SET; } else { containerTriggered = parse<bool>(value); parametersSet |= STOP_CONTAINER_TRIGGER_SET; } break; case SUMO_ATTR_EXPECTED: if (value.empty()) { parametersSet &= ~STOP_EXPECTED_SET; } else { awaitedPersons = parse<std::set<std::string> >(value); parametersSet |= STOP_EXPECTED_SET; } break; case SUMO_ATTR_EXPECTED_CONTAINERS: if (value.empty()) { parametersSet &= ~STOP_EXPECTED_CONTAINERS_SET; } else { awaitedContainers = parse<std::set<std::string> >(value); parametersSet |= STOP_EXPECTED_CONTAINERS_SET; } break; case SUMO_ATTR_PARKING: if (value.empty()) { parametersSet &= ~STOP_PARKING_SET; } else { parking = parse<bool>(value); parametersSet |= STOP_PARKING_SET; } break; case SUMO_ATTR_ACTTYPE: // CHECK break; case SUMO_ATTR_TRIP_ID: if (value.empty()) { parametersSet &= ~STOP_TRIP_ID_SET; } else { tripId = value; parametersSet |= STOP_TRIP_ID_SET; } break; // specific of Stops over stoppingPlaces case SUMO_ATTR_BUS_STOP: case SUMO_ATTR_CONTAINER_STOP: case SUMO_ATTR_CHARGING_STATION: case SUMO_ATTR_PARKING_AREA: changeAdditionalParent(this, value, 0); break; // specific of Stops over lanes case SUMO_ATTR_LANE: changeLaneParents(this, value); break; case SUMO_ATTR_STARTPOS: if (value.empty()) { parametersSet &= ~STOP_START_SET; } else { startPos = parse<double>(value); parametersSet |= STOP_START_SET; } break; case SUMO_ATTR_ENDPOS: if (value.empty()) { parametersSet &= ~STOP_END_SET; } else { endPos = parse<double>(value); parametersSet |= STOP_END_SET; } break; case SUMO_ATTR_FRIENDLY_POS: myFriendlyPosition = parse<bool>(value); break; // case GNE_ATTR_SELECTED: if (parse<bool>(value)) { selectAttributeCarrier(); } else { unselectAttributeCarrier(); } break; case GNE_ATTR_GENERIC: setGenericParametersStr(value); break; default: throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'"); } // check if updated attribute requieres update geometry if (myTagProperty.hasAttribute(key) && myTagProperty.getAttributeProperties(key).requiereUpdateGeometry()) { updateGeometry(true); } }