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 /****************************************************************************/
ODMatrix & myMatrix
The matrix to fill.
const int VEHPARS_TO_TAZ_SET
ROMARouteHandler(ODMatrix &matrix)
standard constructor
std::string vtypeid
The vehicle&#39;s type id.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
virtual ~ROMARouteHandler()
standard destructor
SAX-handler base for SUMO-files.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
std::string toTaz
The vehicle&#39;s destination zone (district)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::vector< std::string > myTazParamKeys
The keys for reading taz.
Encapsulated SAX-Attributes.
parameter associated to a certain key
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
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
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) ...
std::string fromTaz
The vehicle&#39;s origin zone (district)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
const int VEHPARS_FROM_TAZ_SET
bool wasSet(int what) const
Returns whether the given parameter was set.
description of a vehicle
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
a single trip definition (used by router)
std::string id
The vehicle&#39;s id.