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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Parser and container for routes during their loading
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
36 #include <od/ODMatrix.h>
37 #include "ROMARouteHandler.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
44  SUMOSAXHandler(""),
45  myMatrix(matrix) {
46  if (OptionsCont::getOptions().isSet("taz-param")) {
48  }
49 }
50 
51 
53 }
54 
55 
56 void
58  const SUMOSAXAttributes& attrs) {
59  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
61  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
62  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
64  }
65  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  std::pair<const std::string, const std::string> od = std::make_pair(myVehicleParameter->fromTaz, myVehicleParameter->toTaz);
77  delete myVehicleParameter;
78  }
79 }
80 
81 
82 /****************************************************************************/
ODMatrix & myMatrix
The matrix to fill.
ROMARouteHandler(ODMatrix &matrix)
standard constructor
std::string vtypeid
The vehicle&#39;s type id.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
virtual ~ROMARouteHandler()
standard destructor
SAX-handler base for SUMO-files.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
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:75
SUMOTime depart
The vehicle&#39;s departure time.
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.
bool add(double vehicleNumber, SUMOTime begin, SUMOTime end, const std::string &origin, const std::string &destination, const std::string &vehicleType)
Builds a single cell from the given values, verifying them.
Definition: ODMatrix.cpp:70
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.