SUMO - Simulation of Urban MObility
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 
328  Boundary myOrigBoundary, myConvBoundary;
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 
Builds detectors for microsim.
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
ShapeHandler & operator=(const ShapeHandler &s)
bool myCurrentIsBroken
Definition: NLHandler.h:330
Position myNetworkOffset
The network offset.
Definition: NLHandler.h:325
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
Definition: NLHandler.h:301
SUMOReal myNetworkVersion
the loaded network version
Definition: NLHandler.h:346
Storage for geometrical objects.
std::string myCurrentDistrictID
The id of the current district.
Definition: NLHandler.h:313
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)...
Boundary myOrigBoundary
The network&#39;s boundaries.
Definition: NLHandler.h:328
bool haveSeenNeighs() const
Definition: NLHandler.h:112
NLEdgeControlBuilder & myEdgeControlBuilder
The edge builder to use.
Definition: NLHandler.h:307
std::vector< MSLane * > LaneVector
Definition of a lane vector.
Definition: NLHandler.h:87
Encapsulated SAX-Attributes.
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:1260
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
JunctionGraph myJunctionGraph
Definition: NLHandler.h:353
void addPOI(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a POI
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.
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
Definition: NLHandler.h:337
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
void addPoly(const SUMOSAXAttributes &attrs, const bool ignorePruning, const bool useProcessing)
adds a polygon
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
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:64
bool myHaveSeenNeighs
whether the loaded network contains explicit neighbor lanes
Definition: NLHandler.h:340
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
MSNet & myNet
The net to fill (preinitialised)
Definition: NLHandler.h:209
The parent class for traffic light logics.
#define SUMOReal
Definition: config.h:213
NLDiscreteEventBuilder myActionBuilder
A builder for object actions.
Definition: NLHandler.h:294
Builds trigger objects for microsim.
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.
Interface for building edges.
virtual void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.