NLHandler Class Reference

#include <NLHandler.h>

Inheritance diagram for NLHandler:

MSRouteHandler SUMOSAXHandler GenericSAXHandler

Detailed Description

Definition at line 67 of file NLHandler.h.


Public Types

typedef std::vector< MSLane * > LaneVector
 Definition of a lane vector.

Public Member Functions

void characters (const XMLCh *const chars, const XERCES3_SIZE_t length)
 The inherited method called when characters occured.
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 The inherited method called when a tag is being closed.
const std::string & getFileName () const throw ()
 returns the current file name
SUMOTime getLastDepart () const
 Returns the last loaded depart time.
 NLHandler (const std::string &file, MSNet &net, NLDetectorBuilder &detBuilder, NLTriggerBuilder &triggerBuilder, NLEdgeControlBuilder &edgeBuilder, NLJunctionControlBuilder &junctionBuilder, NLGeomShapeBuilder &shapeBuilder) throw ()
 Constructor.
void registerParent (const SumoXMLTag tag, GenericSAXHandler *handler)
 Assigning a parent handler which is enabled when the specified tag is closed.
void retrieveLastReadVehicle (MSEmitControl *into)
 Returns the last loaded vehicle.
void setFileName (const std::string &name) throw ()
 Sets the current file name.
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
 The inherited method called when a new tag opens.
virtual ~NLHandler () throw ()
 Destructor.
SAX ErrorHandler callbacks
void error (const SAXParseException &exception) throw (ProcessError)
 Handler for XML-errors.
void fatalError (const SAXParseException &exception) throw (ProcessError)
 Handler for XML-errors.
void warning (const SAXParseException &exception) throw ()
 Handler for XML-warnings.

Protected Member Functions

virtual void addDetector (const SUMOSAXAttributes &attrs)
 adds a detector Determines the type of the detector first, and then calls the appropriate method
virtual void addE1Detector (const SUMOSAXAttributes &attrs)
 Builds an e1-detector using the given specification.
virtual void addE2Detector (const SUMOSAXAttributes &attrs)
 Builds an e2-detector using the given specification.
void addE3Entry (const SUMOSAXAttributes &attrs)
 Adds an entry to the currently processed e3-detector.
void addE3Exit (const SUMOSAXAttributes &attrs)
 Adds an exit to the currently processed e3-detector.
virtual void addEdgeLaneMeanData (const SUMOSAXAttributes &attrs, const char *objecttype)
 Builds edge or lane base mean data collector using the given specification.
void addParam (const SUMOSAXAttributes &attrs)
virtual void addRouteProbeDetector (const SUMOSAXAttributes &attrs)
 Builds a routeprobe-detector using the given specification.
virtual void addVTypeProbeDetector (const SUMOSAXAttributes &attrs)
 Builds a vtype-detector using the given specification.
void beginE3Detector (const SUMOSAXAttributes &attrs)
 Starts building of an e3-detector using the given specification.
std::string buildErrorMessage (const SAXParseException &exception) throw ()
 Builds an error message.
virtual void closeEdge ()
 Closes the process of building an edge.
void closeFlow () throw (ProcessError)
 Ends the processing of a flow.
virtual void closeLane ()
 Closes the process of building a lane.
void closePerson () throw (ProcessError)
 Ends the processing of a person.
void closeRoute () throw (ProcessError)
void closeRouteDistribution ()
void closeVehicle () throw (ProcessError)
 Ends the processing of a vehicle.
void closeVehicleTypeDistribution ()
void endDetector ()
 Ends the detector building.
virtual void endE3Detector ()
 Builds of an e3-detector using collected values.
void openRoute (const SUMOSAXAttributes &attrs)
void openRouteDistribution (const SUMOSAXAttributes &attrs)
void openVehicleTypeDistribution (const SUMOSAXAttributes &attrs)
inherited from GenericSAXHandler
virtual void myCharacters (SumoXMLTag element, const std::string &chars) throw (ProcessError)
 Called when characters occure.
virtual void myEndElement (SumoXMLTag element) throw (ProcessError)
 Called when a closing tag occurs.
virtual void myStartElement (SumoXMLTag element, const SUMOSAXAttributes &attrs) throw (ProcessError)
 Called on the opening of a tag;.

Protected Attributes

NLDiscreteEventBuilder myActionBuilder
 A builder for object actions.
MSPerson::MSPersonPlanmyActivePlan
 the plan of the current person
MSEdgeVector myActiveRoute
 the current route
RGBColor myActiveRouteColor
 The currently parsed route's color.
std::string myActiveRouteID
 the id of the current route
SUMOReal myActiveRouteProbability
 the id of the current route
std::vector
< SUMOVehicleParameter::Stop
myActiveRouteStops
 List of the stops on the parsed route.
bool myAddVehiclesDirectly
bool myAmInTLLogicMode
 internal information whether a tls-logic is currently read
bool myAmUsingIncrementalDUA
 Information whether not all vehicle shall be emitted due to inc-dua.
Boundary myConvBoundary
std::string myCurrentDetectorType
 The type of the last detector.
bool myCurrentIsBroken
bool myCurrentIsInternalToSkip
 Information whether the currently parsed edge is internal and not wished, here.
RandomDistributor< const
MSRoute * > * 
myCurrentRouteDistribution
 The currently parsed distribution of routes (probability->route).
std::string myCurrentRouteDistributionID
 The id of the currently parsed route distribution.
SUMOVTypeParametermyCurrentVType
 The currently parsed vehicle type.
RandomDistributor
< MSVehicleType * > * 
myCurrentVTypeDistribution
 The currently parsed distribution of vehicle types (probability->vehicle type).
std::string myCurrentVTypeDistributionID
 The id of the currently parsed vehicle type distribution.
std::string myCurrentWAUTID
 The id of the currently processed WAUT.
NLDetectorBuildermyDetectorBuilder
 The detector builder to use.
NLEdgeControlBuildermyEdgeControlBuilder
bool myHaveWarned
 whether we have warned about routes defined as character strings
bool myHaveWarnedAboutDeprecatedJunctionShape
 Whether deprecated definition of a junction shape in characters was already reported.
bool myHaveWarnedAboutDeprecatedLaneShape
 Whether deprecated definition of a lane shape in characters was already reported.
bool myHaveWarnedAboutDeprecatedLocation
 Whether deprecated definition of network boundaries/projection was already reported.
bool myHaveWarnedAboutDeprecatedPhases
 Whether deprecated definition of phases was already reported.
bool myHaveWarnedAboutDeprecatedPolyShape
 Whether deprecated definition of a polygon shape in characters was already reported.
bool myHaveWarnedAboutDeprecatedVClass
 Whether deprecated usage of the "vclass" attribute was already reported.
int myIncrementalBase
 The base for inc-dua.
int myIncrementalStage
 The current stage of inc-dua.
NLJunctionControlBuildermyJunctionControlBuilder
SUMOTime myLastDepart
 the emission time of the vehicle read last
MSVehiclemyLastReadVehicle
 the last vehicle read
MSNetmyNet
 The net to fill (preinitialised).
Position2D myNetworkOffset
 The network offset.
Boundary myOrigBoundary
 The network's boundaries.
unsigned int myRunningVehicleNumber
 The current vehicle number (for inc-dua).
NLGeomShapeBuildermyShapeBuilder
NLSucceedingLaneBuilder mySucceedingLaneBuilder
 storage for building succeeding lanes
NLTriggerBuildermyTriggerBuilder
 The trigger builder to use.
SUMOVehicleParametermyVehicleParameter
Information about a lane
std::vector< SUMOVehicleClassmyAllowedClasses
 Vehicle classes allowed on the current lane.
std::string myCurrentDistrictID
 The id of the current district.
std::string myCurrentLaneID
 The id of the current lane.
SUMOReal myCurrentLength
 The length of the current lane.
SUMOReal myCurrentMaxSpeed
 The maximum speed allowed on the current lane.
std::vector< SUMOVehicleClassmyDisallowedClasses
 Vehicle classes disallowed on the current lane.
bool myLaneIsDepart
 The information whether the current lane is a depart lane.
Position2DVector myShape
 The shape of the current lane.

Private Member Functions

void addDistrict (const SUMOSAXAttributes &attrs) throw (ProcessError)
void addDistrictEdge (const SUMOSAXAttributes &attrs, bool isSource)
void addIncomingLanes (const std::string &chars)
 adds the incoming lanes
void addIncomingPolyPosititon (const std::string &chars)
 adds the incoming Polygon's Positions
void addJunctionShape (const std::string &chars)
 parses the shape of a junction
void addLane (const SUMOSAXAttributes &attrs)
 adds a lane to the previously opened edge
void addLaneShape (const std::string &chars)
 add the shape to the Lane
void addLogicItem (const SUMOSAXAttributes &attrs)
 adds a logic item to the current logic
void addPhase (const SUMOSAXAttributes &attrs)
 adds a phase to the traffic lights logic currently build
void addPOI (const SUMOSAXAttributes &attrs)
 adds a polygon
void addPoly (const SUMOSAXAttributes &attrs)
 adds a polygon
virtual void addSource (const SUMOSAXAttributes &attrs)
 adds a source
void addSuccLane (const SUMOSAXAttributes &attrs)
 adds a succeeding lane
void addTrigger (const SUMOSAXAttributes &attrs)
 adds a trigger
void addWAUTJunction (const SUMOSAXAttributes &attrs)
void addWAUTSwitch (const SUMOSAXAttributes &attrs)
void beginEdgeParsing (const SUMOSAXAttributes &attrs)
 begins the processing of an edge
virtual void closeJunction ()
 ends the processing of a junction
void closeSuccLane ()
 closes the processing of a lane
void closeWAUT ()
void initJunctionLogic (const SUMOSAXAttributes &attrs)
 begins the reading of a junction row logic
void initTrafficLightLogic (const SUMOSAXAttributes &attrs)
 begins the reading of a traffic lights logic
 NLHandler (const NLHandler &s)
virtual void openJunction (const SUMOSAXAttributes &attrs)
 opens a junction for processing
void openSucc (const SUMOSAXAttributes &attrs)
 opens the container of succeeding lanes for processing
virtual void openWAUT (const SUMOSAXAttributes &attrs)
NLHandleroperator= (const NLHandler &s)
MSLink::LinkDirection parseLinkDir (char dir)
 Parses the given character into an enumeration typed link direction.
MSLink::LinkState parseLinkState (char state)
 Parses the given character into an enumeration typed link state.
void setKey (const std::string &chars)
 sets the key of the current junction logic
void setLaneNumber (const std::string &chars)
 sets the lane number of the current junction logic
void setLocation (const SUMOSAXAttributes &attrs)
 Parses network location description.
void setOffset (const std::string &chars)
 Sets the offset a tl-logic shall be fired the first time after.
void setRequestSize (const std::string &chars)
 sets the request size of the current junction logic
void setSubKey (const std::string &chars)
 sets the subkey of the current junction logic

Member Typedef Documentation

typedef std::vector<MSLane*> NLHandler::LaneVector

Definition of a lane vector.

Definition at line 70 of file NLHandler.h.


Constructor & Destructor Documentation

NLHandler::NLHandler ( const std::string &  file,
MSNet net,
NLDetectorBuilder detBuilder,
NLTriggerBuilder triggerBuilder,
NLEdgeControlBuilder edgeBuilder,
NLJunctionControlBuilder junctionBuilder,
NLGeomShapeBuilder shapeBuilder 
) throw ()

Constructor.

Parameters:
[in] file Name of the parsed file
[in,out] net The network to fill
[in] detBuilder The detector builder to use
[in] triggerBuilder The trigger builder to use
[in] edgeBuilder The builder of edges to use
[in] junctionBuilder The builder of junctions to use
[in] shapeBuilder The geometric shapes builder to use

Definition at line 64 of file NLHandler.cpp.

00070         : MSRouteHandler(file, true),
00071         myNet(net), myActionBuilder(net),
00072         myCurrentIsInternalToSkip(false),
00073         myDetectorBuilder(detBuilder), myTriggerBuilder(triggerBuilder),
00074         myEdgeControlBuilder(edgeBuilder), myJunctionControlBuilder(junctionBuilder),
00075         myShapeBuilder(shapeBuilder), mySucceedingLaneBuilder(junctionBuilder),
00076         myAmInTLLogicMode(false), myCurrentIsBroken(false),
00077         myHaveWarnedAboutDeprecatedVClass(false),
00078         myHaveWarnedAboutDeprecatedJunctionShape(false),
00079         myHaveWarnedAboutDeprecatedLaneShape(false),
00080         myHaveWarnedAboutDeprecatedPolyShape(false),
00081         myHaveWarnedAboutDeprecatedLocation(false),
00082         myHaveWarnedAboutDeprecatedPhases(false) {}

NLHandler::~NLHandler (  )  throw () [virtual]

Destructor.

Definition at line 85 of file NLHandler.cpp.

00085 {}

NLHandler::NLHandler ( const NLHandler s  )  [private]

invalid copy constructor


Member Function Documentation

void NLHandler::addDetector ( const SUMOSAXAttributes attrs  )  [protected, virtual]

adds a detector Determines the type of the detector first, and then calls the appropriate method

Definition at line 824 of file NLHandler.cpp.

References addE1Detector(), addE2Detector(), beginE3Detector(), SUMOSAXAttributes::getOptStringReporting(), myCurrentDetectorType, SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_TYPE.

Referenced by myStartElement().

00824                                                      {
00825     // get the id, report an error if not given or empty...
00826     std::string id;
00827     if (!attrs.setIDFromAttributes("detector", id)) {
00828         return;
00829     }
00830     // try to get the type
00831     bool ok = true;
00832     std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, 0, 0, ok, "induct_loop");
00833     // build in dependence to type
00834     // induct loops (E1-detectors)
00835     if (type=="induct_loop"||type=="E1"||type=="e1") {
00836         addE1Detector(attrs);
00837         myCurrentDetectorType = "e1";
00838         return;
00839     }
00840     // lane-based areal detectors (E2-detectors)
00841     if (type=="lane_based"||type=="E2"||type=="e2") {
00842         addE2Detector(attrs);
00843         myCurrentDetectorType = "e2";
00844         return;
00845     }
00846     // multi-origin/multi-destination detectors (E3-detectors)
00847     if (type=="multi_od"||type=="E3"||type=="e3") {
00848         beginE3Detector(attrs);
00849         myCurrentDetectorType = "e3";
00850         return;
00851     }
00852 #ifdef _MESSAGES
00853     // new induct loop, for static messages
00854     if (type=="il_msg"||type=="E4"||type=="e4") {
00855         addMsgDetector(attrs);
00856         myCurrentDetectorType="e4";
00857     }
00858 #endif
00859 }

void NLHandler::addDistrict ( const SUMOSAXAttributes attrs  )  throw (ProcessError) [private]

Parses a district and creates a pseudo edge for it

Called on the occurence of a "district" element, this method retrieves the id of the district and creates a district type edge with this id.

Parameters:
[in] attrs The attributes (of the "district"-element) to parse
Exceptions:
ProcessError If an edge given in district is not known

Definition at line 1358 of file NLHandler.cpp.

References MSEdge::addFollower(), NLEdgeControlBuilder::buildEdge(), MSEdge::dictionary(), MSEdge::EDGEFUNCTION_DISTRICT, MsgHandler::getErrorInstance(), SUMOSAXAttributes::getString(), SUMOSAXAttributes::hasAttribute(), MsgHandler::inform(), MSEdge::initialize(), myCurrentDistrictID, myCurrentIsBroken, myEdgeControlBuilder, SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_EDGES.

Referenced by myStartElement().

01358                                                                          {
01359     myCurrentIsBroken = false;
01360     // get the id, report an error if not given or empty...
01361     if (!attrs.setIDFromAttributes("district", myCurrentDistrictID)) {
01362         myCurrentIsBroken = true;
01363         return;
01364     }
01365     try {
01366         MSEdge* sink = myEdgeControlBuilder.buildEdge(myCurrentDistrictID);
01367         if (!MSEdge::dictionary(myCurrentDistrictID, sink)) {
01368             delete sink;
01369             throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "' exists.");
01370         }
01371         sink->initialize(0, 0, MSEdge::EDGEFUNCTION_DISTRICT);
01372         MSEdge* source = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-source");
01373         if (!MSEdge::dictionary(myCurrentDistrictID + "-source", source)) {
01374             delete source;
01375             throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-source' exists.");
01376         }
01377         source->initialize(0, 0, MSEdge::EDGEFUNCTION_DISTRICT);
01378         if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
01379             std::vector<std::string> desc = StringTokenizer(attrs.getString(SUMO_ATTR_EDGES)).getVector();
01380             for (std::vector<std::string>::const_iterator i=desc.begin(); i!=desc.end(); ++i) {
01381                 MSEdge *edge = MSEdge::dictionary(*i);
01382                 // check whether the edge exists
01383                 if (edge==0) {
01384                     throw InvalidArgument("The edge '" + *i + "' within district '" + myCurrentDistrictID + "' is not known.");
01385                 }
01386                 source->addFollower(edge);
01387                 edge->addFollower(sink);
01388             }
01389         }
01390     } catch (InvalidArgument &e) {
01391         MsgHandler::getErrorInstance()->inform(e.what());
01392         myCurrentIsBroken = true;
01393     }
01394 }

void NLHandler::addDistrictEdge ( const SUMOSAXAttributes attrs,
bool  isSource 
) [private]

Parses a district edge and connects it to the district

Called on the occurence of a "dsource" or "dsink" element, this method retrieves the id of the approachable edge. If this edge is known and valid, the approaching edge is informed about it.

Parameters:
[in] attrs The attributes to parse
[in] isSource whether a "dsource or a "dsink" was given
Todo:
No exception?

Definition at line 1398 of file NLHandler.cpp.

References MSEdge::addFollower(), MSEdge::dictionary(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getStringReporting(), MsgHandler::inform(), myCurrentDistrictID, myCurrentIsBroken, and SUMO_ATTR_ID.

Referenced by myStartElement().

01398                                                                         {
01399     if (myCurrentIsBroken) {
01400         // earlier error
01401         return;
01402     }
01403     bool ok = true;
01404     std::string id = attrs.getStringReporting(SUMO_ATTR_ID, "district", myCurrentDistrictID.c_str(), ok);
01405     MSEdge *succ = MSEdge::dictionary(id);
01406     if (succ!=0) {
01407         // connect edge
01408         if (isSource) {
01409             MSEdge::dictionary(myCurrentDistrictID + "-source")->addFollower(succ);
01410         } else {
01411             succ->addFollower(MSEdge::dictionary(myCurrentDistrictID));
01412         }
01413     } else {
01414         MsgHandler::getErrorInstance()->inform("At district '" + myCurrentDistrictID + "': succeeding edge '" + id + "' does not exist.");
01415     }
01416 }

void NLHandler::addE1Detector ( const SUMOSAXAttributes attrs  )  [protected, virtual]

Builds an e1-detector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 891 of file NLHandler.cpp.

References NLDetectorBuilder::buildInductLoop(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::getSUMOTimeReporting(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myDetectorBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_FILE, SUMO_ATTR_FREQUENCY, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_LANE, SUMO_ATTR_POSITION, SUMO_ATTR_STYLE, and SUMOReal.

Referenced by addDetector(), and myStartElement().

00891                                                        {
00892     // get the id, report an error if not given or empty...
00893     std::string id;
00894     if (!attrs.setIDFromAttributes("e1-detector", id)) {
00895         return;
00896     }
00897     // inform the user about deprecated values
00898     bool ok = true;
00899     if (attrs.getOptStringReporting(SUMO_ATTR_STYLE, "e1-detector", id.c_str(), ok, "<invalid>")!="<invalid>") {
00900         MsgHandler::getWarningInstance()->inform("While parsing E1-detector '" + id + "': 'style' is deprecated.");
00901     }
00902     SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, "e1-detector", id.c_str(), ok);
00903     SUMOReal position = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "e1-detector", id.c_str(), ok);
00904     bool friendlyPos = attrs.getOptBoolReporting(SUMO_ATTR_FRIENDLY_POS, "e1-detector", id.c_str(), ok, false);
00905     std::string lane = attrs.getStringReporting(SUMO_ATTR_LANE, "e1-detector", id.c_str(), ok);
00906     std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, "e1-detector", id.c_str(), ok);
00907     if (!ok) {
00908         return;
00909     }
00910     try {
00911         myDetectorBuilder.buildInductLoop(id, lane, position, frequency,
00912                                           OutputDevice::getDevice(file, getFileName()),
00913                                           friendlyPos);
00914     } catch (InvalidArgument &e) {
00915         MsgHandler::getErrorInstance()->inform(e.what());
00916     } catch (IOError &e) {
00917         MsgHandler::getErrorInstance()->inform(e.what());
00918     }
00919 }

void NLHandler::addE2Detector ( const SUMOSAXAttributes attrs  )  [protected, virtual]

Builds an e2-detector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 974 of file NLHandler.cpp.

References NLDetectorBuilder::buildE2Detector(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::getSUMOTimeReporting(), NLJunctionControlBuilder::getTLLogic(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myDetectorBuilder, myJunctionControlBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_CONT, SUMO_ATTR_FILE, SUMO_ATTR_FREQUENCY, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_HALTING_SPEED_THRESHOLD, SUMO_ATTR_HALTING_TIME_THRESHOLD, SUMO_ATTR_JAM_DIST_THRESHOLD, SUMO_ATTR_LANE, SUMO_ATTR_LENGTH, SUMO_ATTR_MEASURES, SUMO_ATTR_POSITION, SUMO_ATTR_STYLE, SUMO_ATTR_TLID, SUMO_ATTR_TO, SUMOReal, and TIME2STEPS.

Referenced by addDetector(), and myStartElement().

00974                                                        {
00975     // get the id, report an error if not given or empty...
00976     std::string id;
00977     if (!attrs.setIDFromAttributes("e2-detector", id)) {
00978         return;
00979     }
00980     // check whether this is a detector connected to a tls an optionally to a link
00981     bool ok = true;
00982     std::string lsaid = attrs.getOptStringReporting(SUMO_ATTR_TLID, "e2-detector", id.c_str(), ok, "<invalid>");
00983     std::string toLane = attrs.getOptStringReporting(SUMO_ATTR_TO, "e2-detector", id.c_str(), ok, "<invalid>");
00984     // inform the user about deprecated values
00985     if (attrs.getOptStringReporting(SUMO_ATTR_MEASURES, "e2-detector", id.c_str(), ok, "<invalid>")!="<invalid>") {
00986         MsgHandler::getWarningInstance()->inform("While parsing E2-detector '" + id + "': 'measures' is deprecated.");
00987     }
00988     if (attrs.getOptStringReporting(SUMO_ATTR_STYLE, "e2-detector", id.c_str(), ok, "<invalid>")!="<invalid>") {
00989         MsgHandler::getWarningInstance()->inform("While parsing E2-detector '" + id + "': 'style' is deprecated.");
00990     }
00991     //
00992     try {
00993         const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, "e2-detector", id.c_str(), ok, TIME2STEPS(1));
00994         const SUMOReal haltingSpeedThreshold = attrs.getOptSUMORealReporting(SUMO_ATTR_HALTING_SPEED_THRESHOLD, "e2-detector", id.c_str(), ok, 5.0f/3.6f);
00995         const SUMOReal jamDistThreshold = attrs.getOptSUMORealReporting(SUMO_ATTR_JAM_DIST_THRESHOLD, "e2-detector", id.c_str(), ok, 10.0f);
00996         const SUMOReal position = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "e2-detector", id.c_str(), ok);
00997         const SUMOReal length = attrs.getSUMORealReporting(SUMO_ATTR_LENGTH, "e2-detector", id.c_str(), ok);
00998         const bool friendlyPos = attrs.getOptBoolReporting(SUMO_ATTR_FRIENDLY_POS, "e2-detector", id.c_str(), ok, false);
00999         const bool cont = attrs.getOptBoolReporting(SUMO_ATTR_CONT, "e2-detector", id.c_str(), ok, false);
01000         const std::string lane = attrs.getStringReporting(SUMO_ATTR_LANE, "e2-detector", id.c_str(), ok);
01001         const std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, "e2-detector", id.c_str(), ok);
01002         if (!ok) {
01003             return;
01004         }
01005         if (lsaid!="<invalid>") {
01006             if (toLane=="<invalid>") {
01007                 myDetectorBuilder.buildE2Detector(id, lane, position, length, cont,
01008                                                   myJunctionControlBuilder.getTLLogic(lsaid),
01009                                                   OutputDevice::getDevice(file, getFileName()),
01010                                                   (SUMOTime) haltingSpeedThreshold, haltingSpeedThreshold, jamDistThreshold,
01011                                                   friendlyPos);
01012             } else {
01013                 myDetectorBuilder.buildE2Detector(id, lane, position, length, cont,
01014                                                   myJunctionControlBuilder.getTLLogic(lsaid), toLane,
01015                                                   OutputDevice::getDevice(file, getFileName()),
01016                                                   (SUMOTime) haltingSpeedThreshold, haltingSpeedThreshold, jamDistThreshold,
01017                                                   friendlyPos);
01018             }
01019         } else {
01020             bool ok = true;
01021             SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, "e2-detector", id.c_str(), ok);
01022             if (!ok) {
01023                 return;
01024             }
01025             myDetectorBuilder.buildE2Detector(id, lane, position, length, cont, frequency,
01026                                               OutputDevice::getDevice(file, getFileName()),
01027                                               (SUMOTime) haltingSpeedThreshold, haltingSpeedThreshold, jamDistThreshold,
01028                                               friendlyPos);
01029         }
01030     } catch (InvalidArgument &e) {
01031         MsgHandler::getErrorInstance()->inform(e.what());
01032     } catch (IOError &e) {
01033         MsgHandler::getErrorInstance()->inform(e.what());
01034     }
01035 }

void NLHandler::addE3Entry ( const SUMOSAXAttributes attrs  )  [protected]

Adds an entry to the currently processed e3-detector.

Parameters:
[in] attrs The attributes that define the entry

Definition at line 1073 of file NLHandler.cpp.

References NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::getCurrentE3ID(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), myDetectorBuilder, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_LANE, SUMO_ATTR_POSITION, and SUMOReal.

Referenced by myStartElement().

01073                                                     {
01074     bool ok = true;
01075     const SUMOReal position = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "e3-detector/entry", myDetectorBuilder.getCurrentE3ID().c_str(), ok);
01076     const bool friendlyPos = attrs.getOptBoolReporting(SUMO_ATTR_FRIENDLY_POS, "e3-detector/entry", myDetectorBuilder.getCurrentE3ID().c_str(), ok, false);
01077     const std::string lane = attrs.getStringReporting(SUMO_ATTR_LANE, "e3-detector/entry", myDetectorBuilder.getCurrentE3ID().c_str(), ok);
01078     if (!ok) {
01079         return;
01080     }
01081     myDetectorBuilder.addE3Entry(lane, position, friendlyPos);
01082 }

void NLHandler::addE3Exit ( const SUMOSAXAttributes attrs  )  [protected]

Adds an exit to the currently processed e3-detector.

Parameters:
[in] attrs The attributes that define the exit

Definition at line 1086 of file NLHandler.cpp.

References NLDetectorBuilder::addE3Exit(), NLDetectorBuilder::getCurrentE3ID(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), myDetectorBuilder, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_LANE, SUMO_ATTR_POSITION, and SUMOReal.

Referenced by myStartElement().

01086                                                    {
01087     bool ok = true;
01088     const SUMOReal position = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "e3-detector/exit", myDetectorBuilder.getCurrentE3ID().c_str(), ok);
01089     const bool friendlyPos = attrs.getOptBoolReporting(SUMO_ATTR_FRIENDLY_POS, "e3-detector/exit", myDetectorBuilder.getCurrentE3ID().c_str(), ok, false);
01090     const std::string lane = attrs.getStringReporting(SUMO_ATTR_LANE, "e3-detector/exit", myDetectorBuilder.getCurrentE3ID().c_str(), ok);
01091     if (!ok) {
01092         return;
01093     }
01094     myDetectorBuilder.addE3Exit(lane, position, friendlyPos);
01095 }

void NLHandler::addEdgeLaneMeanData ( const SUMOSAXAttributes attrs,
const char *  objecttype 
) [protected, virtual]

Builds edge or lane base mean data collector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 1099 of file NLHandler.cpp.

References NLDetectorBuilder::createEdgeLaneMeanData(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getOptBoolReporting(), OptionsCont::getOptions(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), MsgHandler::inform(), myDetectorBuilder, POSITION_EPS, SUMOSAXAttributes::setIDFromAttributes(), string2time(), SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_EXCLUDE_EMPTY, SUMO_ATTR_FILE, SUMO_ATTR_FREQUENCY, SUMO_ATTR_HALTING_SPEED_THRESHOLD, SUMO_ATTR_MAX_TRAVELTIME, SUMO_ATTR_MIN_SAMPLES, SUMO_ATTR_TRACK_VEHICLES, SUMO_ATTR_TYPE, SUMO_ATTR_VTYPES, SUMO_ATTR_WITH_INTERNAL, and SUMOReal.

Referenced by myStartElement().

01099                                                                                      {
01100     // get the id, report an error if not given or empty...
01101     std::string id;
01102     if (!attrs.setIDFromAttributes(objecttype, id)) {
01103         return;
01104     }
01105     bool ok = true;
01106     const SUMOReal maxTravelTime = attrs.getOptSUMORealReporting(SUMO_ATTR_MAX_TRAVELTIME, objecttype, id.c_str(), ok, 100000);
01107     const SUMOReal minSamples = attrs.getOptSUMORealReporting(SUMO_ATTR_MIN_SAMPLES, objecttype, id.c_str(), ok, 0);
01108     const SUMOReal haltingSpeedThreshold = attrs.getOptSUMORealReporting(SUMO_ATTR_HALTING_SPEED_THRESHOLD, objecttype, id.c_str(), ok, POSITION_EPS);
01109     const bool excludeEmpty = attrs.getOptBoolReporting(SUMO_ATTR_EXCLUDE_EMPTY, objecttype, id.c_str(), ok, false);
01110     const bool withInternal = attrs.getOptBoolReporting(SUMO_ATTR_WITH_INTERNAL, objecttype, id.c_str(), ok, false);
01111     const bool trackVehicles = attrs.getOptBoolReporting(SUMO_ATTR_TRACK_VEHICLES, objecttype, id.c_str(), ok, false);
01112     const std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, objecttype, id.c_str(), ok);
01113     const std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, objecttype, id.c_str(), ok, "performance");
01114     const std::string vtypes = attrs.getOptStringReporting(SUMO_ATTR_VTYPES, objecttype, id.c_str(), ok, "");
01115     const SUMOTime frequency = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, objecttype, id.c_str(), ok, -1);
01116     const SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, objecttype, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("begin")));
01117     const SUMOTime end = attrs.getOptSUMOTimeReporting(SUMO_ATTR_END, objecttype, id.c_str(), ok, string2time(OptionsCont::getOptions().getString("end")));
01118     if (!ok) {
01119         return;
01120     }
01121     try {
01122         myDetectorBuilder.createEdgeLaneMeanData(id, frequency, begin, end,
01123                 type, objecttype=="meandata_lane", !excludeEmpty, withInternal, trackVehicles,
01124                 maxTravelTime, minSamples, haltingSpeedThreshold, vtypes,
01125                 OutputDevice::getDevice(file, getFileName()));
01126     } catch (InvalidArgument &e) {
01127         MsgHandler::getErrorInstance()->inform(e.what());
01128     } catch (IOError &e) {
01129         MsgHandler::getErrorInstance()->inform(e.what());
01130     }
01131 }

void NLHandler::addIncomingLanes ( const std::string &  chars  )  [private]

adds the incoming lanes

Definition at line 1422 of file NLHandler.cpp.

References NLJunctionControlBuilder::addIncomingLane(), MSLane::dictionary(), NLJunctionControlBuilder::getActiveID(), MsgHandler::getErrorInstance(), MSGlobals::gUsingInternalLanes, StringTokenizer::hasNext(), MsgHandler::inform(), myJunctionControlBuilder, and StringTokenizer::next().

Referenced by myCharacters(), and openJunction().

01422                                                   {
01423     // @deprecated: at some time, all junctions should have a shape attribute (moved from characters)
01424     StringTokenizer st(chars);
01425     while (st.hasNext()) {
01426         std::string set = st.next();
01427         MSLane *lane = MSLane::dictionary(set);
01428         if (!MSGlobals::gUsingInternalLanes&&set[0]==':') {
01429             continue;
01430         }
01431         if (lane==0) {
01432             MsgHandler::getErrorInstance()->inform("An unknown lane ('" + set + "') was tried to be set as incoming to junction '" + myJunctionControlBuilder.getActiveID() + "'.");
01433             return;
01434         }
01435         myJunctionControlBuilder.addIncomingLane(lane);
01436     }
01437 }

void NLHandler::addIncomingPolyPosititon ( const std::string &  chars  )  [private]

adds the incoming Polygon's Positions

void NLHandler::addJunctionShape ( const std::string &  chars  )  [private]

parses the shape of a junction

Definition at line 1329 of file NLHandler.cpp.

References NLJunctionControlBuilder::addJunctionShape(), NLJunctionControlBuilder::getActiveID(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myHaveWarnedAboutDeprecatedJunctionShape, myJunctionControlBuilder, and GeomConvHelper::parseShapeReporting().

Referenced by myCharacters().

01329                                                   {
01330     // @deprecated: at some time, all junctions should have a shape attribute (moved from characters)
01331     if (!myHaveWarnedAboutDeprecatedJunctionShape) {
01332         myHaveWarnedAboutDeprecatedJunctionShape = true;
01333         MsgHandler::getWarningInstance()->inform("Your network uses a deprecated junction shape description; please rebuild.");
01334     }
01335     bool ok = true;
01336     Position2DVector shape = GeomConvHelper::parseShapeReporting(chars, "junction", myJunctionControlBuilder.getActiveID().c_str(), ok, true);
01337     if (ok) {
01338         myJunctionControlBuilder.addJunctionShape(shape);
01339     }
01340 }

void NLHandler::addLane ( const SUMOSAXAttributes attrs  )  [private]

adds a lane to the previously opened edge

Definition at line 411 of file NLHandler.cpp.

References addLaneShape(), Position2DVector::clear(), SUMOSAXAttributes::getBoolReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), MsgHandler::getWarningInstance(), SUMOSAXAttributes::hasAttribute(), MsgHandler::inform(), myAllowedClasses, myCurrentIsBroken, myCurrentIsInternalToSkip, myCurrentLaneID, myCurrentLength, myCurrentMaxSpeed, myDisallowedClasses, myHaveWarnedAboutDeprecatedLaneShape, myHaveWarnedAboutDeprecatedVClass, myLaneIsDepart, myShape, parseVehicleClasses(), SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_ALLOW, SUMO_ATTR_DEPART, SUMO_ATTR_DISALLOW, SUMO_ATTR_LENGTH, SUMO_ATTR_MAXSPEED, SUMO_ATTR_SHAPE, and SUMO_ATTR_VCLASSES.

Referenced by myStartElement().

00411                                                  {
00412     myShape.clear();
00413     // omit internal edges if not wished and broken edges
00414     if (myCurrentIsInternalToSkip||myCurrentIsBroken) {
00415         return;
00416     }
00417     // get the id, report an error if not given or empty...
00418     if (!attrs.setIDFromAttributes("lane", myCurrentLaneID)) {
00419         myCurrentIsBroken = true;
00420         return;
00421     }
00422     bool ok = true;
00423     myLaneIsDepart = attrs.getBoolReporting(SUMO_ATTR_DEPART, "lane", myCurrentLaneID.c_str(), ok);
00424     myCurrentMaxSpeed = attrs.getSUMORealReporting(SUMO_ATTR_MAXSPEED, "lane", myCurrentLaneID.c_str(), ok);
00425     myCurrentLength = attrs.getSUMORealReporting(SUMO_ATTR_LENGTH, "lane", myCurrentLaneID.c_str(), ok);
00426     std::string allow = attrs.getOptStringReporting(SUMO_ATTR_ALLOW, "lane", myCurrentLaneID.c_str(), ok, "");
00427     std::string disallow = attrs.getOptStringReporting(SUMO_ATTR_DISALLOW, "lane", myCurrentLaneID.c_str(), ok, "");
00428     std::string vclasses = attrs.getOptStringReporting(SUMO_ATTR_VCLASSES, "lane", myCurrentLaneID.c_str(), ok, "");
00429     myAllowedClasses.clear();
00430     myDisallowedClasses.clear();
00431     parseVehicleClasses(vclasses, allow, disallow, myAllowedClasses, myDisallowedClasses, myHaveWarnedAboutDeprecatedVClass);
00432     myCurrentIsBroken |= !ok;
00433     if (!myCurrentIsBroken) {
00434         if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
00435             addLaneShape(attrs.getStringReporting(SUMO_ATTR_SHAPE, "lane", myCurrentLaneID.c_str(), ok));
00436         } else if (!myHaveWarnedAboutDeprecatedLaneShape) {
00437             myHaveWarnedAboutDeprecatedLaneShape = true;
00438             MsgHandler::getWarningInstance()->inform("Your network uses a deprecated lane shape description; please rebuild.");
00439         }
00440     }
00441 }

void NLHandler::addLaneShape ( const std::string &  chars  )  [private]

add the shape to the Lane

Definition at line 445 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myCurrentIsBroken, myCurrentIsInternalToSkip, myCurrentLaneID, myShape, and GeomConvHelper::parseShapeReporting().

Referenced by addLane(), and myCharacters().

00445                                               {
00446     // omit internal edges if not wished and broken edges
00447     if (myCurrentIsInternalToSkip||myCurrentIsBroken) {
00448         return;
00449     }
00450     bool ok = true;
00451     myShape = GeomConvHelper::parseShapeReporting(chars, "lane", myCurrentLaneID.c_str(), ok, false);
00452     if (!ok) {
00453         MsgHandler::getErrorInstance()->inform("Could not parse shape of lane '" + myCurrentLaneID + "'.\n Can not build according edge.");
00454         myCurrentIsBroken = true;
00455     }
00456 }

void NLHandler::addLogicItem ( const SUMOSAXAttributes attrs  )  [private]

adds a logic item to the current logic

Definition at line 688 of file NLHandler.cpp.

References NLJunctionControlBuilder::addLogicItem(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getStringReporting(), MsgHandler::inform(), myJunctionControlBuilder, SUMO_ATTR_CONT, SUMO_ATTR_FOES, SUMO_ATTR_REQUEST, and SUMO_ATTR_RESPONSE.

Referenced by myStartElement().

00688                                                       {
00689     bool ok = true;
00690     int request = attrs.getIntReporting(SUMO_ATTR_REQUEST, "request", 0, ok);
00691     bool cont = false;
00692 #ifdef HAVE_INTERNAL_LANES
00693     cont = attrs.getOptBoolReporting(SUMO_ATTR_CONT, 0, 0, ok, false);
00694 #endif
00695     std::string response = attrs.getStringReporting(SUMO_ATTR_RESPONSE, 0, 0, ok);
00696     std::string foes = attrs.getStringReporting(SUMO_ATTR_FOES, 0, 0, ok);
00697     if (!ok) {
00698         return;
00699     }
00700     // store received information
00701     if (request>=0 && response.length()>0) {
00702         try {
00703             myJunctionControlBuilder.addLogicItem(request, response, foes, cont);
00704         } catch (InvalidArgument &e) {
00705             MsgHandler::getErrorInstance()->inform(e.what());
00706         }
00707     }
00708 }

void NLHandler::addParam ( const SUMOSAXAttributes attrs  )  [protected]

Definition at line 543 of file NLHandler.cpp.

References NLJunctionControlBuilder::addParam(), SUMOSAXAttributes::getStringReporting(), myAmInTLLogicMode, myJunctionControlBuilder, SUMO_ATTR_KEY, and SUMO_ATTR_VALUE.

Referenced by myStartElement().

00543                                                   {
00544     bool ok = true;
00545     std::string key = attrs.getStringReporting(SUMO_ATTR_KEY, 0, 0, ok);
00546     std::string val = attrs.getStringReporting(SUMO_ATTR_VALUE, 0, 0, ok);
00547     // set
00548     if (ok&&myAmInTLLogicMode) {
00549         assert(key!="");
00550         assert(val!="");
00551         myJunctionControlBuilder.addParam(key, val);
00552     }
00553 }

void NLHandler::addPhase ( const SUMOSAXAttributes attrs  )  [private]

adds a phase to the traffic lights logic currently build

Definition at line 757 of file NLHandler.cpp.

References NLJunctionControlBuilder::addPhase(), NLJunctionControlBuilder::getActiveKey(), NLJunctionControlBuilder::getActiveSubKey(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMOTimeReporting(), MsgHandler::getWarningInstance(), SUMOSAXAttributes::hasAttribute(), MsgHandler::inform(), myHaveWarnedAboutDeprecatedPhases, myJunctionControlBuilder, MSPhaseDefinition::old2new(), SUMO_ATTR_BRAKE, SUMO_ATTR_DURATION, SUMO_ATTR_MAXDURATION, SUMO_ATTR_MINDURATION, SUMO_ATTR_PHASE, SUMO_ATTR_STATE, and SUMO_ATTR_YELLOW.

Referenced by myStartElement().

00757                                                   {
00758     // try to get the phase definition
00759     std::string state;
00760     std::string phase;
00761     std::string brakeMask;
00762     std::string yellowMask;
00763     bool ok = true;
00764     if (attrs.hasAttribute(SUMO_ATTR_STATE)) {
00765         // ok, doing it the new way
00766         state = attrs.getStringReporting(SUMO_ATTR_STATE, "phase", 0, ok);
00767     } else {
00768         phase = attrs.getStringReporting(SUMO_ATTR_PHASE, "phase", 0, ok);
00769         brakeMask = attrs.getStringReporting(SUMO_ATTR_BRAKE, "phase", 0, ok);
00770         yellowMask = attrs.getStringReporting(SUMO_ATTR_YELLOW, "phase", 0, ok);
00771         // check
00772         if (phase.length()!=brakeMask.length()||phase.length()!=yellowMask.length()) {
00773             MsgHandler::getErrorInstance()->inform("Definition of traffic light is broken - descriptions have different lengths.");
00774             return;
00775         }
00776         if (!myHaveWarnedAboutDeprecatedPhases) {
00777             myHaveWarnedAboutDeprecatedPhases = true;
00778             MsgHandler::getWarningInstance()->inform("Deprecated tls phase definition found; replace by one using states.");
00779         }
00780         // convert to new
00781         state = MSPhaseDefinition::old2new(phase, brakeMask, yellowMask);
00782     }
00783     if (!ok) {
00784         return;
00785     }
00786     // try to get the phase duration
00787     SUMOTime duration = attrs.getSUMOTimeReporting(SUMO_ATTR_DURATION, "phase", myJunctionControlBuilder.getActiveKey().c_str(), ok);
00788     if (duration==0) {
00789         MsgHandler::getErrorInstance()->inform("Duration of tls-logic '" + myJunctionControlBuilder.getActiveKey() + "/" + myJunctionControlBuilder.getActiveSubKey() + "' is zero.");
00790         return;
00791     }
00792     // if the traffic light is an actuated traffic light, try to get
00793     //  the minimum and maximum durations
00794     SUMOTime minDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MINDURATION, "phase", myJunctionControlBuilder.getActiveKey().c_str(), ok, -1);
00795     SUMOTime maxDuration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_MAXDURATION, "phase", myJunctionControlBuilder.getActiveKey().c_str(), ok, -1);
00796     myJunctionControlBuilder.addPhase(duration, state, minDuration, maxDuration);
00797 }

void NLHandler::addPOI ( const SUMOSAXAttributes attrs  )  [private]

adds a polygon

Definition at line 630 of file NLHandler.cpp.

References NLGeomShapeBuilder::addPoint(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getOptIntReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), MsgHandler::inform(), INVALID_POSITION, myShapeBuilder, RGBColor::parseColorReporting(), SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_COLOR, SUMO_ATTR_LANE, SUMO_ATTR_LAYER, SUMO_ATTR_POSITION, SUMO_ATTR_TYPE, SUMO_ATTR_X, SUMO_ATTR_Y, and SUMOReal.

Referenced by myStartElement().

00630                                                 {
00631     // get the id, report an error if not given or empty...
00632     std::string id;
00633     if (!attrs.setIDFromAttributes("poi", id)) {
00634         return;
00635     }
00636     bool ok = true;
00637     SUMOReal x = attrs.getOptSUMORealReporting(SUMO_ATTR_X, "poi", id.c_str(), ok, INVALID_POSITION);
00638     SUMOReal y = attrs.getOptSUMORealReporting(SUMO_ATTR_Y, "poi", id.c_str(), ok, INVALID_POSITION);
00639     SUMOReal lanePos = attrs.getOptSUMORealReporting(SUMO_ATTR_POSITION, "poi", id.c_str(), ok, INVALID_POSITION);
00640     int layer = attrs.getOptIntReporting(SUMO_ATTR_LAYER, "poi", id.c_str(), ok, 1);
00641     std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, "poi", id.c_str(), ok, "");
00642     std::string lane = attrs.getOptStringReporting(SUMO_ATTR_LANE, "poi", id.c_str(), ok, "");
00643     std::string colorStr = attrs.getOptStringReporting(SUMO_ATTR_COLOR, "poi", id.c_str(), ok, "1,0,0");
00644     RGBColor color = RGBColor::parseColorReporting(colorStr, "poi", id.c_str(), true, ok);
00645     if (!ok) {
00646         return;
00647     }
00648     try {
00649         myShapeBuilder.addPoint(id, layer, type, color, x, y, lane, lanePos);
00650     } catch (InvalidArgument &e) {
00651         MsgHandler::getErrorInstance()->inform(e.what());
00652     } catch (OutOfBoundsException &) {
00653         MsgHandler::getErrorInstance()->inform("Color definition of POI '" + id + "' seems to be broken.");
00654     } catch (NumberFormatException &) {
00655         MsgHandler::getErrorInstance()->inform("One of POI's '" + id + "' SUMOSAXAttributes should be numeric but is not.");
00656     }
00657 }

void NLHandler::addPoly ( const SUMOSAXAttributes attrs  )  [private]

adds a polygon

Definition at line 661 of file NLHandler.cpp.

References SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getOptIntReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), MsgHandler::getWarningInstance(), SUMOSAXAttributes::hasAttribute(), MsgHandler::inform(), myHaveWarnedAboutDeprecatedPolyShape, myShapeBuilder, RGBColor::parseColorReporting(), GeomConvHelper::parseShapeReporting(), NLGeomShapeBuilder::polygonBegin(), NLGeomShapeBuilder::polygonEnd(), SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_COLOR, SUMO_ATTR_FILL, SUMO_ATTR_LAYER, SUMO_ATTR_SHAPE, and SUMO_ATTR_TYPE.

Referenced by myStartElement().

00661                                                  {
00662     // get the id, report an error if not given or empty...
00663     std::string id;
00664     if (!attrs.setIDFromAttributes("poly", id)) {
00665         return;
00666     }
00667     bool ok = true;
00668     int layer = attrs.getOptIntReporting(SUMO_ATTR_LAYER, "poly", id.c_str(), ok, 1);
00669     bool fill = attrs.getOptBoolReporting(SUMO_ATTR_FILL, "poly", id.c_str(), ok, false);
00670     std::string type = attrs.getOptStringReporting(SUMO_ATTR_TYPE, "poly", id.c_str(), ok, "");
00671     std::string colorStr = attrs.getStringReporting(SUMO_ATTR_COLOR, "poly", id.c_str(), ok);
00672     RGBColor color = RGBColor::parseColorReporting(colorStr, "poi", id.c_str(), true, ok);
00673     if (!ok) {
00674         return;
00675     }
00676     myShapeBuilder.polygonBegin(id, layer, type, color, fill);
00677     if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
00678         // @deprecated; at some time, this is mandatory (no character usage)
00679         myShapeBuilder.polygonEnd(GeomConvHelper::parseShapeReporting(attrs.getStringReporting(SUMO_ATTR_SHAPE, "poly", id.c_str(), ok), "poly", id.c_str(), ok, false));
00680     } else if (!myHaveWarnedAboutDeprecatedPolyShape) {
00681         myHaveWarnedAboutDeprecatedPolyShape = true;
00682         MsgHandler::getWarningInstance()->inform("You use a deprecated polygon shape description; use attribute 'shape' instead.");
00683     }
00684 }

void NLHandler::addRouteProbeDetector ( const SUMOSAXAttributes attrs  )  [protected, virtual]

Builds a routeprobe-detector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 947 of file NLHandler.cpp.

References NLDetectorBuilder::buildRouteProbe(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMOTimeReporting(), MsgHandler::inform(), myDetectorBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_BEGIN, SUMO_ATTR_EDGE, SUMO_ATTR_FILE, and SUMO_ATTR_FREQUENCY.

Referenced by myStartElement().

00947                                                                {
00948     // get the id, report an error if not given or empty...
00949     std::string id;
00950     if (!attrs.setIDFromAttributes("routeprobe", id)) {
00951         return;
00952     }
00953     bool ok = true;
00954     SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, "routeprobe", id.c_str(), ok);
00955     SUMOTime begin = attrs.getOptSUMOTimeReporting(SUMO_ATTR_BEGIN, "routeprobe", id.c_str(), ok, -1);
00956     std::string edge = attrs.getStringReporting(SUMO_ATTR_EDGE, "routeprobe", id.c_str(), ok);
00957     std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, "routeprobe", id.c_str(), ok);
00958     if (!ok) {
00959         return;
00960     }
00961     try {
00962         myDetectorBuilder.buildRouteProbe(id, edge, frequency, begin,
00963                                           OutputDevice::getDevice(file, getFileName()));
00964     } catch (InvalidArgument &e) {
00965         MsgHandler::getErrorInstance()->inform(e.what());
00966     } catch (IOError &e) {
00967         MsgHandler::getErrorInstance()->inform(e.what());
00968     }
00969 }

void NLHandler::addSource ( const SUMOSAXAttributes attrs  )  [private, virtual]

adds a source

Definition at line 1136 of file NLHandler.cpp.

References NLTriggerBuilder::buildTrigger(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), MsgHandler::inform(), myNet, myTriggerBuilder, and SUMOSAXAttributes::setIDFromAttributes().

Referenced by myStartElement().

01136                                                    {
01137     // get the id, report an error if not given or empty...
01138     std::string id;
01139     if (!attrs.setIDFromAttributes("source", id)) {
01140         return;
01141     }
01142     try {
01143         myTriggerBuilder.buildTrigger(myNet, attrs, getFileName());
01144     } catch (InvalidArgument &e) {
01145         MsgHandler::getErrorInstance()->inform(e.what());
01146     }
01147 }

void NLHandler::addSuccLane ( const SUMOSAXAttributes attrs  )  [private]

adds a succeeding lane

Definition at line 1180 of file NLHandler.cpp.

References NLSucceedingLaneBuilder::addSuccLane(), endif, SUMOSAXAttributes::getBoolReporting(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getStringReporting(), HAVE_INTERNAL_LANES, MsgHandler::inform(), myCurrentIsInternalToSkip, mySucceedingLaneBuilder, parseLinkDir(), parseLinkState(), SUMO_ATTR_DIR, SUMO_ATTR_LANE, SUMO_ATTR_PASS, SUMO_ATTR_STATE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKNO, SUMO_ATTR_VIA, SUMO_ATTR_YIELD, and SUMOReal.

Referenced by myStartElement().

01180                                                      {
01181     // do not process internal lanes if not wished
01182     if (myCurrentIsInternalToSkip) {
01183         return;
01184     }
01185     try {
01186         bool ok = true;
01187         SUMOReal pass = attrs.getOptSUMORealReporting(SUMO_ATTR_PASS, 0, 0, ok, -1);
01188         bool yield = attrs.getBoolReporting(SUMO_ATTR_YIELD, 0, 0, ok);
01189         bool internalEnd = attrs.getOptBoolReporting(SUMO_ATTR_YIELD, 0, 0, ok, false);
01190         std::string lane = attrs.getStringReporting(SUMO_ATTR_LANE, 0, 0, ok);
01191         std::string dir = attrs.getStringReporting(SUMO_ATTR_DIR, 0, 0, ok);
01192         std::string state = attrs.getStringReporting(SUMO_ATTR_STATE, 0, 0, ok);
01193         std::string tlID = attrs.getOptStringReporting(SUMO_ATTR_TLID, 0, 0, ok, "");
01194 #ifdef HAVE_INTERNAL_LANES
01195         std::string via = attrs.getOptStringReporting(SUMO_ATTR_VIA, 0, 0, ok, "");
01196 #endif
01197         if (!ok) {
01198             return;
01199         }
01200         if (tlID!="") {
01201             int linkNumber = attrs.getIntReporting(SUMO_ATTR_TLLINKNO, 0, 0, ok);
01202             if (!ok) {
01203                 return;
01204             }
01205             mySucceedingLaneBuilder.addSuccLane(yield, lane,
01206 #ifdef HAVE_INTERNAL_LANES
01207                                                 via, pass,
01208 #endif
01209                                                 parseLinkDir(dir[0]), parseLinkState(state[0]), internalEnd, tlID, linkNumber);
01210         } else {
01211             mySucceedingLaneBuilder.addSuccLane(yield, lane,
01212 #ifdef HAVE_INTERNAL_LANES
01213                                                 via, pass,
01214 #endif
01215                                                 parseLinkDir(dir[0]), parseLinkState(state[0]), internalEnd);
01216         }
01217     } catch (InvalidArgument &e) {
01218         MsgHandler::getErrorInstance()->inform(e.what());
01219     }
01220 }

void NLHandler::addTrigger ( const SUMOSAXAttributes attrs  )  [private]

adds a trigger

Definition at line 1151 of file NLHandler.cpp.

References NLTriggerBuilder::buildTrigger(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), MsgHandler::inform(), myNet, myTriggerBuilder, and SUMOSAXAttributes::setIDFromAttributes().

Referenced by myStartElement().

01151                                                     {
01152     // get the id, report an error if not given or empty...
01153     std::string id;
01154     if (!attrs.setIDFromAttributes("trigger", id)) {
01155         return;
01156     }
01157     try {
01158         myTriggerBuilder.buildTrigger(myNet, attrs, getFileName());
01159         return;
01160     } catch (InvalidArgument &e) {
01161         MsgHandler::getErrorInstance()->inform(e.what());
01162     }
01163 }

void NLHandler::addVTypeProbeDetector ( const SUMOSAXAttributes attrs  )  [protected, virtual]

Builds a vtype-detector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 923 of file NLHandler.cpp.

References NLDetectorBuilder::buildVTypeProbe(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getStringSecure(), SUMOSAXAttributes::getSUMOTimeReporting(), MsgHandler::inform(), myDetectorBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_FILE, SUMO_ATTR_FREQUENCY, and SUMO_ATTR_TYPE.

Referenced by myStartElement().

00923                                                                {
00924     // get the id, report an error if not given or empty...
00925     std::string id;
00926     if (!attrs.setIDFromAttributes("vtypeprobe", id)) {
00927         return;
00928     }
00929     bool ok = true;
00930     SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, "vtypeprobe", id.c_str(), ok);
00931     std::string type = attrs.getStringSecure(SUMO_ATTR_TYPE, "");
00932     std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, "vtypeprobe", id.c_str(), ok);
00933     if (!ok) {
00934         return;
00935     }
00936     try {
00937         myDetectorBuilder.buildVTypeProbe(id, type, frequency, OutputDevice::getDevice(file, getFileName()));
00938     } catch (InvalidArgument &e) {
00939         MsgHandler::getErrorInstance()->inform(e.what());
00940     } catch (IOError &e) {
00941         MsgHandler::getErrorInstance()->inform(e.what());
00942     }
00943 }

void NLHandler::addWAUTJunction ( const SUMOSAXAttributes attrs  )  [private]

Definition at line 604 of file NLHandler.cpp.

References MSTLLogicControl::addWAUTJunction(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getOptBoolReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), NLJunctionControlBuilder::getTLLogicControlToUse(), MsgHandler::inform(), myCurrentIsBroken, myJunctionControlBuilder, SUMO_ATTR_JUNCTION_ID, SUMO_ATTR_PROCEDURE, SUMO_ATTR_SYNCHRON, and SUMO_ATTR_WAUT_ID.

Referenced by myStartElement().

00604                                                          {
00605     bool ok = true;
00606     std::string wautID = attrs.getStringReporting(SUMO_ATTR_WAUT_ID, "wautJunction", 0, ok);
00607     std::string junctionID = attrs.getStringReporting(SUMO_ATTR_JUNCTION_ID, "wautJunction", 0, ok);
00608     std::string procedure = attrs.getOptStringReporting(SUMO_ATTR_PROCEDURE, "wautJunction", 0, ok, "");
00609     bool synchron = attrs.getOptBoolReporting(SUMO_ATTR_SYNCHRON, "wautJunction", 0, ok, false);
00610     if (!ok) {
00611         myCurrentIsBroken = true;
00612     }
00613     try {
00614         if (!myCurrentIsBroken) {
00615             myJunctionControlBuilder.getTLLogicControlToUse().addWAUTJunction(wautID, junctionID, procedure, synchron);
00616         }
00617     } catch (InvalidArgument &e) {
00618         MsgHandler::getErrorInstance()->inform(e.what());
00619         myCurrentIsBroken = true;
00620     }
00621 }

void NLHandler::addWAUTSwitch ( const SUMOSAXAttributes attrs  )  [private]

void NLHandler::beginE3Detector ( const SUMOSAXAttributes attrs  )  [protected]

Starts building of an e3-detector using the given specification.

Parameters:
[in] attrs The attributes that define the detector

Definition at line 1039 of file NLHandler.cpp.

References NLDetectorBuilder::beginE3Detector(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMOTimeReporting(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myDetectorBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_FILE, SUMO_ATTR_FREQUENCY, SUMO_ATTR_HALTING_SPEED_THRESHOLD, SUMO_ATTR_HALTING_TIME_THRESHOLD, SUMO_ATTR_MEASURES, SUMO_ATTR_STYLE, SUMOReal, and TIME2STEPS.

Referenced by addDetector(), and myStartElement().

01039                                                          {
01040     // get the id, report an error if not given or empty...
01041     std::string id;
01042     if (!attrs.setIDFromAttributes("e3-detector", id)) {
01043         return;
01044     }
01045     bool ok = true;
01046     // inform the user about deprecated values
01047     if (attrs.getOptStringReporting(SUMO_ATTR_MEASURES, "e3-detector", id.c_str(), ok, "<invalid>")!="<invalid>") {
01048         MsgHandler::getWarningInstance()->inform("While parsing E3-detector '" + id + "': 'measures' is deprecated.");
01049     }
01050     if (attrs.getOptStringReporting(SUMO_ATTR_STYLE, "e3-detector", id.c_str(), ok, "<invalid>")!="<invalid>") {
01051         MsgHandler::getWarningInstance()->inform("While parsing E3-detector '" + id + "': 'style' is deprecated.");
01052     }
01053     const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, "e3-detector", id.c_str(), ok);
01054     const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, "e3-detector", id.c_str(), ok, TIME2STEPS(1));
01055     const SUMOReal haltingSpeedThreshold = attrs.getOptSUMORealReporting(SUMO_ATTR_HALTING_SPEED_THRESHOLD, "e3-detector", id.c_str(), ok, 5.0f/3.6f);
01056     const std::string file = attrs.getStringReporting(SUMO_ATTR_FILE, "e3-detector", id.c_str(), ok);
01057     if (!ok) {
01058         return;
01059     }
01060     try {
01061         myDetectorBuilder.beginE3Detector(id,
01062                                           OutputDevice::getDevice(file, getFileName()),
01063                                           frequency, haltingSpeedThreshold, haltingTimeThreshold);
01064     } catch (InvalidArgument &e) {
01065         MsgHandler::getErrorInstance()->inform(e.what());
01066     } catch (IOError &e) {
01067         MsgHandler::getErrorInstance()->inform(e.what());
01068     }
01069 }

void NLHandler::beginEdgeParsing ( const SUMOSAXAttributes attrs  )  [private]

begins the processing of an edge

Definition at line 350 of file NLHandler.cpp.

References NLEdgeControlBuilder::beginEdgeParsing(), MSEdge::EDGEFUNCTION_CONNECTOR, MSEdge::EDGEFUNCTION_INTERNAL, MSEdge::EDGEFUNCTION_NORMAL, MSEdge::EDGEFUNCTION_UNKNOWN, MsgHandler::getErrorInstance(), SUMOSAXAttributes::getStringReporting(), MSGlobals::gUsingInternalLanes, MsgHandler::inform(), myCurrentIsBroken, myCurrentIsInternalToSkip, myEdgeControlBuilder, SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_FUNCTION.

Referenced by myStartElement().

00350                                                           {
00351     myCurrentIsBroken = false;
00352     // get the id, report an error if not given or empty...
00353     std::string id;
00354     if (!attrs.setIDFromAttributes("edge", id)) {
00355         myCurrentIsBroken = true;
00356         return;
00357     }
00358     // omit internal edges if not wished
00359     if (!MSGlobals::gUsingInternalLanes&&id[0]==':') {
00360         myCurrentIsInternalToSkip = true;
00361         return;
00362     }
00363     myCurrentIsInternalToSkip = false;
00364     // get the function
00365     bool ok = true;
00366     std::string func = attrs.getStringReporting(SUMO_ATTR_FUNCTION, "edge", id.c_str(), ok);
00367     if (!ok) {
00368         myCurrentIsBroken = true;
00369         return;
00370     }
00371     // parse the function
00372     MSEdge::EdgeBasicFunction funcEnum = MSEdge::EDGEFUNCTION_UNKNOWN;
00373     if (func=="normal") {
00374         funcEnum = MSEdge::EDGEFUNCTION_NORMAL;
00375     } else if (func=="connector"||func=="sink"||func=="source") {
00376         funcEnum = MSEdge::EDGEFUNCTION_CONNECTOR;
00377     } else if (func=="internal") {
00378         funcEnum = MSEdge::EDGEFUNCTION_INTERNAL;
00379     }
00380     if (funcEnum<0) {
00381         MsgHandler::getErrorInstance()->inform("Edge '" + id + "' has an invalid type ('" + func + "').");
00382         myCurrentIsBroken = true;
00383         return;
00384     }
00385     //
00386     try {
00387         myEdgeControlBuilder.beginEdgeParsing(id, funcEnum);
00388     } catch (InvalidArgument &e) {
00389         MsgHandler::getErrorInstance()->inform(e.what());
00390         myCurrentIsBroken = true;
00391     }
00392 }

std::string SUMOSAXHandler::buildErrorMessage ( const SAXParseException &  exception  )  throw () [protected, inherited]

Builds an error message.

The error message includes the file name and the line/column information as supported by the given SAXParseException

Parameters:
[in] exception The name of the currently processed file
Returns:
A string describing the given exception

Definition at line 55 of file SUMOSAXHandler.cpp.

References GenericSAXHandler::getFileName().

Referenced by SUMOSAXHandler::error(), SUMOSAXHandler::fatalError(), and SUMOSAXHandler::warning().

00055                                                                             {
00056     std::ostringstream buf;
00057     char *pMsg = XMLString::transcode(exception.getMessage());
00058     buf << pMsg << std::endl;
00059     buf << " In file '" << getFileName() << "'" << std::endl;
00060     buf << " At line/column " << exception.getLineNumber()+1
00061     << '/' << exception.getColumnNumber() << "." << std::endl;
00062     XMLString::release(&pMsg);
00063     return buf.str();
00064 }

void GenericSAXHandler::characters ( const XMLCh *const   chars,
const XERCES3_SIZE_t  length 
) [inherited]

The inherited method called when characters occured.

The retrieved characters are converted into a string and appended into a private buffer. They are reported as soon as the element ends.

Todo:
recheck/describe what happens with characters when a new element is opened
Todo:
describe characters processing in the class' head

Definition at line 168 of file GenericSAXHandler.cpp.

References GenericSAXHandler::myCharactersVector.

00169                                                            {
00170     myCharactersVector.push_back(TplConvert<XMLCh>::_2str(chars, length));
00171 }

void NLHandler::closeEdge (  )  [protected, virtual]

Closes the process of building an edge.

Definition at line 396 of file NLHandler.cpp.

References NLEdgeControlBuilder::closeEdge(), MsgHandler::getErrorInstance(), MsgHandler::inform(), myCurrentIsBroken, myCurrentIsInternalToSkip, and myEdgeControlBuilder.

Referenced by myEndElement().

00396                      {
00397     // omit internal edges if not wished and broken edges
00398     if (myCurrentIsInternalToSkip||myCurrentIsBroken) {
00399         return;
00400     }
00401     try {
00402         MSEdge& edge = *myEdgeControlBuilder.closeEdge();
00403     } catch (InvalidArgument &e) {
00404         MsgHandler::getErrorInstance()->inform(e.what());
00405     }
00406 }

void MSRouteHandler::closeFlow (  )  throw (ProcessError) [protected, inherited]

Ends the processing of a flow.

Definition at line 590 of file MSRouteHandler.cpp.

References MSEmitControl::add(), SUMOVehicleParameter::depart, MSRoute::dictionary(), MSNet::getEmitControl(), MSNet::getInstance(), OptionsCont::getOptions(), SUMOVehicleParameter::id, MSRouteHandler::myActiveRouteID, MSRouteHandler::myAddVehiclesDirectly, MSRouteHandler::myVehicleParameter, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionsDone, SUMOVehicleParameter::routeid, string2time(), SUMOReal, and SUMOVehicleParameter::vtypeid.

Referenced by MSRouteHandler::myEndElement().

00590                                               {
00591     // let's check whether vehicles had to be emitted before the simulation starts
00592     myVehicleParameter->repetitionsDone = 0;
00593     SUMOReal offsetToBegin = string2time(OptionsCont::getOptions().getString("begin")) - myVehicleParameter->depart;
00594     while (myVehicleParameter->repetitionsDone * myVehicleParameter->repetitionOffset < offsetToBegin) {
00595         myVehicleParameter->repetitionsDone++;
00596         if (myVehicleParameter->repetitionsDone == myVehicleParameter->repetitionNumber) {
00597             return;
00598         }
00599     }
00600     if (MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid)==0) {
00601         throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known.");
00602     }
00603     if (MSRoute::dictionary("!" + myVehicleParameter->id)==0) {
00604         // if not, try via the (hopefully) given route-id
00605         if (MSRoute::dictionary(myVehicleParameter->routeid) == 0) {
00606             if (myVehicleParameter->routeid!="") {
00607                 throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known.");
00608             } else {
00609                 throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route.");
00610             }
00611         }
00612     } else {
00613         myVehicleParameter->routeid = "!" + myVehicleParameter->id;
00614     }
00615     myActiveRouteID = "";
00616 
00617     // check whether the vehicle shall be added directly to the network or
00618     //  shall stay in the internal buffer
00619     if (myAddVehiclesDirectly) {
00620         MSNet::getInstance()->getEmitControl().add(myVehicleParameter);
00621         myVehicleParameter = 0;
00622     }
00623 }

void NLHandler::closeJunction (  )  [private, virtual]

ends the processing of a junction

Definition at line 530 of file NLHandler.cpp.

References NLJunctionControlBuilder::closeJunction(), MsgHandler::getErrorInstance(), MsgHandler::inform(), myCurrentIsBroken, and myJunctionControlBuilder.

Referenced by myEndElement().

00530                          {
00531     if (myCurrentIsBroken) {
00532         return;
00533     }
00534     try {
00535         myJunctionControlBuilder.closeJunction();
00536     } catch (InvalidArgument &e) {
00537         MsgHandler::getErrorInstance()->inform(e.what());
00538     }
00539 }

void NLHandler::closeLane (  )  [protected, virtual]

Closes the process of building a lane.

Definition at line 460 of file NLHandler.cpp.

References NLEdgeControlBuilder::addLane(), MSLane::dictionary(), MsgHandler::getErrorInstance(), MsgHandler::inform(), myAllowedClasses, myCurrentIsBroken, myCurrentIsInternalToSkip, myCurrentLaneID, myCurrentLength, myCurrentMaxSpeed, myDisallowedClasses, myEdgeControlBuilder, myLaneIsDepart, myShape, and Position2DVector::size().

Referenced by myEndElement().

00460                      {
00461     // omit internal edges if not wished and broken edges
00462     if (myCurrentIsInternalToSkip||myCurrentIsBroken) {
00463         return;
00464     }
00465     // check shape
00466     if (myShape.size()<2) {
00467         MsgHandler::getErrorInstance()->inform("Shape of lane '" + myCurrentLaneID + "' is broken.\n Can not build according edge.");
00468         myCurrentIsBroken = true;
00469         return;
00470     }
00471     // build
00472     try {
00473         MSLane *lane =
00474             myEdgeControlBuilder.addLane(myCurrentLaneID, myCurrentMaxSpeed, myCurrentLength, myLaneIsDepart, myShape, myAllowedClasses, myDisallowedClasses);
00475         // insert the lane into the lane-dictionary, checking
00476         if (!MSLane::dictionary(myCurrentLaneID, lane)) {
00477             delete lane;
00478             MsgHandler::getErrorInstance()->inform("Another lane with the id '" + myCurrentLaneID + "' exists.");
00479             myCurrentIsBroken = true;
00480         }
00481     } catch (InvalidArgument &e) {
00482         MsgHandler::getErrorInstance()->inform(e.what());
00483     }
00484 }

void MSRouteHandler::closePerson (  )  throw (ProcessError) [protected, inherited]

void MSRouteHandler::closeRoute (  )  throw (ProcessError) [protected, inherited]

closes (ends) the building of a route. Afterwards no edges may be added to it; this method may throw exceptions when a) the route is empty or b) another route with the same id already exists

Definition at line 419 of file MSRouteHandler.cpp.

References RandomDistributor< T >::add(), MSRoute::dictionary(), MSNet::getInstance(), SUMOVehicleParameter::id, MSRouteHandler::myActiveRoute, MSRouteHandler::myActiveRouteColor, MSRouteHandler::myActiveRouteID, MSRouteHandler::myActiveRouteProbability, MSRouteHandler::myActiveRouteStops, MSRouteHandler::myCurrentRouteDistribution, MSRouteHandler::myVehicleParameter, and SUMOVehicleParameter::repetitionNumber.

Referenced by MSRouteHandler::myEndElement(), and MSRouteHandler::myStartElement().

00419                                                {
00420     if (myActiveRoute.size()==0) {
00421         if (myVehicleParameter!=0) {
00422             throw ProcessError("Vehicle's '" + myVehicleParameter->id + "' route has no edges.");
00423         } else {
00424             throw ProcessError("Route '" + myActiveRouteID + "' has no edges.");
00425         }
00426     }
00427     MSRoute *route = new MSRoute(myActiveRouteID, myActiveRoute,
00428                                  myVehicleParameter==0||myVehicleParameter->repetitionNumber>=1,
00429                                  myActiveRouteColor, myActiveRouteStops);
00430     myActiveRoute.clear();
00431     if (!MSRoute::dictionary(myActiveRouteID, route)) {
00432         delete route;
00433 #ifdef HAVE_MESOSIM
00434         if (!MSGlobals::gStateLoaded) {
00435 #endif
00436             if (myVehicleParameter!=0) {
00437                 if (MSNet::getInstance()->getVehicleControl().getVehicle(myVehicleParameter->id)==0) {
00438                     throw ProcessError("Another route for vehicle '" + myVehicleParameter->id + "' exists.");
00439                 } else {
00440                     throw ProcessError("A vehicle with id '" + myVehicleParameter->id + "' already exists.");
00441                 }
00442             } else {
00443                 throw ProcessError("Another route (or distribution) with the id '" + myActiveRouteID + "' exists.");
00444             }
00445 #ifdef HAVE_MESOSIM
00446         }
00447 #endif
00448     } else {
00449         if (myCurrentRouteDistribution != 0) {
00450             myCurrentRouteDistribution->add(myActiveRouteProbability, route);
00451         }
00452     }
00453     myActiveRouteID = "";
00454     myActiveRouteStops.clear();
00455 }

void MSRouteHandler::closeRouteDistribution (  )  [protected, inherited]

closes (ends) the building of a distribution

Definition at line 479 of file MSRouteHandler.cpp.

References MSRoute::dictionary(), MsgHandler::getErrorInstance(), RandomDistributor< T >::getOverallProb(), MsgHandler::inform(), MSRouteHandler::myCurrentRouteDistribution, and MSRouteHandler::myCurrentRouteDistributionID.

Referenced by MSRouteHandler::myEndElement().

00479                                        {
00480     if (myCurrentRouteDistribution != 0) {
00481         if (myCurrentRouteDistribution->getOverallProb() == 0) {
00482             delete myCurrentRouteDistribution;
00483             MsgHandler::getErrorInstance()->inform("Route distribution '" + myCurrentRouteDistributionID + "' is empty.");
00484         } else if (!MSRoute::dictionary(myCurrentRouteDistributionID, myCurrentRouteDistribution)) {
00485             delete myCurrentRouteDistribution;
00486             MsgHandler::getErrorInstance()->inform("Another route (or distribution) with the id '" + myCurrentRouteDistributionID + "' exists.");
00487         }
00488         myCurrentRouteDistribution = 0;
00489     }
00490 }

void NLHandler::closeSuccLane (  )  [private]

closes the processing of a lane

Definition at line 1470 of file NLHandler.cpp.

References NLSucceedingLaneBuilder::closeSuccLane(), MsgHandler::getErrorInstance(), MsgHandler::inform(), myCurrentIsInternalToSkip, and mySucceedingLaneBuilder.

Referenced by myEndElement().

01470                          {
01471     // do not process internal lanes if not wished
01472     if (myCurrentIsInternalToSkip) {
01473         return;
01474     }
01475     try {
01476         mySucceedingLaneBuilder.closeSuccLane();
01477     } catch (InvalidArgument &e) {
01478         MsgHandler::getErrorInstance()->inform(e.what());
01479     }
01480 }

void MSRouteHandler::closeVehicle (  )  throw (ProcessError) [protected, inherited]

Ends the processing of a vehicle.

Definition at line 494 of file MSRouteHandler.cpp.

References MSEmitControl::add(), MSVehicleControl::addVehicle(), MSVehicleControl::addWaiting(), MSRoute::begin(), MSVehicleControl::buildVehicle(), SUMOVehicleParameter::depart, DEPART_GIVEN, DEPART_TRIGGERED, SUMOVehicleParameter::departProcedure, MSRoute::dictionary(), MSNet::getEmitControl(), MSNet::getInstance(), OptionsCont::getOptions(), MSVehicle::getParameter(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), SUMOVehicleParameter::id, MSRouteHandler::myActiveRouteID, MSRouteHandler::myAddVehiclesDirectly, MSRouteHandler::myAmUsingIncrementalDUA, MSRouteHandler::myIncrementalBase, MSRouteHandler::myIncrementalStage, MSRouteHandler::myLastDepart, MSRouteHandler::myLastReadVehicle, MSRouteHandler::myRunningVehicleNumber, MSRouteHandler::myVehicleParameter, SUMOVehicleParameter::routeid, string2time(), and SUMOVehicleParameter::vtypeid.

Referenced by MSRouteHandler::myEndElement(), and MSRouteHandler::myStartElement().

00494                                                  {
00495     if (myVehicleParameter->departProcedure == DEPART_GIVEN) {
00496         myLastDepart = myVehicleParameter->depart;
00497         // let's check whether this vehicle had to be emitted before the simulation starts
00498         if (myVehicleParameter->depart<string2time(OptionsCont::getOptions().getString("begin"))) {
00499             return;
00500         }
00501     }
00502     // get the vehicle's type
00503     MSVehicleType *vtype = 0;
00504     if (myVehicleParameter->vtypeid!="") {
00505         vtype = MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid);
00506         if (vtype==0) {
00507             throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known.");
00508         }
00509     } else {
00510         // there should be one (at least the default one)
00511         vtype = MSNet::getInstance()->getVehicleControl().getVType();
00512     }
00513     // get the vehicle's route
00514     //  maybe it was explicitely assigned to the vehicle
00515     const MSRoute *route = MSRoute::dictionary("!" + myVehicleParameter->id);
00516     if (route==0) {
00517         // if not, try via the (hopefully) given route-id
00518         route = MSRoute::dictionary(myVehicleParameter->routeid);
00519     }
00520     if (route==0) {
00521         // nothing found? -> error
00522         if (myVehicleParameter->routeid!="") {
00523             throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known.");
00524         } else {
00525             throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route.");
00526         }
00527     }
00528     myActiveRouteID = "";
00529 
00530     // try to build the vehicle
00531     MSVehicle *vehicle = 0;
00532     if (MSNet::getInstance()->getVehicleControl().getVehicle(myVehicleParameter->id)==0) {
00533         // ok there was no other vehicle with the same id, yet
00534         // maybe we do not want this vehicle to be emitted due to using incremental dua
00535         bool add = true;
00536         if (myAmUsingIncrementalDUA) {
00537             if ((int)(myRunningVehicleNumber%myIncrementalBase)>=(int) myIncrementalStage) {
00538                 add = false;
00539             }
00540             myRunningVehicleNumber++;
00541         }
00542         if (add) {
00543             vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(myVehicleParameter, route, vtype);
00544             // add the vehicle to the vehicle control
00545             MSNet::getInstance()->getVehicleControl().addVehicle(myVehicleParameter->id, vehicle);
00546             if (myVehicleParameter->departProcedure == DEPART_TRIGGERED) {
00547                 MSNet::getInstance()->getVehicleControl().addWaiting(*route->begin(), vehicle);
00548             }
00549             myVehicleParameter = 0;
00550         }
00551     } else {
00552         // strange: another vehicle with the same id already exists
00553 #ifdef HAVE_MESOSIM
00554         if (!MSGlobals::gStateLoaded) {
00555 #endif
00556             // and was not loaded while loading a simulation state
00557             // -> error
00558             throw ProcessError("Another vehicle with the id '" + myVehicleParameter->id + "' exists.");
00559 #ifdef HAVE_MESOSIM
00560         } else {
00561             // ok, it seems to be loaded previously while loading a simulation state
00562             vehicle = 0;
00563         }
00564 #endif
00565     }
00566     // check whether the vehicle shall be added directly to the network or
00567     //  shall stay in the internal buffer
00568     if (myAddVehiclesDirectly&&vehicle!=0) {
00569         if (vehicle->getParameter().departProcedure == DEPART_GIVEN) {
00570             MSNet::getInstance()->getEmitControl().add(vehicle);
00571         }
00572     } else {
00573         myLastReadVehicle = vehicle;
00574     }
00575 }

void MSRouteHandler::closeVehicleTypeDistribution (  )  [protected, inherited]

closes (ends) the building of a distribution

Definition at line 293 of file MSRouteHandler.cpp.

References MsgHandler::getErrorInstance(), MSNet::getInstance(), RandomDistributor< T >::getOverallProb(), MsgHandler::inform(), MSRouteHandler::myCurrentVTypeDistribution, and MSRouteHandler::myCurrentVTypeDistributionID.

Referenced by MSRouteHandler::myEndElement().

00293                                              {
00294     if (myCurrentVTypeDistribution != 0) {
00295         if (myCurrentVTypeDistribution->getOverallProb() == 0) {
00296             delete myCurrentVTypeDistribution;
00297             MsgHandler::getErrorInstance()->inform("Vehicle type distribution '" + myCurrentVTypeDistributionID + "' is empty.");
00298         } else if (!MSNet::getInstance()->getVehicleControl().addVTypeDistribution(myCurrentVTypeDistributionID, myCurrentVTypeDistribution)) {
00299             delete myCurrentVTypeDistribution;
00300             MsgHandler::getErrorInstance()->inform("Another vehicle type (or distribution) with the id '" + myCurrentVTypeDistributionID + "' exists.");
00301         }
00302         myCurrentVTypeDistribution = 0;
00303     }
00304 }

void NLHandler::closeWAUT (  )  [private]

void NLHandler::endDetector (  )  [protected]

Ends the detector building.

Todo:
Remove this

Definition at line 1484 of file NLHandler.cpp.

References endE3Detector(), and myCurrentDetectorType.

Referenced by myEndElement().

01484                        {
01485     if (myCurrentDetectorType=="e3") {
01486         endE3Detector();
01487     }
01488     myCurrentDetectorType = "";
01489 }

void NLHandler::endE3Detector (  )  [protected, virtual]

Builds of an e3-detector using collected values.

Definition at line 1493 of file NLHandler.cpp.

References NLDetectorBuilder::endE3Detector(), MsgHandler::getErrorInstance(), MsgHandler::inform(), and myDetectorBuilder.

Referenced by endDetector(), and myEndElement().

01493                          {
01494     try {
01495         myDetectorBuilder.endE3Detector();
01496     } catch (InvalidArgument &e) {
01497         MsgHandler::getErrorInstance()->inform(e.what());
01498     }
01499 }

void GenericSAXHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const   qname 
) [inherited]

The inherited method called when a tag is being closed.

This method calls the user-implemented methods myCharacters with the previously collected and converted characters.

Then, myEndElement is called, supplying it the qname converted to its enum- and string-representations.

Todo:
recheck/describe encoding of the string-representation
Todo:
do not generate and report the string-representation

Definition at line 118 of file GenericSAXHandler.cpp.

References TplConvert< E >::_2str(), GenericSAXHandler::convertTag(), GenericSAXHandler::myCharacters(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myEndElement(), GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, XMLSubSys::setHandler(), SUMO_TAG_INCLUDE, and SUMO_TAG_NOTHING.

00120                                                         {
00121     std::string name = TplConvert<XMLCh>::_2str(qname);
00122     SumoXMLTag element = convertTag(name);
00123     // collect characters
00124     if (myCharactersVector.size()!=0) {
00125         size_t len = 0;
00126         unsigned i;
00127         for (i=0; i<myCharactersVector.size(); ++i) {
00128             len += myCharactersVector[i].length();
00129         }
00130         char *buf = new char[len+1];
00131         size_t pos = 0;
00132         for (i=0; i<myCharactersVector.size(); ++i) {
00133             memcpy((unsigned char*) buf+pos, (unsigned char*) myCharactersVector[i].c_str(),
00134                    sizeof(char)*myCharactersVector[i].length());
00135             pos += myCharactersVector[i].length();
00136         }
00137         buf[pos] = 0;
00138 
00139         // call user handler
00140         try {
00141             myCharacters(element, buf);
00142         } catch (std::runtime_error &) {
00143             delete[] buf;
00144             throw;
00145         }
00146         delete[] buf;
00147     }
00148     if (element != SUMO_TAG_INCLUDE) {
00149         myEndElement(element);
00150         if (myParentHandler && myParentIndicator == element) {
00151             XMLSubSys::setHandler(*myParentHandler);
00152             myParentIndicator = SUMO_TAG_NOTHING;
00153             myParentHandler = 0;
00154         }
00155     }
00156 }

void SUMOSAXHandler::error ( const SAXParseException &  exception  )  throw (ProcessError) [inherited]

Handler for XML-errors.

The message is built using buildErrorMessage and thrown within a ProcessError.

Parameters:
[in] exception The occured exception to process
Exceptions:
ProcessError On any call

Definition at line 74 of file SUMOSAXHandler.cpp.

References SUMOSAXHandler::buildErrorMessage().

00074                                                                             {
00075     throw ProcessError(buildErrorMessage(exception));
00076 }

void SUMOSAXHandler::fatalError ( const SAXParseException &  exception  )  throw (ProcessError) [inherited]

Handler for XML-errors.

The message is built using buildErrorMessage and thrown within a ProcessError.

Exceptions:
ProcessError On any call
Parameters:
[in] exception The occured exception to process

Definition at line 80 of file SUMOSAXHandler.cpp.

References SUMOSAXHandler::buildErrorMessage().

00080                                                                                  {
00081     throw ProcessError(buildErrorMessage(exception));
00082 }

const std::string & GenericSAXHandler::getFileName (  )  const throw () [inherited]

SUMOTime MSRouteHandler::getLastDepart (  )  const [inherited]

Returns the last loaded depart time.

Definition at line 84 of file MSRouteHandler.cpp.

References MSRouteHandler::myLastDepart.

Referenced by MSRouteLoader::loadUntil().

00084                                     {
00085     return myLastDepart;
00086 }

void NLHandler::initJunctionLogic ( const SUMOSAXAttributes attrs  )  [private]

begins the reading of a junction row logic

Definition at line 712 of file NLHandler.cpp.

References SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::hasAttribute(), NLJunctionControlBuilder::initJunctionLogic(), myJunctionControlBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_ID, SUMO_ATTR_LANENUMBER, and SUMO_ATTR_REQUESTSIZE.

Referenced by myStartElement().

00712                                                            {
00713     if (!attrs.hasAttribute(SUMO_ATTR_ID)) {
00714         // @deprecated: assuming a net could still use characters for the id
00715         myJunctionControlBuilder.initJunctionLogic("", -1, -1);
00716         return;
00717     }
00718     // get the id, report an error if not given or empty...
00719     std::string id;
00720     if (!attrs.setIDFromAttributes("row-logic", id)) {
00721         return;
00722     }
00723     bool ok = true;
00724     int requestSize = attrs.getIntReporting(SUMO_ATTR_REQUESTSIZE, "row-logic", id.c_str(), ok);
00725     int laneNumber = attrs.getIntReporting(SUMO_ATTR_LANENUMBER, "row-logic", id.c_str(), ok);
00726     if (ok) {
00727         myJunctionControlBuilder.initJunctionLogic(id, requestSize, laneNumber);
00728     }
00729 }

void NLHandler::initTrafficLightLogic ( const SUMOSAXAttributes attrs  )  [private]

begins the reading of a traffic lights logic

Definition at line 733 of file NLHandler.cpp.

References SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), NLJunctionControlBuilder::initIncomingLanes(), NLJunctionControlBuilder::initTrafficLightLogic(), myAmInTLLogicMode, myJunctionControlBuilder, SUMO_ATTR_DET_OFFSET, SUMO_ATTR_ID, SUMO_ATTR_OFFSET, SUMO_ATTR_PROGRAMID, SUMO_ATTR_TYPE, and SUMOReal.

Referenced by myStartElement().

00733                                                                {
00734     SUMOReal detectorOffset = -1;
00735     myJunctionControlBuilder.initIncomingLanes(); // @deprecated (is this still used?)
00736     bool ok = true;
00737     std::string type = attrs.getStringReporting(SUMO_ATTR_TYPE, "tl-logic", 0, ok);
00738     detectorOffset = attrs.getOptSUMORealReporting(SUMO_ATTR_DET_OFFSET, "tl-logic", 0, ok, -1);
00739     //
00740     if (!attrs.hasAttribute(SUMO_ATTR_ID)) {
00741         // @deprecated: assuming a net could still use characters for the id
00742         myJunctionControlBuilder.initTrafficLightLogic("", "", type, 0, detectorOffset);
00743         return;
00744     }
00745     std::string id = attrs.getStringReporting(SUMO_ATTR_ID, "tl-logic", 0, ok);
00746     int offset = attrs.getOptSUMOTimeReporting(SUMO_ATTR_OFFSET, "tl-logic", id.c_str(), ok, 0);
00747     if (!ok) {
00748         return;
00749     }
00750     std::string programID = attrs.getOptStringReporting(SUMO_ATTR_PROGRAMID, "tl-logic", id.c_str(), ok, "<unknown>");
00751     myJunctionControlBuilder.initTrafficLightLogic(id, programID, type, offset, detectorOffset);
00752     myAmInTLLogicMode = true;
00753 }

void NLHandler::myCharacters ( SumoXMLTag  element,
const std::string &  chars 
) throw (ProcessError) [protected, virtual]

Called when characters occure.

Parameters:
[in] element ID of the last opened element
[in] chars The read characters (complete)
Exceptions:
ProcessError If something fails
See also:
GenericSAXHandler::myCharacters
Todo:
Refactor/describe

Reimplemented from MSRouteHandler.

Definition at line 228 of file NLHandler.cpp.

References addIncomingLanes(), addJunctionShape(), addLaneShape(), NLJunctionControlBuilder::getActiveKey(), MsgHandler::getWarningInstance(), MsgHandler::inform(), GeoConvHelper::init(), MSRouteHandler::myCharacters(), myConvBoundary, myHaveWarnedAboutDeprecatedLocation, myJunctionControlBuilder, myNetworkOffset, myOrigBoundary, myShapeBuilder, GeomConvHelper::parseBoundaryReporting(), GeomConvHelper::parseShapeReporting(), NLGeomShapeBuilder::polygonEnd(), setKey(), setLaneNumber(), setOffset(), setRequestSize(), setSubKey(), SUMO_TAG_CONV_BOUNDARY, SUMO_TAG_INCOMING_LANES, SUMO_TAG_INTERNAL_LANES, SUMO_TAG_KEY, SUMO_TAG_LANE, SUMO_TAG_LANENUMBER, SUMO_TAG_NET_OFFSET, SUMO_TAG_OFFSET, SUMO_TAG_ORIG_BOUNDARY, SUMO_TAG_ORIG_PROJ, SUMO_TAG_POLY, SUMO_TAG_REQUESTSIZE, SUMO_TAG_SHAPE, and SUMO_TAG_SUBKEY.

00229                                                                     {
00230     bool ok = true;
00231     switch (element) {
00232     case SUMO_TAG_POLY:
00233         if (chars.length()!=0) {
00234             myShapeBuilder.polygonEnd(GeomConvHelper::parseShapeReporting(chars, "polygon", 0, ok, false)); // !!! no error handling!
00235         }
00236         break;
00237     case SUMO_TAG_INCOMING_LANES:
00238         addIncomingLanes(chars);
00239         break;
00240 #ifdef HAVE_INTERNAL_LANES
00241     case SUMO_TAG_INTERNAL_LANES:
00242         addInternalLanes(chars);
00243         break;
00244 #endif
00245     case SUMO_TAG_LANE:
00246         if (chars.length()!=0) {
00247             addLaneShape(chars);
00248         }
00249         break;
00250     case SUMO_TAG_REQUESTSIZE:
00251         if (myJunctionControlBuilder.getActiveKey().length()!=0) {
00252             setRequestSize(chars);
00253         }
00254         break;
00255     case SUMO_TAG_LANENUMBER:
00256         if (myJunctionControlBuilder.getActiveKey().length()!=0) {
00257             setLaneNumber(chars);
00258         }
00259         break;
00260     case SUMO_TAG_KEY:
00261         setKey(chars);
00262         break;
00263     case SUMO_TAG_SUBKEY:
00264         setSubKey(chars);
00265         break;
00266     case SUMO_TAG_OFFSET:
00267         setOffset(chars);
00268         break;
00269     case SUMO_TAG_NET_OFFSET: {
00270         if (!myHaveWarnedAboutDeprecatedLocation) {
00271             myHaveWarnedAboutDeprecatedLocation = true;
00272             MsgHandler::getWarningInstance()->inform("Your network uses a deprecated network offset/projection definition.");
00273         }
00274         Position2DVector s = GeomConvHelper::parseShapeReporting(chars, "net", 0, ok, false);
00275         if (ok) {
00276             myNetworkOffset = s[0];
00277         }
00278     }
00279     break;
00280     case SUMO_TAG_CONV_BOUNDARY:
00281         myConvBoundary = GeomConvHelper::parseBoundaryReporting(chars, "net", 0, ok);
00282         break;
00283     case SUMO_TAG_ORIG_BOUNDARY:
00284         myOrigBoundary = GeomConvHelper::parseBoundaryReporting(chars, "net", 0, ok);
00285         break;
00286     case SUMO_TAG_ORIG_PROJ:
00287         GeoConvHelper::init(chars, myNetworkOffset, myOrigBoundary, myConvBoundary);
00288         break;
00289     case SUMO_TAG_SHAPE:
00290         if (chars.length()!=0) {
00291             addJunctionShape(chars);
00292         }
00293         break;
00294     default:
00295         break;
00296     }
00297     MSRouteHandler::myCharacters(element, chars);
00298 }

void NLHandler::myEndElement ( SumoXMLTag  element  )  throw (ProcessError) [protected, virtual]

Called when a closing tag occurs.

Parameters:
[in] element ID of the currently opened element
Exceptions:
ProcessError If something fails
See also:
GenericSAXHandler::myEndElement
Todo:
Refactor/describe

Reimplemented from MSRouteHandler.

Definition at line 302 of file NLHandler.cpp.

References closeEdge(), closeJunction(), NLJunctionControlBuilder::closeJunctionLogic(), closeLane(), closeSuccLane(), NLJunctionControlBuilder::closeTrafficLightLogic(), closeWAUT(), endDetector(), endE3Detector(), MsgHandler::getErrorInstance(), MsgHandler::inform(), myAmInTLLogicMode, MSRouteHandler::myEndElement(), myJunctionControlBuilder, SUMO_TAG_DETECTOR, SUMO_TAG_E3DETECTOR, SUMO_TAG_EDGE, SUMO_TAG_JUNCTION, SUMO_TAG_LANE, SUMO_TAG_ROWLOGIC, SUMO_TAG_SUCC, SUMO_TAG_TLLOGIC, and SUMO_TAG_WAUT.

00302                                                               {
00303     switch (element) {
00304     case SUMO_TAG_EDGE:
00305         closeEdge();
00306         break;
00307     case SUMO_TAG_LANE:
00308         closeLane();
00309         break;
00310     case SUMO_TAG_JUNCTION:
00311         closeJunction();
00312         break;
00313     case SUMO_TAG_SUCC:
00314         closeSuccLane();
00315         break;
00316     case SUMO_TAG_ROWLOGIC:
00317         try {
00318             myJunctionControlBuilder.closeJunctionLogic();
00319         } catch (InvalidArgument &e) {
00320             MsgHandler::getErrorInstance()->inform(e.what());
00321         }
00322         break;
00323     case SUMO_TAG_TLLOGIC:
00324         try {
00325             myJunctionControlBuilder.closeTrafficLightLogic();
00326         } catch (InvalidArgument &e) {
00327             MsgHandler::getErrorInstance()->inform(e.what());
00328         }
00329         myAmInTLLogicMode = false;
00330         break;
00331     case SUMO_TAG_WAUT:
00332         closeWAUT();
00333         break;
00334     case SUMO_TAG_E3DETECTOR:
00335         endE3Detector();
00336         break;
00337     case SUMO_TAG_DETECTOR:
00338         endDetector();
00339         break;
00340     default:
00341         break;
00342     }
00343     MSRouteHandler::myEndElement(element);
00344 }

void NLHandler::myStartElement ( SumoXMLTag  element,
const SUMOSAXAttributes attrs 
) throw (ProcessError) [protected, virtual]

Called on the opening of a tag;.

Parameters:
[in] element ID of the currently opened element
[in] attrs Attributes within the currently opened element
Exceptions:
ProcessError If something fails
See also:
GenericSAXHandler::myStartElement
Todo:
Refactor/describe

Deprecated:
begins

Deprecated:
ends

Reimplemented from MSRouteHandler.

Definition at line 89 of file NLHandler.cpp.

References NLDiscreteEventBuilder::addAction(), addDetector(), addDistrict(), addDistrictEdge(), addE1Detector(), addE2Detector(), addE3Entry(), addE3Exit(), addEdgeLaneMeanData(), addLane(), addLogicItem(), addParam(), addPhase(), addPOI(), addPoly(), addRouteProbeDetector(), addSource(), addSuccLane(), addTrigger(), addVTypeProbeDetector(), addWAUTJunction(), addWAUTSwitch(), beginE3Detector(), beginEdgeParsing(), NLTriggerBuilder::buildVaporizer(), MsgHandler::getErrorInstance(), GenericSAXHandler::getFileName(), MsgHandler::inform(), initJunctionLogic(), initTrafficLightLogic(), myActionBuilder, myNet, MSRouteHandler::myStartElement(), myTriggerBuilder, openJunction(), openSucc(), openWAUT(), NLTriggerBuilder::parseAndBuildBusStop(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildLaneEmitTrigger(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), NLTriggerBuilder::parseAndBuildRerouter(), setLocation(), SUMO_TAG_BUS_STOP, SUMO_TAG_CALIBRATOR, SUMO_TAG_DET_ENTRY, SUMO_TAG_DET_EXIT, SUMO_TAG_DETECTOR, SUMO_TAG_DISTRICT, SUMO_TAG_DSINK, SUMO_TAG_DSOURCE, SUMO_TAG_E1DETECTOR, SUMO_TAG_E2DETECTOR, SUMO_TAG_E3DETECTOR, SUMO_TAG_EDGE, SUMO_TAG_EMITTER, SUMO_TAG_JUNCTION, SUMO_TAG_LANE, SUMO_TAG_LOCATION, SUMO_TAG_LOGICITEM, SUMO_TAG_MEANDATA_EDGE, SUMO_TAG_MEANDATA_LANE, SUMO_TAG_PARAM, SUMO_TAG_PHASE, SUMO_TAG_POI, SUMO_TAG_POLY, SUMO_TAG_REROUTER, SUMO_TAG_ROUTEPROBE, SUMO_TAG_ROWLOGIC, SUMO_TAG_SOURCE, SUMO_TAG_SUCC, SUMO_TAG_SUCCLANE, SUMO_TAG_TIMEDEVENT, SUMO_TAG_TLLOGIC, SUMO_TAG_TRIGGER, SUMO_TAG_VAPORIZER, SUMO_TAG_VSS, SUMO_TAG_VTYPEPROBE, SUMO_TAG_WAUT, SUMO_TAG_WAUT_JUNCTION, and SUMO_TAG_WAUT_SWITCH.

00090                                                                               {
00091     try {
00092         switch (element) {
00093         case SUMO_TAG_EDGE:
00094             beginEdgeParsing(attrs);
00095             break;
00096         case SUMO_TAG_LANE:
00097             addLane(attrs);
00098             break;
00099         case SUMO_TAG_POLY:
00100             addPoly(attrs);
00101             break;
00102         case SUMO_TAG_POI:
00103             addPOI(attrs);
00104             break;
00105         case SUMO_TAG_JUNCTION:
00106             openJunction(attrs);
00107             break;
00108         case SUMO_TAG_PHASE:
00109             addPhase(attrs);
00110             break;
00111         case SUMO_TAG_SUCC:
00112             openSucc(attrs);
00113             break;
00114         case SUMO_TAG_SUCCLANE:
00115             addSuccLane(attrs);
00116             break;
00117         case SUMO_TAG_ROWLOGIC:
00118             initJunctionLogic(attrs);
00119             break;
00120         case SUMO_TAG_TLLOGIC:
00121             initTrafficLightLogic(attrs);
00122             break;
00123         case SUMO_TAG_LOGICITEM:
00124             addLogicItem(attrs);
00125             break;
00126         case SUMO_TAG_WAUT:
00127             openWAUT(attrs);
00128             break;
00129         case SUMO_TAG_WAUT_SWITCH:
00130             addWAUTSwitch(attrs);
00131             break;
00132         case SUMO_TAG_WAUT_JUNCTION:
00133             addWAUTJunction(attrs);
00134             break;
00136         case SUMO_TAG_DETECTOR:
00137             addDetector(attrs);
00138             break;
00140 #ifdef _MESSAGES
00141         case SUMO_TAG_MSG_EMITTER:
00142             addMsgEmitter(attrs);
00143             break;
00144         case SUMO_TAG_MSG:
00145             addMsgDetector(attrs);
00146             break;
00147 #endif
00148         case SUMO_TAG_E1DETECTOR:
00149             addE1Detector(attrs);
00150             break;
00151         case SUMO_TAG_E2DETECTOR:
00152             addE2Detector(attrs);
00153             break;
00154         case SUMO_TAG_E3DETECTOR:
00155             beginE3Detector(attrs);
00156             break;
00157         case SUMO_TAG_DET_ENTRY:
00158             addE3Entry(attrs);
00159             break;
00160         case SUMO_TAG_DET_EXIT:
00161             addE3Exit(attrs);
00162             break;
00163         case SUMO_TAG_VSS:
00164             myTriggerBuilder.parseAndBuildLaneSpeedTrigger(myNet, attrs, getFileName());
00165             break;
00166         case SUMO_TAG_EMITTER:
00167             myTriggerBuilder.parseAndBuildLaneEmitTrigger(myNet, attrs, getFileName());
00168             break;
00169         case SUMO_TAG_CALIBRATOR:
00170             myTriggerBuilder.parseAndBuildCalibrator(myNet, attrs, getFileName());
00171             break;
00172         case SUMO_TAG_REROUTER:
00173             myTriggerBuilder.parseAndBuildRerouter(myNet, attrs, getFileName());
00174             break;
00175         case SUMO_TAG_BUS_STOP:
00176             myTriggerBuilder.parseAndBuildBusStop(myNet, attrs);
00177             break;
00178         case SUMO_TAG_VTYPEPROBE:
00179             addVTypeProbeDetector(attrs);
00180             break;
00181         case SUMO_TAG_ROUTEPROBE:
00182             addRouteProbeDetector(attrs);
00183             break;
00184         case SUMO_TAG_MEANDATA_EDGE:
00185             addEdgeLaneMeanData(attrs, "meandata_edge");
00186             break;
00187         case SUMO_TAG_MEANDATA_LANE:
00188             addEdgeLaneMeanData(attrs, "meandata_lane");
00189             break;
00190         case SUMO_TAG_SOURCE:
00191             addSource(attrs);
00192             break;
00193         case SUMO_TAG_TRIGGER:
00194             addTrigger(attrs);
00195             break;
00196         case SUMO_TAG_TIMEDEVENT:
00197             myActionBuilder.addAction(attrs, getFileName());
00198             break;
00199         case SUMO_TAG_VAPORIZER:
00200             myTriggerBuilder.buildVaporizer(attrs);
00201             break;
00202         case SUMO_TAG_LOCATION:
00203             setLocation(attrs);
00204             break;
00205         case SUMO_TAG_DISTRICT:
00206             addDistrict(attrs);
00207             break;
00208         case SUMO_TAG_DSOURCE:
00209             addDistrictEdge(attrs, true);
00210             break;
00211         case SUMO_TAG_DSINK:
00212             addDistrictEdge(attrs, false);
00213             break;
00214         default:
00215             break;
00216         }
00217     } catch (InvalidArgument &e) {
00218         MsgHandler::getErrorInstance()->inform(e.what());
00219     }
00220     MSRouteHandler::myStartElement(element, attrs);
00221     if (element==SUMO_TAG_PARAM) {
00222         addParam(attrs);
00223     }
00224 }

void NLHandler::openJunction ( const SUMOSAXAttributes attrs  )  [private, virtual]

opens a junction for processing

Definition at line 489 of file NLHandler.cpp.

References addIncomingLanes(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getStringSecure(), SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::hasAttribute(), MsgHandler::inform(), myCurrentIsBroken, myJunctionControlBuilder, NLJunctionControlBuilder::openJunction(), GeomConvHelper::parseShapeReporting(), SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_INCLANES, SUMO_ATTR_INTLANES, SUMO_ATTR_KEY, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, SUMO_ATTR_X, SUMO_ATTR_Y, and SUMOReal.

Referenced by myStartElement().

00489                                                       {
00490     myCurrentIsBroken = false;
00491     // get the id, report an error if not given or empty...
00492     std::string id;
00493     if (!attrs.setIDFromAttributes("junction", id)) {
00494         myCurrentIsBroken = true;
00495         return;
00496     }
00497     bool ok = true;
00498     Position2DVector shape;
00499     if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
00500         // @deprecated: at some time, all junctions should have a shape attribute (moved from characters)
00501         shape = GeomConvHelper::parseShapeReporting(attrs.getStringSecure(SUMO_ATTR_SHAPE, ""), "junction", id.c_str(), ok, true);
00502     }
00503     SUMOReal x = attrs.getSUMORealReporting(SUMO_ATTR_X, "junction", id.c_str(), ok);
00504     SUMOReal y = attrs.getSUMORealReporting(SUMO_ATTR_Y, "junction", id.c_str(), ok);
00505     std::string type = attrs.getStringReporting(SUMO_ATTR_TYPE, "junction", id.c_str(), ok);
00506     std::string key = attrs.getOptStringReporting(SUMO_ATTR_KEY, "junction", id.c_str(), ok, "");
00507     if (!ok) {
00508         myCurrentIsBroken = true;
00509     } else {
00510         try {
00511             myJunctionControlBuilder.openJunction(id, key, type, x, y, shape);
00512         } catch (InvalidArgument &e) {
00513             MsgHandler::getErrorInstance()->inform(e.what() + std::string("\n Can not build according junction."));
00514             myCurrentIsBroken = true;
00515         }
00516         //
00517         if (!myCurrentIsBroken&&attrs.hasAttribute(SUMO_ATTR_INCLANES)) {
00518             addIncomingLanes(attrs.getStringSecure(SUMO_ATTR_INCLANES, ""));
00519         }
00520 #ifdef HAVE_INTERNAL_LANES
00521         if (!myCurrentIsBroken&&attrs.hasAttribute(SUMO_ATTR_INTLANES)) {
00522             addInternalLanes(attrs.getStringSecure(SUMO_ATTR_INTLANES, ""));
00523         }
00524 #endif
00525     }
00526 }

void MSRouteHandler::openRoute ( const SUMOSAXAttributes attrs  )  [protected, inherited]

opens a route for reading

Definition at line 308 of file MSRouteHandler.cpp.

References DEFAULT_VEH_PROB, RGBColor::getDefaultColor(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getString(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, MSRouteHandler::myActiveRoute, MSRouteHandler::myActiveRouteColor, MSRouteHandler::myActiveRouteID, MSRouteHandler::myActiveRouteProbability, MSRouteHandler::myVehicleParameter, RGBColor::parseColorReporting(), MSEdge::parseEdgesList(), SUMO_ATTR_COLOR, SUMO_ATTR_EDGES, SUMO_ATTR_ID, and SUMO_ATTR_PROB.

Referenced by MSRouteHandler::myStartElement().

00308                                                         {
00309     // check whether the id is really necessary
00310     if (myVehicleParameter!=0) {
00311         // ok, a vehicle is wrapping the route,
00312         //  we may use this vehicle's id as default
00313         myActiveRouteID = "!" + myVehicleParameter->id; // !!! document this
00314     } else {
00315         bool ok = true;
00316         myActiveRouteID = attrs.getStringReporting(SUMO_ATTR_ID, "route", 0, ok, false);
00317         if (!ok) {
00318             return;
00319         }
00320     }
00321     bool ok = true;
00322     if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
00323         MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_EDGES, "route", myActiveRouteID.c_str(), ok), myActiveRoute, myActiveRouteID);
00324     }
00325     myActiveRouteProbability = attrs.getOptSUMORealReporting(SUMO_ATTR_PROB, "route", myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB);
00326     myActiveRouteColor = attrs.hasAttribute(SUMO_ATTR_COLOR) ? RGBColor::parseColorReporting(attrs.getString(SUMO_ATTR_COLOR), "route", myActiveRouteID.c_str(), true, ok) : RGBColor::getDefaultColor();
00327 }

void MSRouteHandler::openRouteDistribution ( const SUMOSAXAttributes attrs  )  [protected, inherited]

opens a route distribution for reading

Definition at line 459 of file MSRouteHandler.cpp.

References RandomDistributor< T >::add(), MSRoute::dictionary(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), StringTokenizer::hasNext(), MSRouteHandler::myCurrentRouteDistribution, MSRouteHandler::myCurrentRouteDistributionID, StringTokenizer::next(), SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_ROUTES.

Referenced by MSRouteHandler::myStartElement().

00459                                                                     {
00460     if (attrs.setIDFromAttributes("routeDistribution", myCurrentRouteDistributionID)) {
00461         myCurrentRouteDistribution = new RandomDistributor<const MSRoute*>();
00462         if (attrs.hasAttribute(SUMO_ATTR_ROUTES)) {
00463             bool ok = true;
00464             StringTokenizer st(attrs.getStringReporting(SUMO_ATTR_ROUTES, "routeDistribution", myCurrentRouteDistributionID.c_str(), ok));
00465             while (st.hasNext()) {
00466                 std::string routeID = st.next();
00467                 const MSRoute *route = MSRoute::dictionary(routeID);
00468                 if (route==0) {
00469                     throw ProcessError("Unknown route '" + routeID + "' in distribution '" + myCurrentRouteDistributionID + "'.");
00470                 }
00471                 myCurrentRouteDistribution->add(1., route, false);
00472             }
00473         }
00474     }
00475 }

void NLHandler::openSucc ( const SUMOSAXAttributes attrs  )  [private]

opens the container of succeeding lanes for processing

Definition at line 1167 of file NLHandler.cpp.

References SUMOSAXAttributes::getStringReporting(), MSGlobals::gUsingInternalLanes, myCurrentIsInternalToSkip, mySucceedingLaneBuilder, NLSucceedingLaneBuilder::openSuccLane(), and SUMO_ATTR_LANE.

Referenced by myStartElement().

01167                                                   {
01168     bool ok = true;
01169     std::string id = attrs.getStringReporting(SUMO_ATTR_LANE, "succ", 0, ok);
01170     if (!MSGlobals::gUsingInternalLanes&&id[0]==':') {
01171         myCurrentIsInternalToSkip = true;
01172         return;
01173     }
01174     myCurrentIsInternalToSkip = false;
01175     mySucceedingLaneBuilder.openSuccLane(id);
01176 }

void MSRouteHandler::openVehicleTypeDistribution ( const SUMOSAXAttributes attrs  )  [protected, inherited]

opens a type distribution for reading

Definition at line 273 of file MSRouteHandler.cpp.

References RandomDistributor< T >::add(), MSVehicleType::getDefaultProbability(), MSNet::getInstance(), SUMOSAXAttributes::getStringReporting(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), SUMOSAXAttributes::hasAttribute(), StringTokenizer::hasNext(), MSRouteHandler::myCurrentVTypeDistribution, MSRouteHandler::myCurrentVTypeDistributionID, StringTokenizer::next(), SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_VTYPES.

Referenced by MSRouteHandler::myStartElement().

00273                                                                           {
00274     if (attrs.setIDFromAttributes("vtypeDistribution", myCurrentVTypeDistributionID)) {
00275         myCurrentVTypeDistribution = new RandomDistributor<MSVehicleType*>();
00276         if (attrs.hasAttribute(SUMO_ATTR_VTYPES)) {
00277             bool ok = true;
00278             StringTokenizer st(attrs.getStringReporting(SUMO_ATTR_VTYPES, "vtypeDistribution", myCurrentVTypeDistributionID.c_str(), ok));
00279             while (st.hasNext()) {
00280                 std::string vtypeID = st.next();
00281                 MSVehicleType *type = MSNet::getInstance()->getVehicleControl().getVType(vtypeID);
00282                 if (type==0) {
00283                     throw ProcessError("Unknown vtype '" + vtypeID + "' in distribution '" + myCurrentVTypeDistributionID + "'.");
00284                 }
00285                 myCurrentVTypeDistribution->add(type->getDefaultProbability(), type);
00286             }
00287         }
00288     }
00289 }

void NLHandler::openWAUT ( const SUMOSAXAttributes attrs  )  [private, virtual]

Definition at line 557 of file NLHandler.cpp.

References MSTLLogicControl::addWAUT(), MsgHandler::getErrorInstance(), SUMOSAXAttributes::getOptSUMOTimeReporting(), SUMOSAXAttributes::getStringReporting(), NLJunctionControlBuilder::getTLLogicControlToUse(), MsgHandler::inform(), myCurrentIsBroken, myCurrentWAUTID, myJunctionControlBuilder, SUMOSAXAttributes::setIDFromAttributes(), SUMO_ATTR_REF_TIME, and SUMO_ATTR_START_PROG.

Referenced by myStartElement().

00557                                                   {
00558     myCurrentIsBroken = false;
00559 
00560     // get the id, report an error if not given or empty...
00561     std::string id;
00562     if (!attrs.setIDFromAttributes("waut", id)) {
00563         myCurrentIsBroken = true;
00564         return;
00565     }
00566     bool ok = true;
00567     SUMOTime t = attrs.getOptSUMOTimeReporting(SUMO_ATTR_REF_TIME, "waut", id.c_str(), ok, 0);
00568     std::string pro = attrs.getStringReporting(SUMO_ATTR_START_PROG, "waut", id.c_str(), ok);
00569     if (!ok) {
00570         myCurrentIsBroken = true;
00571     }
00572     if (!myCurrentIsBroken) {
00573         myCurrentWAUTID = id;
00574         try {
00575             myJunctionControlBuilder.getTLLogicControlToUse().addWAUT(t, id, pro);
00576         } catch (InvalidArgument &e) {
00577             MsgHandler::getErrorInstance()->inform(e.what());
00578             myCurrentIsBroken = true;
00579         }
00580     }
00581 }

NLHandler& NLHandler::operator= ( const NLHandler s  )  [private]

invalid assignment operator

MSLink::LinkDirection NLHandler::parseLinkDir ( char  dir  )  [private]

Parses the given character into an enumeration typed link direction.

Definition at line 1225 of file NLHandler.cpp.

References MSLink::LINKDIR_LEFT, MSLink::LINKDIR_PARTLEFT, MSLink::LINKDIR_PARTRIGHT, MSLink::LINKDIR_RIGHT, MSLink::LINKDIR_STRAIGHT, MSLink::LINKDIR_TURN, and toString().

Referenced by addSuccLane().

01225                                 {
01226     switch (dir) {
01227     case 's':
01228         return MSLink::LINKDIR_STRAIGHT;
01229     case 'l':
01230         return MSLink::LINKDIR_LEFT;
01231     case 'r':
01232         return MSLink::LINKDIR_RIGHT;
01233     case 't':
01234         return MSLink::LINKDIR_TURN;
01235     case 'L':
01236         return MSLink::LINKDIR_PARTLEFT;
01237     case 'R':
01238         return MSLink::LINKDIR_PARTRIGHT;
01239     default:
01240         throw InvalidArgument("Unrecognised link direction '" + toString(dir) + "'.");
01241     }
01242 }

MSLink::LinkState NLHandler::parseLinkState ( char  state  )  [private]

Parses the given character into an enumeration typed link state.

Definition at line 1246 of file NLHandler.cpp.

References MSLink::LINKSTATE_EQUAL, MSLink::LINKSTATE_MAJOR, MSLink::LINKSTATE_MINOR, MSLink::LINKSTATE_TL_OFF_BLINKING, MSLink::LINKSTATE_TL_OFF_NOSIGNAL, and toString().

Referenced by addSuccLane().

01246                                     {
01247     switch (state) {
01248     case 't':
01249     case 'o':
01250         return MSLink::LINKSTATE_TL_OFF_BLINKING;
01251     case 'O':
01252         return MSLink::LINKSTATE_TL_OFF_NOSIGNAL;
01253     case 'M':
01254         return MSLink::LINKSTATE_MAJOR;
01255     case 'm':
01256         return MSLink::LINKSTATE_MINOR;
01257     case '=':
01258         return MSLink::LINKSTATE_EQUAL;
01259     default:
01260         throw InvalidArgument("Unrecognised link state '" + toString(state) + "'.");
01261     }
01262 }

void GenericSAXHandler::registerParent ( const SumoXMLTag  tag,
GenericSAXHandler handler 
) [inherited]

Assigning a parent handler which is enabled when the specified tag is closed.

Definition at line 160 of file GenericSAXHandler.cpp.

References GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, and XMLSubSys::setHandler().

Referenced by NLTriggerBuilder::parseAndBuildLaneSpeedTrigger().

00160                                                                                   {
00161     myParentHandler = handler;
00162     myParentIndicator = tag;
00163     XMLSubSys::setHandler(*this);
00164 }

void MSRouteHandler::retrieveLastReadVehicle ( MSEmitControl into  )  [inherited]

void GenericSAXHandler::setFileName ( const std::string &  name  )  throw () [inherited]

Sets the current file name.

Parameters:
[in] name The name of the currently processed file
Todo:
Hmmm - this is as unsafe as having a direct access to the variable; recheck

Definition at line 72 of file GenericSAXHandler.cpp.

References GenericSAXHandler::myFileName.

Referenced by PCNetProjectionLoader::loadIfSet(), ROLoader::loadNet(), NIImporter_OpenStreetMap::loadNetwork(), NILoader::loadXMLType(), and traci::TraCIServer::TraCIServer().

00072                                                             {
00073     myFileName = name;
00074 }

void NLHandler::setKey ( const std::string &  chars  )  [private]

sets the key of the current junction logic

Definition at line 1294 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myJunctionControlBuilder, and NLJunctionControlBuilder::setKey().

Referenced by myCharacters().

01294                                         {
01295     // @deprecated: assuming a net could still use characters for the id
01296     if (chars.length()==0) {
01297         MsgHandler::getErrorInstance()->inform("No key given for the current junction logic.");
01298         return;
01299     }
01300     myJunctionControlBuilder.setKey(chars);
01301 }

void NLHandler::setLaneNumber ( const std::string &  chars  )  [private]

sets the lane number of the current junction logic

Definition at line 1281 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myJunctionControlBuilder, and NLJunctionControlBuilder::setLaneNumber().

Referenced by myCharacters().

01281                                                {
01282     // @deprecated: assuming a net could still use characters for the lane number
01283     try {
01284         myJunctionControlBuilder.setLaneNumber(TplConvert<char>::_2int(chars.c_str()));
01285     } catch (EmptyData &) {
01286         MsgHandler::getErrorInstance()->inform("Missing lane number.");
01287     } catch (NumberFormatException &) {
01288         MsgHandler::getErrorInstance()->inform("One of an edge's SUMOSAXAttributes must be numeric but is not.");
01289     }
01290 }

void NLHandler::setLocation ( const SUMOSAXAttributes attrs  )  [private]

Parses network location description.

Definition at line 1344 of file NLHandler.cpp.

References SUMOSAXAttributes::getStringReporting(), GeoConvHelper::init(), GeomConvHelper::parseBoundaryReporting(), GeomConvHelper::parseShapeReporting(), SUMO_ATTR_CONV_BOUNDARY, SUMO_ATTR_NET_OFFSET, SUMO_ATTR_ORIG_BOUNDARY, and SUMO_ATTR_ORIG_PROJ.

Referenced by myStartElement().

01344                                                      {
01345     bool ok = true;
01346     Position2DVector s = GeomConvHelper::parseShapeReporting(attrs.getStringReporting(SUMO_ATTR_NET_OFFSET, "net", 0, ok), "net", 0, ok, false);
01347     Boundary convBoundary = GeomConvHelper::parseBoundaryReporting(attrs.getStringReporting(SUMO_ATTR_CONV_BOUNDARY, "net", 0, ok), "net", 0, ok);
01348     Boundary origBoundary = GeomConvHelper::parseBoundaryReporting(attrs.getStringReporting(SUMO_ATTR_ORIG_BOUNDARY, "net", 0, ok), "net", 0, ok);
01349     std::string proj = attrs.getStringReporting(SUMO_ATTR_ORIG_PROJ, "net", 0, ok);
01350     if (ok) {
01351         Position2D networkOffset = s[0];
01352         GeoConvHelper::init(proj, networkOffset, origBoundary, convBoundary);
01353     }
01354 }

void NLHandler::setOffset ( const std::string &  chars  )  [private]

Sets the offset a tl-logic shall be fired the first time after.

Definition at line 1316 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myJunctionControlBuilder, NLJunctionControlBuilder::setOffset(), and string2time().

Referenced by myCharacters().

01316                                            {
01317     // @deprecated: assuming a net could still use characters for the offset
01318     try {
01319         myJunctionControlBuilder.setOffset(string2time(chars));
01320     } catch (NumberFormatException &) {
01321         MsgHandler::getErrorInstance()->inform("The offset for a junction is not numeric.");
01322     } catch (EmptyData &) {
01323         MsgHandler::getErrorInstance()->inform("The offset for a junction is not empty.");
01324     } // !!! can chars have length 0?
01325 }

void NLHandler::setRequestSize ( const std::string &  chars  )  [private]

sets the request size of the current junction logic

Definition at line 1268 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myJunctionControlBuilder, and NLJunctionControlBuilder::setRequestSize().

Referenced by myCharacters().

01268                                                 {
01269     // @deprecated: assuming a net could still use characters for the request size
01270     try {
01271         myJunctionControlBuilder.setRequestSize(TplConvert<char>::_2int(chars.c_str()));
01272     } catch (EmptyData &) {
01273         MsgHandler::getErrorInstance()->inform("Missing request size.");
01274     } catch (NumberFormatException &) {
01275         MsgHandler::getErrorInstance()->inform("One of an edge's SUMOSAXAttributes must be numeric but is not.");
01276     }
01277 }

void NLHandler::setSubKey ( const std::string &  chars  )  [private]

sets the subkey of the current junction logic

Definition at line 1305 of file NLHandler.cpp.

References MsgHandler::getErrorInstance(), MsgHandler::inform(), myJunctionControlBuilder, and NLJunctionControlBuilder::setSubKey().

Referenced by myCharacters().

01305                                            {
01306     // @deprecated: assuming a net could still use characters for the sub id
01307     if (chars.length()==0) {
01308         MsgHandler::getErrorInstance()->inform("No subkey given for the current junction logic.");
01309         return;
01310     }
01311     myJunctionControlBuilder.setSubKey(chars);
01312 }

void GenericSAXHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const   qname,
const Attributes &  attrs 
) [inherited]

The inherited method called when a new tag opens.

The method parses the supplied XMLCh*-qname using the internal name/enum-map to obtain the enum representation of the attribute name.

Then, "myStartElement" is called supplying the enumeration value, the string-representation of the name and the attributes.

Todo:
recheck/describe encoding of the string-representation
Todo:
do not generate and report the string-representation

Definition at line 97 of file GenericSAXHandler.cpp.

References TplConvert< E >::_2str(), GenericSAXHandler::convertTag(), FileHelpers::getConfigurationRelative(), GenericSAXHandler::getFileName(), SUMOSAXAttributesImpl_Xerces::getString(), FileHelpers::isAbsolute(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myPredefinedTags, GenericSAXHandler::myPredefinedTagsMML, GenericSAXHandler::myStartElement(), XMLSubSys::runParser(), SUMO_ATTR_HREF, and SUMO_TAG_INCLUDE.

00100                                                          {
00101     std::string name = TplConvert<XMLCh>::_2str(qname);
00102     SumoXMLTag element = convertTag(name);
00103     myCharactersVector.clear();
00104     SUMOSAXAttributesImpl_Xerces na(attrs, myPredefinedTags, myPredefinedTagsMML);
00105     if (element == SUMO_TAG_INCLUDE) {
00106         std::string file = na.getString(SUMO_ATTR_HREF);
00107         if (!FileHelpers::isAbsolute(file)) {
00108             file = FileHelpers::getConfigurationRelative(getFileName(), file);
00109         }
00110         XMLSubSys::runParser(*this, file);
00111     } else {
00112         myStartElement(element, na);
00113     }
00114 }

void SUMOSAXHandler::warning ( const SAXParseException &  exception  )  throw () [inherited]

Handler for XML-warnings.

The message is built using buildErrorMessage and reported to the warning-instance of the MsgHandler.

Parameters:
[in] exception The occured exception to process

Definition at line 68 of file SUMOSAXHandler.cpp.

References SUMOSAXHandler::buildErrorMessage(), MsgHandler::getWarningInstance(), and MsgHandler::inform().


Field Documentation

A builder for object actions.

Definition at line 341 of file NLHandler.h.

Referenced by myStartElement().

the plan of the current person

Definition at line 166 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closePerson(), and MSRouteHandler::myStartElement().

The currently parsed route's color.

Definition at line 160 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeRoute(), and MSRouteHandler::openRoute().

std::string MSRouteHandler::myActiveRouteID [protected, inherited]

SUMOReal MSRouteHandler::myActiveRouteProbability [protected, inherited]

the id of the current route

Definition at line 157 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeRoute(), and MSRouteHandler::openRoute().

List of the stops on the parsed route.

Definition at line 163 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeRoute(), and MSRouteHandler::myStartElement().

information whether vehicles shall be directly added to the network or kept within the buffer

Definition at line 170 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeFlow(), and MSRouteHandler::closeVehicle().

Vehicle classes allowed on the current lane.

Definition at line 386 of file NLHandler.h.

Referenced by addLane(), and closeLane().

internal information whether a tls-logic is currently read

Definition at line 396 of file NLHandler.h.

Referenced by addParam(), initTrafficLightLogic(), and myEndElement().

Information whether not all vehicle shall be emitted due to inc-dua.

Definition at line 185 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle(), and MSRouteHandler::MSRouteHandler().

Definition at line 405 of file NLHandler.h.

Referenced by myCharacters().

std::string NLHandler::myCurrentDetectorType [protected]

The type of the last detector.

Definition at line 350 of file NLHandler.h.

Referenced by addDetector(), and endDetector().

std::string NLHandler::myCurrentDistrictID [protected]

The id of the current district.

Definition at line 374 of file NLHandler.h.

Referenced by addDistrict(), and addDistrictEdge().

Information whether the currently parsed edge is internal and not wished, here.

Definition at line 344 of file NLHandler.h.

Referenced by addLane(), addLaneShape(), addSuccLane(), beginEdgeParsing(), closeEdge(), closeLane(), closeSuccLane(), and openSucc().

std::string NLHandler::myCurrentLaneID [protected]

The id of the current lane.

Definition at line 371 of file NLHandler.h.

Referenced by addLane(), addLaneShape(), and closeLane().

SUMOReal NLHandler::myCurrentLength [protected]

The length of the current lane.

Definition at line 383 of file NLHandler.h.

Referenced by addLane(), and closeLane().

SUMOReal NLHandler::myCurrentMaxSpeed [protected]

The maximum speed allowed on the current lane.

Definition at line 380 of file NLHandler.h.

Referenced by addLane(), and closeLane().

The currently parsed distribution of routes (probability->route).

Definition at line 179 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeRoute(), MSRouteHandler::closeRouteDistribution(), and MSRouteHandler::openRouteDistribution().

std::string MSRouteHandler::myCurrentRouteDistributionID [protected, inherited]

The id of the currently parsed route distribution.

Definition at line 182 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeRouteDistribution(), and MSRouteHandler::openRouteDistribution().

The currently parsed vehicle type.

Definition at line 200 of file MSRouteHandler.h.

Referenced by MSRouteHandler::myEndElement(), and MSRouteHandler::myStartElement().

The currently parsed distribution of vehicle types (probability->vehicle type).

Definition at line 173 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicleTypeDistribution(), MSRouteHandler::myEndElement(), and MSRouteHandler::openVehicleTypeDistribution().

std::string MSRouteHandler::myCurrentVTypeDistributionID [protected, inherited]

The id of the currently parsed vehicle type distribution.

Definition at line 176 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicleTypeDistribution(), and MSRouteHandler::openVehicleTypeDistribution().

std::string NLHandler::myCurrentWAUTID [protected]

The id of the currently processed WAUT.

Definition at line 399 of file NLHandler.h.

Referenced by addWAUTSwitch(), closeWAUT(), and openWAUT().

Vehicle classes disallowed on the current lane.

Definition at line 389 of file NLHandler.h.

Referenced by addLane(), and closeLane().

storage for edges during building

Definition at line 356 of file NLHandler.h.

Referenced by addDistrict(), beginEdgeParsing(), closeEdge(), and closeLane().

bool MSRouteHandler::myHaveWarned [protected, inherited]

whether we have warned about routes defined as character strings

Definition at line 197 of file MSRouteHandler.h.

Referenced by MSRouteHandler::myCharacters().

Whether deprecated definition of a junction shape in characters was already reported.

Definition at line 413 of file NLHandler.h.

Referenced by addJunctionShape().

Whether deprecated definition of a lane shape in characters was already reported.

Definition at line 416 of file NLHandler.h.

Referenced by addLane().

Whether deprecated definition of network boundaries/projection was already reported.

Definition at line 422 of file NLHandler.h.

Referenced by myCharacters().

Whether deprecated definition of phases was already reported.

Definition at line 425 of file NLHandler.h.

Referenced by addPhase().

Whether deprecated definition of a polygon shape in characters was already reported.

Definition at line 419 of file NLHandler.h.

Referenced by addPoly().

Whether deprecated usage of the "vclass" attribute was already reported.

Definition at line 410 of file NLHandler.h.

Referenced by addLane().

int MSRouteHandler::myIncrementalBase [protected, inherited]

The base for inc-dua.

Definition at line 191 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle(), and MSRouteHandler::MSRouteHandler().

int MSRouteHandler::myIncrementalStage [protected, inherited]

The current stage of inc-dua.

Definition at line 194 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle(), and MSRouteHandler::MSRouteHandler().

The information whether the current lane is a depart lane.

Definition at line 377 of file NLHandler.h.

Referenced by addLane(), and closeLane().

SUMOTime MSRouteHandler::myLastDepart [protected, inherited]

the emission time of the vehicle read last

Definition at line 144 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle(), and MSRouteHandler::getLastDepart().

the last vehicle read

Definition at line 147 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle(), and MSRouteHandler::retrieveLastReadVehicle().

MSNet& NLHandler::myNet [protected]

The net to fill (preinitialised).

Definition at line 206 of file NLHandler.h.

Referenced by addSource(), addTrigger(), and myStartElement().

The network offset.

Definition at line 402 of file NLHandler.h.

Referenced by myCharacters().

The network's boundaries.

Definition at line 405 of file NLHandler.h.

Referenced by myCharacters().

unsigned int MSRouteHandler::myRunningVehicleNumber [protected, inherited]

The current vehicle number (for inc-dua).

Definition at line 188 of file MSRouteHandler.h.

Referenced by MSRouteHandler::closeVehicle().

The shape of the current lane.

Definition at line 392 of file NLHandler.h.

Referenced by addLane(), addLaneShape(), and closeLane().

Definition at line 361 of file NLHandler.h.

Referenced by addPOI(), addPoly(), and myCharacters().

storage for building succeeding lanes

Definition at line 364 of file NLHandler.h.

Referenced by addSuccLane(), closeSuccLane(), and openSucc().

The trigger builder to use.

Definition at line 353 of file NLHandler.h.

Referenced by addSource(), addTrigger(), and myStartElement().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:57 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6