SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NLHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The XML-Handler for network loading
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef NLHandler_h
24 #define NLHandler_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <xercesc/sax/HandlerBase.hpp>
37 #include <xercesc/sax/SAXException.hpp>
38 #include <xercesc/sax/AttributeList.hpp>
39 #include <utils/common/SUMOTime.h>
42 #include <microsim/MSLink.h>
46 #include <microsim/MSBitSetLogic.h>
47 #include "NLBuilder.h"
48 #include "NLDiscreteEventBuilder.h"
49 
50 
51 
52 // ===========================================================================
53 // class declarations
54 // ===========================================================================
55 class NLContainer;
56 class NLDetectorBuilder;
57 class NLTriggerBuilder;
59 
60 
61 // ===========================================================================
62 // class definitions
63 // ===========================================================================
72 class NLHandler : public MSRouteHandler {
73 public:
75  typedef std::vector<MSLane*> LaneVector;
76 
77 public:
87  NLHandler(const std::string& file, MSNet& net,
88  NLDetectorBuilder& detBuilder, NLTriggerBuilder& triggerBuilder,
89  NLEdgeControlBuilder& edgeBuilder,
90  NLJunctionControlBuilder& junctionBuilder);
91 
92 
94  virtual ~NLHandler();
95 
96  bool haveSeenInternalEdge() const {
98  }
99 
100 protected:
102 
103 
112  virtual void myStartElement(int element,
113  const SUMOSAXAttributes& attrs);
114 
115 
123  virtual void myEndElement(int element);
125 
126 
127 protected:
128  void addParam(const SUMOSAXAttributes& attrs);
129 
133  virtual void addE1Detector(const SUMOSAXAttributes& attrs);
134 
138  virtual void addInstantE1Detector(const SUMOSAXAttributes& attrs);
139 
143  virtual void addE2Detector(const SUMOSAXAttributes& attrs);
144 
148  void beginE3Detector(const SUMOSAXAttributes& attrs);
149 
153  void addE3Entry(const SUMOSAXAttributes& attrs);
154 
158  void addE3Exit(const SUMOSAXAttributes& attrs);
159 
161  virtual void endE3Detector();
162 
166  virtual void addVTypeProbeDetector(const SUMOSAXAttributes& attrs);
167 
171  virtual void addRouteProbeDetector(const SUMOSAXAttributes& attrs);
172 
177  virtual void addEdgeLaneMeanData(const SUMOSAXAttributes& attrs, int objecttype);
178 
180  virtual void closeEdge();
181 
182 
183 protected:
186 
187 
188 private:
190  void beginEdgeParsing(const SUMOSAXAttributes& attrs);
191 
193  void addLane(const SUMOSAXAttributes& attrs);
194 
196  void addPOI(const SUMOSAXAttributes& attrs);
197 
199  void addPoly(const SUMOSAXAttributes& attrs);
200 
202  void addRequest(const SUMOSAXAttributes& attrs);
203 
205  void initJunctionLogic(const SUMOSAXAttributes& attrs);
206 
208  void initTrafficLightLogic(const SUMOSAXAttributes& attrs);
209 
211  void addPhase(const SUMOSAXAttributes& attrs);
212 
213 
215  virtual void openJunction(const SUMOSAXAttributes& attrs);
216 
217  void parseLanes(const std::string& junctionID, const std::string& def, std::vector<MSLane*>& into, bool& ok);
218 
220  void addConnection(const SUMOSAXAttributes& attrs);
221 
222  virtual void openWAUT(const SUMOSAXAttributes& attrs);
223  void addWAUTSwitch(const SUMOSAXAttributes& attrs);
224  void addWAUTJunction(const SUMOSAXAttributes& attrs);
225 
227  void setLocation(const SUMOSAXAttributes& attrs);
228 
238  void addDistrict(const SUMOSAXAttributes& attrs);
239 
240 
251  void addDistrictEdge(const SUMOSAXAttributes& attrs, bool isSource);
252 
256  void addRoundabout(const SUMOSAXAttributes& attrs);
257 
258 
259  void closeWAUT();
260 
262  LinkDirection parseLinkDir(const std::string& dir);
263 
265  LinkState parseLinkState(const std::string& state);
266 
267 
268 protected:
271 
274 
275 
278 
281 
284 
287 
289  std::string myCurrentDistrictID;
290 
293 
295  std::string myCurrentWAUTID;
296 
299 
302 
304 
306 
308 
311 
312 
313 private:
315  NLHandler(const NLHandler& s);
316 
318  NLHandler& operator=(const NLHandler& s);
319 
320 };
321 
322 
323 #endif
324 
325 /****************************************************************************/
326 
void beginE3Detector(const SUMOSAXAttributes &attrs)
Starts building of an e3 detector using the given specification.
Definition: NLHandler.cpp:857
void addPoly(const SUMOSAXAttributes &attrs)
adds a polygon
Definition: NLHandler.cpp:592
void addWAUTJunction(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:510
Builds detectors for microsim.
virtual void addE2Detector(const SUMOSAXAttributes &attrs)
Builds an e2 detector using the given specification.
Definition: NLHandler.cpp:804
bool myCurrentIsInternalToSkip
Information whether the currently parsed edge is internal and not wished, here.
Definition: NLHandler.h:273
bool myHaveWarnedAboutDeprecatedLanes
Definition: NLHandler.h:305
virtual void openWAUT(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:464
bool myCurrentIsBroken
Definition: NLHandler.h:303
Position myNetworkOffset
The network offset.
Definition: NLHandler.h:298
void parseLanes(const std::string &junctionID, const std::string &def, std::vector< MSLane * > &into, bool &ok)
Definition: NLHandler.cpp:427
virtual void addVTypeProbeDetector(const SUMOSAXAttributes &attrs)
Builds a vtype-detector using the given specification.
Definition: NLHandler.cpp:761
void addRoundabout(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1151
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
Definition: NLHandler.h:277
virtual void addE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:707
NLHandler(const std::string &file, MSNet &net, NLDetectorBuilder &detBuilder, NLTriggerBuilder &triggerBuilder, NLEdgeControlBuilder &edgeBuilder, NLJunctionControlBuilder &junctionBuilder)
Constructor.
Definition: NLHandler.cpp:69
void beginEdgeParsing(const SUMOSAXAttributes &attrs)
begins the processing of an edge
Definition: NLHandler.cpp:256
std::string myCurrentDistrictID
The id of the current district.
Definition: NLHandler.h:289
virtual void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLHandler.cpp:1170
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The simulated network and simulation perfomer.
Definition: MSNet.h:89
bool myAmInTLLogicMode
internal information whether a tls-logic is currently read
Definition: NLHandler.h:292
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
void closeWAUT()
Definition: NLHandler.cpp:1180
void addParam(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:447
void addDistrict(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1079
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
Definition: NLHandler.cpp:1062
Boundary myOrigBoundary
The network's boundaries.
Definition: NLHandler.h:301
virtual void openJunction(const SUMOSAXAttributes &attrs)
opens a junction for processing
Definition: NLHandler.cpp:377
NLEdgeControlBuilder & myEdgeControlBuilder
The edge builder to use.
Definition: NLHandler.h:283
void addE3Entry(const SUMOSAXAttributes &attrs)
Adds an entry to the currently processed e3 detector.
Definition: NLHandler.cpp:880
std::vector< MSLane * > LaneVector
Definition of a lane vector.
Definition: NLHandler.h:75
Encapsulated SAX-Attributes.
void addE3Exit(const SUMOSAXAttributes &attrs)
Adds an exit to the currently processed e3 detector.
Definition: NLHandler.cpp:893
Builder of microsim-junctions and tls.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void addWAUTSwitch(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:491
void addRequest(const SUMOSAXAttributes &attrs)
adds a request item to the current junction logic
Definition: NLHandler.cpp:619
void addConnection(const SUMOSAXAttributes &attrs)
adds a connection
Definition: NLHandler.cpp:941
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NLHandler.cpp:89
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
Definition: NLHandler.h:310
LinkDirection parseLinkDir(const std::string &dir)
Parses the given character into an enumeration typed link direction.
Definition: NLHandler.cpp:1036
An upper class for objects with additional parameters.
Definition: Parameterised.h:46
The XML-Handler for network loading.
Definition: NLHandler.h:72
std::string myCurrentWAUTID
The id of the currently processed WAUT.
Definition: NLHandler.h:295
virtual void addInstantE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:736
virtual void closeEdge()
Closes the process of building an edge.
Definition: NLHandler.cpp:311
virtual void addRouteProbeDetector(const SUMOSAXAttributes &attrs)
Builds a routeProbe-detector using the given specification.
Definition: NLHandler.cpp:781
void addLane(const SUMOSAXAttributes &attrs)
adds a lane to the previously opened edge
Definition: NLHandler.cpp:327
virtual ~NLHandler()
Destructor.
Definition: NLHandler.cpp:85
NLTriggerBuilder & myTriggerBuilder
The trigger builder to use.
Definition: NLHandler.h:280
bool haveSeenInternalEdge() const
Definition: NLHandler.h:96
NLHandler & operator=(const NLHandler &s)
Boundary myConvBoundary
Definition: NLHandler.h:301
void addPhase(const SUMOSAXAttributes &attrs)
adds a phase to the traffic lights logic currently build
Definition: NLHandler.cpp:683
void addDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
Definition: NLHandler.cpp:1129
MSNet & myNet
The net to fill (preinitialised)
Definition: NLHandler.h:185
LinkState parseLinkState(const std::string &state)
Parses the given character into an enumeration typed link state.
Definition: NLHandler.cpp:1046
The parent class for traffic light logics.
NLDiscreteEventBuilder myActionBuilder
A builder for object actions.
Definition: NLHandler.h:270
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: NLHandler.cpp:210
virtual void addEdgeLaneMeanData(const SUMOSAXAttributes &attrs, int objecttype)
Builds edge or lane base mean data collector using the given specification.
Definition: NLHandler.cpp:906
Builds trigger objects for microsim.
void initJunctionLogic(const SUMOSAXAttributes &attrs)
begins the reading of a junction row logic
Definition: NLHandler.cpp:646
Parameterised * myLastParameterised
Definition: NLHandler.h:307
NLJunctionControlBuilder & myJunctionControlBuilder
The junction builder to use.
Definition: NLHandler.h:286
Parser and container for routes during their loading.
void initTrafficLightLogic(const SUMOSAXAttributes &attrs)
begins the reading of a traffic lights logic
Definition: NLHandler.cpp:660
Interface for building edges.
void addPOI(const SUMOSAXAttributes &attrs)
adds a polygon
Definition: NLHandler.cpp:536