#include "shapefil.h"
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
Include dependency graph for dbfopen.c:
Go to the source code of this file.
Defines | |
#define | FALSE 0 |
#define | TRUE 1 |
Functions | |
static void * | SfRealloc (void *pMem, int nNewSize) |
static void | DBFWriteHeader (DBFHandle psDBF) |
static void | DBFFlushRecord (DBFHandle psDBF) |
DBFHandle SHPAPI_CALL | DBFOpen (const char *pszFilename, const char *pszAccess) |
void SHPAPI_CALL | DBFClose (DBFHandle psDBF) |
DBFHandle SHPAPI_CALL | DBFCreate (const char *pszFilename) |
int SHPAPI_CALL | DBFAddField (DBFHandle psDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals) |
static void * | DBFReadAttribute (DBFHandle psDBF, int hEntity, int iField, char chReqType) |
int SHPAPI_CALL | DBFReadIntegerAttribute (DBFHandle psDBF, int iRecord, int iField) |
double SHPAPI_CALL | DBFReadDoubleAttribute (DBFHandle psDBF, int iRecord, int iField) |
const char SHPAPI_CALL1 * | DBFReadStringAttribute (DBFHandle psDBF, int iRecord, int iField){return((const char *) DBFReadAttribute(psDBF, iRecord, iField, 'C') |
const char SHPAPI_CALL1 * | DBFReadLogicalAttribute (DBFHandle psDBF, int iRecord, int iField){return((const char *) DBFReadAttribute(psDBF, iRecord, iField, 'L') |
int SHPAPI_CALL | DBFIsAttributeNULL (DBFHandle psDBF, int iRecord, int iField) |
int SHPAPI_CALL | DBFGetFieldCount (DBFHandle psDBF) |
int SHPAPI_CALL | DBFGetRecordCount (DBFHandle psDBF) |
DBFFieldType SHPAPI_CALL | DBFGetFieldInfo (DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals) |
static int | DBFWriteAttribute (DBFHandle psDBF, int hEntity, int iField, void *pValue) |
int | DBFWriteAttributeDirectly (DBFHandle psDBF, int hEntity, int iField, void *pValue) |
int SHPAPI_CALL | DBFWriteDoubleAttribute (DBFHandle psDBF, int iRecord, int iField, double dValue) |
int SHPAPI_CALL | DBFWriteIntegerAttribute (DBFHandle psDBF, int iRecord, int iField, int nValue) |
int SHPAPI_CALL | DBFWriteStringAttribute (DBFHandle psDBF, int iRecord, int iField, const char *pszValue) |
int SHPAPI_CALL | DBFWriteNULLAttribute (DBFHandle psDBF, int iRecord, int iField) |
int SHPAPI_CALL | DBFWriteLogicalAttribute (DBFHandle psDBF, int iRecord, int iField, const char lValue) |
int SHPAPI_CALL | DBFWriteTuple (DBFHandle psDBF, int hEntity, void *pRawTuple) |
const char SHPAPI_CALL1 * | DBFReadTuple (DBFHandle psDBF, int hEntity){intnRecordOffset;unsigned char *pabyRec;static char *pReturnTuple=NULL;static int nTupleLen=0;if(hEntity< 0||hEntity >=psDBF->nRecords) return(NULL |
if (psDBF->nCurrentRecord!=hEntity) | |
if (nTupleLen< psDBF->nRecordLength) | |
memcpy (pReturnTuple, pabyRec, psDBF->nRecordLength) | |
return (pReturnTuple) | |
DBFHandle SHPAPI_CALL | DBFCloneEmpty (DBFHandle psDBF, const char *pszFilename) |
char SHPAPI_CALL | DBFGetNativeFieldType (DBFHandle psDBF, int iField) |
static void | str_to_upper (char *string) |
int SHPAPI_CALL | DBFGetFieldIndex (DBFHandle psDBF, const char *pszFieldName) |
Variables | |
static char | rcsid [] |
static int | nStringFieldLen = 0 |
static char * | pszStringField = NULL |
pabyRec = (unsigned char *) psDBF->pszCurrentRecord |
#define FALSE 0 |
Definition at line 196 of file dbfopen.c.
Referenced by DBFAddField(), DBFCreate(), DBFFlushRecord(), DBFOpen(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), DBFWriteHeader(), DBFWriteTuple(), helpDialog::helpDialog(), if(), SHPCreate(), SHPOpen(), and SHPRewindObject().
#define TRUE 1 |
Definition at line 197 of file dbfopen.c.
Referenced by DBFCloneEmpty(), DBFCreate(), DBFWriteAttribute(), if(), ihm10(), splitLineDialogDlg::run(), simplifyLineDialogDlg::run(), polygonToPolyLineDialogDlg::run(), mergeFeaturesDialogDlg::run(), StreamPolyLineDlg::run(), StreamGridDlg::run(), LinkGridDlg::run(), FlowGridDlg::run(), CatchmentPolygonDlg::run(), CatchmentGridDlg::run(), rivFileDlg::run(), paraFileDlg::run(), mshFileDlg::run(), attFileDlg::run(), runTriangleDlg::run(), generateShapeTopologyDlg::run(), createTINsDlg::run(), SHPCreate(), SHPOpen(), and SHPWriteObject().
int SHPAPI_CALL DBFAddField | ( | DBFHandle | psDBF, | |
const char * | pszFieldName, | |||
DBFFieldType | eType, | |||
int | nWidth, | |||
int | nDecimals | |||
) |
Definition at line 585 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFInfo::bUpdated, FALSE, FTDouble, FTLogical, FTString, DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::nRecords, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCurrentRecord, DBFInfo::pszHeader, and SfRealloc().
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), catchmentPoly(), createTinShapeFile(), extractRiver4mTIN(), generateShape(), mergeFeatures(), polygonToPolyline(), simplifyPolySHP(), splitLineAtVertices(), and streamSegmentationShp().
Here is the call graph for this function:
Definition at line 1395 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFInfo::bUpdated, DBFClose(), DBFCreate(), DBFOpen(), DBFWriteHeader(), memcpy(), DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszHeader, and TRUE.
Here is the call graph for this function:
void SHPAPI_CALL DBFClose | ( | DBFHandle | psDBF | ) |
Definition at line 442 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFInfo::bUpdated, DBFFlushRecord(), DBFWriteHeader(), DBFInfo::fp, fread(), fseek(), DBFInfo::nRecords, nStringFieldLen, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCurrentRecord, DBFInfo::pszHeader, and pszStringField.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), catchmentPoly(), createTinShapeFile(), DBFCloneEmpty(), extractRiver4mTIN(), generateShape(), mergeFeatures(), simplifyPolySHP(), splitLineAtVertices(), and streamSegmentationShp().
Here is the call graph for this function:
DBFHandle SHPAPI_CALL DBFCreate | ( | const char * | pszFilename | ) |
Definition at line 509 of file dbfopen.c.
References DBFInfo::bCurrentRecordModified, DBFInfo::bNoHeader, FALSE, DBFInfo::fp, DBFInfo::nCurrentRecord, DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::nRecords, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCurrentRecord, DBFInfo::pszHeader, and TRUE.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), catchmentPoly(), createTinShapeFile(), DBFCloneEmpty(), extractRiver4mTIN(), generateShape(), mergeFeatures(), polygonToPolyline(), simplifyPolySHP(), splitLineAtVertices(), and streamSegmentationShp().
static void DBFFlushRecord | ( | DBFHandle | psDBF | ) | [static] |
Definition at line 281 of file dbfopen.c.
References DBFInfo::bCurrentRecordModified, FALSE, DBFInfo::fp, fseek(), DBFInfo::nCurrentRecord, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, and DBFInfo::pszCurrentRecord.
Referenced by DBFClose(), DBFReadAttribute(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), DBFWriteTuple(), and if().
Here is the call graph for this function:
int SHPAPI_CALL DBFGetFieldCount | ( | DBFHandle | psDBF | ) |
Definition at line 897 of file dbfopen.c.
References DBFInfo::nFields.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), and DBFGetFieldIndex().
int SHPAPI_CALL DBFGetFieldIndex | ( | DBFHandle | psDBF, | |
const char * | pszFieldName | |||
) |
Definition at line 1475 of file dbfopen.c.
References DBFGetFieldCount(), DBFGetFieldInfo(), name(), NULL, and str_to_upper().
Referenced by addSOrder(), calDownSegment(), rivFileDlg::run(), and simplifyPolySHP().
Here is the call graph for this function:
DBFFieldType SHPAPI_CALL DBFGetFieldInfo | ( | DBFHandle | psDBF, | |
int | iField, | |||
char * | pszFieldName, | |||
int * | pnWidth, | |||
int * | pnDecimals | |||
) |
Definition at line 923 of file dbfopen.c.
References FTDouble, FTInteger, FTInvalid, FTLogical, DBFInfo::nFields, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldSize, and DBFInfo::pszHeader.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), and DBFGetFieldIndex().
char SHPAPI_CALL DBFGetNativeFieldType | ( | DBFHandle | psDBF, | |
int | iField | |||
) |
int SHPAPI_CALL DBFGetRecordCount | ( | DBFHandle | psDBF | ) |
Definition at line 910 of file dbfopen.c.
References DBFInfo::nRecords.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), extractRiver4mTIN(), mergeFeatures(), polygonToPolyline(), rivFileDlg::run(), attFileDlg::run(), simplifyPolySHP(), and splitLineAtVertices().
int SHPAPI_CALL DBFIsAttributeNULL | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) |
Definition at line 862 of file dbfopen.c.
References DBFReadStringAttribute(), and DBFInfo::pachFieldType.
Here is the call graph for this function:
DBFHandle SHPAPI_CALL DBFOpen | ( | const char * | pszFilename, | |
const char * | pszAccess | |||
) |
Definition at line 305 of file dbfopen.c.
References DBFInfo::bCurrentRecordModified, DBFInfo::bNoHeader, FALSE, DBFInfo::fp, fread(), fseek(), DBFInfo::nCurrentRecord, DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::nRecords, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCurrentRecord, DBFInfo::pszHeader, and SfRealloc().
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), DBFCloneEmpty(), extractRiver4mTIN(), generateShape(), mergeFeatures(), polygonToPolyline(), rivFileDlg::run(), attFileDlg::run(), simplifyPolySHP(), and splitLineAtVertices().
Here is the call graph for this function:
static void* DBFReadAttribute | ( | DBFHandle | psDBF, | |
int | hEntity, | |||
int | iField, | |||
char | chReqType | |||
) | [static] |
Definition at line 686 of file dbfopen.c.
References DBFFlushRecord(), fread(), fseek(), DBFInfo::nCurrentRecord, DBFInfo::nFields, DBFInfo::nRecords, nStringFieldLen, NULL, pabyRec, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCurrentRecord, pszStringField, and SfRealloc().
Referenced by DBFReadDoubleAttribute(), and DBFReadIntegerAttribute().
Here is the call graph for this function:
double SHPAPI_CALL DBFReadDoubleAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) |
Definition at line 814 of file dbfopen.c.
References DBFReadAttribute(), and NULL.
Referenced by addFID(), addSOrder(), addToFromNode(), and calDownSegment().
Here is the call graph for this function:
int SHPAPI_CALL DBFReadIntegerAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) |
Definition at line 794 of file dbfopen.c.
References DBFReadAttribute(), and NULL.
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), rivFileDlg::run(), and simplifyPolySHP().
Here is the call graph for this function:
const char SHPAPI_CALL1* DBFReadLogicalAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) | const |
const char SHPAPI_CALL1* DBFReadStringAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) | const |
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), and DBFIsAttributeNULL().
const char SHPAPI_CALL1* DBFReadTuple | ( | DBFHandle | psDBF, | |
int | hEntity | |||
) |
static int DBFWriteAttribute | ( | DBFHandle | psDBF, | |
int | hEntity, | |||
int | iField, | |||
void * | pValue | |||
) | [static] |
Definition at line 970 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFFlushRecord(), DBFWriteHeader(), FALSE, fread(), fseek(), DBFInfo::nCurrentRecord, DBFInfo::nRecordLength, DBFInfo::nRecords, pabyRec, DBFInfo::pszCurrentRecord, and TRUE.
Referenced by DBFWriteDoubleAttribute(), DBFWriteIntegerAttribute(), DBFWriteLogicalAttribute(), DBFWriteNULLAttribute(), and DBFWriteStringAttribute().
Here is the call graph for this function:
int DBFWriteAttributeDirectly | ( | DBFHandle | psDBF, | |
int | hEntity, | |||
int | iField, | |||
void * | pValue | |||
) |
Definition at line 1140 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFFlushRecord(), DBFWriteHeader(), FALSE, fread(), fseek(), DBFInfo::nCurrentRecord, DBFInfo::nRecordLength, DBFInfo::nRecords, pabyRec, and DBFInfo::pszCurrentRecord.
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteDoubleAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField, | |||
double | dValue | |||
) |
Definition at line 1216 of file dbfopen.c.
References DBFWriteAttribute().
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), and generateShape().
Here is the call graph for this function:
static void DBFWriteHeader | ( | DBFHandle | psDBF | ) | [static] |
Definition at line 228 of file dbfopen.c.
References DBFInfo::bNoHeader, FALSE, DBFInfo::fp, fseek(), DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::pszHeader, and XBASE_FLDHDR_SZ.
Referenced by DBFCloneEmpty(), DBFClose(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), and DBFWriteTuple().
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteIntegerAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField, | |||
int | nValue | |||
) |
Definition at line 1230 of file dbfopen.c.
References DBFWriteAttribute().
Referenced by addFID(), addSOrder(), addToFromNode(), calDownSegment(), catchmentPoly(), createTinShapeFile(), extractRiver4mTIN(), generateShape(), mergeFeatures(), simplifyPolySHP(), splitLineAtVertices(), and streamGenShp().
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteLogicalAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField, | |||
const char | lValue | |||
) |
Definition at line 1273 of file dbfopen.c.
References DBFWriteAttribute().
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteNULLAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField | |||
) |
Definition at line 1260 of file dbfopen.c.
References DBFWriteAttribute(), and NULL.
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteStringAttribute | ( | DBFHandle | psDBF, | |
int | iRecord, | |||
int | iField, | |||
const char * | pszValue | |||
) |
Definition at line 1246 of file dbfopen.c.
References DBFWriteAttribute().
Referenced by addFID(), addSOrder(), addToFromNode(), and calDownSegment().
Here is the call graph for this function:
int SHPAPI_CALL DBFWriteTuple | ( | DBFHandle | psDBF, | |
int | hEntity, | |||
void * | pRawTuple | |||
) |
Definition at line 1287 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFFlushRecord(), DBFWriteHeader(), FALSE, fread(), fseek(), DBFInfo::nCurrentRecord, DBFInfo::nRecordLength, DBFInfo::nRecords, pabyRec, and DBFInfo::pszCurrentRecord.
Here is the call graph for this function:
if | ( | nTupleLen< psDBF-> | nRecordLength | ) |
Definition at line 1378 of file dbfopen.c.
References SfRealloc().
Here is the call graph for this function:
if | ( | psDBF->nCurrentRecord! | = hEntity |
) |
Definition at line 1364 of file dbfopen.c.
References DBFFlushRecord(), fread(), and fseek().
Referenced by boundingbox(), ihm10(), parsecommandline(), and sweeplinedelaunay().
Here is the call graph for this function:
memcpy | ( | pReturnTuple | , | |
pabyRec | , | |||
psDBF-> | nRecordLength | |||
) |
Referenced by DBFCloneEmpty(), if(), SHPOpen(), and SHPWriteObject().
return | ( | pReturnTuple | ) |
static void* SfRealloc | ( | void * | pMem, | |
int | nNewSize | |||
) | [static] |
Definition at line 210 of file dbfopen.c.
References NULL.
Referenced by DBFAddField(), DBFOpen(), DBFReadAttribute(), if(), and SHPWriteObject().
static void str_to_upper | ( | char * | string | ) | [static] |
int nStringFieldLen = 0 [static] |
pabyRec = (unsigned char *) psDBF->pszCurrentRecord |
Definition at line 1376 of file dbfopen.c.
Referenced by DBFReadAttribute(), DBFWriteAttribute(), DBFWriteAttributeDirectly(), DBFWriteTuple(), and SHPWriteObject().
char* pszStringField = NULL [static] |
char rcsid[] [static] |