![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include "shapefil.h"#include <math.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include <limits.h>
Go to the source code of this file.
Classes | |
| struct | SHPDiskTreeInfo |
Macros | |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | SHP_SPLIT_RATIO 0.55 |
| #define | STATIC_CAST(type, x) ((type)(x)) |
| #define | REINTERPRET_CAST(type, x) ((type)(x)) |
| #define | CONST_CAST(type, x) ((type)(x)) |
| #define | SHPLIB_NULLPTR NULL |
Functions | |
| static const char * | cvsid_aw () |
| static void * | SfRealloc (void *pMem, int nNewSize) |
| static SHPTreeNode * | SHPTreeNodeCreate (double *padfBoundsMin, double *padfBoundsMax) |
| SHPTree * | SHPCreateTree (SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax) |
| static void | SHPDestroyTreeNode (SHPTreeNode *psTreeNode) |
| void | SHPDestroyTree (SHPTree *psTree) |
| int | SHPCheckBoundsOverlap (double *padfBox1Min, double *padfBox1Max, double *padfBox2Min, double *padfBox2Max, int nDimension) |
| static int | SHPCheckObjectContained (SHPObject *psObject, int nDimension, double *padfBoundsMin, double *padfBoundsMax) |
| static void | SHPTreeSplitBounds (double *padfBoundsMinIn, double *padfBoundsMaxIn, double *padfBoundsMin1, double *padfBoundsMax1, double *padfBoundsMin2, double *padfBoundsMax2) |
| static int | SHPTreeNodeAddShapeId (SHPTreeNode *psTreeNode, SHPObject *psObject, int nMaxDepth, int nDimension) |
| int | SHPTreeAddShapeId (SHPTree *psTree, SHPObject *psObject) |
| static void | SHPTreeCollectShapeIds (SHPTree *hTree, SHPTreeNode *psTreeNode, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount, int *pnMaxShapes, int **ppanShapeList) |
| static int | compare_ints (const void *a, const void *b) |
| int * | SHPTreeFindLikelyShapes (SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount) |
| static int | SHPTreeNodeTrim (SHPTreeNode *psTreeNode) |
| void | SHPTreeTrimExtraNodes (SHPTree *hTree) |
| static void | SwapWord (int length, void *wordP) |
| SHPTreeDiskHandle | SHPOpenDiskTree (const char *pszQIXFilename, SAHooks *psHooks) |
| void | SHPCloseDiskTree (SHPTreeDiskHandle hDiskTree) |
| static int | SHPSearchDiskTreeNode (SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int **ppanResultBuffer, int *pnBufferMax, int *pnResultCount, int bNeedSwap, int nRecLevel) |
| static SAOffset | SHPTreeReadLibc (void *p, SAOffset size, SAOffset nmemb, SAFile file) |
| static SAOffset | SHPTreeSeekLibc (SAFile file, SAOffset offset, int whence) |
| int * | SHPSearchDiskTree (FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount) |
| int * | SHPSearchDiskTreeEx (SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount) |
| static int | SHPGetSubNodeOffset (SHPTreeNode *node) |
| static void | SHPWriteTreeNode (SAFile fp, SHPTreeNode *node, SAHooks *psHooks) |
| int | SHPWriteTree (SHPTree *tree, const char *filename) |
| int | SHPWriteTreeLL (SHPTree *tree, const char *filename, SAHooks *psHooks) |
Variables | |
| static const char | cpl_cvsid [] = "$Id$" |
| static int | bBigEndian = 0 |
|
static |
Definition at line 710 of file shptree.c.
References a, and REINTERPRET_CAST.
Referenced by SHPSearchDiskTreeEx(), and SHPTreeFindLikelyShapes().
|
static |
Definition at line 171 of file shptree.c.
References SHPLIB_NULLPTR.
Referenced by SHPSearchDiskTreeNode(), SHPTreeCollectShapeIds(), and SHPTreeNodeAddShapeId().
| int SHPCheckBoundsOverlap | ( | double * | padfBox1Min, |
| double * | padfBox1Max, | ||
| double * | padfBox2Min, | ||
| double * | padfBox2Max, | ||
| int | nDimension | ||
| ) |
Definition at line 378 of file shptree.c.
Referenced by SHPSearchDiskTreeNode(), and SHPTreeCollectShapeIds().
|
static |
Definition at line 403 of file shptree.c.
References tagSHPObject::dfMMax, tagSHPObject::dfMMin, tagSHPObject::dfXMax, tagSHPObject::dfXMin, tagSHPObject::dfYMax, tagSHPObject::dfYMin, tagSHPObject::dfZMax, tagSHPObject::dfZMin, FALSE, and TRUE.
Referenced by SHPTreeNodeAddShapeId().
| void SHPCloseDiskTree | ( | SHPTreeDiskHandle | hDiskTree | ) |
Definition at line 873 of file shptree.c.
References SAHooks::FClose, SHPDiskTreeInfo::fpQIX, SHPDiskTreeInfo::sHooks, and SHPLIB_NULLPTR.
| SHPTree* SHPCreateTree | ( | SHPHandle | hSHP, |
| int | nDimension, | ||
| int | nMaxDepth, | ||
| double * | padfBoundsMin, | ||
| double * | padfBoundsMax | ||
| ) |
Definition at line 217 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, SHPTree::hSHP, MAX_DEFAULT_TREE_DEPTH, SHPTree::nDimension, SHPTree::nMaxDepth, SHPTree::nTotalCount, SHPTree::psRoot, SHPDestroyObject(), SHPGetInfo(), SHPLIB_NULLPTR, SHPReadObject(), SHPTreeAddShapeId(), SHPTreeNodeCreate(), and STATIC_CAST.
| void SHPDestroyTree | ( | SHPTree * | psTree | ) |
Definition at line 364 of file shptree.c.
References SHPTree::psRoot, and SHPDestroyTreeNode().
|
static |
Definition at line 329 of file shptree.c.
References shape_tree_node::apsSubNode, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, shape_tree_node::panShapeIds, shape_tree_node::papsShapeObj, SHPDestroyObject(), and SHPLIB_NULLPTR.
Referenced by SHPDestroyTree(), and SHPTreeNodeTrim().
|
static |
Definition at line 1139 of file shptree.c.
References shape_tree_node::apsSubNode, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, and offset.
Referenced by SHPWriteTreeNode().
| SHPTreeDiskHandle SHPOpenDiskTree | ( | const char * | pszQIXFilename, |
| SAHooks * | psHooks | ||
| ) |
Definition at line 847 of file shptree.c.
References SAHooks::FOpen, SHPDiskTreeInfo::fpQIX, SASetupDefaultHooks(), SHPDiskTreeInfo::sHooks, SHPLIB_NULLPTR, and STATIC_CAST.
| int* SHPSearchDiskTree | ( | FILE * | fp, |
| double * | padfBoundsMin, | ||
| double * | padfBoundsMax, | ||
| int * | pnShapeCount | ||
| ) |
Definition at line 1048 of file shptree.c.
References SHPDiskTreeInfo::fpQIX, SAHooks::FRead, SAHooks::FSeek, REINTERPRET_CAST, SHPDiskTreeInfo::sHooks, SHPSearchDiskTreeEx(), SHPTreeReadLibc(), and SHPTreeSeekLibc().
| int* SHPSearchDiskTreeEx | ( | SHPTreeDiskHandle | hDiskTree, |
| double * | padfBoundsMin, | ||
| double * | padfBoundsMax, | ||
| int * | pnShapeCount | ||
| ) |
Definition at line 1070 of file shptree.c.
References bBigEndian, compare_ints(), FALSE, SHPDiskTreeInfo::fpQIX, SAHooks::FRead, SAHooks::FSeek, REINTERPRET_CAST, SEEK_SET, SHPDiskTreeInfo::sHooks, SHPLIB_NULLPTR, SHPSearchDiskTreeNode(), STATIC_CAST, and TRUE.
Referenced by SHPSearchDiskTree().
|
static |
Definition at line 887 of file shptree.c.
References SAHooks::Error, FALSE, SHPDiskTreeInfo::fpQIX, SAHooks::FRead, SAHooks::FSeek, offset, SEEK_CUR, SfRealloc(), SHPDiskTreeInfo::sHooks, SHPCheckBoundsOverlap(), SHPLIB_NULLPTR, STATIC_CAST, SwapWord(), and TRUE.
Referenced by SHPSearchDiskTreeEx().
Definition at line 631 of file shptree.c.
References SHPTree::nDimension, SHPTree::nMaxDepth, SHPTree::nTotalCount, SHPTree::psRoot, and SHPTreeNodeAddShapeId().
Referenced by SHPCreateTree().
|
static |
Definition at line 648 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, shape_tree_node::apsSubNode, SHPTree::nDimension, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, shape_tree_node::panShapeIds, SfRealloc(), SHPCheckBoundsOverlap(), SHPLIB_NULLPTR, and STATIC_CAST.
Referenced by SHPTreeFindLikelyShapes().
| int* SHPTreeFindLikelyShapes | ( | SHPTree * | hTree, |
| double * | padfBoundsMin, | ||
| double * | padfBoundsMax, | ||
| int * | pnShapeCount | ||
| ) |
Definition at line 716 of file shptree.c.
References compare_ints(), SHPLIB_NULLPTR, and SHPTreeCollectShapeIds().
|
static |
Definition at line 483 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, shape_tree_node::apsSubNode, shape_tree_node::nShapeCount, tagSHPObject::nShapeId, shape_tree_node::nSubNodes, shape_tree_node::panShapeIds, shape_tree_node::papsShapeObj, SfRealloc(), SHPCheckObjectContained(), SHPLIB_NULLPTR, SHPTreeNodeCreate(), SHPTreeSplitBounds(), STATIC_CAST, and TRUE.
Referenced by SHPTreeAddShapeId().
|
static |
Definition at line 186 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, shape_tree_node::panShapeIds, shape_tree_node::papsShapeObj, SHPLIB_NULLPTR, and STATIC_CAST.
Referenced by SHPCreateTree(), and SHPTreeNodeAddShapeId().
|
static |
Definition at line 750 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, shape_tree_node::apsSubNode, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, shape_tree_node::panShapeIds, shape_tree_node::papsShapeObj, SHPDestroyTreeNode(), and SHPLIB_NULLPTR.
Referenced by SHPTreeTrimExtraNodes().
Definition at line 1023 of file shptree.c.
References REINTERPRET_CAST, size, and STATIC_CAST.
Referenced by SHPSearchDiskTree().
Definition at line 1036 of file shptree.c.
References offset, REINTERPRET_CAST, and STATIC_CAST.
Referenced by SHPSearchDiskTree().
|
static |
Definition at line 440 of file shptree.c.
References SHP_SPLIT_RATIO.
Referenced by SHPTreeNodeAddShapeId().
| void SHPTreeTrimExtraNodes | ( | SHPTree * | hTree | ) |
Definition at line 810 of file shptree.c.
References SHPTree::psRoot, and SHPTreeNodeTrim().
| int SHPWriteTree | ( | SHPTree * | tree, |
| const char * | filename | ||
| ) |
Definition at line 1210 of file shptree.c.
References filename, SASetupDefaultHooks(), SHPDiskTreeInfo::sHooks, and SHPWriteTreeLL().
Definition at line 1223 of file shptree.c.
References bBigEndian, FALSE, SAHooks::FClose, filename, SAHooks::FOpen, SAHooks::FWrite, SHPTree::nMaxDepth, SHPTree::nTotalCount, SHPTree::psRoot, REINTERPRET_CAST, SASetupDefaultHooks(), SHPDiskTreeInfo::sHooks, SHPLIB_NULLPTR, SHPWriteTreeNode(), and TRUE.
Referenced by SHPWriteTree().
|
static |
Definition at line 1161 of file shptree.c.
References shape_tree_node::adfBoundsMax, shape_tree_node::adfBoundsMin, shape_tree_node::apsSubNode, SAHooks::FWrite, shape_tree_node::nShapeCount, shape_tree_node::nSubNodes, offset, shape_tree_node::panShapeIds, SHPGetSubNodeOffset(), SHPLIB_NULLPTR, and STATIC_CAST.
Referenced by SHPWriteTreeLL().
|
static |
Definition at line 822 of file shptree.c.
References STATIC_CAST.
Referenced by SHPSearchDiskTreeNode().
|
static |
Definition at line 139 of file shptree.c.
Referenced by SHPSearchDiskTreeEx(), and SHPWriteTreeLL().