#include "shapefil.h"
#include <math.h>
#include <limits.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for shpopen.c:
Go to the source code of this file.
Defines | |
#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) |
Typedefs | |
typedef unsigned char | uchar |
typedef int | int32 |
Functions | |
static void | SwapWord (int length, void *wordP) |
static void * | SfRealloc (void *pMem, int nNewSize) |
static void | SHPWriteHeader (SHPHandle psSHP) |
SHPHandle SHPAPI_CALL | SHPOpen (const char *pszLayer, const char *pszAccess) |
void SHPAPI_CALL | SHPClose (SHPHandle psSHP) |
void SHPAPI_CALL | SHPGetInfo (SHPHandle psSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound) |
SHPHandle SHPAPI_CALL | SHPCreate (const char *pszLayer, int nShapeType) |
static void | _SHPSetBounds (uchar *pabyRec, SHPObject *psShape) |
void SHPAPI_CALL | SHPComputeExtents (SHPObject *psObject) |
SHPObject SHPAPI_CALL1 * | SHPCreateObject (int nSHPType, int nShapeId, int nParts, int *panPartStart, int *panPartType, int nVertices, double *padfX, double *padfY, double *padfZ, double *padfM){SHPObject *psObject;inti, bHasM, bHasZ;psObject=(SHPObject *) calloc(1, sizeof(SHPObject) |
if (nSHPType==SHPT_ARCM||nSHPType==SHPT_POINTM||nSHPType==SHPT_POLYGONM||nSHPType==SHPT_MULTIPOINTM) | |
SHPComputeExtents (psObject) | |
return (psObject) | |
SHPObject SHPAPI_CALL1 * | SHPCreateSimpleObject (int nSHPType, int nVertices, double *padfX, double *padfY, double *padfZ){return(SHPCreateObject(nSHPType,-1, 0, NULL, NULL, nVertices, padfX, padfY, padfZ, NULL) |
int SHPAPI_CALL | SHPWriteObject (SHPHandle psSHP, int nShapeId, SHPObject *psObject) |
SHPObject SHPAPI_CALL1 * | SHPReadObject (SHPHandle psSHP, int hEntity){SHPObject *psShape;if(hEntity< 0||hEntity >=psSHP->nRecords) return(NULL |
if (psSHP->panRecSize[hEntity]+8 > psSHP->nBufSize) | |
fseek (psSHP->fpSHP, psSHP->panRecOffset[hEntity], 0) | |
fread (psSHP->pabyRec, psSHP->panRecSize[hEntity]+8, 1, psSHP->fpSHP) | |
memcpy (&psShape->nSHPType, psSHP->pabyRec+8, 4) | |
if (bBigEndian) | |
else | if (psShape->nSHPType==SHPT_MULTIPOINT||psShape->nSHPType==SHPT_MULTIPOINTM||psShape->nSHPType==SHPT_MULTIPOINTZ) |
return (psShape) | |
const char SHPAPI_CALL1 * | SHPTypeName (int nSHPType){switch(nSHPType |
const char SHPAPI_CALL1 * | SHPPartTypeName (int nPartType){switch(nPartType |
void SHPAPI_CALL | SHPDestroyObject (SHPObject *psShape) |
int SHPAPI_CALL | SHPRewindObject (SHPHandle hSHP, SHPObject *psObject) |
Variables | |
static char | rcsid [] |
static int | bBigEndian |
psObject | nSHPType = nSHPType |
psObject | nShapeId = nShapeId |
psShape = (SHPObject *) calloc(1,sizeof(SHPObject)) | |
psShape | nShapeId = hEntity |
#define ByteCopy | ( | a, | |||
b, | |||||
c | ) | memcpy( b, a, c ) |
Definition at line 185 of file shpopen.c.
Referenced by _SHPSetBounds(), SHPCreate(), SHPWriteHeader(), and SHPWriteObject().
#define MAX | ( | a, | |||
b | ) | ((a>b) ? a : b) |
Definition at line 188 of file shpopen.c.
Referenced by SHPComputeExtents(), SHPOpen(), streamGen(), streamGenShp(), and streamSegmentationShp().
#define MIN | ( | a, | |||
b | ) | ((a<b) ? a : b) |
Definition at line 724 of file shpopen.c.
References bBigEndian, ByteCopy, psShape, and SwapWord().
Referenced by SHPWriteObject().
Here is the call graph for this function:
fread | ( | psSHP-> | pabyRec, | |
psSHP->panRecSize+ | 8[hEntity], | |||
1 | , | |||
psSHP-> | fpSHP | |||
) |
Referenced by DBFClose(), DBFOpen(), DBFReadAttribute(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), DBFWriteTuple(), if(), and SHPOpen().
fseek | ( | psSHP-> | fpSHP, | |
psSHP-> | panRecOffset[hEntity], | |||
0 | ||||
) |
Referenced by DBFClose(), DBFFlushRecord(), DBFOpen(), DBFReadAttribute(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), DBFWriteHeader(), DBFWriteTuple(), eol(), if(), and SHPWriteHeader().
else if | ( | psShape-> | nSHPType = = SHPT_MULTIPOINT || psShape->nSHPType == SHPT_MULTIPOINTM || psShape->nSHPType == SHPT_MULTIPOINTZ |
) |
Definition at line 1454 of file shpopen.c.
References memcpy(), SHPInfo::pabyRec, psShape, and SwapWord().
Here is the call graph for this function:
if | ( | bBigEndian | ) |
if | ( | psSHP->panRecSize+ | 8[hEntity], | |
psSHP-> | nBufSize | |||
) |
Definition at line 1290 of file shpopen.c.
References SHPInfo::nBufSize, SHPInfo::pabyRec, SHPInfo::panRecSize, and SfRealloc().
Here is the call graph for this function:
return | ( | psShape | ) |
return | ( | psObject | ) |
static void* SfRealloc | ( | void * | pMem, | |
int | nNewSize | |||
) | [static] |
void SHPAPI_CALL SHPClose | ( | SHPHandle | psSHP | ) |
Definition at line 553 of file shpopen.c.
References SHPInfo::bUpdated, SHPInfo::fpSHP, SHPInfo::fpSHX, NULL, SHPInfo::pabyRec, SHPInfo::panRecOffset, SHPInfo::panRecSize, and SHPWriteHeader().
Referenced by addSOrder(), addToFromNode(), catchmentPoly(), createTinShapeFile(), extractRiver4mTIN(), generateShape(), mergeFeatures(), simplifyPolySHP(), splitLineAtVertices(), and streamSegmentationShp().
Here is the call graph for this function:
SHPComputeExtents | ( | psObject | ) |
void SHPAPI_CALL SHPComputeExtents | ( | SHPObject * | psObject | ) |
Definition at line 749 of file shpopen.c.
References SHPObject::dfMMax, SHPObject::dfMMin, SHPObject::dfXMax, SHPObject::dfXMin, SHPObject::dfYMax, SHPObject::dfYMin, SHPObject::dfZMax, SHPObject::dfZMin, MAX, MIN, SHPObject::nVertices, SHPObject::padfM, SHPObject::padfX, SHPObject::padfY, and SHPObject::padfZ.
SHPHandle SHPAPI_CALL SHPCreate | ( | const char * | pszLayer, | |
int | nShapeType | |||
) |
Definition at line 617 of file shpopen.c.
References bBigEndian, ByteCopy, FALSE, NULL, SHPOpen(), SwapWord(), and TRUE.
Referenced by catchmentPoly(), createTinShapeFile(), extractRiver4mTIN(), generateShape(), mergeFeatures(), polygonToPolyline(), simplifyPolySHP(), splitLineAtVertices(), and streamSegmentationShp().
Here is the call graph for this function:
SHPObject SHPAPI_CALL1* SHPCreateObject | ( | int | nSHPType, | |
int | nShapeId, | |||
int | nParts, | |||
int * | panPartStart, | |||
int * | panPartType, | |||
int | nVertices, | |||
double * | padfX, | |||
double * | padfY, | |||
double * | padfZ, | |||
double * | padfM | |||
) |
SHPObject SHPAPI_CALL1* SHPCreateSimpleObject | ( | int | nSHPType, | |
int | nVertices, | |||
double * | padfX, | |||
double * | padfY, | |||
double * | padfZ | |||
) |
Referenced by catchmentPoly(), extractRiver4mTIN(), simplifyPolySHP(), splitLineAtVertices(), and streamGenShp().
void SHPAPI_CALL SHPDestroyObject | ( | SHPObject * | psShape | ) |
void SHPAPI_CALL SHPGetInfo | ( | SHPHandle | psSHP, | |
int * | pnEntities, | |||
int * | pnShapeType, | |||
double * | padfMinBound, | |||
double * | padfMaxBound | |||
) |
Definition at line 588 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, SHPInfo::nRecords, SHPInfo::nShapeType, and NULL.
Referenced by generatePolyFile(), generateShape(), and polygonToPolyLineDialogDlg::run().
SHPHandle SHPAPI_CALL SHPOpen | ( | const char * | pszLayer, | |
const char * | pszAccess | |||
) |
Definition at line 341 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, bBigEndian, SHPInfo::bUpdated, FALSE, SHPInfo::fpSHP, SHPInfo::fpSHX, fread(), MAX, memcpy(), SHPInfo::nFileSize, SHPInfo::nMaxRecords, SHPInfo::nRecords, SHPInfo::nShapeType, NULL, SHPInfo::panRecOffset, SHPInfo::panRecSize, SwapWord(), and TRUE.
Referenced by addSOrder(), addToFromNode(), extractRiver4mTIN(), generatePolyFile(), generateShape(), mergeFeatures(), polygonToPolyline(), attFileDlg::run(), polygonToPolyLineDialogDlg::run(), SHPCreate(), simplifyPolySHP(), and splitLineAtVertices().
Here is the call graph for this function:
const char SHPAPI_CALL1* SHPPartTypeName | ( | ) |
Definition at line 1660 of file shpopen.c.
References SHPP_FIRSTRING, SHPP_INNERRING, SHPP_OUTERRING, SHPP_RING, SHPP_TRIFAN, and SHPP_TRISTRIP.
Definition at line 1725 of file shpopen.c.
References FALSE, SHPObject::nParts, SHPObject::nSHPType, SHPObject::nVertices, SHPObject::padfX, SHPObject::padfY, SHPObject::panPartStart, SHPT_POLYGON, SHPT_POLYGONM, and SHPT_POLYGONZ.
const char SHPAPI_CALL1* SHPTypeName | ( | ) |
Definition at line 1603 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.
static void SHPWriteHeader | ( | SHPHandle | psSHP | ) | [static] |
Definition at line 237 of file shpopen.c.
References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, bBigEndian, ByteCopy, SHPInfo::fpSHP, SHPInfo::fpSHX, fseek(), SHPInfo::nFileSize, SHPInfo::nRecords, SHPInfo::nShapeType, SHPInfo::panRecOffset, SHPInfo::panRecSize, and SwapWord().
Referenced by SHPClose().
Here is the call graph for this function:
Definition at line 914 of file shpopen.c.
References _SHPSetBounds(), bBigEndian, SHPInfo::bUpdated, ByteCopy, memcpy(), SHPInfo::nMaxRecords, SHPObject::nParts, SHPInfo::nRecords, SHPInfo::nShapeType, SHPObject::nSHPType, SHPObject::nVertices, pabyRec, SHPObject::panPartStart, SHPObject::panPartType, SHPInfo::panRecOffset, SHPInfo::panRecSize, SfRealloc(), SHPT_ARC, SHPT_ARCM, SHPT_ARCZ, SHPT_MULTIPATCH, SHPT_NULL, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, SwapWord(), and TRUE.
Referenced by catchmentPoly(), createTinShapeFile(), extractRiver4mTIN(), generateShape(), mergeFeatures(), simplifyPolySHP(), splitLineAtVertices(), and streamGenShp().
Here is the call graph for this function:
static void SwapWord | ( | int | length, | |
void * | wordP | |||
) | [static] |
Definition at line 200 of file shpopen.c.
Referenced by _SHPSetBounds(), if(), SHPCreate(), SHPOpen(), SHPWriteHeader(), and SHPWriteObject().
int bBigEndian [static] |
Definition at line 191 of file shpopen.c.
Referenced by _SHPSetBounds(), SHPCreate(), SHPOpen(), SHPWriteHeader(), and SHPWriteObject().
Definition at line 1305 of file shpopen.c.
Referenced by _SHPSetBounds(), if(), and SHPDestroyObject().
char rcsid[] [static] |