SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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.dlr.de/
13 // Copyright (C) 2001-2016 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 <utils/geom/Boundary.h>
39 #include "NLDiscreteEventBuilder.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class NLContainer;
46 class NLDetectorBuilder;
49 class NLTriggerBuilder;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
56 
57 
64 class NLShapeHandler : public ShapeHandler {
65 public:
66  NLShapeHandler(const std::string& file, ShapeContainer& sc) :
67  ShapeHandler(file, sc) {}
68 
70  virtual ~NLShapeHandler() {}
71 
72  Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos);
73 };
74 
75 
84 class NLHandler : public MSRouteHandler {
85 public:
87  typedef std::vector<MSLane*> LaneVector;
88 
89 public:
99  NLHandler(const std::string& file, MSNet& net,
100  NLDetectorBuilder& detBuilder, NLTriggerBuilder& triggerBuilder,
101  NLEdgeControlBuilder& edgeBuilder,
102  NLJunctionControlBuilder& junctionBuilder);
103 
104 
106  virtual ~NLHandler();
107 
108  bool haveSeenInternalEdge() const {
109  return myHaveSeenInternalEdge;
110  }
111 
112  bool haveSeenNeighs() const {
113  return myHaveSeenNeighs;
114  }
115 
116  bool lefthand() const {
117  return myLefthand;
118  }
119 
121  return myNetworkVersion;
122  }
123 
124 protected:
126 
127 
136  virtual void myStartElement(int element,
137  const SUMOSAXAttributes& attrs);
138 
139 
147  virtual void myEndElement(int element);
149 
150 
151 protected:
152  void addParam(const SUMOSAXAttributes& attrs);
153 
157  virtual void addE1Detector(const SUMOSAXAttributes& attrs);
158 
162  virtual void addInstantE1Detector(const SUMOSAXAttributes& attrs);
163 
167  virtual void addE2Detector(const SUMOSAXAttributes& attrs);
168 
172  void beginE3Detector(const SUMOSAXAttributes& attrs);
173 
177  void addE3Entry(const SUMOSAXAttributes& attrs);
178 
182  void addE3Exit(const SUMOSAXAttributes& attrs);
183 
185  virtual void endE3Detector();
186 
190  virtual void addVTypeProbeDetector(const SUMOSAXAttributes& attrs);
191 
195  virtual void addRouteProbeDetector(const SUMOSAXAttributes& attrs);
196 
201  virtual void addEdgeLaneMeanData(const SUMOSAXAttributes& attrs, int objecttype);
202 
204  virtual void closeEdge();
205 
206 
207 protected:
210 
211 
212 private:
214  void beginEdgeParsing(const SUMOSAXAttributes& attrs);
215 
217  void addLane(const SUMOSAXAttributes& attrs);
218 
220  void addPOI(const SUMOSAXAttributes& attrs);
221 
223  void addPoly(const SUMOSAXAttributes& attrs);
224 
226  void addRequest(const SUMOSAXAttributes& attrs);
227 
229  void initJunctionLogic(const SUMOSAXAttributes& attrs);
230 
232  void initTrafficLightLogic(const SUMOSAXAttributes& attrs);
233 
235  void addPhase(const SUMOSAXAttributes& attrs);
236 
237 
239  virtual void openJunction(const SUMOSAXAttributes& attrs);
240 
241  void parseLanes(const std::string& junctionID, const std::string& def, std::vector<MSLane*>& into, bool& ok);
242 
244  void addConnection(const SUMOSAXAttributes& attrs);
245 
246  virtual void openWAUT(const SUMOSAXAttributes& attrs);
247  void addWAUTSwitch(const SUMOSAXAttributes& attrs);
248  void addWAUTJunction(const SUMOSAXAttributes& attrs);
249 
251  void setLocation(const SUMOSAXAttributes& attrs);
252 
262  void addDistrict(const SUMOSAXAttributes& attrs);
263 
264 
275  void addDistrictEdge(const SUMOSAXAttributes& attrs, bool isSource);
276 
280  void addRoundabout(const SUMOSAXAttributes& attrs);
281 
282 
283  void closeWAUT();
284 
286  LinkDirection parseLinkDir(const std::string& dir);
287 
289  LinkState parseLinkState(const std::string& state);
290 
291 
292 protected:
295 
298 
299 
302 
305 
308 
311 
313  std::string myCurrentDistrictID;
314 
317 
319  std::string myCurrentWAUTID;
320 
322  std::string myCurrentTypeID;
323 
326 
329 
331 
333 
335 
338 
341 
344 
347 
350 
352  typedef std::map<std::string, std::pair<std::string, std::string> > JunctionGraph;
353  JunctionGraph myJunctionGraph;
354 
355 private:
357  NLHandler(const NLHandler& s);
358 
360  NLHandler& operator=(const NLHandler& s);
361 
362 };
363 
364 
365 
366 
367 #endif
368 
369 /****************************************************************************/
370 
void beginE3Detector(const SUMOSAXAttributes &attrs)
Starts building of an e3 detector using the given specification.
Definition: NLHandler.cpp:917
void addPoly(const SUMOSAXAttributes &attrs)
adds a polygon
void addWAUTJunction(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:584
Builds detectors for microsim.
virtual void addE2Detector(const SUMOSAXAttributes &attrs)
Builds an e2 detector using the given specification.
Definition: NLHandler.cpp:863
NLShapeHandler(const std::string &file, ShapeContainer &sc)
Definition: NLHandler.h:66
bool myCurrentIsInternalToSkip
Information whether the currently parsed edge is internal and not wished, here.
Definition: NLHandler.h:297
SUMOReal networkVersion() const
Definition: NLHandler.h:120
virtual ~NLShapeHandler()
Destructor.
Definition: NLHandler.h:70
bool myHaveWarnedAboutDeprecatedLanes
Definition: NLHandler.h:332
virtual void openWAUT(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:538
bool myCurrentIsBroken
Definition: NLHandler.h:330
Position myNetworkOffset
The network offset.
Definition: NLHandler.h:325
void parseLanes(const std::string &junctionID, const std::string &def, std::vector< MSLane * > &into, bool &ok)
Definition: NLHandler.cpp:500
virtual void addVTypeProbeDetector(const SUMOSAXAttributes &attrs)
Builds a vtype-detector using the given specification.
Definition: NLHandler.cpp:819
void addRoundabout(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1222
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
Definition: NLHandler.h:301
SUMOReal myNetworkVersion
the loaded network version
Definition: NLHandler.h:346
virtual void addE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:764
Storage for geometrical objects.
NLHandler(const std::string &file, MSNet &net, NLDetectorBuilder &detBuilder, NLTriggerBuilder &triggerBuilder, NLEdgeControlBuilder &edgeBuilder, NLJunctionControlBuilder &junctionBuilder)
Constructor.
Definition: NLHandler.cpp:68
void beginEdgeParsing(const SUMOSAXAttributes &attrs)
begins the processing of an edge
Definition: NLHandler.cpp:297
std::string myCurrentDistrictID
The id of the current district.
Definition: NLHandler.h:313
virtual void endE3Detector()
Builds of an e3 detector using collected values.
Definition: NLHandler.cpp:1241
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The simulated network and simulation perfomer.
Definition: MSNet.h:93
bool myAmInTLLogicMode
internal information whether a tls-logic is currently read
Definition: NLHandler.h:316
The XML-Handler for network loading.
Definition: ShapeHandler.h:56
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
void closeWAUT()
Definition: NLHandler.cpp:1251
void addParam(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:520
void addDistrict(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:1150
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
Definition: NLHandler.cpp:1129
Boundary myOrigBoundary
The network's boundaries.
Definition: NLHandler.h:328
bool haveSeenNeighs() const
Definition: NLHandler.h:112
virtual void openJunction(const SUMOSAXAttributes &attrs)
opens a junction for processing
Definition: NLHandler.cpp:450
NLEdgeControlBuilder & myEdgeControlBuilder
The edge builder to use.
Definition: NLHandler.h:307
void addE3Entry(const SUMOSAXAttributes &attrs)
Adds an entry to the currently processed e3 detector.
Definition: NLHandler.cpp:941
std::vector< MSLane * > LaneVector
Definition of a lane vector.
Definition: NLHandler.h:87
Encapsulated SAX-Attributes.
void addE3Exit(const SUMOSAXAttributes &attrs)
Adds an exit to the currently processed e3 detector.
Definition: NLHandler.cpp:954
Builder of microsim-junctions and tls.
Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)
get position for a given laneID
Definition: NLHandler.cpp:1265
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void addWAUTSwitch(const SUMOSAXAttributes &attrs)
Definition: NLHandler.cpp:565
JunctionGraph myJunctionGraph
Definition: NLHandler.h:353
void addRequest(const SUMOSAXAttributes &attrs)
adds a request item to the current junction logic
Definition: NLHandler.cpp:605
void addConnection(const SUMOSAXAttributes &attrs)
adds a connection
Definition: NLHandler.cpp:1002
std::string myCurrentTypeID
The id of the currently processed edge type.
Definition: NLHandler.h:322
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:93
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
Definition: NLHandler.h:337
LinkDirection parseLinkDir(const std::string &dir)
Parses the given character into an enumeration typed link direction.
Definition: NLHandler.cpp:1103
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
bool lefthand() const
Definition: NLHandler.h:116
The XML-Handler for network loading.
Definition: NLHandler.h:84
std::map< std::string, std::pair< std::string, std::string > > JunctionGraph
temporary data for building the junction graph after network parsing is finished
Definition: NLHandler.h:352
std::string myCurrentWAUTID
The id of the currently processed WAUT.
Definition: NLHandler.h:319
virtual void addInstantE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
Definition: NLHandler.cpp:793
virtual void closeEdge()
Closes the process of building an edge.
Definition: NLHandler.cpp:386
virtual void addRouteProbeDetector(const SUMOSAXAttributes &attrs)
Builds a routeProbe-detector using the given specification.
Definition: NLHandler.cpp:839
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:64
void addLane(const SUMOSAXAttributes &attrs)
adds a lane to the previously opened edge
Definition: NLHandler.cpp:402
bool myHaveSeenNeighs
whether the loaded network contains explicit neighbor lanes
Definition: NLHandler.h:340
virtual ~NLHandler()
Destructor.
Definition: NLHandler.cpp:89
NLTriggerBuilder & myTriggerBuilder
The trigger builder to use.
Definition: NLHandler.h:304
bool myNetIsLoaded
whether the location element was already loadee
Definition: NLHandler.h:349
bool haveSeenInternalEdge() const
Definition: NLHandler.h:108
NLHandler & operator=(const NLHandler &s)
Boundary myConvBoundary
Definition: NLHandler.h:328
void addPhase(const SUMOSAXAttributes &attrs)
adds a phase to the traffic lights logic currently build
Definition: NLHandler.cpp:673
void addDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
Definition: NLHandler.cpp:1200
MSNet & myNet
The net to fill (preinitialised)
Definition: NLHandler.h:209
LinkState parseLinkState(const std::string &state)
Parses the given character into an enumeration typed link state.
Definition: NLHandler.cpp:1113
The parent class for traffic light logics.
#define SUMOReal
Definition: config.h:214
NLDiscreteEventBuilder myActionBuilder
A builder for object actions.
Definition: NLHandler.h:294
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: NLHandler.cpp:240
virtual void addEdgeLaneMeanData(const SUMOSAXAttributes &attrs, int objecttype)
Builds edge or lane base mean data collector using the given specification.
Definition: NLHandler.cpp:967
Builds trigger objects for microsim.
void initJunctionLogic(const SUMOSAXAttributes &attrs)
begins the reading of a junction row logic
Definition: NLHandler.cpp:632
bool myLefthand
whether the loaded network was built for left hand traffic
Definition: NLHandler.h:343
Parameterised * myLastParameterised
Definition: NLHandler.h:334
NLJunctionControlBuilder & myJunctionControlBuilder
The junction builder to use.
Definition: NLHandler.h:310
Parser and container for routes during their loading.
void initTrafficLightLogic(const SUMOSAXAttributes &attrs)
begins the reading of a traffic lights logic
Definition: NLHandler.cpp:646
Interface for building edges.
void addPOI(const SUMOSAXAttributes &attrs)
adds a polygon