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 /****************************************************************************/
18 // Parser and container for routes during their loading
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
31 #include <od/ODMatrix.h>
32 #include "ROMARouteHandler.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
39  SUMOSAXHandler(""), myMatrix(matrix) {
40  if (OptionsCont::getOptions().isSet("taz-param")) {
42  }
43 }
44 
45 
47 }
48 
49 
50 void
52  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
56  }
59  }
60  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
61  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
64  }
65  if (myTazParamKeys.size() > 1 && attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[1]) {
68  }
69  }
70 }
71 
72 
73 void
75  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
76  if (myVehicleParameter->fromTaz == "" || myVehicleParameter->toTaz == "") {
77  WRITE_WARNING("No origin or no destination given, ignoring '" + myVehicleParameter->id + "'!");
78  } else {
82  }
83  delete myVehicleParameter;
84  }
85 }
86 
87 
88 /****************************************************************************/
ROMARouteHandler::ROMARouteHandler
ROMARouteHandler(ODMatrix &matrix)
standard constructor
Definition: ROMARouteHandler.cpp:38
SUMOVehicleParameter::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: SUMOVehicleParameter.h:306
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:650
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
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:42
SUMOVehicleParserHelper.h
OptionsCont.h
SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:170
ROMARouteHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: ROMARouteHandler.cpp:51
SUMOVehicleParameter::vtypeid
std::string vtypeid
The vehicle's type id.
Definition: SUMOVehicleParameter.h:468
MsgHandler.h
ROMARouteHandler::~ROMARouteHandler
virtual ~ROMARouteHandler()
standard destructor
Definition: ROMARouteHandler.cpp:46
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
ODMatrix.h
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:476
SUMOVehicleParameter.h
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
Definition: SUMOXMLDefinitions.h:638
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:64
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:462
SUMOVehicleParameter::fromTaz
std::string fromTaz
The vehicle's origin zone (district)
Definition: SUMOVehicleParameter.h:558
SUMO_TAG_VEHICLE
description of a vehicle
Definition: SUMOXMLDefinitions.h:120
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:74
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:637
ROMARouteHandler::myMatrix
ODMatrix & myMatrix
The matrix to fill.
Definition: ROMARouteHandler.h:73
ROMARouteHandler::myTazParamKeys
std::vector< std::string > myTazParamKeys
The keys for reading taz.
Definition: ROMARouteHandler.h:76
SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:409
VEHPARS_FROM_TAZ_SET
const int VEHPARS_FROM_TAZ_SET
Definition: SUMOVehicleParameter.h:61
SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:776
VEHPARS_TO_TAZ_SET
const int VEHPARS_TO_TAZ_SET
Definition: SUMOVehicleParameter.h:62
ROMARouteHandler::myVehicleParameter
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
Definition: ROMARouteHandler.h:78
config.h
SUMOVehicleParameter::toTaz
std::string toTaz
The vehicle's destination zone (district)
Definition: SUMOVehicleParameter.h:561
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
ROMARouteHandler.h
OptionsCont::getStringVector
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:921
SUMO_TAG_TRIP
a single trip definition (used by router)
Definition: SUMOXMLDefinitions.h:146