Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIImporter_Vissim.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Importer for networks stored in Vissim format
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <map>
28#include <vector>
30#include <utils/geom/Position.h>
32#include "NIVissimElements.h"
37
40#include <list>
41
42// ===========================================================================
43// class declarations
44// ===========================================================================
45class OptionsCont;
46class NBNetBuilder;
47
48
49// ===========================================================================
50// class definitions
51// ===========================================================================
57public:
69 static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
70
71
72
73private:
74
75 typedef std::map<std::string, std::list<std::string> > nodeMap;
77
83 public:
87 //NIVissimXMLHandler_Streckendefinition(std::map<int, VissimXMLEdge>& toFill);
89
90
93
94 protected:
96
97
105 void myStartElement(int element, const SUMOSAXAttributes& attrs);
107
108 void myEndElement(int element);
110
111 private:
112
113 //std::map<int, VissimXMLEdge> myToFill;
115
118
121
124
127
130 };
131
132
133private:
173
174
175private:
215
216
217private:
268
269private:
320
321
322
323
324private:
375
376
377private:
428
429
430private:
436 public:
440
441
444
445
446 protected:
448
449
457 void myStartElement(int element, const SUMOSAXAttributes& attrs);
459
460
461 private:
462
463
466
469 };
470
471
472protected:
475
478
480 void load(const OptionsCont& options);
481
482 bool admitContinue(const std::string& tag);
483
484public:
486 public:
489
491 virtual ~VissimSingleTypeParser();
492
495 virtual bool parse(std::istream& from) = 0;
496
497 protected:
499 std::string myRead(std::istream& from);
500
502 std::string readEndSecure(std::istream& from,
503 const std::string& excl = "");
504
505 std::string readEndSecure(std::istream& from,
506 const std::vector<std::string>& excl);
507
509 std::string overrideOptionalLabel(std::istream& from,
510 const std::string& tag = "");
511
513 Position getPosition(std::istream& from);
514
517 std::vector<int> parseAssignedVehicleTypes(std::istream& from,
518 const std::string& next);
519
521
525 std::string readName(std::istream& from);
526
529 bool skipOverreading(std::istream& from, const std::string& name = "");
530
532 void readUntil(std::istream& from, const std::string& name);
533
534 private:
536
537 private:
540
541 };
542
543
545 typedef std::map<std::string, RGBColor> ColorMap;
546
547private:
548 bool readContents(std::istream& strm);
549 void postLoadBuild(double offset);
550
551
553 void insertKnownElements();
554
556 void buildParsers();
557
558private:
560 typedef std::map<std::string, NIVissimElement> ToElemIDMap;
561
564
566 typedef std::map<NIVissimElement, VissimSingleTypeParser*> ToParserMap;
567
570
573
574 std::string myLastSecure;
575
577
578private:
581
584
585
586
616
617
649
652
655
656
657};
A handler which converts occurring elements and attributes into enums.
Instance responsible for building networks.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_ConflictArea(const NIVissimXMLHandler_ConflictArea &c)
invalidated copy constructor
NIVissimXMLHandler_ConflictArea & operator=(const NIVissimXMLHandler_ConflictArea &c)
invalidated assignment operator
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
NIVissimXMLHandler_Fahrzeugklassendefinition(const NIVissimXMLHandler_Fahrzeugklassendefinition &f)
invalidated copy constructor
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Fahrzeugklassendefinition & operator=(const NIVissimXMLHandler_Fahrzeugklassendefinition &f)
invalidated assignment operator
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition & operator=(const NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition &vW)
invalidated assignment operator
NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition(const NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition &vW)
invalidated copy constructor
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Parkplatzdefinition(const NIVissimXMLHandler_Parkplatzdefinition &z)
invalidated copy constructor
NIVissimXMLHandler_Parkplatzdefinition & operator=(const NIVissimXMLHandler_Parkplatzdefinition &z)
invalidated assignment operator
A class which extracts VISSIM-Routes from a parsed VISSIM-file.
NIVissimXMLHandler_Routenentscheidungsdefinition & operator=(const NIVissimXMLHandler_Routenentscheidungsdefinition &r)
invalidated assignment operator
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
NIVissimXMLHandler_Routenentscheidungsdefinition(const NIVissimXMLHandler_Routenentscheidungsdefinition &r)
invalidated copy constructor
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
NIVissimXMLHandler_Streckendefinition & operator=(const NIVissimXMLHandler_Streckendefinition &s)
invalidated assignment operator
NIVissimXMLHandler_Streckendefinition(const NIVissimXMLHandler_Streckendefinition &s)
invalidated copy constructor
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_VWunschentscheidungsdefinition(const NIVissimXMLHandler_VWunschentscheidungsdefinition &vW)
invalidated copy constructor
NIVissimXMLHandler_VWunschentscheidungsdefinition & operator=(const NIVissimXMLHandler_VWunschentscheidungsdefinition &vW)
invalidated assignment operator
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Zuflussdefinition(const NIVissimXMLHandler_Zuflussdefinition &z)
invalidated copy constructor
NIVissimXMLHandler_Zuflussdefinition & operator=(const NIVissimXMLHandler_Zuflussdefinition &z)
invalidated assignment operator
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Position getPosition(std::istream &from)
returns the 2d-position saved as next within the stream
VissimSingleTypeParser & operator=(const VissimSingleTypeParser &)
Invalidated assignment operator.
std::string readEndSecure(std::istream &from, const std::string &excl="")
as myRead, but returns "DATAEND" when the current field has ended
NIVissimExtendedEdgePoint readExtEdgePointDef(std::istream &from)
std::vector< int > parseAssignedVehicleTypes(std::istream &from, const std::string &next)
parses a listof vehicle types assigned to the current data field One should remeber,...
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
virtual bool parse(std::istream &from)=0
Parses a single data type. Returns whether no error occurred.
void readUntil(std::istream &from, const std::string &name)
Reads from the stream until the keywor occurs.
bool skipOverreading(std::istream &from, const std::string &name="")
Overreads the named parameter (if) given and skips the rest until "DATAEND".
std::string overrideOptionalLabel(std::istream &from, const std::string &tag="")
overrides the optional label definition; returns the next tag as done by readEndSecure
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
Importer for networks stored in Vissim format.
std::map< std::string, NIVissimElement > ToElemIDMap
Definition of a map from element names to their numerical representation.
NIImporter_Vissim & operator=(const NIImporter_Vissim &)
Invalidated assignment operator.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads network definition from the assigned option and stores it in the given network builder.
static SequentialStringBijection::Entry vissimAttrs[]
The names of VISSIM-XML attributes (for passing to GenericSAXHandler)
std::map< std::string, std::list< std::string > > nodeMap
void buildParsers()
adds id-to-parser - relationships of elements to parse into myParsers
static SequentialStringBijection::Entry vissimTags[]
The names of VISSIM-XML elements (for passing to GenericSAXHandler)
VissimXMLAttr
Numbers representing VISSIM-XML - attributes.
bool admitContinue(const std::string &tag)
ColorMap myColorMap
a map from color names to color definitions
VissimXMLTag
Numbers representing VISSIM-XML - element names.
ToElemIDMap myKnownElements
Map from element names to their numerical representation.
void postLoadBuild(double offset)
std::map< std::string, RGBColor > ColorMap
definition of a map from color names to color definitions
void insertKnownElements()
adds name-to-id - relationships of known elements into myKnownElements
bool readContents(std::istream &strm)
ToParserMap myParsers
Parsers by element id.
NBNetBuilder & myNetBuilder
std::map< NIVissimElement, VissimSingleTypeParser * > ToParserMap
Definition of a map from an element's numerical id to his parser.
NIImporter_Vissim(const NIImporter_Vissim &)
Invalidated copy constructor.
void load(const OptionsCont &options)
loads the vissim file
A storage for options typed value containers)
Definition OptionsCont.h:89
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Encapsulated SAX-Attributes.