Eclipse SUMO - Simulation of Urban MObility
NIVissimBoundedClusterObject.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
15 // -------------------
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 
25 #include <cassert>
26 #include <utils/geom/Boundary.h>
28 
30 
32  : myBoundary(nullptr), myClusterID(-1) {
33  myDict.insert(this);
34 }
35 
36 
38  delete myBoundary;
39 }
40 
41 
42 bool
44  double offset) const {
45  assert(myBoundary != 0 && myBoundary->xmax() >= myBoundary->xmin());
46  return myBoundary->overlapsWith(poly, offset);
47 }
48 
49 
50 void
52  myClusterID = id;
53 }
54 
55 
56 bool
58  return myClusterID > 0;
59 }
60 
61 
62 void
64  for (ContType::iterator i = myDict.begin(); i != myDict.end(); i++) {
65  (*i)->computeBounding();
66  }
67 }
68 
69 
70 const Boundary&
72  return *myBoundary;
73 }
74 
75 
76 
77 /****************************************************************************/
78 
AbstractPoly
Definition: AbstractPoly.h:36
NIVissimBoundedClusterObject::myClusterID
int myClusterID
Definition: NIVissimBoundedClusterObject.h:56
Boundary.h
NIVissimBoundedClusterObject::NIVissimBoundedClusterObject
NIVissimBoundedClusterObject()
Definition: NIVissimBoundedClusterObject.cpp:31
NIVissimBoundedClusterObject::~NIVissimBoundedClusterObject
virtual ~NIVissimBoundedClusterObject()
Definition: NIVissimBoundedClusterObject.cpp:37
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:125
NIVissimBoundedClusterObject::ContType
std::set< NIVissimBoundedClusterObject * > ContType
Definition: NIVissimBoundedClusterObject.h:53
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
NIVissimBoundedClusterObject::clustered
bool clustered() const
Definition: NIVissimBoundedClusterObject.cpp:57
NIVissimBoundedClusterObject.h
NIVissimBoundedClusterObject::crosses
bool crosses(const AbstractPoly &poly, double offset=0) const
Definition: NIVissimBoundedClusterObject.cpp:43
NIVissimBoundedClusterObject::myBoundary
Boundary * myBoundary
Definition: NIVissimBoundedClusterObject.h:55
NIVissimBoundedClusterObject::closeLoading
static void closeLoading()
Definition: NIVissimBoundedClusterObject.cpp:63
NIVissimBoundedClusterObject::inCluster
void inCluster(int id)
Definition: NIVissimBoundedClusterObject.cpp:51
NIVissimBoundedClusterObject::myDict
static ContType myDict
Definition: NIVissimBoundedClusterObject.h:54
config.h
NIVissimBoundedClusterObject::getBoundary
const Boundary & getBoundary() const
Definition: NIVissimBoundedClusterObject.cpp:71
Boundary::overlapsWith
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
Definition: Boundary.cpp:182