14 #include "cmake_config.h"
17 #include <spatialindex/SpatialIndex.h>
66 v3s16 minedge,
v3s16 maxedge,
bool accept_overlap) = 0;
103 static void cacheMiss(
void *data,
const v3s16 &mpos, std::vector<Area *> *dest);
119 v3s16 minedge,
v3s16 maxedge,
bool accept_overlap);
139 v3s16 minedge,
v3s16 maxedge,
bool accept_overlap);
145 SpatialIndex::ISpatialIndex *
m_tree =
nullptr;
156 virtual void visitNode(
const SpatialIndex::INode &in) {}
160 u32
id = in.getIdentifier();
167 virtual void visitData(std::vector<const SpatialIndex::IData *> &v)
169 for (
size_t i = 0; i < v.size(); i++)
Definition areastore.h:36
AreaMap areas_map
Definition areastore.h:99
AreaStore()
Definition areastore.h:38
virtual void reserve(size_t count)
Definition areastore.h:46
virtual void getAreasForPosImpl(std::vector< Area * > *result, v3s16 pos)=0
Implementation of getAreasForPos.
void setCacheParams(bool enabled, u8 block_radius, size_t limit)
Sets cache parameters.
Definition areastore.cpp:124
static void cacheMiss(void *data, const v3s16 &mpos, std::vector< Area * > *dest)
Called by the cache when a value isn't found in the cache.
Definition areastore.cpp:132
void getAreasForPos(std::vector< Area * > *result, v3s16 pos)
Finds areas that the passed position is contained in.
Definition areastore.cpp:153
u32 getNextId() const
Returns the next area ID and increments it.
Definition areastore.cpp:111
static AreaStore * getOptimalImplementation()
Definition areastore.cpp:33
virtual ~AreaStore()=default
std::map< u32, Area > AreaMap
Definition areastore.h:98
virtual bool insertArea(Area *a)=0
Add an area to the store.
const Area * getArea(u32 id) const
Returns a pointer to the area coresponding to the passed ID, or NULL if it doesn't exist.
Definition areastore.cpp:42
LRUCache< v3s16, std::vector< Area * > > m_res_cache
Definition areastore.h:109
virtual bool removeArea(u32 id)=0
Removes an area from the store by ID.
void serialize(std::ostream &is) const
Serializes the store's areas to a binary ostream.
Definition areastore.cpp:50
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 deserialize(std::istream &is)
Deserializes the Areas from a binary istream.
Definition areastore.cpp:74
u8 m_cacheblock_radius
Range, in nodes, of the getAreasForPos cache.
Definition areastore.h:108
void invalidateCache()
Invalidates the getAreasForPos cache.
Definition areastore.cpp:104
size_t size() const
Definition areastore.h:47
bool m_cache_enabled
Definition areastore.h:105
Definition container.h:249
Definition areastore.h:148
~VectorResultVisitor()
Definition areastore.h:154
virtual void visitData(const SpatialIndex::IData &in)
Definition areastore.h:158
virtual void visitNode(const SpatialIndex::INode &in)
Definition areastore.h:156
VectorResultVisitor(std::vector< Area * > *result, SpatialAreaStore *store)
Definition areastore.h:150
virtual void visitData(std::vector< const SpatialIndex::IData * > &v)
Definition areastore.h:167
SpatialAreaStore * m_store
Definition areastore.h:174
std::vector< Area * > * m_result
Definition areastore.h:175
Definition areastore.h:131
SpatialIndex::ISpatialIndex * m_tree
Definition areastore.h:145
virtual bool removeArea(u32 id)
Removes an area from the store by ID.
Definition areastore.cpp:259
virtual ~SpatialAreaStore()
Definition areastore.cpp:292
virtual void getAreasForPosImpl(std::vector< Area * > *result, v3s16 pos)
Implementation of getAreasForPos.
Definition areastore.cpp:274
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.
Definition areastore.cpp:280
virtual bool insertArea(Area *a)
Add an area to the store.
Definition areastore.cpp:247
SpatialIndex::IStorageManager * m_storagemanager
Definition areastore.h:146
SpatialAreaStore()
Definition areastore.cpp:298
Definition areastore.h:113
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.
Definition areastore.cpp:217
virtual bool insertArea(Area *a)
Add an area to the store.
Definition areastore.cpp:177
virtual void getAreasForPosImpl(std::vector< Area * > *result, v3s16 pos)
Implementation of getAreasForPos.
Definition areastore.cpp:208
virtual void reserve(size_t count)
Definition areastore.h:115
virtual bool removeArea(u32 id)
Removes an area from the store by ID.
Definition areastore.cpp:190
std::vector< Area * > m_areas
Definition areastore.h:125
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
#define U32_MAX
Definition irrlichttypes.h:23
void sortBoxVerticies(core::vector3d< T > &p1, core::vector3d< T > &p2)
Definition numeric.h:118
Definition areastore.h:21
v3s16 maxedge
Definition areastore.h:31
u32 id
Definition areastore.h:30
Area(u32 area_id)
Definition areastore.h:22
std::string data
Definition areastore.h:32
Area(const v3s16 &mine, const v3s16 &maxe, u32 area_id=U32_MAX)
Definition areastore.h:24
v3s16 minedge
Definition areastore.h:31