![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include "shapefil.h"#include <math.h>#include <limits.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include <stdio.h>#include <errno.h>
Go to the source code of this file.
Macros | |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | ByteCopy(a, b, c) memcpy( b, a, c ) |
| #define | MIN(a, b) ((a<b) ? a : b) |
| #define | MAX(a, b) ((a>b) ? a : b) |
| #define | CPL_UNUSED |
| #define | STATIC_CAST(type, x) ((type)(x)) |
| #define | SHPLIB_NULLPTR NULL |
Typedefs | |
| typedef unsigned char | uchar |
| typedef unsigned int | int32 |
Functions | |
| static const char * | cvsid_aw () |
| static void | SwapWord (int length, void *wordP) |
| static void * | SfRealloc (void *pMem, int nNewSize) |
| void | SHPWriteHeader (SHPHandle psSHP) |
| SHPHandle | SHPOpen (const char *pszLayer, const char *pszAccess) |
| static int | SHPGetLenWithoutExtension (const char *pszBasename) |
| SHPHandle | SHPOpenLL (const char *pszLayer, const char *pszAccess, SAHooks *psHooks) |
| SHPHandle | SHPOpenLLEx (const char *pszLayer, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX) |
| int | SHPRestoreSHX (const char *pszLayer, const char *pszAccess, SAHooks *psHooks) |
| void | SHPClose (SHPHandle psSHP) |
| void | SHPSetFastModeReadObject (SHPHandle hSHP, int bFastMode) |
| void | SHPGetInfo (SHPHandle psSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound) |
| SHPHandle | SHPCreate (const char *pszLayer, int nShapeType) |
| SHPHandle | SHPCreateLL (const char *pszLayer, int nShapeType, SAHooks *psHooks) |
| static void | _SHPSetBounds (uchar *pabyRec, SHPObject *psShape) |
| void | SHPComputeExtents (SHPObject *psObject) |
| SHPObject * | SHPCreateObject (int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM) |
| SHPObject * | SHPCreateSimpleObject (int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ) |
| int | SHPWriteObject (SHPHandle psSHP, int nShapeId, SHPObject *psObject) |
| static void * | SHPAllocBuffer (unsigned char **pBuffer, int nSize) |
| static unsigned char * | SHPReallocObjectBufIfNecessary (SHPHandle psSHP, int nObjectBufSize) |
| SHPObject * | SHPReadObject (SHPHandle psSHP, int hEntity) |
| const char * | SHPTypeName (int nSHPType) |
| const char * | SHPPartTypeName (int nPartType) |
| void | SHPDestroyObject (SHPObject *psShape) |
| static int | SHPGetPartVertexCount (const SHPObject *psObject, int iPart) |
| static int | SHPRewindIsInnerRing (const SHPObject *psObject, int iOpRing) |
| int | SHPRewindObject (SHPHandle hSHP, SHPObject *psObject) |
Variables | |
| static const char | cpl_cvsid [] = "$Id$" |
| static int | bBigEndian |
Definition at line 1406 of file shpopen.c.
References bBigEndian, ByteCopy, tagSHPObject::dfXMax, tagSHPObject::dfXMin, tagSHPObject::dfYMax, tagSHPObject::dfYMin, and SwapWord().
Referenced by SHPWriteObject().
|
static |
Definition at line 401 of file shpopen.c.
References SHPLIB_NULLPTR.
Referenced by SHPReadObject(), and SHPWriteObject().
|
static |
Definition at line 2043 of file shpopen.c.
References SHPLIB_NULLPTR.
Referenced by SHPReadObject().
| void SHPClose | ( | SHPHandle | psSHP | ) |
Definition at line 1149 of file shpopen.c.
References SHPInfo::bUpdated, SAHooks::FClose, SHPInfo::fpSHP, SHPInfo::fpSHX, SHPInfo::pabyObjectBuf, SHPInfo::pabyRec, SHPInfo::panRecOffset, SHPInfo::panRecSize, SHPInfo::psCachedObject, SHPInfo::sHooks, SHPLIB_NULLPTR, and SHPWriteHeader().
Referenced by SHPOpenLL().
| void SHPComputeExtents | ( | SHPObject * | psObject | ) |
Definition at line 1431 of file shpopen.c.
References tagSHPObject::dfMMax, tagSHPObject::dfMMin, tagSHPObject::dfXMax, tagSHPObject::dfXMin, tagSHPObject::dfYMax, tagSHPObject::dfYMin, tagSHPObject::dfZMax, tagSHPObject::dfZMin, MAX, MIN, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, and tagSHPObject::padfZ.
Referenced by SHPCreateObject().
| SHPHandle SHPCreate | ( | const char * | pszLayer, |
| int | nShapeType | ||
| ) |
Definition at line 1249 of file shpopen.c.
References SASetupDefaultHooks(), and SHPCreateLL().
Definition at line 1267 of file shpopen.c.
References bBigEndian, ByteCopy, SAHooks::Error, FALSE, SAHooks::FClose, SAHooks::FOpen, SAHooks::FWrite, SHPGetLenWithoutExtension(), SHPLIB_NULLPTR, SHPOpenLL(), STATIC_CAST, SwapWord(), and TRUE.
Referenced by SHPCreate().
| SHPObject* SHPCreateObject | ( | int | nSHPType, |
| int | nShapeId, | ||
| int | nParts, | ||
| const int * | panPartStart, | ||
| const int * | panPartType, | ||
| int | nVertices, | ||
| const double * | padfX, | ||
| const double * | padfY, | ||
| const double * | padfZ, | ||
| const double * | padfM | ||
| ) |
Definition at line 1469 of file shpopen.c.
References tagSHPObject::bMeasureIsUsed, FALSE, MAX, tagSHPObject::nParts, tagSHPObject::nShapeId, tagSHPObject::nSHPType, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, tagSHPObject::panPartType, SHPComputeExtents(), SHPLIB_NULLPTR, SHPP_RING, SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPATCH, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, STATIC_CAST, and TRUE.
Referenced by SHPCreateSimpleObject().
| SHPObject* SHPCreateSimpleObject | ( | int | nSHPType, |
| int | nVertices, | ||
| const double * | padfX, | ||
| const double * | padfY, | ||
| const double * | padfZ | ||
| ) |
Definition at line 1587 of file shpopen.c.
References SHPCreateObject(), and SHPLIB_NULLPTR.
| void SHPDestroyObject | ( | SHPObject * | psShape | ) |
Definition at line 2902 of file shpopen.c.
References tagSHPObject::bFastModeReadObject, FALSE, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, tagSHPObject::panPartType, and SHPLIB_NULLPTR.
Referenced by SHPCreateTree(), SHPDestroyTreeNode(), and SHPReadObject().
| void SHPGetInfo | ( | SHPHandle | psSHP, |
| int * | pnEntities, | ||
| int * | pnShapeType, | ||
| double * | padfMinBound, | ||
| double * | padfMaxBound | ||
| ) |
Definition at line 1217 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, SHPInfo::nRecords, SHPInfo::nShapeType, and SHPLIB_NULLPTR.
Referenced by SHPCreateTree().
|
static |
Definition at line 575 of file shpopen.c.
References STATIC_CAST.
Referenced by SHPCreateLL(), SHPOpenLL(), and SHPRestoreSHX().
|
static |
Definition at line 2935 of file shpopen.c.
References tagSHPObject::nParts, tagSHPObject::nVertices, and tagSHPObject::panPartStart.
Referenced by SHPRewindIsInnerRing(), and SHPRewindObject().
| SHPHandle SHPOpen | ( | const char * | pszLayer, |
| const char * | pszAccess | ||
| ) |
Definition at line 561 of file shpopen.c.
References SASetupDefaultHooks(), and SHPOpenLL().
Definition at line 599 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, bBigEndian, SHPInfo::bUpdated, SAHooks::Error, FALSE, SAHooks::FClose, SAHooks::FOpen, SHPInfo::fpSHP, SHPInfo::fpSHX, SAHooks::FRead, SAHooks::FSeek, SAHooks::FTell, MAX, SHPInfo::nFileSize, SHPInfo::nMaxRecords, SHPInfo::nRecords, SHPInfo::nShapeType, SHPInfo::panRecOffset, SHPInfo::panRecSize, SHPInfo::sHooks, SHPClose(), SHPGetLenWithoutExtension(), SHPLIB_NULLPTR, STATIC_CAST, SwapWord(), and TRUE.
Referenced by SHPCreateLL(), SHPOpen(), and SHPOpenLLEx().
| SHPHandle SHPOpenLLEx | ( | const char * | pszLayer, |
| const char * | pszAccess, | ||
| SAHooks * | psHooks, | ||
| int | bRestoreSHX | ||
| ) |
Definition at line 942 of file shpopen.c.
References SHPLIB_NULLPTR, SHPOpenLL(), and SHPRestoreSHX().
| const char* SHPPartTypeName | ( | int | nPartType | ) |
Definition at line 2869 of file shpopen.c.
References SHPP_FIRSTRING, SHPP_INNERRING, SHPP_OUTERRING, SHPP_RING, SHPP_TRIFAN, and SHPP_TRISTRIP.
Definition at line 2092 of file shpopen.c.
References bBigEndian, tagSHPObject::bFastModeReadObject, tagSHPObject::bMeasureIsUsed, tagSHPObject::dfMMax, tagSHPObject::dfMMin, tagSHPObject::dfXMax, tagSHPObject::dfXMin, tagSHPObject::dfYMax, tagSHPObject::dfYMin, tagSHPObject::dfZMax, tagSHPObject::dfZMin, FALSE, tagSHPObject::nParts, tagSHPObject::nShapeId, tagSHPObject::nSHPType, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, tagSHPObject::panPartType, SfRealloc(), SHPAllocBuffer(), SHPDestroyObject(), SHPLIB_NULLPTR, SHPP_RING, SHPReallocObjectBufIfNecessary(), SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPATCH, SHPT_MULTIPOINT, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_POINT, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, STATIC_CAST, SwapWord(), and TRUE.
Referenced by SHPCreateTree().
|
static |
Definition at line 2062 of file shpopen.c.
References SHPInfo::nObjectBufSize, SHPInfo::pabyObjectBuf, SHPLIB_NULLPTR, and STATIC_CAST.
Referenced by SHPReadObject().
| int SHPRestoreSHX | ( | const char * | pszLayer, |
| const char * | pszAccess, | ||
| SAHooks * | psHooks | ||
| ) |
Definition at line 966 of file shpopen.c.
References bBigEndian, SAHooks::Error, FALSE, SAHooks::FClose, SAHooks::FOpen, SAHooks::FRead, SAHooks::FSeek, SAHooks::FWrite, SHPGetLenWithoutExtension(), SHPLIB_NULLPTR, STATIC_CAST, SwapWord(), and TRUE.
Referenced by SHPOpenLLEx().
|
static |
Definition at line 2947 of file shpopen.c.
References FALSE, tagSHPObject::nParts, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::panPartStart, and SHPGetPartVertexCount().
Referenced by SHPRewindObject().
Definition at line 3030 of file shpopen.c.
References tagSHPObject::nParts, tagSHPObject::nSHPType, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, SHPGetPartVertexCount(), SHPRewindIsInnerRing(), SHPT_POLYGON, SHPT_POLYGONM, and SHPT_POLYGONZ.
| void SHPSetFastModeReadObject | ( | SHPHandle | hSHP, |
| int | bFastMode | ||
| ) |
Definition at line 1196 of file shpopen.c.
References SHPInfo::bFastModeReadObject, SHPInfo::psCachedObject, SHPLIB_NULLPTR, and STATIC_CAST.
| const char* SHPTypeName | ( | int | nSHPType | ) |
Definition at line 2812 of file shpopen.c.
References SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPATCH, SHPT_MULTIPOINT, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_NULL, SHPT_POINT, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, and SHPT_POLYGONZ.
| void SHPWriteHeader | ( | SHPHandle | psSHP | ) |
Definition at line 417 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, bBigEndian, ByteCopy, SAHooks::Error, SAHooks::FFlush, SHPInfo::fpSHP, SHPInfo::fpSHX, SAHooks::FSeek, SAHooks::FWrite, SHPInfo::nFileSize, SHPInfo::nRecords, SHPInfo::nShapeType, SHPInfo::panRecOffset, SHPInfo::panRecSize, SHPInfo::sHooks, SHPLIB_NULLPTR, STATIC_CAST, and SwapWord().
Referenced by SHPClose().
Definition at line 1604 of file shpopen.c.
References _SHPSetBounds(), SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, bBigEndian, tagSHPObject::bMeasureIsUsed, SHPInfo::bUpdated, ByteCopy, tagSHPObject::dfMMax, tagSHPObject::dfMMin, tagSHPObject::dfZMax, tagSHPObject::dfZMin, DISABLE_MULTIPATCH_MEASURE, SAHooks::Error, FALSE, SHPInfo::fpSHP, SAHooks::FSeek, SAHooks::FWrite, MAX, MIN, SHPInfo::nFileSize, SHPInfo::nMaxRecords, tagSHPObject::nParts, SHPInfo::nRecords, SHPInfo::nShapeType, tagSHPObject::nSHPType, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, tagSHPObject::panPartType, SHPInfo::panRecOffset, SHPInfo::panRecSize, SfRealloc(), SHPInfo::sHooks, SHPLIB_NULLPTR, SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPATCH, SHPT_MULTIPOINT, SHPT_MULTIPOINTM, SHPT_MULTIPOINTZ, SHPT_NULL, SHPT_POINT, SHPT_POINTM, SHPT_POINTZ, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, STATIC_CAST, SwapWord(), and TRUE.
|
static |
Definition at line 380 of file shpopen.c.
References STATIC_CAST.
Referenced by _SHPSetBounds(), SHPCreateLL(), SHPOpenLL(), SHPReadObject(), SHPRestoreSHX(), SHPWriteHeader(), and SHPWriteObject().
|
static |
Definition at line 363 of file shpopen.c.
Referenced by _SHPSetBounds(), SHPCreateLL(), SHPOpenLL(), SHPReadObject(), SHPRestoreSHX(), SHPWriteHeader(), and SHPWriteObject().