137 "desSpeedDistribution",
141 "speedDistributionDataPoint",
145 "vehicleRoutingDecisionStatic",
149 "vehicleRouteStatic",
193 if (!oc.
isSet(
"vissim-file")) {
207 vissimAttrs, VISSIM_ATTR_NOTHING,
209 myElemData(elemData),
231 myElemData[
"name"].push_back(attrs.
get<std::string>(
VISSIM_ATTR_NAME,
nullptr, ok,
false));
245 if (isConnector !=
true) {
251 myElemData[
"from_pos"].push_back(attrs.
get<std::string>(
VISSIM_ATTR_POS,
nullptr, ok));
252 myElemData[
"from_id"].push_back(from[0]);
253 myElemData[
"from_lane"].push_back(from[1]);
261 myElemData[
"to_id"].push_back(to[0]);
262 myElemData[
"to_lane"].push_back(to[1]);
268 std::string sep(
" ");
275 if (z.length() > 0) {
279 myElemData[
"pos"].push_back(posS);
291 std::vector<int> assignedVehicles;
296 while (!myElemData[
"pos"].empty()) {
298 myElemData[
"pos"].front(),
" ").getVector());
299 myElemData[
"pos"].pop_front();
300 std::vector<double> pos_v(3);
303 std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(),
308 double length(geom.
length());
312 std::vector<double> laneWidths;
313 for (std::string& w : myElemData[
"width"]) {
317 myElemData[
"name"].front(),
318 myElemData[
"type"].front(),
325 int numLanes = (int)myElemData[
"width"].size();
326 std::vector<int> laneVec(numLanes);
333 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
334 *each = *(each - 1) + 1;
347 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
348 *each = *(each - 1) + 1;
359 myElemData[
"name"].front(),
361 geom, assignedVehicles, clv);
424 std::vector<std::pair<int, int> > assignedVehicles;
427 std::vector<int> districts;
429 std::vector<double> percentages;
451 myElemData(elemData),
452 myHierarchyLevel(0) {
465 myElemData[
"name"].push_back(attrs.
get<std::string>(
VISSIM_ATTR_NAME,
nullptr, ok,
false));
467 for (
int pos = (
int)colorStr.size() - 2; pos > 0; pos -= 2) {
468 colorStr.insert(pos,
" ");
470 myElemData[
"color"].push_back(colorStr);
484 std::istringstream iss(myElemData[
"color"].front());
486 myElemData[
"color"].front(),
" ").getVector());
487 std::vector<int> myColorVector(sCol_v.size());
490 color =
RGBColor((
unsigned char)myColorVector[0],
491 (
unsigned char)myColorVector[1],
492 (
unsigned char)myColorVector[2],
493 (
unsigned char)myColorVector[3]);
494 std::vector<int> types;
495 while (!myElemData[
"types"].empty()) {
497 myElemData[
"types"].pop_front();
501 myElemData[
"name"].front(),
516 myElemData(elemData),
517 myHierarchyLevel(0) {
533 std::string sep(
" ");
537 myElemData[
"points"].push_back(posS);
547 while (!myElemData[
"points"].empty()) {
549 myElemData[
"points"].front(),
" ").getVector());
550 myElemData[
"points"].pop_front();
566 myElemData(elemData),
567 myHierarchyLevel(0) {
578 myElemData[
"name"].push_back(attrs.
get<std::string>(
VISSIM_ATTR_NAME,
nullptr, ok,
false));
597 myElemData(elemData),
598 myHierarchyLevel(0) {
610 myElemData[
"startPos"].push_back(attrs.
get<std::string>(
VISSIM_ATTR_POS,
nullptr, ok));
647 if (status !=
"PASSIVE") {
662 : myVissimParent(parent) {}
679 const std::string& excl) {
681 std::string tmp = myRead(from);
687 (tmp.substr(0, 2) ==
"--" || !myVissimParent.admitContinue(tmp))
697 const std::vector<std::string>& excl) {
698 std::vector<std::string> myExcl;
699 std::vector<std::string>::const_iterator i;
700 for (i = excl.begin(); i != excl.end(); i++) {
702 myExcl.push_back(mes);
704 std::string tmp = myRead(from);
710 for (i = myExcl.begin(); i != myExcl.end() && !equals; i++) {
717 (tmp.substr(0, 2) ==
"--" || !myVissimParent.admitContinue(tmp))
727 const std::string& tag) {
734 if (tmp ==
"beschriftung") {
736 if (tmp ==
"keine") {
757 std::istream& from,
const std::string& next) {
758 std::string tmp = readEndSecure(from);
759 std::vector<int> ret;
764 while (tmp !=
"DATAEND" && tmp != next) {
766 tmp = readEndSecure(from);
774 std::istream& from) {
780 std::vector<int> lanes;
781 while (tag !=
"bei") {
782 tag = readEndSecure(from);
785 lanes.push_back(lane - 1);
790 std::vector<int> dummy;
799 if (name[0] ==
'"') {
800 while (name[name.length() - 1] !=
'"') {
803 name = name +
" " + tmp;
805 name = name.substr(1, name.length() - 2);
813 const std::string& name) {
815 while (tag != name) {
822 const std::string& name) {
824 while (tag != name) {
827 while (tag !=
"DATAEND") {
828 tag = readEndSecure(from);
883 const std::string file = options.
getString(
"vissim-file");
885 std::ifstream strm(file.c_str());
918 XMLHandler_Geschwindigkeitsverteilung.
setFileName(file);
927 XMLHandler_Fahrzeugklassendefinition.
setFileName(file);
951 strm.seekg(strm.beg);
975 while (strm.good() && ok) {
984 while (!parsed && strm.good() && ok) {
987 ToParserMap::iterator j =
myParsers.find((*i).second);
990 ok = parser->
parse(strm);
1000 }
while (strm.good() && (line ==
"" || line[0] ==
' ' || line[0] ==
'-'));
#define WRITE_ERRORF(...)
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
@ VE_Richtungsentscheidungsdefinition
@ VE_Lichtsignalanlagendefinition
@ VE_LSAKopplungdefinition
@ VE_VWunschentscheidungsdefinition
@ VE_Leistungsverteilungsdefinition
@ VE_Fahrverhaltendefinition
@ VE_Auswertungsdefinition
@ VE_Geschwindigkeitsverteilungsdefinition
@ VE_Wunschbeschleunigungskurvedefinition
@ VE_Verlustzeitmessungsdefinition
@ VE_Maxverzoegerungskurvedefinition
@ VE_Querschnittsmessungsdefinition
@ VE_Stauzaehlerdefinition
@ VE_Netzobjektdefinition
@ VE_Stauparameterdefinition
@ VE_Wunschverzoegerungskurvedefinition
@ VE_Verkehrszusammensetzungsdefinition
@ VE_Detektorendefinition
@ VE_Routenentscheidungsdefinition
@ VE_Streckentypdefinition
@ VE_Baujahrverteilungsdefinition
@ VE_Fahrzeugklassendefinition
@ VE_Maxbeschleunigungskurvedefinition
@ VE_Reisezeitmessungsdefinition
@ VE_Signalgruppendefinition
@ VE_Massenverteilungsdefinition
@ VE_Laufleistungsverteilungsdefinition
@ VE_Gelbverhaltendefinition
@ VE_Querverkehrsstoerungsdefinition
@ VE_Verbindungsdefinition
@ VE_Haltestellendefinition
@ VE_Laengenverteilungsdefinition
@ VE_Signalgeberdefinition
@ VE_Fahrzeugtypdefinition
@ VE_Richtungspfeildefinition
@ VE_Stopschilddefinition
@ VE_Zeitenverteilungsdefinition
@ VE_Langsamfahrbereichdefinition
@ VE_Gefahrenwarnsystemdefinition
static bool dictionary(const std::string &type, const std::string &id, Distribution *d)
Adds a distribution of the given type and name to the container.
A handler which converts occurring elements and attributes into enums.
void setFileName(const std::string &name)
Sets the current file name.
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
~NIVissimXMLHandler_ConflictArea()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_ConflictArea()
Constructor.
~NIVissimXMLHandler_Fahrzeugklassendefinition()
Destructor.
NIVissimXMLHandler_Fahrzeugklassendefinition(nodeMap &elemData)
Constructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
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()
Destructor.
NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition(nodeMap &elemData)
Constructor.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
~NIVissimXMLHandler_Parkplatzdefinition()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Parkplatzdefinition()
Constructor.
~NIVissimXMLHandler_Routenentscheidungsdefinition()
Destructor.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
NIVissimXMLHandler_Routenentscheidungsdefinition(nodeMap &elemData)
Constructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
~NIVissimXMLHandler_Streckendefinition()
Destructor.
NIVissimXMLHandler_Streckendefinition(nodeMap &elemData)
Constructor.
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;.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
~NIVissimXMLHandler_VWunschentscheidungsdefinition()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_VWunschentscheidungsdefinition(nodeMap &elemData)
Constructor.
~NIVissimXMLHandler_Zuflussdefinition()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NIVissimXMLHandler_Zuflussdefinition()
Constructor.
VissimSingleTypeParser(NIImporter_Vissim &parent)
Constructor.
Position getPosition(std::istream &from)
returns the 2d-position saved as next within the stream
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 ~VissimSingleTypeParser()
Destructor.
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.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads network definition from the assigned option and stores it in the given network builder.
~NIImporter_Vissim()
destructor
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)
@ VISSIM_ATTR_LINKBEHAVETYPE
bool admitContinue(const std::string &tag)
ColorMap myColorMap
a map from color names to color definitions
@ VISSIM_TAG_VEHICLE_INPUT
@ VISSIM_TAG_VEHICLE_CLASS
@ VISSIM_TAG_ROUTE_STATIC
@ VISSIM_TAG_LINKPOLYPOINT
@ VISSIM_TAG_DECISION_STATIC
@ VISSIM_TAG_INTOBJECTREF
@ VISSIM_TAG_SPEED_DECISION
ToElemIDMap myKnownElements
Map from element names to their numerical representation.
void postLoadBuild(double offset)
void insertKnownElements()
adds name-to-id - relationships of known elements into myKnownElements
bool readContents(std::istream &strm)
ToParserMap myParsers
Parsers by element id.
NIImporter_Vissim(NBNetBuilder &nb)
constructor
NBNetBuilder & myNetBuilder
void load(const OptionsCont &options)
loads the vissim file
static void closeLoading()
static bool dictionary(int id, const std::string &link1, const std::string &link2, const std::string &status)
Adds the described item to the dictionary Builds the conflict area first.
static void setPriorityRegulation(NBEdgeCont &ec)
Sets the priority regulation according to the VISSIM conflict area data.
static void clearDict()
Clears the dictionary.
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap.
static void buildNodeClusters()
static void dict_buildNBEdgeConnections(NBEdgeCont &ec)
static void dict_assignToEdges()
static bool dictionary(int id, NIVissimConnection *o)
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
static void dict_BuildDistrictConnections()
static void dict_CheckEdgeEnds()
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
static void clearDict()
Clears the dictionary.
static bool dictionary(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Inserts the connection into the dictionary after building it.
static void dict_SetDisturbances()
A temporary storage for edges imported from Vissim.
static void reportUnsetSpeeds()
Writes edges with unset speeds to the warnings message log instance.
static void dict_checkEdges2Join()
static void buildConnectionClusters()
Clusters connections of each edge.
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double offset)
Builds NBEdges from the VissimEdges within the dictionary.
static void dict_propagateSpeeds()
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, double zuschlag1, double zuschlag2, double length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
static void setCurrentVirtID(int id)
static void dict_addDisturbances(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec)
static void buildNBNodes(NBNodeCont &nc)
static bool dictionary(const std::string &id, const std::string &name, const std::string &edgeid)
static bool dict_SetSignals(NBTrafficLightLogicCont &tlc, NBEdgeCont &ec)
static bool dictionary(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
double length() const
Returns the length.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
static const RGBColor WHITE
static const RGBColor GREY
static const RGBColor YELLOW
static const RGBColor CYAN
static const RGBColor GREEN
static const RGBColor BLACK
static const RGBColor MAGENTA
static const RGBColor RED
named colors
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
std::vector< std::string > getVector()
return vector of strings
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static int hexToInt(const std::string &sData)
converts a string with a hex value into the integer value described by it by calling the char-type co...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static std::string convertUmlaute(std::string str)
Converts german "Umlaute" to their latin-version.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.