33#define GUI_RTREE_QUAL RTree<GUIGlObject*, GUIGlObject, float, 2, GUIVisualizationSettings>
38inline float GUI_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
40 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
41 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
42 return .78539816f * (extent0 * extent0 + extent1 * extent1);
46inline GUI_RTREE_QUAL::Rect GUI_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
47 ASSERT(a_rectA && a_rectB);
49 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
50 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
51 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
52 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
79 WRITE_ERROR(
"Mutex of SUMORTree is locked during call of the destructor");
91 virtual void Insert(
const float a_min[2],
const float a_max[2],
GUIGlObject*
const & a_dataId) {
92 FXMutexLock locker(
myLock);
93 GUI_RTREE_QUAL::Insert(a_min, a_max, a_dataId);
102 virtual void Remove(
const float a_min[2],
const float a_max[2],
GUIGlObject*
const & a_dataId) {
103 FXMutexLock locker(
myLock);
104 GUI_RTREE_QUAL::Remove(a_min, a_max, a_dataId);
117 FXMutexLock locker(
myLock);
118 return GUI_RTREE_QUAL::Search(a_min, a_max, c);
127 throw ProcessError(
"Mutex of SUMORTree is locked before object insertion");
130 FXMutexLock locker(
myLock);
134 if (exaggeration > 1) {
135 b.
scale(exaggeration);
152 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
153 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
165 throw ProcessError(
"Mutex of SUMORTree is locked before object remove");
168 FXMutexLock locker(
myLock);
172 if (exaggeration > 1) {
173 b.
scale(exaggeration);
193 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
194 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
203 std::vector<GUIGlObject*> glObjects;
206 GUI_RTREE_QUAL::Iterator it;
209 while (!IsNull(it)) {
210 const auto glType = (*it)->getType();
211 if ((glType == type) ||
214 glObjects.push_back(*it);
219 for (
const auto &glObject : glObjects) {
242 if (it->first == obj) {
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_ADDITIONALELEMENT
reserved GLO type for packing all additionals elements
@ GLO_SHAPE
reserved GLO type to pack shapes
@ GLO_LOCKICON
Lock icon (used in netedit)
#define WRITE_GLDEBUG(msg)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
bool isInitialised() const
check if Boundary is Initialised
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
double getHeight() const
Returns the height of the boundary (y-axis)
double getWidth() const
Returns the width of the boudary (x-axis)
Boundary & scale(double by)
scale the boundary by the given amount
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual Boundary getCenteringBoundary() const =0
const std::string & getFullName() const
Stores the information about how to visualize structures.
static bool writeDebugGLMessages()
check whether to enable/disable gl-debug messages
A RT-tree for efficient storing of SUMO's GL-objects.
void updateBoundaries(GUIGlObjectType type)
update boundaries
void addAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Adds an additional object (detector/shape/trigger) for visualisation.
int myTreeSize
number of inserted elements
virtual void Remove(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Remove entry.
std::map< GUIGlObject *, Boundary > myTreeDebug
Map only used for check that SUMORTree works as expected, only is used if option "gui-testing-debug-g...
virtual void Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry.
void removeAdditionalGLObject(GUIGlObject *o, const double exaggeration=1)
Removes an additional object (detector/shape/trigger) from being visualised.
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
FXMutex myLock
A mutex avoiding parallel change and traversal of the tree.
virtual ~SUMORTree()
Destructor.
bool removeObjectFromTreeDebug(const GUIGlObject *obj)
remove object from TreeDebug
static const std::string format(const std::string &format, T value, Targs... Fargs)
adds a new formatted message