Eclipse SUMO - Simulation of Urban MObility
ROMARouteHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Parser and container for routes during their loading
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
30 #include <od/ODMatrix.h>
31 #include "ROMARouteHandler.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  SUMOSAXHandler(""), myMatrix(matrix) {
39  if (OptionsCont::getOptions().isSet("taz-param")) {
41  }
42 }
43 
44 
46 }
47 
48 
49 void
51  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
55  }
58  }
59  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
60  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
63  }
64  if (myTazParamKeys.size() > 1 && attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[1]) {
67  }
68  }
69 }
70 
71 
72 void
74  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
75  if (myVehicleParameter->fromTaz == "" || myVehicleParameter->toTaz == "") {
76  WRITE_WARNING("No origin or no destination given, ignoring '" + myVehicleParameter->id + "'!");
77  } else {
81  }
82  delete myVehicleParameter;
83  }
84 }
85 
86 
87 /****************************************************************************/
ROMARouteHandler::ROMARouteHandler
ROMARouteHandler(ODMatrix &matrix)
standard constructor
Definition: ROMARouteHandler.cpp:37
SUMOVehicleParameter::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: SUMOVehicleParameter.h:312
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SUMOVehicleParameter::parametersSet
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
Definition: SUMOVehicleParameter.h:671
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
SUMOVehicleParserHelper.h
OptionsCont.h
SUMO_TAG_PARAM
@ SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
ROMARouteHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: ROMARouteHandler.cpp:50
SUMOVehicleParameter::vtypeid
std::string vtypeid
The vehicle's type id.
Definition: SUMOVehicleParameter.h:474
MsgHandler.h
ROMARouteHandler::~ROMARouteHandler
virtual ~ROMARouteHandler()
standard destructor
Definition: ROMARouteHandler.cpp:45
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
ODMatrix.h
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:482
SUMOVehicleParameter.h
OptionsCont::getStringVector
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
Definition: OptionsCont.cpp:235
SUMOVehicleParserHelper::parseVehicleAttributes
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
Definition: SUMOVehicleParserHelper.cpp:231
SUMO_ATTR_TO
@ SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
ODMatrix::add
bool add(double vehicleNumber, SUMOTime begin, SUMOTime end, const std::string &origin, const std::string &destination, const std::string &vehicleType, const bool originIsEdge=false, const bool destinationIsEdge=false)
Builds a single cell from the given values, verifying them.
Definition: ODMatrix.cpp:63
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:468
SUMOVehicleParameter::fromTaz
std::string fromTaz
The vehicle's origin zone (district)
Definition: SUMOVehicleParameter.h:564
SUMO_TAG_VEHICLE
@ SUMO_TAG_VEHICLE
description of a vehicle
Definition: SUMOXMLDefinitions.h:119
ODMatrix
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
ROMARouteHandler::myEndElement
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
Definition: ROMARouteHandler.cpp:73
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
ROMARouteHandler::myMatrix
ODMatrix & myMatrix
The matrix to fill.
Definition: ROMARouteHandler.h:72
ROMARouteHandler::myTazParamKeys
std::vector< std::string > myTazParamKeys
The keys for reading taz.
Definition: ROMARouteHandler.h:75
SUMO_ATTR_KEY
@ SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
VEHPARS_FROM_TAZ_SET
const int VEHPARS_FROM_TAZ_SET
Definition: SUMOVehicleParameter.h:60
SUMO_ATTR_VALUE
@ SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
VEHPARS_TO_TAZ_SET
const int VEHPARS_TO_TAZ_SET
Definition: SUMOVehicleParameter.h:61
ROMARouteHandler::myVehicleParameter
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
Definition: ROMARouteHandler.h:77
config.h
SUMOVehicleParameter::toTaz
std::string toTaz
The vehicle's destination zone (district)
Definition: SUMOVehicleParameter.h:567
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
ROMARouteHandler.h
SUMO_TAG_TRIP
@ SUMO_TAG_TRIP
a single trip definition (used by router)
Definition: SUMOXMLDefinitions.h:145