SUMO - Simulation of Urban MObility
NIVissimNodeDef_Edges.h
Go to the documentation of this file.
00001 /****************************************************************************/
00007 // -------------------
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This file is part of SUMO.
00014 //   SUMO is free software: you can redistribute it and/or modify
00015 //   it under the terms of the GNU General Public License as published by
00016 //   the Free Software Foundation, either version 3 of the License, or
00017 //   (at your option) any later version.
00018 //
00019 /****************************************************************************/
00020 #ifndef NIVissimNodeDef_Edges_h
00021 #define NIVissimNodeDef_Edges_h
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 
00034 #include <string>
00035 #include <map>
00036 #include "NIVissimNodeParticipatingEdgeVector.h"
00037 #include "NIVissimExtendedEdgePoint.h"
00038 #include "NIVissimNodeDef.h"
00039 
00040 class NIVissimNodeDef_Edges :
00041     public NIVissimNodeDef {
00042 public:
00043     NIVissimNodeDef_Edges(int id, const std::string& name,
00044                           const NIVissimNodeParticipatingEdgeVector& edges);
00045     virtual ~NIVissimNodeDef_Edges();
00046     static bool dictionary(int id, const std::string& name,
00047                            const NIVissimNodeParticipatingEdgeVector& edges);
00048 //    virtual void computeBounding();
00049     virtual void searchAndSetConnections();
00050     virtual SUMOReal getEdgePosition(int edgeid) const;
00051 
00055     class id_matches {
00056     public:
00057         explicit id_matches(int id) : myEdgeID(id) { }
00058         bool operator()(NIVissimNodeParticipatingEdge* e) {
00059             return e->getID() == myEdgeID;
00060         }
00061     private:
00062         int myEdgeID;
00063     };
00064 
00065     class lying_within_match {
00066     public:
00067         explicit lying_within_match(NIVissimNodeParticipatingEdge* e) : myEdge(e) { }
00068         bool operator()(NIVissimExtendedEdgePoint* e) {
00069             return e->getEdgeID() == myEdge->getID() &&
00070                    myEdge->positionLiesWithin(e->getPosition());
00071         }
00072     private:
00073         NIVissimNodeParticipatingEdge* myEdge;
00074     };
00075 
00076 protected:
00077     NIVissimNodeParticipatingEdgeVector myEdges;
00078 };
00079 
00080 
00081 #endif
00082 
00083 /****************************************************************************/
00084 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines