21 #include <unordered_map>
39 typedef std::unordered_multimap<BorderID,object*, BorderIDHasher>
BorderID2Object;
100 if(it->first.m_first.distance(checkCoord)>=distance
101 && it->first.m_last.distance(checkCoord) >= distance)
120 template <
typename T>
127 if(it->first.m_first.distance(checkCoord)>=distance
128 && it->first.m_last.distance(checkCoord) >= distance)
131 removedObjects.push_back(*(
dynamic_cast<T*
>((*it).second)));
147 void insert_object(
object* obj,
bool remove_duplicates=
false,
double precision=0.5)
149 if(remove_duplicates)
164 if((std::abs)(it.first->second->getLanePosition().m_progress-position.
m_progress)<precision)
180 for(
auto it = borderSet.begin();it!=borderSet.end();it++)
182 for(
auto it2 =
borderId2Object.equal_range((*it)->m_id);it2.first!=it2.second;)
196 for(
auto it = borderIDSet.begin();it!=borderIDSet.end();it++)
198 for(
auto it2 =
borderId2Object.equal_range(*it);it2.first!=it2.second;)
247 std::vector<object*> result;
287 auto bid = it->first;
290 if(bid.m_first.distance(center)>radius
291 && bid.m_last.distance(center)>radius)
Abstract class for Objects that are positioned by a connection to a certain lane.
Definition: alanepositionedobject.h:28
virtual const LanePosition & getLanePosition()=0
Get the LanePosition of the Object.
efficiently store borders in boost R-tree
Definition: borderset.h:99
bool hasBorder(const BorderID &id) const
check whether a border exists in the set
Definition: borderset.h:966
This class represents a set of objects that are positioned by LanePosition.
Definition: lanepositionedobjectset.h:34
void discard_distant_objects(double x, double y, double distance=100.0)
Discard distant objects.
Definition: lanepositionedobjectset.h:94
BorderID2Object borderId2Object
Definition: lanepositionedobjectset.h:43
void discard_distant_objects(double x, double y, std::vector< T > &removedObjects, double distance=100.0)
Discard distant objects.
Definition: lanepositionedobjectset.h:121
ObjectIteratorPair getAllObjects()
Get the begin()- and end()-iterator for the whole set.
Definition: lanepositionedobjectset.h:224
void eraseObjectsBorderBased(const std::vector< Border * > borderSet)
Erase Objects that are positioned on certain borders.
Definition: lanepositionedobjectset.h:178
void insert_object(object *obj, bool remove_duplicates=false, double precision=0.5)
Insert a new object.
Definition: lanepositionedobjectset.h:147
bool m_isOwner
Definition: lanepositionedobjectset.h:44
virtual ~LanePositionedObjectSet()
Destroy the LanePositionedObjectSet object.
Definition: lanepositionedobjectset.h:59
void eraseObjectsBorderBased(const std::vector< BorderID > borderIDSet)
Erase Objects that are positioned on certain borders given by their BorderIDs.
Definition: lanepositionedobjectset.h:194
BorderID2Object::iterator ObjectIterator
Definition: lanepositionedobjectset.h:40
ObjectIteratorPair getObjects(const BorderID &borderID)
Get the begin()- and end()-iterator for objects that are positioned on a certain border.
Definition: lanepositionedobjectset.h:234
std::unordered_multimap< BorderID, object *, BorderIDHasher > BorderID2Object
Definition: lanepositionedobjectset.h:39
LanePositionedObjectSet()
Construct a new LanePositionedObjectSet object.
Definition: lanepositionedobjectset.h:51
void erase_objectsWithUnknownBordersOutsideRadius(BorderSet *borderSet, Coordinate center, double radius)
Erase objects that are positioned that are outside a specified circle.
Definition: lanepositionedobjectset.h:283
bool hasObjects(const BorderID &borderID)
Check whether at least one object is contained that is positioned on a certain Border.
Definition: lanepositionedobjectset.h:212
bool hasObjects(const LanePosition &position, double precision=0.5)
Check whether the set holds at least one object on a certain LanePosition.
Definition: lanepositionedobjectset.h:265
void setIsOwner(bool isOwner)
Set the owner flag.
Definition: lanepositionedobjectset.h:68
std::pair< ObjectIterator, ObjectIterator > ObjectIteratorPair
Definition: lanepositionedobjectset.h:41
std::vector< object * > getObjects(const LanePosition &position, double precision=0.5)
Get the objects that are positioned on a certain LanePosition.
Definition: lanepositionedobjectset.h:245
void clear()
Clear the LanePositionedObjectSet.
Definition: lanepositionedobjectset.h:76
void erase_object(const LanePosition &position, double precision=0.5)
Erase objects on a certain LanePosition.
Definition: lanepositionedobjectset.h:160
ALanePositionedObject object
Definition: lanepositionedobjectset.h:38
x
Definition: adore_set_goal.py:30
y
Definition: adore_set_goal.py:31
Definition: areaofeffectconverter.h:20
This struct identifies a Border by the coordinates of the starting and the end point.
Definition: borderid.h:31
This struct represents 3-dimensional coordines.
Definition: coordinate.h:34
This is a struct that contains a position defined by a BorderID and a progress on that border.
Definition: laneposition.h:30
double m_progress
Definition: laneposition.h:32
BorderID m_rightID
Definition: laneposition.h:31
pair of iterators to iterate from first iterator till second iterator is reached
Definition: borderset.h:46
T1 first
Definition: borderset.h:47
T2 second
Definition: borderset.h:48