1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    NIVissimDisturbance.h
11 /// @author  Daniel Krajzewicz
12 /// @author  Michael Behrisch
13 /// @date    Sept 2002
14 /// @version $Id$
15 ///
16 // -------------------
17 /****************************************************************************/
18 #ifndef NIVissimDisturbance_h
19 #define NIVissimDisturbance_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <map>
28 #include <string>
29 #include <utils/geom/AbstractPoly.h>
30 #include <netbuild/NBConnection.h>
31 #include "NIVissimExtendedEdgePoint.h"
32 #include "NIVissimBoundedClusterObject.h"
33 #include "NIVissimNodeParticipatingEdgeVector.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class NBNode;
40 class NBEdge;
41 class NBDistrictCont;
42 
43 class NIVissimDisturbance
44     : public NIVissimBoundedClusterObject {
45 public:
46     NIVissimDisturbance(int id, const std::string& name,
47                         const NIVissimExtendedEdgePoint& edge,
48                         const NIVissimExtendedEdgePoint& by);
49     virtual ~NIVissimDisturbance();
50     void computeBounding();
51     bool addToNode(NBNode* node, NBDistrictCont& dc,
52                    NBNodeCont& nc, NBEdgeCont& ec);
getEdgeID()53     int getEdgeID() const {
54         return myEdge.getEdgeID();
55     }
getDisturbanceID()56     int getDisturbanceID() const {
57         return myDisturbance.getEdgeID();
58     }
59     NBConnection getConnection(NBNode* node, int aedgeid);
60 
61 public:
62     static bool dictionary(const std::string& name,
63                            const NIVissimExtendedEdgePoint& edge,
64                            const NIVissimExtendedEdgePoint& by);
65     static bool dictionary(int id, NIVissimDisturbance* o);
66     static NIVissimDisturbance* dictionary(int id);
67     static std::vector<int> getWithin(const AbstractPoly& poly);
68     static void clearDict();
69     static void dict_SetDisturbances();
70     static void reportRefused();
71 
72 private:
73     int myID;
74     int myNode;
75     std::string myName;
76     NIVissimExtendedEdgePoint myEdge;
77     NIVissimExtendedEdgePoint myDisturbance;
78 
79     typedef std::map<int, NIVissimDisturbance*> DictType;
80     static DictType myDict;
81     static int myRunningID;
82     static int refusedProhibits;
83 };
84 
85 
86 #endif
87 
88 /****************************************************************************/
89 
90