67 const std::string& name,
68 const std::vector<int>& districts,
const std::vector<double>& percentages,
69 int edgeid,
double position,
70 const std::vector<std::pair<int, int> >& assignedVehicles)
71 : myID(id), myName(name), myDistricts(districts),
72 myEdgeID(edgeid), myPosition(position),
73 myAssignedVehicles(assignedVehicles) {
75 std::vector<double>::const_iterator j = percentages.begin();
90 const std::vector<int>& districts,
const std::vector<double>& percentages,
91 int edgeid,
double position,
92 const std::vector<std::pair<int, int> >& assignedVehicles) {
95 edgeid, position, assignedVehicles);
106 DictType::iterator i =
myDict.find(
id);
117 DictType::iterator i =
myDict.find(
id);
127 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
129 const std::vector<int>& districts = c->
myDistricts;
130 for (std::vector<int>::const_iterator j = districts.begin(); j != districts.end(); j++) {
141 const std::vector<int>& connections = (*k).second;
142 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
163 const std::vector<int>& connections = (*k).second;
165 std::string dsid = toString<int>((*k).first);
170 for (std::vector<int>::const_iterator j = connections.begin(); j != connections.end(); j++) {
175 if (connections.size() == 1) {
176 distCenter.
add(10, 10);
178 district->setCenter(distCenter);
180 std::string
id =
"District" + district->getID();
182 new NBNode(
id, district->getPosition(), district);
183 if (!nc.
insert(districtNode)) {
199 const std::vector<int>& connections = (*k).second;
202 dc.
retrieve(toString<int>((*k).first));
204 assert(district != 0 && districtNode != 0);
206 for (std::vector<int>::const_iterator l = connections.begin(); l != connections.end(); l++) {
214 WRITE_WARNING(
"Could not build district '" + toString<int>((*k).first) +
"' - edge '" + toString<int>(c->
myEdgeID) +
"' is missing.");
217 std::string
id =
"ParkingPlace" + toString<int>(*l);
219 if (parkingPlace == 0) {
221 if (pos < e->getLength() - pos) {
236 id =
"VissimFromParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
238 new NBEdge(
id, districtNode, parkingPlace,
246 if (!district->
addSource(source, percNormed)) {
253 id =
"VissimToParkingplace" + toString<int>((*k).first) +
"-" + toString<int>(c->
myID);
255 new NBEdge(
id, parkingPlace, districtNode,
256 "Connection", (
double) 100 / (
double) 3.6, 2, -1,
258 if (!ec.
insert(destination)) {
263 if (!district->
addSink(destination, percNormed2)) {
347 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
348 if ((*i).second->myEdgeID == edgeid) {
358 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); i++) {
370 return (
double) 200 / (double) 3.6;
373 std::vector<std::pair<int, int> >::const_iterator i;
383 std::string
id = toString<int>(distNo);
386 WRITE_WARNING(
"The referenced speed distribution '" +
id +
"' is not known.");
391 double speed = dist->getMax();
392 if (speed < 0 || speed > 1000) {
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Position getGeomPosition(double pos) const
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
static void dict_BuildDistricts(NBDistrictCont &dc, NBEdgeCont &ec, NBNodeCont &nc)
Builds the districts.
double getRealSpeed(int distNo) const
static std::map< int, std::vector< int > > myDistrictsConnections
Map from ditricts to connections.
void add(const Position &pos)
Adds the given position to this one.
The representation of a single edge during network building.
A container for districts.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Position geomPosition() const
Returns the position The position yields from the edge geometry and the place the connection is plaed...
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.
const std::string & getID() const
Returns the id.
static NIVissimDistrictConnection * dict_findForEdge(int edgeid)
Returns the connection to a district placed at the given node Yep, there onyl should be one...
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
DistrictPercentages myPercentages
A map how many vehicles (key, amount) should leave to a district (key)
static OptionsCont & getOptions()
Retrieves the options.
A temporary storage for edges imported from Vissim.
static void dict_CheckEdgeEnds()
int myID
The id of the connections.
A class representing a single district.
double getPosition() const
Returns the position of the connection at the edge.
static void dict_BuildDistrictConnections()
std::vector< std::pair< int, int > > myAssignedVehicles
The vehicles using this connection.
void invalidateIncomingConnections()
invalidate incoming connections
int myEdgeID
The id of the connected edge.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
NBEdge * retrievePossiblySplit(const std::string &id, bool downstream) const
Tries to retrieve an edge, even if it is splitted.
A point in 2D or 3D with translation and scaling methods.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
std::vector< int > myDistricts
The connected districts.
void invalidateOutgoingConnections()
invalidate outgoing connections
void checkDistrictConnectionExistanceAt(double pos)
Storage for edges, including some functionality operating on multiple edges.
static DictType myDict
District connection dictionary.
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.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
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.
bool addSink(NBEdge *const sink, double weight)
Adds a sink.
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
static void clearDict()
Clears the dictionary.
~NIVissimDistrictConnection()
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Represents a single node (junction) during network building.
double getMeanSpeed() const
double myPosition
The position on the edge.
NBNode * getFromNode() const
Returns the origin node of the edge.
Container for nodes during the netbuilding process.
std::map< int, NIVissimDistrictConnection * > DictType
Definition of a dictionary of district connections.
bool addSource(NBEdge *const source, double weight)
Adds a source.
NBNode * getToNode() const
Returns the destination node of the edge.
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.