/usr/include/geos/index/quadtree/NodeBase.h is in libgeos-dev 3.2.2-3ubuntu1.
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 | /**********************************************************************
* $Id: NodeBase.h 2556 2009-06-06 22:22:28Z strk $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: index/quadtree/NodeBase.java rev 1.9 (JTS-1.10)
*
**********************************************************************/
#ifndef GEOS_IDX_QUADTREE_NODEBASE_H
#define GEOS_IDX_QUADTREE_NODEBASE_H
#include <geos/export.h>
#include <vector>
#include <string>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class Envelope;
}
namespace index {
class ItemVisitor;
namespace quadtree {
class Node;
}
}
}
namespace geos {
namespace index { // geos::index
namespace quadtree { // geos::index::quadtree
/**
* \brief
* The base class for nodes in a Quadtree.
*
*/
class GEOS_DLL NodeBase {
private:
void visitItems(const geom::Envelope* searchEnv,
ItemVisitor& visitor);
public:
static int getSubnodeIndex(const geom::Envelope *env,
const geom::Coordinate& centre);
NodeBase();
virtual ~NodeBase();
std::vector<void*>& getItems();
/// Add an item to this node.
/// Ownership of the item is left to caller.
void add(void* item);
/// Push all node items to the given vector, return the argument
std::vector<void*>& addAllItems(std::vector<void*>& resultItems) const;
virtual void addAllItemsFromOverlapping(const geom::Envelope& searchEnv,
std::vector<void*>& resultItems) const;
unsigned int depth() const;
unsigned int size() const;
unsigned int getNodeCount() const;
virtual std::string toString() const;
virtual void visit(const geom::Envelope* searchEnv, ItemVisitor& visitor);
/**
* Removes a single item from this subtree.
*
* @param searchEnv the envelope containing the item
* @param item the item to remove
* @return <code>true</code> if the item was found and removed
*/
bool remove(const geom::Envelope* itemEnv, void* item);
bool hasItems() const;
bool hasChildren() const;
bool isPrunable() const;
protected:
/// Actual items are NOT owned by this class
std::vector<void*> items;
/**
* subquads are numbered as follows:
* <pre>
* 2 | 3
* --+--
* 0 | 1
* </pre>
*
* Nodes are owned by this class
*/
Node* subnode[4];
virtual bool isSearchMatch(const geom::Envelope& searchEnv) const=0;
};
// INLINES, To be moved in NodeBase.inl
inline bool
NodeBase::hasChildren() const
{
for (int i = 0; i < 4; i++)
if (subnode[i]) return true;
return false;
}
inline bool
NodeBase::isPrunable() const
{
return ! (hasChildren() || hasItems());
}
inline bool
NodeBase::hasItems() const
{
return ! items.empty();
}
} // namespace geos::index::quadtree
} // namespace geos::index
} // namespace geos
#endif // GEOS_IDX_QUADTREE_NODEBASE_H
/**********************************************************************
* $Log$
* Revision 1.1 2006/03/22 12:22:50 strk
* indexQuadtree.h split
*
**********************************************************************/
|