Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
SpatialAreaStore Class Reference

#include <areastore.h>

+ Inheritance diagram for SpatialAreaStore:
+ Collaboration diagram for SpatialAreaStore:

Classes

class  VectorResultVisitor
 

Public Member Functions

 SpatialAreaStore ()
 
virtual ~SpatialAreaStore ()
 
virtual bool insertArea (Area *a)
 Add an area to the store.
 
virtual bool removeArea (u32 id)
 Removes an area from the store by ID.
 
virtual void getAreasInArea (std::vector< Area * > *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap)
 Finds areas that are completely contained inside the area defined by the passed edges.
 
- Public Member Functions inherited from AreaStore
 AreaStore ()
 
virtual ~AreaStore ()=default
 
virtual void reserve (size_t count)
 
size_t size () const
 
virtual bool insertArea (Area *a)=0
 Add an area to the store.
 
virtual bool removeArea (u32 id)=0
 Removes an area from the store by ID.
 
void getAreasForPos (std::vector< Area * > *result, v3s16 pos)
 Finds areas that the passed position is contained in.
 
virtual void getAreasInArea (std::vector< Area * > *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap)=0
 Finds areas that are completely contained inside the area defined by the passed edges.
 
void setCacheParams (bool enabled, u8 block_radius, size_t limit)
 Sets cache parameters.
 
const AreagetArea (u32 id) const
 Returns a pointer to the area coresponding to the passed ID, or NULL if it doesn't exist.
 
void serialize (std::ostream &is) const
 Serializes the store's areas to a binary ostream.
 
void deserialize (std::istream &is)
 Deserializes the Areas from a binary istream.
 

Protected Member Functions

virtual void getAreasForPosImpl (std::vector< Area * > *result, v3s16 pos)
 Implementation of getAreasForPos.
 
- Protected Member Functions inherited from AreaStore
void invalidateCache ()
 Invalidates the getAreasForPos cache.
 
virtual void getAreasForPosImpl (std::vector< Area * > *result, v3s16 pos)=0
 Implementation of getAreasForPos.
 
u32 getNextId () const
 Returns the next area ID and increments it.
 

Private Attributes

SpatialIndex::ISpatialIndex * m_tree = nullptr
 
SpatialIndex::IStorageManager * m_storagemanager = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from AreaStore
static AreaStoregetOptimalImplementation ()
 
- Protected Types inherited from AreaStore
typedef std::map< u32, AreaAreaMap
 
- Protected Attributes inherited from AreaStore
AreaMap areas_map
 

Constructor & Destructor Documentation

◆ SpatialAreaStore()

SpatialAreaStore::SpatialAreaStore ( )

References m_storagemanager, and m_tree.

◆ ~SpatialAreaStore()

SpatialAreaStore::~SpatialAreaStore ( )
virtual

References m_storagemanager, and m_tree.

Member Function Documentation

◆ getAreasForPosImpl()

void SpatialAreaStore::getAreasForPosImpl ( std::vector< Area * > *  result,
v3s16  pos 
)
protectedvirtual

Implementation of getAreasForPos.

getAreasForPos calls this if the cache is disabled.

Implements AreaStore.

References get_spatial_point(), and m_tree.

+ Here is the call graph for this function:

◆ getAreasInArea()

void SpatialAreaStore::getAreasInArea ( std::vector< Area * > *  result,
v3s16  minedge,
v3s16  maxedge,
bool  accept_overlap 
)
virtual

Finds areas that are completely contained inside the area defined by the passed edges.

If accept_overlap is true this finds any areas that intersect with the passed area at any point.

Implements AreaStore.

References get_spatial_region(), and m_tree.

+ Here is the call graph for this function:

◆ insertArea()

bool SpatialAreaStore::insertArea ( Area a)
virtual

Add an area to the store.

Updates the area's ID if it hasn't already been set.

Returns
Whether the area insertion was successful.

Implements AreaStore.

References AreaStore::areas_map, get_spatial_region(), AreaStore::getNextId(), Area::id, AreaStore::invalidateCache(), m_tree, Area::maxedge, Area::minedge, and U32_MAX.

+ Here is the call graph for this function:

◆ removeArea()

bool SpatialAreaStore::removeArea ( u32  id)
virtual

Removes an area from the store by ID.

Returns
Whether the area was in the store and removed.

Implements AreaStore.

References AreaStore::areas_map, get_spatial_region(), AreaStore::invalidateCache(), m_tree, Area::maxedge, and Area::minedge.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_storagemanager

SpatialIndex::IStorageManager* SpatialAreaStore::m_storagemanager = nullptr
private

◆ m_tree

SpatialIndex::ISpatialIndex* SpatialAreaStore::m_tree = nullptr
private

The documentation for this class was generated from the following files: