/usr/include/ossim/base/ossimQuadTreeWarp.h is in libossim-dev 1.7.21-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | //*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts
//
//*************************************************************************
// $Id: ossimQuadTreeWarp.h 14799 2009-06-30 08:54:44Z dburken $
#ifndef ossimQuadTreeWarp_HEADER
#define ossimQuadTreeWarp_HEADER
#include <ossim/base/ossimDpt.h>
#include <ossim/base/ossimDrect.h>
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/base/ossimKeywordNames.h>
#include <ossim/base/ossim2dTo2dTransform.h>
#include <vector>
#include <iosfwd>
class ossimQuadTreeWarpNode;
class OSSIMDLLEXPORT ossimQuadTreeWarpVertex
{
public:
friend std::ostream& operator<<(std::ostream& out,
const ossimQuadTreeWarpVertex& rhs);
ossimQuadTreeWarpVertex(const ossimDpt& position=ossimDpt(0,0),
const ossimDpt& delta=ossimDpt(0,0));
~ossimQuadTreeWarpVertex();
void setPosition(const ossimDpt& position);
void setDelta(const ossimDpt& delta);
const ossimDpt& getDelta()const;
const ossimDpt& getPosition()const;
void addSharedNode(ossimQuadTreeWarpNode* node);
void removeNode(ossimQuadTreeWarpNode* node);
bool isShared()const;
bool saveState(ossimKeywordlist& kwl,
const char* prefix)const;
bool loadState(const ossimKeywordlist& kwl,
const char* prefix);
std::vector<ossimQuadTreeWarpNode*> theSharedNodeList;
ossimDpt thePosition;
ossimDpt theDelta;
bool theLockedFlag;
};
class ossimQuadTreeWarpNode
{
public:
friend std::ostream& operator <<(std::ostream& out,
const ossimQuadTreeWarpNode& rhs);
ossimQuadTreeWarpNode();
ossimQuadTreeWarpNode(const ossimDrect& bounds,
ossimQuadTreeWarpNode* parent=NULL,
ossimQuadTreeWarpVertex* ulVertex=(ossimQuadTreeWarpVertex*)NULL,
ossimQuadTreeWarpVertex* urVertex=(ossimQuadTreeWarpVertex*)NULL,
ossimQuadTreeWarpVertex* lrVertex=(ossimQuadTreeWarpVertex*)NULL,
ossimQuadTreeWarpVertex* llVertex=(ossimQuadTreeWarpVertex*)NULL);
~ossimQuadTreeWarpNode();
bool hasValidVertices()const;
void removeVertex(ossimQuadTreeWarpVertex* v);
void removeVertices();
bool isLeaf()const;
void clear();
void removeChild(ossimQuadTreeWarpNode* node);
bool saveState(ossimKeywordlist& kwl,
const char* prefix = 0)const;
bool loadState(const ossimKeywordlist& kwl,
const char* prefix = 0);
ossimDrect theBoundingRect;
ossimQuadTreeWarpVertex* theUlVertex;
ossimQuadTreeWarpVertex* theUrVertex;
ossimQuadTreeWarpVertex* theLrVertex;
ossimQuadTreeWarpVertex* theLlVertex;
ossimQuadTreeWarpNode* theParent;
std::vector<ossimQuadTreeWarpNode*> theChildren;
};
class ossimQuadTreeWarp : public ossim2dTo2dTransform
{
public:
friend std::ostream& operator<<(std::ostream& out,
const ossimQuadTreeWarp& rhs);
ossimQuadTreeWarp();
ossimQuadTreeWarp(const ossimDrect& boundingRect,
const ossimDpt& ulShift=ossimDpt(0,0),
const ossimDpt& urShift=ossimDpt(0,0),
const ossimDpt& lrShift=ossimDpt(0,0),
const ossimDpt& llShift=ossimDpt(0,0));
ossimQuadTreeWarp(const ossimQuadTreeWarp& rhs);
virtual ossimObject* dup()const;
virtual ~ossimQuadTreeWarp();
virtual ossimDpt getOrigin()const;
void create(const ossimDrect& boundingRect,
const ossimDpt& ulShift=ossimDpt(0,0),
const ossimDpt& urShift=ossimDpt(0,0),
const ossimDpt& lrShift=ossimDpt(0,0),
const ossimDpt& llShift=ossimDpt(0,0));
/*!
* Will warp the passed in point and placed the warped value in result
*/
virtual void forward(const ossimDpt& pt,
ossimDpt& result)const;
/*!
* Will warp the passed in point and overwrite it
*/
virtual void forward(ossimDpt& pt)const;
// void inverse(const ossimDpt& input,
// ossimDpt& output) const;
virtual std::ostream& print(std::ostream& out) const;
virtual void printVertices(std::ostream& out)const;
ossimQuadTreeWarpNode* getRoot();
const ossimQuadTreeWarpNode* getRoot()const;
bool isEmpty()const;
ossimQuadTreeWarpVertex* findClosestVertex(ossimDpt& position);
/*!
* This method will go through the tree and try to locate the
* vertex. This is faster sine the tree is sorted. Use
* the getVertex to just search the internal shared vertex list.
*/
ossimQuadTreeWarpVertex* findVertex(const ossimDpt& position);
/*!
* Searches the shared vetex list. This will not go through the tree.
* this is needed for load states to perform correctly.
*/
ossimQuadTreeWarpVertex* getVertex(const ossimDpt& position);
/*!
* Will get the shift or delta value for the passed in pt.
*/
void getShift(ossimDpt& result,
const ossimDpt& pt)const;
/*!
* The initial passed in node must not be a leaf. It will
* turn the passed in node into a leaf by recursively
* pruning its children.
*/
void pruneTree(ossimQuadTreeWarpNode* node);
// Search methods
ossimQuadTreeWarpNode* findNode(const ossimDpt& pt);
const ossimQuadTreeWarpNode* findNode(const ossimDpt& pt)const;
/*!
* Will get the shift or delta value for the passed in pt.
*/
ossimDpt getShift(const ossimDpt& pt)const;
void clear();
void split(const ossimDpt& point,
double splitHoriCoefficient=0.0,
double splitVertCoefficient=0.0);
/*!
* The passed in node is suppose to be a leaf node.
* it splits the leaf node horizontally and vertically
* by the passed in percentage. Use find node to
* find the leaf node of a given point
*/
void split(ossimQuadTreeWarpNode* node,
double splitHoriCoefficient=.5,
double splitVertCoefficient=.5);
const ossimQuadTreeWarpNode* findNode(const ossimQuadTreeWarpNode* node,
const ossimDpt& pt)const;
ossimQuadTreeWarpNode* findNode(ossimQuadTreeWarpNode* node,
const ossimDpt& pt);
void findAllNodes(std::vector<ossimQuadTreeWarpNode*>& result,
const ossimDpt& pt);
void findAllNodes(std::vector<const ossimQuadTreeWarpNode*>& result,
const ossimDpt& pt)const;
void findAllNodes(std::vector<ossimQuadTreeWarpNode*>& result,
ossimQuadTreeWarpNode* node,
const ossimDpt& pt);
void findAllNodes(std::vector<const ossimQuadTreeWarpNode*>& result,
ossimQuadTreeWarpNode* node,
const ossimDpt& pt)const;
bool isOnEdge(ossimQuadTreeWarpNode* node,
const ossimDpt& point)const;
bool isOnPoint(ossimQuadTreeWarpNode* node,
const ossimDpt& point)const;
void updateAllVericeLockFlags();
const std::vector<ossimQuadTreeWarpVertex*>& getVertices()const;
void setWarpEnabledFlag(bool flag);
void setToIdentity();
virtual bool saveState(ossimKeywordlist& kwl,
const char* prefix=0)const;
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix=0);
protected:
bool theWarpEnabledFlag;
ossimQuadTreeWarpNode* theTree;
std::vector<ossimQuadTreeWarpVertex*> theVertexList;
void getShift(ossimDpt& result,
const ossimQuadTreeWarpNode* node,
const ossimDpt& pt)const;
void recursivePruneTree(ossimQuadTreeWarpNode* node);
void pruneSharedVertices();
void removeSharedVertex(ossimQuadTreeWarpVertex* v);
void recursivePrint(std::ostream& out,
ossimQuadTreeWarpNode* node)const;
void recursiveDelete(ossimQuadTreeWarpNode* node);
void getNewQuads(ossimQuadTreeWarpNode* parent,
const ossimDrect& ul,
const ossimDrect& ur,
const ossimDrect& lr,
const ossimDrect& ll,
ossimQuadTreeWarpNode*& ulNode,
ossimQuadTreeWarpNode*& urNode,
ossimQuadTreeWarpNode*& lrNode,
ossimQuadTreeWarpNode*& llNode);
void updateLockFlag(ossimQuadTreeWarpVertex* v);
void updateDelta(ossimQuadTreeWarpVertex* v);
bool recursiveSave(ossimQuadTreeWarpNode* node,
ossimKeywordlist& kwl,
const char* prefix)const;
bool recursiveLoad(ossimQuadTreeWarpNode* node,
const ossimKeywordlist& kwl,
const char* prefix);
// bool resetAllSharedLists();
TYPE_DATA
};
#endif
|