Eclipse SUMO - Simulation of Urban MObility
NIImporter_Vissim.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Importer for networks stored in Vissim format
19 /****************************************************************************/
20 #ifndef NIImporter_Vissim_h
21 #define NIImporter_Vissim_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <map>
31 #include <vector>
32 #include <utils/common/RGBColor.h>
33 #include <utils/geom/Position.h>
35 #include "NIVissimElements.h"
40 
43 #include <list>
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class OptionsCont;
49 class NBNetBuilder;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
60 public:
72  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
73 
74 
75 
76 private:
77 
78  typedef std::map<std::string, std::list<std::string> > nodeMap;
79  nodeMap elementData;
80 
86  public:
90  //NIVissimXMLHandler_Streckendefinition(std::map<int, VissimXMLEdge>& toFill);
91  NIVissimXMLHandler_Streckendefinition(nodeMap& elemData);
92 
93 
96 
97  protected:
99 
100 
108  void myStartElement(int element, const SUMOSAXAttributes& attrs);
110 
111  void myEndElement(int element);
113 
114  private:
115 
116  //std::map<int, VissimXMLEdge> myToFill;
117  nodeMap& myElemData;
118 
121 
124 
127 
130 
133  };
134 
135 
136 private:
142  public:
146 
147 
150 
151  protected:
153 
154 
162  void myStartElement(int element, const SUMOSAXAttributes& attrs);
164 
165 
166  private:
167 
168 
169 
172 
175  };
176 
177 
178 private:
184  public:
188 
189 
192 
193  protected:
195 
196 
204  void myStartElement(int element, const SUMOSAXAttributes& attrs);
206 
207 
208  private:
209 
210 
211 
214 
217  };
218 
219 
220 private:
226  public:
232 
233 
236 
237  protected:
239 
240 
248  void myStartElement(int element, const SUMOSAXAttributes& attrs);
250 
251  void myEndElement(int element);
253 
254  private:
255 
256  //std::map<int, VissimXMLEdge> myToFill;
257  nodeMap& myElemData;
258 
261 
264 
267 
270  };
271 
272 private:
278  public:
284 
285 
288 
289  protected:
291 
292 
300  void myStartElement(int element, const SUMOSAXAttributes& attrs);
302 
303  void myEndElement(int element);
305 
306  private:
307 
308  //std::map<int, VissimXMLEdge> myToFill;
309  nodeMap& myElemData;
310 
313 
316 
319 
322  };
323 
324 
325 
326 
327 private:
333  public:
339 
340 
343 
344  protected:
346 
347 
355  void myStartElement(int element, const SUMOSAXAttributes& attrs);
357 
358  void myEndElement(int element);
360 
361  private:
362 
363  //std::map<int, VissimXMLEdge> myToFill;
364  nodeMap& myElemData;
365 
368 
371 
374 
377  };
378 
379 
380 private:
386  public:
392 
393 
396 
397  protected:
399 
400 
408  void myStartElement(int element, const SUMOSAXAttributes& attrs);
410 
411  void myEndElement(int element);
413 
414  private:
415 
416  //std::map<int, VissimXMLEdge> myToFill;
417  nodeMap& myElemData;
418 
421 
424 
427 
430  };
431 
432 
433 private:
439  public:
443 
444 
447 
448 
449  protected:
451 
452 
460  void myStartElement(int element, const SUMOSAXAttributes& attrs);
462 
463 
464  private:
465 
466 
469 
472  };
473 
474 
475 protected:
478 
481 
483  void load(const OptionsCont& options);
484 
485  bool admitContinue(const std::string& tag);
486 
487 public:
489  public:
492 
494  virtual ~VissimSingleTypeParser();
495 
498  virtual bool parse(std::istream& from) = 0;
499 
500  protected:
502  std::string myRead(std::istream& from);
503 
505  std::string readEndSecure(std::istream& from,
506  const std::string& excl = "");
507 
508  std::string readEndSecure(std::istream& from,
509  const std::vector<std::string>& excl);
510 
512  std::string overrideOptionalLabel(std::istream& from,
513  const std::string& tag = "");
514 
516  Position getPosition(std::istream& from);
517 
520  std::vector<int> parseAssignedVehicleTypes(std::istream& from,
521  const std::string& next);
522 
523  NIVissimExtendedEdgePoint readExtEdgePointDef(std::istream& from);
524 
528  std::string readName(std::istream& from);
529 
532  bool skipOverreading(std::istream& from, const std::string& name = "");
533 
535  void readUntil(std::istream& from, const std::string& name);
536 
537  private:
539 
540  private:
543 
544  };
545 
546 
548  typedef std::map<std::string, RGBColor> ColorMap;
549 
550 private:
551  bool readContents(std::istream& strm);
552  void postLoadBuild(double offset);
553 
554 
556  void insertKnownElements();
557 
559  void buildParsers();
560 
561 private:
563  typedef std::map<std::string, NIVissimElement> ToElemIDMap;
564 
566  ToElemIDMap myKnownElements;
567 
569  typedef std::map<NIVissimElement, VissimSingleTypeParser*> ToParserMap;
570 
572  ToParserMap myParsers;
573 
575  ColorMap myColorMap;
576 
577  std::string myLastSecure;
578 
580 
581 private:
584 
587 
588 
589 
618  };
619 
620 
651  };
652 
655 
658 
659 
660 };
661 
662 
663 #endif
664 
665 /****************************************************************************/
666 
NIVissimXMLHandler_Streckendefinition(nodeMap &elemData)
Constructor.
~NIImporter_Vissim()
destructor
static StringBijection< int >::Entry vissimAttrs[]
The names of VISSIM-XML attributes (for passing to GenericSAXHandler)
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
Importer for networks stored in Vissim format.
std::map< std::string, NIVissimElement > ToElemIDMap
Definition of a map from element names to their numerical representation.
bool readContents(std::istream &strm)
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
ToParserMap myParsers
Parsers by element id.
void insertKnownElements()
adds name-to-id - relationships of known elements into myKnownElements
ToElemIDMap myKnownElements
Map from element names to their numerical representation.
A handler which converts occuring elements and attributes into enums.
Encapsulated SAX-Attributes.
void load(const OptionsCont &options)
loads the vissim file
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
static StringBijection< int >::Entry vissimTags[]
The names of VISSIM-XML elements (for passing to GenericSAXHandler)
ColorMap myColorMap
a map from color names to color definitions
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
VissimXMLTag
Numbers representing VISSIM-XML - element names.
NIImporter_Vissim(NBNetBuilder &nb)
constructor
void buildParsers()
adds id-to-parser - relationships of elements to parse into myParsers
std::map< std::string, RGBColor > ColorMap
definition of a map from color names to color definitions
NIVissimXMLHandler_Streckendefinition & operator=(const NIVissimXMLHandler_Streckendefinition &s)
invalidated assignment operator
std::map< std::string, std::list< std::string > > nodeMap
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
A storage for options typed value containers)
Definition: OptionsCont.h:90
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads network definition from the assigned option and stores it in the given network builder...
void postLoadBuild(double offset)
VissimXMLAttr
Numbers representing VISSIM-XML - attributes.
std::map< NIVissimElement, VissimSingleTypeParser * > ToParserMap
Definition of a map from an element&#39;s numerical id to his parser.
NBNetBuilder & myNetBuilder
std::string myLastSecure
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
bool admitContinue(const std::string &tag)
A class which extracts VISSIM-Routes from a parsed VISSIM-file.