31 #ifndef _OGR_FEATURE_H_INCLUDED 32 #define _OGR_FEATURE_H_INCLUDED 36 #include "cpl_atomic_ops.h" 71 void SetName(
const char * );
80 { eJustify = eJustifyIn; }
83 void SetWidth(
int nWidthIn ) { nWidth = MAX(0,nWidthIn); }
87 { nPrecision = nPrecisionIn; }
93 const OGRField *GetDefaultRef() {
return &uDefault; }
96 void SetIgnored(
int bIgnore ) { this->bIgnore = bIgnore; }
129 void SetName(
const char * );
170 volatile int nRefCount;
178 char *pszFeatureClassName;
186 virtual const char *GetName();
188 virtual int GetFieldCount();
190 virtual int GetFieldIndex(
const char * );
193 virtual OGRErr DeleteFieldDefn(
int iField );
194 virtual OGRErr ReorderFieldDefns(
int* panMap );
196 virtual int GetGeomFieldCount();
198 virtual int GetGeomFieldIndex(
const char * );
201 virtual OGRErr DeleteGeomFieldDefn(
int iGeomField );
213 virtual int IsGeometryIgnored();
214 virtual void SetGeometryIgnored(
int bIgnore );
220 static OGRFeatureDefn *CreateFeatureDefn(
const char *pszName = NULL );
242 char * m_pszStyleString;
244 char * m_pszTmpFieldValue;
266 OGRGeometry* GetGeomFieldRef(
const char* pszFName);
267 OGRErr SetGeomFieldDirectly(
int iField,
OGRGeometry * );
271 virtual OGRBoolean Equal(
OGRFeature * poFeature );
279 int IsFieldSet(
int iField );
281 void UnsetField(
int iField );
285 int GetFieldAsInteger(
int i );
286 double GetFieldAsDouble(
int i );
287 const char *GetFieldAsString(
int i );
288 const int *GetFieldAsIntegerList(
int i,
int *pnCount );
289 const double *GetFieldAsDoubleList(
int i,
int *pnCount );
290 char **GetFieldAsStringList(
int i );
291 GByte *GetFieldAsBinary(
int i,
int *pnCount );
292 int GetFieldAsDateTime(
int i,
293 int *pnYear,
int *pnMonth,
int *pnDay,
294 int *pnHour,
int *pnMinute,
int *pnSecond,
297 int GetFieldAsInteger(
const char *pszFName )
298 {
return GetFieldAsInteger( GetFieldIndex(pszFName) ); }
299 double GetFieldAsDouble(
const char *pszFName )
300 {
return GetFieldAsDouble( GetFieldIndex(pszFName) ); }
301 const char *GetFieldAsString(
const char *pszFName )
302 {
return GetFieldAsString( GetFieldIndex(pszFName) ); }
303 const int *GetFieldAsIntegerList(
const char *pszFName,
305 {
return GetFieldAsIntegerList( GetFieldIndex(pszFName),
307 const double *GetFieldAsDoubleList(
const char *pszFName,
309 {
return GetFieldAsDoubleList( GetFieldIndex(pszFName),
311 char **GetFieldAsStringList(
const char *pszFName )
312 {
return GetFieldAsStringList(GetFieldIndex(pszFName)); }
314 void SetField(
int i,
int nValue );
315 void SetField(
int i,
double dfValue );
316 void SetField(
int i,
const char * pszValue );
317 void SetField(
int i,
int nCount,
int * panValues );
318 void SetField(
int i,
int nCount,
double * padfValues );
319 void SetField(
int i,
char ** papszValues );
320 void SetField(
int i,
OGRField * puValue );
321 void SetField(
int i,
int nCount, GByte * pabyBinary );
322 void SetField(
int i,
int nYear,
int nMonth,
int nDay,
323 int nHour=0,
int nMinute=0,
int nSecond=0,
326 void SetField(
const char *pszFName,
int nValue )
327 { SetField( GetFieldIndex(pszFName), nValue ); }
328 void SetField(
const char *pszFName,
double dfValue )
329 { SetField( GetFieldIndex(pszFName), dfValue ); }
330 void SetField(
const char *pszFName,
const char * pszValue)
331 { SetField( GetFieldIndex(pszFName), pszValue ); }
332 void SetField(
const char *pszFName,
int nCount,
334 { SetField(GetFieldIndex(pszFName),nCount,panValues);}
335 void SetField(
const char *pszFName,
int nCount,
336 double * padfValues )
337 {SetField(GetFieldIndex(pszFName),nCount,padfValues);}
338 void SetField(
const char *pszFName,
char ** papszValues )
339 { SetField( GetFieldIndex(pszFName), papszValues); }
340 void SetField(
const char *pszFName,
OGRField * puValue )
341 { SetField( GetFieldIndex(pszFName), puValue ); }
342 void SetField(
const char *pszFName,
343 int nYear,
int nMonth,
int nDay,
344 int nHour=0,
int nMinute=0,
int nSecond=0,
346 { SetField( GetFieldIndex(pszFName),
348 nHour, nMinute, nSecond, nTZFlag ); }
351 virtual OGRErr SetFID(
long nFID );
353 void DumpReadable( FILE *,
char** papszOptions = NULL );
356 OGRErr SetFrom(
OGRFeature *,
int *,
int = TRUE );
357 OGRErr SetFieldsFrom(
OGRFeature *,
int *,
int = TRUE );
360 int *panRemapSource );
362 int *panRemapSource );
364 virtual const char *GetStyleString();
365 virtual void SetStyleString(
const char * );
366 virtual void SetStyleStringDirectly(
char * );
367 virtual OGRStyleTable *GetStyleTable() {
return m_poStyleTable; }
369 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable)
370 {
if ( m_poStyleTable )
delete m_poStyleTable;
371 m_poStyleTable = poStyleTable; }
390 char **FieldCollector(
void *,
char ** );
403 long *EvaluateAgainstIndices(
OGRLayer *, OGRErr * );
407 char **GetUsedFields();
409 void *GetSWGExpr() {
return pSWQExpr; }
int IsIgnored()
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:138
int GetReferenceCount()
Fetch current reference count.
Definition: ogr_feature.h:210
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:283
const char * GetNameRef()
Fetch name of this field.
Definition: ogr_feature.h:130
Definition: ogr_feature.h:112
int GetPrecision()
Get the formatting precision for this field. This should normally be zero for fields of types other t...
Definition: ogr_feature.h:85
long GetFID()
Get feature identifier.
Definition: ogr_feature.h:350
virtual int GetGeomFieldCount()
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:561
virtual void SetStyleIgnored(int bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:216
int GetWidth()
Get the formatting width for this field.
Definition: ogr_feature.h:82
int GetFieldIndex(const char *pszName)
Fetch the field index given field name.
Definition: ogr_feature.h:276
Definition: ogr_feature.h:167
virtual int GetGeomFieldIndex(const char *)
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:798
void SetType(OGRFieldType eTypeIn)
Set the type of this field. This should never be done to an OGRFieldDefn that is already part of an O...
Definition: ogr_feature.h:75
Definition: ogr_feature.h:52
OGRFieldType GetType()
Fetch type of this field.
Definition: ogr_feature.h:74
const char * GetNameRef()
Fetch name of this field.
Definition: ogr_feature.h:72
OGRwkbGeometryType
Definition: ogr_core.h:308
OGRwkbGeometryType GetType()
Fetch geometry type of this field.
Definition: ogr_feature.h:132
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:604
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition: ogr_feature.h:274
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:86
Definition: ogr_geometry.h:79
Definition: ogr_feature.h:384
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:83
OGRJustification
Definition: ogr_core.h:409
OGRJustification GetJustify()
Get the justification for this field.
Definition: ogr_feature.h:78
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:208
OGRFieldType
Definition: ogr_core.h:388
Definition: ogr_spatialref.h:129
int GetGeomFieldIndex(const char *pszName)
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:261
int IsIgnored()
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:95
int GetFieldCount()
Fetch number of fields on this feature. This will always be the same as the field count for the OGRFe...
Definition: ogr_feature.h:273
void SetIgnored(int bIgnore)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:96
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:209
int GetGeomFieldCount()
Fetch number of geometry fields on this feature. This will always be the same as the geometry field c...
Definition: ogr_feature.h:257
Definition: ogr_core.h:427
Definition: ogrsf_frmts.h:59
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:259
Definition: ogr_feature.h:232
virtual int GetFieldCount()
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:263
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:305
Definition: ogr_featurestyle.h:81
virtual int IsStyleIgnored()
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:215
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:79
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:250
virtual int GetFieldIndex(const char *)
Find field by name.
Definition: ogrfeaturedefn.cpp:1074
void SetIgnored(int bIgnore)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:139