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