9 #ifndef GlobeEngine_CullableSpatialKey_H
10 #define GlobeEngine_CullableSpatialKey_H
107 void setInitial(
short _lod,
unsigned int _x,
unsigned int _y) {
116 this->
setLod(_copy->getLod());
117 this->
coord[0] = _copy->getX();
118 this->coord[1] = _copy->getY();
122 this->
loaded = _copy->loaded;
123 this->
removed = _copy->removed;
124 this->parent = _copy->parent;
125 for(
int i=0;i<4;i++){
126 this->childs[i] = _copy->childs[i];
138 this->childs[_idx] = std::make_shared<CullableSpatialKey2<T> >(this->
lod+1,this->
coord[0]*2, this->coord[1]*2);
141 this->childs[_idx] = std::make_shared<CullableSpatialKey2<T> >(this->
lod+1,this->
coord[0]*2 + 1, this->coord[1]*2);
144 this->childs[_idx] = std::make_shared<CullableSpatialKey2<T> >(this->
lod+1,this->
coord[0]*2, this->coord[1]*2 + 1);
147 this->childs[_idx] = std::make_shared<CullableSpatialKey2<T> >(this->
lod+1,this->
coord[0]*2 + 1, this->coord[1]*2 + 1);
150 std::cout <<
"Child key request out of range" << std::endl;
163 double powOfDiff =
pow(2.0f, _key->getLod() - this->
getLod());
165 for (
int i = 0; i < 2; i++){
166 keysProj[i] = this->
getCoord()[i] * powOfDiff;
168 int sidelenghtOfChild = (
int)(powOfDiff / 2.0f);
169 if (keysProj[0] <= _key->getX() && _key->getX() < keysProj[0] + sidelenghtOfChild) {
170 if (keysProj[1] <= _key->getY() && _key->getY() < keysProj[1] + sidelenghtOfChild) {
178 if (keysProj[1] <= _key->getY() && _key->getY() < keysProj[1] + sidelenghtOfChild) {
201 if(this->
lod != _other.
lod)
202 return this->
lod < _other.
lod;
219 std::shared_ptr< CullableSpatialKey2<T> > parent;
220 std::shared_ptr< CullableSpatialKey2<T> > childs[4];
233 template <
typename T>
235 const std::shared_ptr<T>& rhs)
const {
236 return (*lhs) < (*rhs);
bool isFarFromViewFrustum() const
Definition: CullableSpatialKey.h:59
int getChildKeyInDirectionTo(std::shared_ptr< CullableSpatialKey2< T > > _key)
Definition: CullableSpatialKey.h:158
std::set< std::shared_ptr< geSpatial::CullableSpatialKey >, geSpatial::CullableSpatialKeyComp >::iterator CullableSpatialKeySetIterator
Definition: CullableSpatialKey.h:241
bool operator<(const CullableSpatialKey2 &_other) const
Definition: CullableSpatialKey.h:190
CullableSpatialKey2(short _lod, unsigned int _x, unsigned int _y)
Definition: CullableSpatialKey.h:103
bool operator==(const CullableSpatialKey2 &other) const
Definition: CullableSpatialKey.h:209
void isRemoved(bool _in)
Definition: CullableSpatialKey.h:45
short lod
Definition: SpatialKey.h:57
short getLod() const
Definition: SpatialKey.h:33
void isRequestabilityTested(bool _in)
Definition: CullableSpatialKey.h:49
void isFarFromViewFrustum(bool _in)
Definition: CullableSpatialKey.h:57
void setX(unsigned int _in)
Definition: CullableSpatialKey.h:214
expr pow(half base, half exp)
Definition: Half.h:2231
CullableSpatialKey2< unsigned char > CullableSpatialKey2ub
Definition: CullableSpatialKey.h:224
typedef int(CALL_CONVENTION *func_type_com_asprise_ocr_setup)(bool)
void clearCullability()
Definition: CullableSpatialKey.h:27
Definition: CullableSpatialKey.h:92
std::set< std::shared_ptr< geSpatial::CullableSpatialKey >, geSpatial::CullableSpatialKeyComp > CullableSpatialKeySet
Definition: CullableSpatialKey.h:240
CullableSpatialKey2< unsigned int > CullableSpatialKey2ui
Definition: CullableSpatialKey.h:228
bool isInViewFrustum() const
Definition: CullableSpatialKey.h:55
T coord[D]
Definition: SpatialKey.h:58
bool isRequestabilityTested() const
Definition: CullableSpatialKey.h:51
double cameraDistance
Definition: CullableSpatialKey.h:82
void setLod(short _in)
Definition: SpatialKey.h:34
CullableSpatialKey2(short _lod)
Definition: CullableSpatialKey.h:99
void isLoaded(bool _in)
Definition: CullableSpatialKey.h:41
std::shared_ptr< CullableSpatialKey2< T > > getParentKey()
Definition: CullableSpatialKey.h:130
CullableSpatialKey2< int > CullableSpatialKey2i
Definition: CullableSpatialKey.h:227
bool farFromViewFrustum
Definition: CullableSpatialKey.h:80
bool operator()(const std::shared_ptr< T > &lhs, const std::shared_ptr< T > &rhs) const
Definition: CullableSpatialKey.h:234
CullableSpatialKey2ui CullableSpatialKey
Definition: CullableSpatialKey.h:230
bool loaded
Definition: CullableSpatialKey.h:73
void isRequestable(bool _in)
Definition: CullableSpatialKey.h:37
void setInitial(short _lod, unsigned int _x, unsigned int _y)
Definition: CullableSpatialKey.h:107
std::shared_ptr< CullableSpatialKey2< T > > getChildKey(int _idx)
Definition: CullableSpatialKey.h:134
bool isRequestable() const
Definition: CullableSpatialKey.h:39
CullableSpatialKey2(const std::shared_ptr< CullableSpatialKey2 > _copy)
Definition: CullableSpatialKey.h:115
Definition: SpatialKey.h:17
void isInViewFrustum(bool _in)
Definition: CullableSpatialKey.h:53
Definition: CullableSpatialKey.h:24
bool requestable
Definition: CullableSpatialKey.h:70
const T * getCoord() const
Definition: SpatialKey.h:36
bool isLoaded() const
Definition: CullableSpatialKey.h:43
bool inViewFrustum
Definition: CullableSpatialKey.h:79
void setDistanceToCamera(double _in)
Definition: CullableSpatialKey.h:61
double getDistanceToCamera() const
Definition: CullableSpatialKey.h:63
CullableSpatialKey2()
Definition: CullableSpatialKey.h:95
CullableSpatialKey2< char > CullableSpatialKey2b
Definition: CullableSpatialKey.h:223
bool isRemoved() const
Definition: CullableSpatialKey.h:47
CullableSpatialKey2< short > CullableSpatialKey2s
Definition: CullableSpatialKey.h:225
bool removed
Definition: CullableSpatialKey.h:76
void setY(unsigned int _in)
Definition: CullableSpatialKey.h:216
CullableSpatialKey2< unsigned short > CullableSpatialKey2us
Definition: CullableSpatialKey.h:226
bool requestabilityTested
Definition: CullableSpatialKey.h:67
Definition: CullableSpatialKey.h:232
int getChildIdxInDirectionTo(std::shared_ptr< CullableSpatialKey2< T > > _key)
Definition: CullableSpatialKey.h:162
unsigned int getX()
Definition: CullableSpatialKey.h:213
unsigned int getY()
Definition: CullableSpatialKey.h:215