137 "desSpeedDistribution",
141 "speedDistributionDataPoint",
145 "vehicleRoutingDecisionStatic",
149 "vehicleRouteStatic",
193 if (!oc.
isSet(
"vissim-file")) {
199 if ((oc.
getString(
"vissim-file").find(
".inpx") != std::string::npos))
204 loader.myInputIsLegacyFormat =
false;
208 loader.myInputIsLegacyFormat =
true;
222 myElemData(elemData),
242 myElemData[
"id"].push_back(attrs.
get<std::string>(VISSIM_ATTR_NO,
nullptr, ok));
281 std::string sep(
" ");
288 if (z.length() > 0) {
304 std::vector<int> assignedVehicles;
313 std::vector<double> pos_v(3);
316 std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(),
321 double length(geom.
length());
333 if (
id == 85 ||
id == 91) {
334 std::cout <<
id <<
"\n";
335 std::cout <<
myElemData[
"width"].size() <<
"\n";
336 std::cout << length <<
"\n";
337 std::cout << geom <<
"\n";
340 int numLanes = (int)
myElemData[
"width"].size();
341 std::vector<int> laneVec(numLanes);
348 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
349 *each = *(each - 1) + 1;
362 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
363 *each = *(each - 1) + 1;
376 geom, assignedVehicles, clv);
439 std::vector<std::pair<int, int> > assignedVehicles;
442 std::vector<int> districts;
444 std::vector<double> percentages;
466 myElemData(elemData),
467 myHierarchyLevel(0) {
482 for (
int pos = (
int)colorStr.size() - 2; pos > 0; pos -= 2) {
483 colorStr.insert(pos,
" ");
499 std::istringstream iss(
myElemData[
"color"].front());
501 myElemData[
"color"].front(),
" ").getVector());
502 std::vector<int> myColorVector(sCol_v.size());
505 color =
RGBColor((
unsigned char)myColorVector[0],
506 (
unsigned char)myColorVector[1],
507 (
unsigned char)myColorVector[2],
508 (
unsigned char)myColorVector[3]);
509 std::vector<int> types;
548 std::string sep(
" ");
564 myElemData[
"points"].front(),
" ").getVector());
662 if (status !=
"PASSIVE") {
677 : myVissimParent(parent) {}
694 const std::string& excl) {
696 std::string tmp =
myRead(from);
712 const std::vector<std::string>& excl) {
713 std::vector<std::string> myExcl;
714 std::vector<std::string>::const_iterator i;
715 for (i = excl.begin(); i != excl.end(); i++) {
717 myExcl.push_back(mes);
719 std::string tmp =
myRead(from);
725 for (i = myExcl.begin(); i != myExcl.end() && !equals; i++) {
742 const std::string& tag) {
749 if (tmp ==
"beschriftung") {
751 if (tmp ==
"keine") {
772 std::istream& from,
const std::string& next) {
774 std::vector<int> ret;
779 while (tmp !=
"DATAEND" && tmp != next) {
789 std::istream& from) {
795 std::vector<int> lanes;
796 while (tag !=
"bei") {
800 lanes.push_back(lane - 1);
805 std::vector<int> dummy;
814 if (name[0] ==
'"') {
815 while (name[name.length() - 1] !=
'"') {
818 name = name +
" " + tmp;
820 name = name.substr(1, name.length() - 2);
828 const std::string& name) {
830 while (tag != name) {
837 const std::string& name) {
839 while (tag != name) {
842 while (tag !=
"DATAEND") {
902 std::ifstream strm(options.
getString(
"vissim-file").c_str());
916 std::string file = options.
getString(
"vissim-file");
925 WRITE_ERROR(
"Could not open vissim-file '" + file +
"'.");
946 XMLHandler_Geschwindigkeitsverteilung.
setFileName(file);
955 XMLHandler_Fahrzeugklassendefinition.
setFileName(file);
997 while (strm.good() && ok) {
1005 bool parsed =
false;
1006 while (!parsed && strm.good() && ok) {
1009 ToParserMap::iterator j =
myParsers.find((*i).second);
1012 ok = parser->
parse(strm);
1021 getline(strm, line);
1022 }
while (strm.good() && (line ==
"" || line[0] ==
' ' || line[0] ==
'-'));
~NIVissimXMLHandler_Zuflussdefinition()
Destructor.
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
void readUntil(std::istream &from, const std::string &name)
Reads from the stream until the keywor occurs.
int myHierarchyLevel
The current hierarchy level.
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
static bool dictionary(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
static void dict_buildNBEdgeConnections(NBEdgeCont &ec)
static bool isReadable(std::string path)
Checks whether the given file is readable.
NIVissimXMLHandler_Parkplatzdefinition()
Constructor.
NIVissimXMLHandler_Streckendefinition(nodeMap &elemData)
Constructor.
static const RGBColor WHITE
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.
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
static void dict_checkEdges2Join()
NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition(nodeMap &elemData)
Constructor.
~NIVissimXMLHandler_Routenentscheidungsdefinition()
Destructor.
static void reportUnsetSpeeds()
Writes edges with unset speeds to the warnings message log instance.
std::string readEndSecure(std::istream &from, const std::string &excl="")
as myRead, but returns "DATAEND" when the current field has ended
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
~NIImporter_Vissim()
destructor
static StringBijection< int >::Entry vissimAttrs[]
The names of VISSIM-XML attributes (for passing to GenericSAXHandler)
NIVissimXMLHandler_Zuflussdefinition()
Constructor.
~NIVissimXMLHandler_Parkplatzdefinition()
Destructor.
~NIVissimXMLHandler_VWunschentscheidungsdefinition()
Destructor.
Importer for networks stored in Vissim format.
VissimSingleTypeParser(NIImporter_Vissim &parent)
Constructor.
virtual ~VissimSingleTypeParser()
Destructor.
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double offset)
Builds NBEdges from the VissimEdges within the dictionary.
NIVissimXMLHandler_Routenentscheidungsdefinition(nodeMap &elemData)
Constructor.
virtual bool parse(std::istream &from)=0
Parses a single data type. Returns whether no error occurred.
bool readContents(std::istream &strm)
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.
static void closeLoading()
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static const RGBColor BLACK
~NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition()
Destructor.
static bool dictionary(int id, NIVissimConnection *o)
int myLastNodeID
ID of the currently parsed node, for reporting mainly.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
#define UNUSED_PARAMETER(x)
NIImporter_Vissim & myVissimParent
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
static void setPriorityRegulation(NBEdgeCont &ec)
Sets the priority regulation according to the VISSIM conflict area data.
int myHierarchyLevel
The current hierarchy level.
static OptionsCont & getOptions()
Retrieves the options.
A temporary storage for edges imported from Vissim.
void loadXML(const OptionsCont &options, NBNetBuilder &nb)
ToParserMap myParsers
Parsers by element id.
static void dict_CheckEdgeEnds()
static void dict_assignToEdges()
void insertKnownElements()
adds name-to-id - relationships of known elements into myKnownElements
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
ToElemIDMap myKnownElements
Map from element names to their numerical representation.
~NIVissimXMLHandler_Fahrzeugklassendefinition()
Destructor.
static void dict_BuildDistrictConnections()
A handler which converts occuring elements and attributes into enums.
static void setCurrentVirtID(int id)
static const RGBColor GREEN
static const RGBColor GREY
void setFileName(const std::string &name)
Sets the current file name.
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.
bool myInputIsLegacyFormat
NIVissimExtendedEdgePoint readExtEdgePointDef(std::istream &from)
static void dict_addDisturbances(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec)
Encapsulated SAX-Attributes.
static void dict_propagateSpeeds()
void load(const OptionsCont &options)
loads the vissim file
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
static void clearDict()
Clears the dictionary.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
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
~NIVissimXMLHandler_Streckendefinition()
Destructor.
static void buildNodeClusters()
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static bool dict_SetSignals(NBTrafficLightLogicCont &tlc, NBEdgeCont &ec)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
static const RGBColor MAGENTA
#define PROGRESS_BEGIN_MESSAGE(msg)
bool isConnector
check if the link is a connector
Position getPosition(std::istream &from)
returns the 2d-position saved as next within the stream
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
int myHierarchyLevel
The current hierarchy level.
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;.
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.
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static std::string convertUmlaute(std::string str)
Converts german "Umlaute" to their latin-version.
std::vector< std::string > getVector()
void buildParsers()
adds id-to-parser - relationships of elements to parse into myParsers
NIVissimXMLHandler_Fahrzeugklassendefinition(nodeMap &elemData)
Constructor.
static void clearDict()
Clears the dictionary.
static void buildConnectionClusters()
Clusters connections of each edge.
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
static const RGBColor YELLOW
static const RGBColor RED
named colors
double length() const
Returns the length.
static const RGBColor CYAN
std::map< std::string, std::list< std::string > > nodeMap
~NIVissimXMLHandler_ConflictArea()
Destructor.
NIImporter_Vissim(NBNetBuilder &nb, const std::string &file)
constructor
NBNodeCont & getNodeCont()
Returns a reference to the node container.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Instance responsible for building networks.
int myHierarchyLevel
The current hierarchy level.
A storage for options typed value containers)
bool skipOverreading(std::istream &from, const std::string &name="")
Overreads the named parameter (if) given and skips the rest until "DATAEND".
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads network definition from the assigned option and stores it in the given network builder...
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
static void buildNBNodes(NBNodeCont &nc)
void postLoadBuild(double offset)
NIVissimXMLHandler_VWunschentscheidungsdefinition(nodeMap &elemData)
Constructor.
static void dict_SetDisturbances()
void push_back_noDoublePos(const Position &p)
insert in back a non double position
NBNetBuilder & myNetBuilder
NIVissimXMLHandler_ConflictArea()
Constructor.
#define PROGRESS_DONE_MESSAGE()
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
int myHierarchyLevel
The current hierarchy level.
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
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...
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
bool admitContinue(const std::string &tag)
std::string overrideOptionalLabel(std::istream &from, const std::string &tag="")
overrides the optional label definition; returns the next tag as done by readEndSecure ...
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
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, that -1 means "all" vehicle types
static bool dictionary(const std::string &id, const std::string &name, const std::string &edgeid)
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
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.