143 "desSpeedDistribution",
147 "speedDistributionDataPoint",
151 "vehicleRoutingDecisionStatic",
155 "vehicleRouteStatic",
199 if (!oc.
isSet(
"vissim-file")) {
205 if ((oc.
getString(
"vissim-file").find(
".inpx") != std::string::npos))
210 loader.myInputIsLegacyFormat =
false;
214 loader.myInputIsLegacyFormat =
true;
228 myElemData(elemData),
248 myElemData[
"id"].push_back(attrs.
get<std::string>(VISSIM_ATTR_NO, 0, ok));
287 std::string sep(
" ");
294 if (z.length() > 0) {
310 std::vector<int> assignedVehicles;
319 std::vector<double> pos_v(3);
322 std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(),
327 double length(geom.
length());
339 if (
id == 85 ||
id == 91) {
340 std::cout <<
id <<
"\n";
341 std::cout <<
myElemData[
"width"].size() <<
"\n";
342 std::cout << length <<
"\n";
343 std::cout << geom <<
"\n";
346 int numLanes = (int)
myElemData[
"width"].size();
347 std::vector<int> laneVec(numLanes);
354 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
355 *each = *(each - 1) + 1;
368 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
369 *each = *(each - 1) + 1;
382 geom, assignedVehicles, clv);
445 std::vector<std::pair<int, int> > assignedVehicles;
448 std::vector<int> districts;
450 std::vector<double> percentages;
472 myElemData(elemData),
473 myHierarchyLevel(0) {
488 for (
int pos = (
int)colorStr.size() - 2; pos > 0; pos -= 2) {
489 colorStr.insert(pos,
" ");
505 std::istringstream iss(
myElemData[
"color"].front());
507 myElemData[
"color"].front(),
" ").getVector());
508 std::vector<int> myColorVector(sCol_v.size());
509 std::transform(sCol_v.begin(), sCol_v.end(), myColorVector.begin(),
512 color =
RGBColor((
unsigned char)myColorVector[0],
513 (
unsigned char)myColorVector[1],
514 (
unsigned char)myColorVector[2],
515 (
unsigned char)myColorVector[3]);
516 std::vector<int> types;
555 std::string sep(
" ");
571 myElemData[
"points"].front(),
" ").getVector());
669 if (status !=
"PASSIVE") {
684 : myVissimParent(parent) {}
701 const std::string& excl) {
703 std::string tmp =
myRead(from);
719 const std::vector<std::string>& excl) {
720 std::vector<std::string> myExcl;
721 std::vector<std::string>::const_iterator i;
722 for (i = excl.begin(); i != excl.end(); i++) {
724 myExcl.push_back(mes);
726 std::string tmp =
myRead(from);
732 for (i = myExcl.begin(); i != myExcl.end() && !equals; i++) {
749 const std::string& tag) {
756 if (tmp ==
"beschriftung") {
758 if (tmp ==
"keine") {
779 std::istream& from,
const std::string& next) {
781 std::vector<int> ret;
786 while (tmp !=
"DATAEND" && tmp != next) {
796 std::istream& from) {
802 std::vector<int> lanes;
803 while (tag !=
"bei") {
807 lanes.push_back(lane - 1);
812 std::vector<int> dummy;
821 if (name[0] ==
'"') {
822 while (name[name.length() - 1] !=
'"') {
825 name = name +
" " + tmp;
827 name = name.substr(1, name.length() - 2);
835 const std::string& name) {
837 while (tag != name) {
844 const std::string& name) {
846 while (tag != name) {
849 while (tag !=
"DATAEND") {
909 std::ifstream strm(options.
getString(
"vissim-file").c_str());
923 std::string file = options.
getString(
"vissim-file");
932 WRITE_ERROR(
"Could not open vissim-file '" + file +
"'.");
953 XMLHandler_Geschwindigkeitsverteilung.
setFileName(file);
962 XMLHandler_Fahrzeugklassendefinition.
setFileName(file);
1004 while (strm.good() && ok) {
1012 bool parsed =
false;
1013 while (!parsed && strm.good() && ok) {
1016 ToParserMap::iterator j =
myParsers.find((*i).second);
1019 ok = parser->
parse(strm);
1028 getline(strm, line);
1029 }
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 occured.
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.
static double _str2double(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
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 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 int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
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
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 int _2int(const E *const data)
converts a char-type array into the integer value described by it
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()
static int _strHex2int(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.
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.
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.