58 const std::string& name,
59 const std::vector<int>& districts,
const std::vector<double>& percentages,
60 int edgeid,
double position,
61 const std::vector<std::pair<int, int> >& assignedVehicles)
62 : myID(id), myName(name), myDistricts(districts),
63 myEdgeID(edgeid), myPosition(position),
64 myAssignedVehicles(assignedVehicles) {
66 std::vector<double>::const_iterator j = percentages.begin();
81 const std::vector<int>& districts,
const std::vector<double>& percentages,
82 int edgeid,
double position,
83 const std::vector<std::pair<int, int> >& assignedVehicles) {
86 edgeid, position, assignedVehicles);
97 DictType::iterator i =
myDict.find(
id);
108 DictType::iterator i =
myDict.find(
id);
118 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
120 const std::vector<int>& districts = c->
myDistricts;
121 for (std::vector<int>::const_iterator j = districts.begin(); j != districts.end(); j++) {
132 const std::vector<int>& connections = (*k).second;
133 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
154 const std::vector<int>& connections = (*k).second;
156 std::string dsid = toString<int>((*k).first);
161 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
166 if (connections.size() == 1) {
167 distCenter.
add(10, 10);
171 std::string
id =
"District" + district->
getID();
174 if (!nc.
insert(districtNode)) {
190 const std::vector<int>& connections = (*k).second;
193 dc.
retrieve(toString<int>((*k).first));
195 assert(district != 0 && districtNode != 0);
197 for (std::vector<int>::const_iterator l = connections.begin(); l != connections.end(); l++) {
205 WRITE_WARNINGF(
TL(
"Could not build district '%' - edge '%' is missing."), toString<int>((*k).first), toString<int>(c->
myEdgeID));
208 std::string
id =
"ParkingPlace" + toString<int>(*l);
210 if (parkingPlace ==
nullptr) {
212 if (pos < e->getLength() - pos) {
227 id =
"VissimFromParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
229 new NBEdge(
id, districtNode, parkingPlace,
237 if (!district->
addSource(source, percNormed)) {
244 id =
"VissimToParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
246 new NBEdge(
id, parkingPlace, districtNode,
249 if (!ec.
insert(destination)) {
254 if (!district->
addSink(destination, percNormed2)) {
338 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
339 if ((*i).second->myEdgeID == edgeid) {
349 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
361 return (
double) 200 / (double) 3.6;
364 std::vector<std::pair<int, int> >::const_iterator i;
374 std::string
id = toString<int>(distNo);
376 if (dist ==
nullptr) {
377 WRITE_WARNINGF(
TL(
"The referenced speed distribution '%' is not known."),
id);
382 double speed = dist->
getMax();
383 if (speed < 0 || speed > 1000) {
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
virtual double getMax() const =0
Returns the maximum value of this distribution.
A container for districts.
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
A class representing a single district.
bool addSink(NBEdge *const sink, double weight)
Adds a sink.
bool addSource(NBEdge *const source, double weight)
Adds a source.
void setCenter(const Position &pos)
Sets the center coordinates.
const Position & getPosition() const
Returns the position of this district's center.
Storage for edges, including some functionality operating on multiple edges.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
NBEdge * retrievePossiblySplit(const std::string &id, bool downstream) const
Tries to retrieve an edge, even if it is splitted.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
The representation of a single edge during network building.
NBNode * getToNode() const
Returns the destination node of the edge.
static const double UNSPECIFIED_FRICTION
unspecified lane friction
NBNode * getFromNode() const
Returns the origin node of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Container for nodes during the netbuilding process.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Represents a single node (junction) during network building.
void invalidateOutgoingConnections(bool reallowSetting=false)
invalidate outgoing connections
void invalidateIncomingConnections(bool reallowSetting=false)
invalidate incoming connections
Position getGeomPosition(double pos) const
double getMeanSpeed() const
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
NIVissimDistrictConnection(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)
Contructor.
DistrictPercentages myPercentages
A map how many vehicles (key, amount) should leave to a district (key)
std::vector< int > myDistricts
The connected districts.
static void dict_BuildDistrictConnections()
~NIVissimDistrictConnection()
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one,...
static std::map< int, std::vector< int > > myDistrictsConnections
Map from ditricts to connections.
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
static void dict_CheckEdgeEnds()
std::vector< std::pair< int, int > > myAssignedVehicles
The vehicles using this connection.
double myPosition
The position on the edge.
static void dict_BuildDistrictNodes(NBDistrictCont &dc, NBNodeCont &nc)
Builds the nodes that belong to a district.
int myID
The id of the connections.
double getRealSpeed(int distNo) const
static void clearDict()
Clears the dictionary.
double getPosition() const
Returns the position of the connection at the edge.
static DictType myDict
District connection 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.
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
int myEdgeID
The id of the connected edge.
A temporary storage for edges imported from Vissim.
void checkDistrictConnectionExistanceAt(double pos)
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.
const std::string & getID() const
Returns the id.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
void add(const Position &pos)
Adds the given position to this one.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.