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");
89 virtual void Insert(
const float a_min[2],
const float a_max[2],
GUIGlObject*
const & a_dataId) {
90 FXMutexLock locker(
myLock);
91 GUI_RTREE_QUAL::Insert(a_min, a_max, a_dataId);
100 virtual void Remove(
const float a_min[2],
const float a_max[2],
GUIGlObject*
const & a_dataId) {
101 FXMutexLock locker(
myLock);
102 GUI_RTREE_QUAL::Remove(a_min, a_max, a_dataId);
115 FXMutexLock locker(
myLock);
116 return GUI_RTREE_QUAL::Search(a_min, a_max, c);
125 throw ProcessError(
"Mutex of SUMORTree is locked before object insertion");
128 FXMutexLock locker(
myLock);
132 if (exaggeration > 1) {
133 b.scale(exaggeration);
137 if (!b.isInitialised()) {
139 }
else if ((b.getWidth() == 0) || (b.getHeight() == 0)) {
148 const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
149 const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
161 throw ProcessError(
"Mutex of SUMORTree is locked before object remove");
164 FXMutexLock locker(
myLock);
168 if (exaggeration > 1) {
169 b.scale(exaggeration);
173 if (!b.isInitialised()) {
175 }
else if ((b.getWidth() == 0) || (b.getHeight() == 0)) {
188 const float cmin[2] = {(float) b.xmin(), (float) b.ymin()};
189 const float cmax[2] = {(float) b.xmax(), (float) b.ymax()};
198 std::vector<GUIGlObject*> glObjects;
201 GUI_RTREE_QUAL::Iterator it;
204 while (!IsNull(it)) {
205 const auto glType = (*it)->getType();
206 if ((glType == type) ||
209 glObjects.push_back(*it);
214 for (
const auto &glObject : glObjects) {
237 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).
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Boundary()
Constructor - the boundary is unset.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual Boundary getCenteringBoundary() const =0
Stores the information about how to visualize structures.
static bool writeDebugGLMessages()
check whether to enable/disable gl-debug messages
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