139 "desSpeedDistribution",
143 "speedDistributionDataPoint",
147 "vehicleRoutingDecisionStatic",
151 "vehicleRouteStatic",
195 if (!oc.
isSet(
"vissim-file")) {
211 myElemData(elemData),
231 myElemData[
"id"].push_back(attrs.
get<std::string>(VISSIM_ATTR_NO,
nullptr, ok));
270 std::string sep(
" ");
277 if (z.length() > 0) {
293 std::vector<int> assignedVehicles;
302 std::vector<double> pos_v(3);
305 std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(),
310 double length(geom.
length());
314 std::vector<double> laneWidths;
319 myElemData[
"name"].front(),
320 myElemData[
"type"].front(),
327 int numLanes = (int)
myElemData[
"width"].size();
328 std::vector<int> laneVec(numLanes);
335 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
336 *each = *(each - 1) + 1;
349 for (std::vector<int>::iterator each = ++laneVec.begin(); each != laneVec.end(); ++each) {
350 *each = *(each - 1) + 1;
363 geom, assignedVehicles, clv);
426 std::vector<std::pair<int, int> > assignedVehicles;
429 std::vector<int> districts;
431 std::vector<double> percentages;
453 myElemData(elemData),
454 myHierarchyLevel(0) {
469 for (
int pos = (
int)colorStr.size() - 2; pos > 0; pos -= 2) {
470 colorStr.insert(pos,
" ");
486 std::istringstream iss(
myElemData[
"color"].front());
488 myElemData[
"color"].front(),
" ").getVector());
489 std::vector<int> myColorVector(sCol_v.size());
492 color =
RGBColor((
unsigned char)myColorVector[0],
493 (
unsigned char)myColorVector[1],
494 (
unsigned char)myColorVector[2],
495 (
unsigned char)myColorVector[3]);
496 std::vector<int> types;
535 std::string sep(
" ");
551 myElemData[
"points"].front(),
" ").getVector());
649 if (status !=
"PASSIVE") {
664 : myVissimParent(parent) {}
681 const std::string& excl) {
683 std::string tmp =
myRead(from);
699 const std::vector<std::string>& excl) {
700 std::vector<std::string> myExcl;
701 std::vector<std::string>::const_iterator i;
702 for (i = excl.begin(); i != excl.end(); i++) {
704 myExcl.push_back(mes);
706 std::string tmp =
myRead(from);
712 for (i = myExcl.begin(); i != myExcl.end() && !equals; i++) {
729 const std::string& tag) {
736 if (tmp ==
"beschriftung") {
738 if (tmp ==
"keine") {
759 std::istream& from,
const std::string& next) {
761 std::vector<int> ret;
766 while (tmp !=
"DATAEND" && tmp != next) {
776 std::istream& from) {
782 std::vector<int> lanes;
783 while (tag !=
"bei") {
787 lanes.push_back(lane - 1);
792 std::vector<int> dummy;
801 if (name[0] ==
'"') {
802 while (name[name.length() - 1] !=
'"') {
805 name = name +
" " + tmp;
807 name = name.substr(1, name.length() - 2);
815 const std::string& name) {
817 while (tag != name) {
824 const std::string& name) {
826 while (tag != name) {
829 while (tag !=
"DATAEND") {
885 const std::string file = options.
getString(
"vissim-file");
887 std::ifstream strm(file.c_str());
889 WRITE_ERROR(
"Could not open vissim-file '" + file +
"'.");
920 XMLHandler_Geschwindigkeitsverteilung.
setFileName(file);
929 XMLHandler_Fahrzeugklassendefinition.
setFileName(file);
953 strm.seekg(strm.beg);
977 while (strm.good() && ok) {
986 while (!parsed && strm.good() && ok) {
989 ToParserMap::iterator j =
myParsers.find((*i).second);
992 ok = parser->
parse(strm);
1001 getline(strm, line);
1002 }
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)
NIVissimXMLHandler_Parkplatzdefinition()
Constructor.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
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.
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.
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.
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.
NIImporter_Vissim(NBNetBuilder &nb)
constructor
std::vector< std::string > getVector()
return vector of strings
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.
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.