5 #ifndef VMML_ArrayTreeNode_h
6 #define VMML_ArrayTreeNode_h
13 template <
short TREESIZE,
class KEYTYPE,
short HALFTREESIZE>
19 this->
key = std::make_shared< KEYTYPE >();
24 this->
key = std::move(_key);
28 this->
key = std::make_shared< KEYTYPE >();
39 key = std::move(_key);
55 void setChildByKey(std::shared_ptr< KEYTYPE >
const& _key,
int _childid)
58 if(this->
key->getX()*2 == _key->getX()){
59 if(this->
key->getY()*2 == _key->getY()){
65 if(this->
key->getY()*2 == _key->getY()){
74 double powOfDiff =
pow(2.0f, _key->getLod() - this->
key->getLod());
75 int nodesProj[HALFTREESIZE];
76 for (
int i = 0; i < HALFTREESIZE; i++){
77 nodesProj[i] = this->
key->getCoord()[i] * powOfDiff;
79 int sidelenghtOfChild = (
int)(powOfDiff / 2.0f);
80 if (nodesProj[0] <= _key->getX() && _key->getX() < nodesProj[0] + sidelenghtOfChild) {
81 if (nodesProj[1] <= _key->getY() && _key->getY() < nodesProj[1] + sidelenghtOfChild) {
89 if (nodesProj[1] <= _key->getY() && _key->getY() < nodesProj[1] + sidelenghtOfChild) {
99 this->
key->setLod(_lod);
109 inline std::shared_ptr< KEYTYPE >
const&
getKey()
const{
113 inline void setKey(std::shared_ptr< KEYTYPE > _key){
114 this->
key = std::move(_key);
126 inline int getUID()
const {
return uid; }
127 inline void setUID(
int _uid) { uid = _uid; }
131 for (
int i = 0; i<TREESIZE; i++){
136 std::cout <<
"there is a problem with the nodeids while delete" << std::endl;
151 for (
int i = 0; i<TREESIZE; i++){
157 std::cout << this->uid <<
" | ";
158 std::cout << *this->
key <<
" | ";
159 std::cout << this->parent <<
" | ";
160 std::cout << this->parentID <<
" | ";
162 for (
int i = 1; i<TREESIZE; i++){
170 std::shared_ptr< KEYTYPE >
key;
void setChildByKey(std::shared_ptr< KEYTYPE > const &_key, int _childid)
Definition: ArrayTreeNode.h:55
void print()
Definition: ArrayTreeNode.h:156
expr pow(half base, half exp)
Definition: Half.h:2231
void setKey(std::shared_ptr< KEYTYPE > _key)
Definition: ArrayTreeNode.h:113
Definition: AvalancheTrainingSimulationEngine.h:39
Definition: ArrayTree.h:13
void setUID(int _uid)
Definition: ArrayTreeNode.h:127
void setLod(short _lod)
Definition: ArrayTreeNode.h:98
ArrayTreeNode< 2, geSpatial::BinaryTreeKey, 1 > ArrayBinTreeNode
Definition: ArrayTreeNode.h:179
typedef int(CALL_CONVENTION *func_type_com_asprise_ocr_setup)(bool)
int getParentID() const
Definition: ArrayTreeNode.h:146
std::shared_ptr< KEYTYPE > const & getKey() const
Definition: ArrayTreeNode.h:109
int children[TREESIZE]
Definition: ArrayTreeNode.h:169
void setBasic(int _uid, int _parent)
Definition: ArrayTreeNode.h:102
void setParentID(int _parent)
Definition: ArrayTreeNode.h:145
ArrayTreeNode< 4, geSpatial::CullableSpatialKey, 2 > ArrayQuadTreeNode
Definition: ArrayTreeNode.h:178
std::shared_ptr< KEYTYPE > key
Definition: ArrayTreeNode.h:170
ArrayTree< ArrayBinTreeNode > ArrayBinTree
Definition: ArrayTreeNode.h:182
void setArrayNodeProperties(int _uid, std::shared_ptr< KEYTYPE > _key, int _parent, bool _isParent)
Definition: ArrayTreeNode.h:37
ArrayTreeNode(int _uid, short _lod, int _parent)
Definition: ArrayTreeNode.h:26
void setArrayNodeProperties(int _uid, short _lod, int _parent, bool _isParent)
Definition: ArrayTreeNode.h:42
Definition: ArrayTreeNode.h:14
bool isParent() const
Definition: ArrayTreeNode.h:141
ArrayTreeNode(int _uid, std::shared_ptr< KEYTYPE > _key, int _parent)
Definition: ArrayTreeNode.h:22
void setArrayNodeProperties(int _uid, int _parent, bool _isParent)
Definition: ArrayTreeNode.h:47
void clear()
Definition: ArrayTreeNode.h:33
~ArrayTreeNode()
Definition: ArrayTreeNode.h:31
void setChildIdx(short _childIdx, int _idx)
Definition: ArrayTreeNode.h:129
int getUID() const
Definition: ArrayTreeNode.h:126
void isParent(bool _input)
Definition: ArrayTreeNode.h:142
int locateKeyInChild(std::shared_ptr< KEYTYPE > const &_key)
Definition: ArrayTreeNode.h:73
void clearChildIndices()
Definition: ArrayTreeNode.h:150
const int getChildIdx(short _childIdx) const
Definition: ArrayTreeNode.h:128
ArrayTreeNode(int _uid=-1, int _parent=-1)
Definition: ArrayTreeNode.h:18
ArrayTree< ArrayQuadTreeNode > ArrayQuadTree
Definition: ArrayTreeNode.h:181
const int * getChildren() const
Definition: ArrayTreeNode.h:148
void repairChildIdx(int _nodeid)
Definition: ArrayTreeNode.h:130