NIVissimNodeDef_Poly Class Reference

#include <NIVissimNodeDef_Poly.h>

Inheritance diagram for NIVissimNodeDef_Poly:

NIVissimNodeDef_Edges NIVissimNodeDef

Detailed Description

Definition at line 38 of file NIVissimNodeDef_Poly.h.


Public Member Functions

int buildNodeCluster ()
virtual SUMOReal getEdgePosition (int edgeid) const
 NIVissimNodeDef_Poly (int id, const std::string &name, const Position2DVector &poly)
virtual void searchAndSetConnections ()
void searchAndSetConnections (SUMOReal offset)
virtual ~NIVissimNodeDef_Poly ()

Static Public Member Functions

static void clearDict ()
static void dict_assignConnectionsToNodes ()
static NIVissimNodeDefdictionary (int id)
static bool dictionary (int id, NIVissimNodeDef *o)
static bool dictionary (int id, const std::string &name, const NIVissimNodeParticipatingEdgeVector &edges)
static bool dictionary (int id, const std::string &name, const Position2DVector &poly)
static size_t dictSize ()
static int getMaxID ()

Protected Attributes

NIVissimNodeParticipatingEdgeVector myEdges
int myID
std::string myName

Private Attributes

Position2DVector myPoly

Constructor & Destructor Documentation

NIVissimNodeDef_Poly::NIVissimNodeDef_Poly ( int  id,
const std::string &  name,
const Position2DVector poly 
)

Definition at line 52 of file NIVissimNodeDef_Poly.cpp.

Referenced by dictionary().

NIVissimNodeDef_Poly::~NIVissimNodeDef_Poly (  )  [virtual]

Definition at line 58 of file NIVissimNodeDef_Poly.cpp.

00058 {}


Member Function Documentation

int NIVissimNodeDef::buildNodeCluster (  )  [inherited]

void NIVissimNodeDef::clearDict (  )  [static, inherited]

Definition at line 131 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myDict.

Referenced by NIImporter_Vissim::~NIImporter_Vissim().

00131                            {
00132     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
00133         delete(*i).second;
00134     }
00135     myDict.clear();
00136 }

void NIVissimNodeDef::dict_assignConnectionsToNodes (  )  [static, inherited]

Definition at line 116 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myDict.

00116                                                {
00117     for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) {
00118         (*i).second->searchAndSetConnections();
00119     }
00120 }

NIVissimNodeDef * NIVissimNodeDef::dictionary ( int  id  )  [static, inherited]

Definition at line 73 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myDict.

00073                                   {
00074     DictType::iterator i=myDict.find(id);
00075     if (i==myDict.end()) {
00076         return 0;
00077     }
00078     return (*i).second;
00079 }

bool NIVissimNodeDef::dictionary ( int  id,
NIVissimNodeDef o 
) [static, inherited]

Definition at line 58 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myDict, and NIVissimNodeDef::myMaxID.

Referenced by dictionary(), NIVissimNodeDef_Edges::dictionary(), and NIVissimConnectionCluster::getPositionForEdge().

00058                                                       {
00059     DictType::iterator i=myDict.find(id);
00060     if (i==myDict.end()) {
00061         myDict[id] = o;
00062         myMaxID = myMaxID > id
00063                   ? myMaxID
00064                   : id;
00065 //        o->computeBounding();
00066         return true;
00067     }
00068     return false;
00069 }

bool NIVissimNodeDef_Edges::dictionary ( int  id,
const std::string &  name,
const NIVissimNodeParticipatingEdgeVector edges 
) [static, inherited]

Definition at line 66 of file NIVissimNodeDef_Edges.cpp.

References NIVissimNodeDef::dictionary(), and NIVissimNodeDef_Edges::NIVissimNodeDef_Edges().

Referenced by NIVissimSingleTypeParser_Knotendefinition::parse().

00067                                                                                     {
00068     NIVissimNodeDef_Edges *o = new NIVissimNodeDef_Edges(id, name, edges);
00069     if (!NIVissimNodeDef::dictionary(id, o)) {
00070         delete o;
00071         return false;
00072     }
00073     return true;
00074 }

bool NIVissimNodeDef_Poly::dictionary ( int  id,
const std::string &  name,
const Position2DVector poly 
) [static]

Definition at line 62 of file NIVissimNodeDef_Poly.cpp.

References NIVissimNodeDef::dictionary(), and NIVissimNodeDef_Poly().

Referenced by NIVissimSingleTypeParser_Knotendefinition::parse().

00063                                                                {
00064     NIVissimNodeDef_Poly *o = new NIVissimNodeDef_Poly(id, name, poly);
00065     if (!NIVissimNodeDef::dictionary(id, o)) {
00066         delete o;
00067         assert(false);
00068         return false;
00069     }
00070     return true;
00071 }

size_t NIVissimNodeDef::dictSize (  )  [static, inherited]

Definition at line 124 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myDict.

00124                           {
00125     return myDict.size();
00126 }

SUMOReal NIVissimNodeDef_Edges::getEdgePosition ( int  edgeid  )  const [virtual, inherited]

Implements NIVissimNodeDef.

Definition at line 111 of file NIVissimNodeDef_Edges.cpp.

References NIVissimNodeParticipatingEdge::getFromPos(), NIVissimNodeParticipatingEdge::getID(), NIVissimNodeParticipatingEdge::getToPos(), NIVissimNodeDef_Edges::myEdges, and SUMOReal.

00111                                                        {
00112     for (NIVissimNodeParticipatingEdgeVector::const_iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00113         NIVissimNodeParticipatingEdge *edge = *i;
00114         if (edge->getID()==edgeid) {
00115             return (edge->getFromPos() + edge->getToPos()) / (SUMOReal) 2.0;
00116         }
00117     }
00118     return -1;
00119 }

int NIVissimNodeDef::getMaxID (  )  [static, inherited]

Definition at line 140 of file NIVissimNodeDef.cpp.

References NIVissimNodeDef::myMaxID.

Referenced by NIImporter_Vissim::postLoadBuild().

00140                           {
00141     return myMaxID;
00142 }

void NIVissimNodeDef_Edges::searchAndSetConnections (  )  [virtual, inherited]

Implements NIVissimNodeDef.

Definition at line 78 of file NIVissimNodeDef_Edges.cpp.

References Boundary::add(), NIVissimEdge::dictionary(), NIVissimConnection::dictionary(), NIVissimConnection::getFromGeomPosition(), NIVissimNodeParticipatingEdge::getFromPos(), NIVissimNodeParticipatingEdge::getID(), NIVissimConnection::getToGeomPosition(), NIVissimNodeParticipatingEdge::getToPos(), NIVissimEdge::myConnectionClusters, NIVissimNodeDef_Edges::myEdges, NIVissimNodeDef::myID, and NIVissimConnection::setNodeCluster().

00078                                                {
00079     IntVector connections;
00080     IntVector edges;
00081     Boundary boundary;
00082     for (NIVissimNodeParticipatingEdgeVector::const_iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00083         NIVissimNodeParticipatingEdge *edge = *i;
00084         NIVissimConnection *c =
00085             NIVissimConnection::dictionary(edge->getID());
00086         NIVissimEdge *e =
00087             NIVissimEdge::dictionary(edge->getID());
00088         if (c!=0) {
00089             connections.push_back(edge->getID());
00090             boundary.add(c->getFromGeomPosition());
00091             boundary.add(c->getToGeomPosition());
00092             c->setNodeCluster(myID);
00093         }
00094         if (e!=0) {
00095             edges.push_back(edge->getID());
00096             boundary.add(e->getGeomPosition(edge->getFromPos()));
00097             boundary.add(e->getGeomPosition(edge->getToPos()));
00098         }
00099     }
00100     NIVissimConnectionCluster *c =
00101         new NIVissimConnectionCluster(connections, boundary, myID, edges);
00102     for (IntVector::iterator j=edges.begin(); j!=edges.end(); j++) {
00103         NIVissimEdge *edge = NIVissimEdge::dictionary(*j);
00104         edge->myConnectionClusters.push_back(c);
00105     }
00106 }

void NIVissimNodeDef_Poly::searchAndSetConnections ( SUMOReal  offset  ) 

Definition at line 96 of file NIVissimNodeDef_Poly.cpp.

References NIVissimEdge::dictionary(), NIVissimConnection::dictionary(), Position2DVector::getBoxBoundary(), NIVissimAbstractEdge::getWithin(), NIVissimEdge::myConnectionClusters, NIVissimNodeDef::myID, myPoly, and NIVissimConnection::setNodeCluster().

00096                                                              {
00097     IntVector within = NIVissimAbstractEdge::getWithin(myPoly, offset);
00098     IntVector connections;
00099     IntVector edges;
00100     Boundary boundary(myPoly.getBoxBoundary());
00101     for (IntVector::const_iterator i=within.begin(); i!=within.end(); i++) {
00102         NIVissimConnection *c =
00103             NIVissimConnection::dictionary(*i);
00104         NIVissimEdge *e =
00105             NIVissimEdge::dictionary(*i);
00106         if (c!=0) {
00107             connections.push_back(*i);
00108             c->setNodeCluster(myID);
00109         }
00110         if (e!=0) {
00111             edges.push_back(*i);
00112         }
00113     }
00114     NIVissimConnectionCluster *c =
00115         new NIVissimConnectionCluster(connections, boundary, myID, edges);
00116     for (IntVector::iterator j=edges.begin(); j!=edges.end(); j++) {
00117         NIVissimEdge *edge = NIVissimEdge::dictionary(*j);
00118         edge->myConnectionClusters.push_back(c);
00119     }
00120 }


Field Documentation

int NIVissimNodeDef::myID [protected, inherited]

std::string NIVissimNodeDef::myName [protected, inherited]

Definition at line 61 of file NIVissimNodeDef.h.

Definition at line 50 of file NIVissimNodeDef_Poly.h.

Referenced by searchAndSetConnections().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:54 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6