Loading...
Searching...
No Matches
shpopen.c File Reference
`#include "shapefil_private.h"`
`#include <assert.h>`
`#include <errno.h>`
`#include <limits.h>`
`#include <math.h>`
`#include <stdbool.h>`
`#include <stdint.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
Include dependency graph for shpopen.c:

Go to the source code of this file.

## Macros

#define | FALSE 0
#define | TRUE 1
#define | ByteCopy(a, b, c)
#define | MIN(a, b)
#define | MAX(a, b)
#define | SHP_RESTORE_SHX_HINT_MESSAGE " Use SHPRestoreSHX() to restore or create it."

## Functions

void | SHPWriteHeader (SHPHandle psSHP)
SHPHandle | SHPOpen (const char *pszLayer, const char *pszAccess)
SHPHandle | SHPOpenLL (const char *pszLayer, const char *pszAccess, const SAHooks *psHooks)
SHPHandle | SHPOpenLLEx (const char *pszLayer, const char *pszAccess, const SAHooks *psHooks, int bRestoreSHX)
int | SHPRestoreSHX (const char *pszLayer, const char *pszAccess, const SAHooks *psHooks)
void | SHPClose (SHPHandle psSHP)
void | SHPSetFastModeReadObject (SHPHandle hSHP, int bFastMode)
void | SHPGetInfo (const SHPHandle psSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
SHPHandle | SHPCreate (const char *pszLayer, int nShapeType)
SHPHandle | SHPCreateLL (const char *pszLayer, int nShapeType, const SAHooks *psHooks)
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, const SHPObject *psObject)
SHPObject * | SHPReadObject (const SHPHandle psSHP, int hEntity)
const char * | SHPTypeName (int nSHPType)
const char * | SHPPartTypeName (int nPartType)
void | SHPDestroyObject (SHPObject *psShape)
int | SHPRewindObject (const SHPHandle hSHP, SHPObject *psObject)

## Macro Definition Documentation

## ByteCopy

#define ByteCopy | ( |  | a,
|  |  | b,
|  |  | c )

Value:
memcpy(b, a, c)
b
double b
Definition driver/set_window.c:5

Definition at line 31 of file shpopen.c.

Referenced by SHPCreateLL(), SHPWriteHeader(), and SHPWriteObject().

## FALSE

#define FALSE 0

Definition at line 27 of file shpopen.c.

## MAX

#define MAX | ( |  | a,
|  |  | b )

Value:
((a > b) ? a : b)

Definition at line 34 of file shpopen.c.

Referenced by SHPComputeExtents(), SHPCreateObject(), SHPOpenLL(), and SHPWriteObject().

## MIN

#define MIN | ( |  | a,
|  |  | b )

Value:
((a < b) ? a : b)

Definition at line 33 of file shpopen.c.

Referenced by Cairo_raster(), G_rgb_to_hsv(), SHPComputeExtents(), and SHPWriteObject().

## SHP_RESTORE_SHX_HINT_MESSAGE

#define SHP_RESTORE_SHX_HINT_MESSAGE " Use SHPRestoreSHX() to restore or create it."

Definition at line 51 of file shpopen.c.

Referenced by SHPOpenLL().

## TRUE

#define TRUE 1

Definition at line 28 of file shpopen.c.

## Function Documentation

## SHPClose()

void SHPClose | ( | SHPHandle | psSHP | ) |

Definition at line 851 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, SHPAPI_CALL, SHPLIB_NULLPTR, and SHPWriteHeader().

Referenced by SHPOpenLL().

## SHPComputeExtents()

void SHPComputeExtents | ( | SHPObject * | psObject | ) |

Definition at line 1147 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, tagSHPObject::padfZ, and SHPAPI_CALL.

Referenced by SHPCreateObject().

## SHPCreate()

SHPHandle SHPCreate | ( | const char * | pszLayer,
|  | int | nShapeType )

Definition at line 944 of file shpopen.c.

References SASetupDefaultHooks(), SHPAPI_CALL, and SHPCreateLL().

## SHPCreateLL()

SHPHandle SHPCreateLL | ( | const char * | pszLayer,
|  | int | nShapeType,
|  | const SAHooks * | psHooks )

Definition at line 960 of file shpopen.c.

References SHPInfo::bUpdated, ByteCopy, SAHooks::Error, FALSE, SAHooks::FClose, SAHooks::FOpen, SHPInfo::fpSHP, SHPInfo::fpSHX, SAHooks::FWrite, SHPInfo::nFileSize, SHPInfo::nShapeType, SHPInfo::panRecOffset, SHPInfo::panRecSize, SAHooks::pvUserData, SHPInfo::sHooks, SHP_SWAP32, SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

Referenced by SHPCreate().

## SHPCreateObject()

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 1180 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(), SHPCreateObject(), 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 SHPCreateObject(), and SHPCreateSimpleObject().

## SHPCreateSimpleObject()

SHPObject * SHPCreateSimpleObject | ( | int | nSHPType,
|  | int | nVertices,
|  | const double * | padfX,
|  | const double * | padfY,
|  | const double * | padfZ )

Definition at line 1309 of file shpopen.c.

References SHPCreateObject(), SHPCreateSimpleObject(), and SHPLIB_NULLPTR.

Referenced by SHPCreateSimpleObject().

## SHPDestroyObject()

void SHPDestroyObject | ( | SHPObject * | psShape | ) |

Definition at line 2725 of file shpopen.c.

References tagSHPObject::bFastModeReadObject, FALSE, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, tagSHPObject::panPartType, SHPAPI_CALL, and SHPLIB_NULLPTR.

## SHPGetInfo()

void SHPGetInfo | ( | const SHPHandle | psSHP,
|  | int * | pnEntities,
|  | int * | pnShapeType,
|  | double * | padfMinBound,
|  | double * | padfMaxBound )

Definition at line 916 of file shpopen.c.

References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, SHPInfo::nRecords, SHPInfo::nShapeType, SHPAPI_CALL, and SHPLIB_NULLPTR.

## SHPOpen()

SHPHandle SHPOpen | ( | const char * | pszLayer,
|  | const char * | pszAccess )

Definition at line 219 of file shpopen.c.

References SASetupDefaultHooks(), SHPAPI_CALL, and SHPOpenLL().

## SHPOpenLL()

SHPHandle SHPOpenLL | ( | const char * | pszLayer,
|  | const char * | pszAccess,
|  | const SAHooks * | psHooks )

Definition at line 251 of file shpopen.c.

References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, 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, SAHooks::pvUserData, SHPInfo::sHooks, SHP_RESTORE_SHX_HINT_MESSAGE, SHP_SWAP32, SHP_SWAP64, SHPAPI_CALL, SHPClose(), SHPLIB_NULLPTR, and STATIC_CAST.

Referenced by SHPOpen(), and SHPOpenLLEx().

## SHPOpenLLEx()

SHPHandle SHPOpenLLEx | ( | const char * | pszLayer,
|  | const char * | pszAccess,
|  | const SAHooks * | psHooks,
|  | int | bRestoreSHX )

Definition at line 602 of file shpopen.c.

References SHPAPI_CALL, SHPLIB_NULLPTR, SHPOpenLL(), and SHPRestoreSHX().

## SHPPartTypeName()

const char * SHPPartTypeName | ( | int | nPartType | ) |

Definition at line 2695 of file shpopen.c.

References SHPP_FIRSTRING, SHPP_INNERRING, SHPP_OUTERRING, SHPP_RING, SHPP_TRIFAN, SHPP_TRISTRIP, and SHPPartTypeName().

Referenced by SHPPartTypeName().

## SHPReadObject()

SHPObject * SHPReadObject | ( | const SHPHandle | psSHP,
|  | int | hEntity )

Definition at line 1852 of file shpopen.c.

References SHP_SWAP32, SHPLIB_NULLPTR, SHPReadObject(), and STATIC_CAST.

Referenced by SHPReadObject().

## SHPRestoreSHX()

int SHPRestoreSHX | ( | const char * | pszLayer,
|  | const char * | pszAccess,
|  | const SAHooks * | psHooks )

Definition at line 623 of file shpopen.c.

References SAHooks::Error, FALSE, SAHooks::FClose, SAHooks::FOpen, SAHooks::FRead, SAHooks::FSeek, SAHooks::FWrite, SAHooks::pvUserData, SHP_SWAP32, SHPAPI_CALL, 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, and TRUE.

Referenced by SHPOpenLLEx().

## SHPRewindObject()

int SHPRewindObject | ( | const SHPHandle | hSHP,
|  | SHPObject * | psObject )

Definition at line 2856 of file shpopen.c.

References FALSE, tagSHPObject::nParts, tagSHPObject::nSHPType, tagSHPObject::nVertices, tagSHPObject::padfM, tagSHPObject::padfX, tagSHPObject::padfY, tagSHPObject::padfZ, tagSHPObject::panPartStart, SHPAPI_CALL, SHPT_POLYGON, SHPT_POLYGONM, SHPT_POLYGONZ, and TRUE.

## SHPSetFastModeReadObject()

void SHPSetFastModeReadObject | ( | SHPHandle | hSHP,
|  | int | bFastMode )

Definition at line 897 of file shpopen.c.

References assert, SHPInfo::bFastModeReadObject, SHPInfo::psCachedObject, SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

## SHPTypeName()

const char * SHPTypeName | ( | int | nSHPType | ) |

Definition at line 2641 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, SHPT_POLYGONZ, and SHPTypeName().

Referenced by SHPTypeName().

## SHPWriteHeader()

void SHPWriteHeader | ( | SHPHandle | psSHP | ) |

Definition at line 62 of file shpopen.c.

References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, 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, SHP_SWAP32, SHP_SWAP64, SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

Referenced by SHPClose().

## SHPWriteObject()

int SHPWriteObject | ( | SHPHandle | psSHP,
|  | int | nShapeId,
|  | const SHPObject * | psObject )

Definition at line 1323 of file shpopen.c.

References SHPInfo::adBoundsMax, SHPInfo::adBoundsMin, assert, tagSHPObject::bMeasureIsUsed, SHPInfo::bUpdated, ByteCopy, tagSHPObject::dfMMax, tagSHPObject::dfMMin, tagSHPObject::dfZMax, tagSHPObject::dfZMin, DISABLE_MULTIPATCH_MEASURE, SAHooks::Error, SHPInfo::fpSHP, SAHooks::FSeek, SAHooks::FTell, 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, SHPInfo::sHooks, SHP_SWAP32, SHP_SWAP64, SHPAPI_CALL, 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, and TRUE.