ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
shpopen.c File Reference
#include "shapefil.h"
#include <math.h>
#include <limits.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.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)   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)
 
SHPObjectSHPCreateObject (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)
 
SHPObjectSHPCreateSimpleObject (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)
 
SHPObjectSHPReadObject (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
 

Macro Definition Documentation

◆ ByteCopy

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

Definition at line 332 of file shpopen.c.

◆ CPL_UNUSED

#define CPL_UNUSED

Definition at line 354 of file shpopen.c.

◆ FALSE

#define FALSE   0

Definition at line 328 of file shpopen.c.

◆ MAX

#define MAX (   a,
 
)    ((a>b) ? a : b)

Definition at line 335 of file shpopen.c.

◆ MIN

#define MIN (   a,
 
)    ((a<b) ? a : b)

Definition at line 334 of file shpopen.c.

◆ SHPLIB_NULLPTR

#define SHPLIB_NULLPTR   NULL

Definition at line 371 of file shpopen.c.

◆ STATIC_CAST

#define STATIC_CAST (   type,
  x 
)    ((type)(x))

Definition at line 370 of file shpopen.c.

◆ TRUE

#define TRUE   1

Definition at line 329 of file shpopen.c.

Typedef Documentation

◆ int32

typedef unsigned int int32

Definition at line 324 of file shpopen.c.

◆ uchar

typedef unsigned char uchar

Definition at line 319 of file shpopen.c.

Function Documentation

◆ _SHPSetBounds()

static void _SHPSetBounds ( uchar pabyRec,
SHPObject psShape 
)
static

◆ cvsid_aw()

static const char* cvsid_aw ( )
static

Definition at line 317 of file shpopen.c.

◆ SfRealloc()

static void* SfRealloc ( void *  pMem,
int  nNewSize 
)
static

Definition at line 401 of file shpopen.c.

References SHPLIB_NULLPTR.

Referenced by SHPReadObject(), and SHPWriteObject().

◆ SHPAllocBuffer()

static void* SHPAllocBuffer ( unsigned char **  pBuffer,
int  nSize 
)
static

Definition at line 2043 of file shpopen.c.

References SHPLIB_NULLPTR.

Referenced by SHPReadObject().

◆ SHPClose()

◆ SHPComputeExtents()

◆ SHPCreate()

SHPHandle SHPCreate ( const char *  pszLayer,
int  nShapeType 
)

Definition at line 1249 of file shpopen.c.

References SASetupDefaultHooks(), and SHPCreateLL().

◆ SHPCreateLL()

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

◆ 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 
)

◆ 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.

◆ SHPDestroyObject()

◆ SHPGetInfo()

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

◆ SHPGetLenWithoutExtension()

static int SHPGetLenWithoutExtension ( const char *  pszBasename)
static

Definition at line 575 of file shpopen.c.

References STATIC_CAST.

Referenced by SHPCreateLL(), SHPOpenLL(), and SHPRestoreSHX().

◆ SHPGetPartVertexCount()

static int SHPGetPartVertexCount ( const SHPObject psObject,
int  iPart 
)
static

◆ SHPOpen()

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

Definition at line 561 of file shpopen.c.

References SASetupDefaultHooks(), and SHPOpenLL().

◆ SHPOpenLL()

◆ 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().

◆ SHPPartTypeName()

const char* SHPPartTypeName ( int  nPartType)

◆ SHPReadObject()

◆ SHPReallocObjectBufIfNecessary()

static unsigned char* SHPReallocObjectBufIfNecessary ( SHPHandle  psSHP,
int  nObjectBufSize 
)
static

Definition at line 2062 of file shpopen.c.

References SHPInfo::nObjectBufSize, SHPInfo::pabyObjectBuf, SHPLIB_NULLPTR, and STATIC_CAST.

Referenced by SHPReadObject().

◆ SHPRestoreSHX()

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

◆ SHPRewindIsInnerRing()

static int SHPRewindIsInnerRing ( const SHPObject psObject,
int  iOpRing 
)
static

◆ SHPRewindObject()

◆ SHPSetFastModeReadObject()

void SHPSetFastModeReadObject ( SHPHandle  hSHP,
int  bFastMode 
)

◆ SHPTypeName()

◆ SHPWriteHeader()

◆ SHPWriteObject()

◆ SwapWord()

static void SwapWord ( int  length,
void *  wordP 
)
static

Variable Documentation

◆ bBigEndian

int bBigEndian
static

◆ cpl_cvsid

const char cpl_cvsid[] = "$Id$"
static

Definition at line 317 of file shpopen.c.