#include <ogr_feature.h>
Public Member Functions | |
OGRFeature (OGRFeatureDefn *) | |
Constructor. | |
OGRFeatureDefn * | GetDefnRef () |
Fetch feature definition. | |
OGRErr | SetGeometryDirectly (OGRGeometry *) |
Set feature geometry. | |
OGRErr | SetGeometry (OGRGeometry *) |
Set feature geometry. | |
OGRGeometry * | GetGeometryRef () |
Fetch pointer to feature geometry. | |
OGRGeometry * | StealGeometry () |
Take away ownership of geometry. | |
OGRFeature * | Clone () |
Duplicate feature. | |
virtual OGRBoolean | Equal (OGRFeature *poFeature) |
Test if two features are the same. | |
int | GetFieldCount () |
Fetch number of fields on this feature. This will always be the same as the field count for the OGRFeatureDefn. | |
OGRFieldDefn * | GetFieldDefnRef (int iField) |
Fetch definition for this field. | |
int | GetFieldIndex (const char *pszName) |
Fetch the field index given field name. | |
int | IsFieldSet (int iField) const |
Test if a field has ever been assigned a value or not. | |
void | UnsetField (int iField) |
Clear a field, marking it as unset. | |
OGRField * | GetRawFieldRef (int i) |
Fetch a pointer to the internal field value given the index. | |
int | GetFieldAsInteger (int i) |
Fetch field value as integer. | |
double | GetFieldAsDouble (int i) |
Fetch field value as a double. | |
const char * | GetFieldAsString (int i) |
Fetch field value as a string. | |
const int * | GetFieldAsIntegerList (int i, int *pnCount) |
Fetch field value as a list of integers. | |
const double * | GetFieldAsDoubleList (int i, int *pnCount) |
Fetch field value as a list of doubles. | |
char ** | GetFieldAsStringList (int i) const |
Fetch field value as a list of strings. | |
GByte * | GetFieldAsBinary (int i, int *pnCount) |
Fetch field value as binary data. | |
int | GetFieldAsDateTime (int i, int *pnYear, int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, int *pnSecond, int *pnTZFlag) |
Fetch field value as date and time. | |
void | SetField (int i, int nValue) |
Set field to integer value. | |
void | SetField (int i, double dfValue) |
Set field to double value. | |
void | SetField (int i, const char *pszValue) |
Set field to string value. | |
void | SetField (int i, int nCount, int *panValues) |
Set field to list of integers value. | |
void | SetField (int i, int nCount, double *padfValues) |
Set field to list of doubles value. | |
void | SetField (int i, char **papszValues) |
Set field to list of strings value. | |
void | SetField (int i, OGRField *puValue) |
Set field. | |
void | SetField (int i, int nCount, GByte *pabyBinary) |
Set field to binary data. | |
void | SetField (int i, int nYear, int nMonth, int nDay, int nHour=0, int nMinute=0, int nSecond=0, int nTZFlag=0) |
Set field to date. | |
long | GetFID () |
Get feature identifier. | |
virtual OGRErr | SetFID (long nFID) |
Set the feature identifier. | |
void | DumpReadable (FILE *, char **papszOptions=NULL) |
Dump this feature in a human readable form. | |
OGRErr | SetFrom (OGRFeature *, int=TRUE) |
Set one feature from another. | |
OGRErr | SetFrom (OGRFeature *, int *, int=TRUE) |
Set one feature from another. | |
virtual const char * | GetStyleString () |
Fetch style string for this feature. | |
virtual void | SetStyleString (const char *) |
Set feature style string. This method operate exactly as OGRFeature::SetStyleStringDirectly() except that it does not assume ownership of the passed string, but instead makes a copy of it. | |
virtual void | SetStyleStringDirectly (char *) |
Set feature style string. This method operate exactly as OGRFeature::SetStyleString() except that it assumes ownership of the passed string. | |
Static Public Member Functions | |
static OGRFeature * | CreateFeature (OGRFeatureDefn *) |
Feature factory. | |
static void | DestroyFeature (OGRFeature *) |
Destroy feature. |
OGRFeature::OGRFeature | ( | OGRFeatureDefn * | poDefnIn | ) |
Constructor.
Note that the OGRFeature will increment the reference count of it's defining OGRFeatureDefn. Destruction of the OGRFeatureDefn before destruction of all OGRFeatures that depend on it is likely to result in a crash.
This method is the same as the C function OGR_F_Create().
poDefnIn | feature class (layer) definition to which the feature will adhere. |
References OGRFeatureDefn::GetFieldCount(), OGRField::nMarker1, OGRField::nMarker2, OGRFeatureDefn::Reference(), and OGRField::Set.
Referenced by Clone(), and CreateFeature().
OGRFeature * OGRFeature::Clone | ( | ) |
Duplicate feature.
The newly created feature is owned by the caller, and will have it's own reference to the OGRFeatureDefn.
This method is the same as the C function OGR_F_Clone().
References GetFID(), OGRFeatureDefn::GetFieldCount(), GetStyleString(), OGRFeature(), SetFID(), SetField(), SetGeometry(), and SetStyleString().
OGRFeature * OGRFeature::CreateFeature | ( | OGRFeatureDefn * | poDefn | ) | [static] |
Feature factory.
This is essentially a feature factory, useful for applications creating features but wanting to ensure they are created out of the OGR/GDAL heap.
This method is the same as the C function OGR_F_Create().
poDefn | Feature definition defining schema. |
References OGRFeature().
Referenced by OGRDataSource::CopyLayer().
void OGRFeature::DestroyFeature | ( | OGRFeature * | poFeature | ) | [static] |
Destroy feature.
The feature is deleted, but within the context of the GDAL/OGR heap. This is necessary when higher level applications use GDAL/OGR from a DLL and they want to delete a feature created within the DLL. If the delete is done in the calling application the memory will be freed onto the application heap which is inappropriate.
This method is the same as the C function OGR_F_Destroy().
poFeature | the feature to delete. |
Referenced by OGRDataSource::CopyLayer().
void OGRFeature::DumpReadable | ( | FILE * | fpOut, | |
char ** | papszOptions = NULL | |||
) |
Dump this feature in a human readable form.
This dumps the attributes, and geometry; however, it doesn't definition information (other than field types and names), nor does it report the geometry spatial reference system.
A few options can be defined to change the default dump :
This method is the same as the C function OGR_F_DumpReadable().
fpOut | the stream to write to, such as stdout. If NULL stdout will be used. | |
papszOptions | NULL terminated list of options (may be NULL) |
References OGRGeometry::dumpReadable(), GetFID(), GetFieldAsString(), GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetFieldTypeName(), OGRFeatureDefn::GetName(), OGRFieldDefn::GetNameRef(), GetStyleString(), OGRFieldDefn::GetType(), and IsFieldSet().
OGRBoolean OGRFeature::Equal | ( | OGRFeature * | poFeature | ) | [virtual] |
Test if two features are the same.
Two features are considered equal if the share them (pointer equality) same OGRFeatureDefn, have the same field values, and the same geometry (as tested by OGRGeometry::Equal()) as well as the same feature id.
This method is the same as the C function OGR_F_Equal().
poFeature | the other feature to test this one against. |
References OGRGeometry::Equals(), GetDefnRef(), GetFID(), GetFieldAsBinary(), GetFieldAsDateTime(), GetFieldAsDouble(), GetFieldAsDoubleList(), GetFieldAsInteger(), GetFieldAsIntegerList(), GetFieldAsString(), GetFieldAsStringList(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), GetGeometryRef(), OGRFieldDefn::GetType(), IsFieldSet(), OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, and OFTTime.
OGRFeatureDefn * OGRFeature::GetDefnRef | ( | ) | [inline] |
Fetch feature definition.
This method is the same as the C function OGR_F_GetDefnRef().
Referenced by Equal().
long OGRFeature::GetFID | ( | ) | [inline] |
Get feature identifier.
This method is the same as the C function OGR_F_GetFID().
Referenced by Clone(), OGRDataSource::CopyLayer(), DumpReadable(), Equal(), OGRLayer::GetFeature(), GetFieldAsDouble(), GetFieldAsInteger(), and GetFieldAsString().
GByte * OGRFeature::GetFieldAsBinary | ( | int | iField, | |
int * | pnBytes | |||
) |
Fetch field value as binary data.
Currently this method only works for OFTBinary fields.
This method is the same as the C function OGR_F_GetFieldAsBinary().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
pnBytes | location to put the number of bytes returned. |
References OGRField::Binary, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OGRField::nCount, OFTBinary, and OGRField::paData.
Referenced by Equal().
int OGRFeature::GetFieldAsDateTime | ( | int | iField, | |
int * | pnYear, | |||
int * | pnMonth, | |||
int * | pnDay, | |||
int * | pnHour, | |||
int * | pnMinute, | |||
int * | pnSecond, | |||
int * | pnTZFlag | |||
) |
Fetch field value as date and time.
Currently this method only works for OFTDate, OFTTime and OFTDateTime fields.
This method is the same as the C function OGR_F_GetFieldAsDateTime().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
pnYear | (including century) | |
pnMonth | (1-12) | |
pnDay | (1-31) | |
pnHour | (0-23) | |
pnMinute | (0-59) | |
pnSecond | (0-59) | |
pnTZFlag | (0=unknown, 1=localtime, 100=GMT, see data model for details) |
References OGRField::Date, OGRField::Day, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::Hour, IsFieldSet(), OGRField::Minute, OGRField::Month, OFTDate, OFTDateTime, OFTTime, OGRField::Second, OGRField::TZFlag, and OGRField::Year.
Referenced by Equal().
double OGRFeature::GetFieldAsDouble | ( | int | iField | ) |
Fetch field value as a double.
OFTString features will be translated using atof(). OFTInteger fields will be cast to double. Other field types, or errors will result in a return value of zero.
This method is the same as the C function OGR_F_GetFieldAsDouble().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OFTInteger, OFTReal, and OFTString.
const double * OGRFeature::GetFieldAsDoubleList | ( | int | iField, | |
int * | pnCount | |||
) |
Fetch field value as a list of doubles.
Currently this method only works for OFTRealList fields.
This method is the same as the C function OGR_F_GetFieldAsDoubleList().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
pnCount | an integer to put the list count (number of doubles) into. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OGRField::nCount, OFTRealList, OGRField::paList, and OGRField::RealList.
Referenced by Equal().
int OGRFeature::GetFieldAsInteger | ( | int | iField | ) |
Fetch field value as integer.
OFTString features will be translated using atoi(). OFTReal fields will be cast to integer. Other field types, or errors will result in a return value of zero.
This method is the same as the C function OGR_F_GetFieldAsInteger().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OFTInteger, OFTReal, OFTString, and OGRField::Real.
const int * OGRFeature::GetFieldAsIntegerList | ( | int | iField, | |
int * | pnCount | |||
) |
Fetch field value as a list of integers.
Currently this method only works for OFTIntegerList fields.
This method is the same as the C function OGR_F_GetFieldAsIntegerList().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
pnCount | an integer to put the list count (number of integers) into. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::IntegerList, IsFieldSet(), OGRField::nCount, OFTIntegerList, and OGRField::paList.
Referenced by Equal().
const char * OGRFeature::GetFieldAsString | ( | int | iField | ) |
Fetch field value as a string.
OFTReal and OFTInteger fields will be translated to string using sprintf(), but not necessarily using the established formatting rules. Other field types, or errors will result in a return value of zero.
This method is the same as the C function OGR_F_GetFieldAsString().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References OGRField::Binary, OGRField::Date, OGRField::Day, OGRGeometry::exportToWkt(), GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRGeometry::getGeometryName(), OGRFieldDefn::GetPrecision(), GetStyleString(), OGRFieldDefn::GetType(), OGRFieldDefn::GetWidth(), OGRField::Hour, OGRField::IntegerList, IsFieldSet(), OGRField::Minute, OGRField::Month, OGRField::nCount, OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OFTTime, OGRField::paData, OGRField::paList, OGRField::RealList, OGRField::Second, OGRField::String, OGRField::StringList, OGRField::TZFlag, and OGRField::Year.
Referenced by DumpReadable(), Equal(), GetStyleString(), and SetFrom().
char ** OGRFeature::GetFieldAsStringList | ( | int | iField | ) | const |
Fetch field value as a list of strings.
Currently this method only works for OFTStringList fields.
The returned list is terminated by a NULL pointer. The number of elements can also be calculated using CSLCount().
This method is the same as the C function OGR_F_GetFieldAsStringList().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OFTStringList, OGRField::paList, and OGRField::StringList.
Referenced by Equal().
int OGRFeature::GetFieldCount | ( | ) | [inline] |
Fetch number of fields on this feature. This will always be the same as the field count for the OGRFeatureDefn.
This method is the same as the C function OGR_F_GetFieldCount().
Referenced by DumpReadable(), and SetFrom().
OGRFieldDefn * OGRFeature::GetFieldDefnRef | ( | int | iField | ) | [inline] |
Fetch definition for this field.
This method is the same as the C function OGR_F_GetFieldDefnRef().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
Referenced by SetFrom().
int OGRFeature::GetFieldIndex | ( | const char * | pszName | ) | [inline] |
Fetch the field index given field name.
This is a cover for the OGRFeatureDefn::GetFieldIndex() method.
This method is the same as the C function OGR_F_GetFieldIndex().
pszName | the name of the field to search for. |
Referenced by GetStyleString(), and SetFrom().
OGRGeometry * OGRFeature::GetGeometryRef | ( | ) | [inline] |
Fetch pointer to feature geometry.
This method is the same as the C function OGR_F_GetGeometryRef().
Referenced by Equal(), OGRLayer::GetExtent(), and SetFrom().
OGRField * OGRFeature::GetRawFieldRef | ( | int | iField | ) | [inline] |
Fetch a pointer to the internal field value given the index.
This method is the same as the C function OGR_F_GetRawFieldRef().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
Referenced by SetFrom().
const char * OGRFeature::GetStyleString | ( | ) | [virtual] |
Fetch style string for this feature.
Set the OGR Feature Style Specification for details on the format of this string, and ogr_featurestyle.h for services available to parse it.
This method is the same as the C function OGR_F_GetStyleString().
References GetFieldAsString(), and GetFieldIndex().
Referenced by Clone(), DumpReadable(), GetFieldAsString(), OGRStyleMgr::InitFromFeature(), and SetFrom().
int OGRFeature::IsFieldSet | ( | int | iField | ) | const [inline] |
Test if a field has ever been assigned a value or not.
This method is the same as the C function OGR_F_IsFieldSet().
iField | the field to test. |
Referenced by DumpReadable(), Equal(), GetFieldAsBinary(), GetFieldAsDateTime(), GetFieldAsDouble(), GetFieldAsDoubleList(), GetFieldAsInteger(), GetFieldAsIntegerList(), GetFieldAsString(), GetFieldAsStringList(), SetField(), SetFrom(), and UnsetField().
OGRErr OGRFeature::SetFID | ( | long | nFID | ) | [virtual] |
Set the feature identifier.
For specific types of features this operation may fail on illegal features ids. Generally it always succeeds. Feature ids should be greater than or equal to zero, with the exception of OGRNullFID (-1) indicating that the feature id is unknown.
This method is the same as the C function OGR_F_SetFID().
nFID | the new feature identifier value to assign. |
Referenced by Clone(), OGRDataSource::CopyLayer(), and SetFrom().
void OGRFeature::SetField | ( | int | iField, | |
int | nYear, | |||
int | nMonth, | |||
int | nDay, | |||
int | nHour = 0 , |
|||
int | nMinute = 0 , |
|||
int | nSecond = 0 , |
|||
int | nTZFlag = 0 | |||
) |
Set field to date.
This method currently only has an effect for OFTDate, OFTTime and OFTDateTime fields.
This method is the same as the C function OGR_F_SetFieldDateTime().
iField | the field to set, from 0 to GetFieldCount()-1. | |
nYear | (including century) | |
nMonth | (1-12) | |
nDay | (1-31) | |
nHour | (0-23) | |
nMinute | (0-59) | |
nSecond | (0-59) | |
nTZFlag | (0=unknown, 1=localtime, 100=GMT, see data model for details) |
References OGRField::Date, OGRField::Day, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::Hour, OGRField::Minute, OGRField::Month, OFTDate, OFTDateTime, OFTTime, OGRField::Second, OGRField::TZFlag, and OGRField::Year.
void OGRFeature::SetField | ( | int | iField, | |
int | nBytes, | |||
GByte * | pabyData | |||
) |
Set field to binary data.
This method currently on has an effect of OFTBinary fields.
This method is the same as the C function OGR_F_SetFieldBinary().
iField | the field to set, from 0 to GetFieldCount()-1. | |
nBytes | bytes of data being set. | |
pabyData | the raw data being applied. |
References OGRField::Binary, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::nCount, OFTBinary, OGRField::paData, and SetField().
void OGRFeature::SetField | ( | int | iField, | |
OGRField * | puValue | |||
) |
Set field.
The passed value OGRField must be of exactly the same type as the target field, or an application crash may occur. The passed value is copied, and will not be affected. It remains the responsibility of the caller.
This method is the same as the C function OGR_F_SetFieldRaw().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
puValue | the value to assign. |
References OGRField::Binary, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::IntegerList, IsFieldSet(), OGRField::nCount, OGRField::nMarker1, OGRField::nMarker2, OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OFTTime, OGRField::paData, OGRField::paList, OGRField::RealList, OGRField::Set, OGRField::String, and OGRField::StringList.
void OGRFeature::SetField | ( | int | iField, | |
char ** | papszValues | |||
) |
Set field to list of strings value.
This method currently on has an effect of OFTStringList fields.
This method is the same as the C function OGR_F_SetFieldStringList().
iField | the field to set, from 0 to GetFieldCount()-1. | |
papszValues | the values to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::nCount, OFTStringList, OGRField::paList, SetField(), and OGRField::StringList.
void OGRFeature::SetField | ( | int | iField, | |
int | nCount, | |||
double * | padfValues | |||
) |
Set field to list of doubles value.
This method currently on has an effect of OFTRealList fields.
This method is the same as the C function OGR_F_SetFieldDoubleList().
iField | the field to set, from 0 to GetFieldCount()-1. | |
nCount | the number of values in the list being assigned. | |
padfValues | the values to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::nCount, OFTRealList, OGRField::paList, OGRField::RealList, and SetField().
void OGRFeature::SetField | ( | int | iField, | |
int | nCount, | |||
int * | panValues | |||
) |
Set field to list of integers value.
This method currently on has an effect of OFTIntegerList fields.
This method is the same as the C function OGR_F_SetFieldIntegerList().
iField | the field to set, from 0 to GetFieldCount()-1. | |
nCount | the number of values in the list being assigned. | |
panValues | the values to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::IntegerList, OGRField::nCount, OFTIntegerList, OGRField::paList, and SetField().
void OGRFeature::SetField | ( | int | iField, | |
const char * | pszValue | |||
) |
Set field to string value.
OFTInteger fields will be set based on an atoi() conversion of the string. OFTReal fields will be set based on an atof() conversion of the string. Other field types may be unaffected.
This method is the same as the C function OGR_F_SetFieldString().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
pszValue | the value to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::Integer, IsFieldSet(), OGRField::nMarker2, OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime, OGRParseDate(), OGRField::Real, OGRField::Set, and OGRField::String.
void OGRFeature::SetField | ( | int | iField, | |
double | dfValue | |||
) |
Set field to double value.
OFTInteger and OFTReal fields will be set directly. OFTString fields will be assigned a string representation of the value, but not necessarily taking into account formatting constraints on this field. Other field types may be unaffected.
This method is the same as the C function OGR_F_SetFieldDouble().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
dfValue | the value to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::Integer, IsFieldSet(), OGRField::nMarker2, OFTInteger, OFTReal, OFTString, OGRField::Real, OGRField::Set, and OGRField::String.
void OGRFeature::SetField | ( | int | iField, | |
int | nValue | |||
) |
Set field to integer value.
OFTInteger and OFTReal fields will be set directly. OFTString fields will be assigned a string representation of the value, but not necessarily taking into account formatting constraints on this field. Other field types may be unaffected.
This method is the same as the C function OGR_F_SetFieldInteger().
iField | the field to fetch, from 0 to GetFieldCount()-1. | |
nValue | the value to assign. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OGRField::Integer, IsFieldSet(), OGRField::nMarker2, OFTInteger, OFTReal, OFTString, OGRField::Real, OGRField::Set, and OGRField::String.
Referenced by Clone(), SetField(), and SetFrom().
OGRErr OGRFeature::SetFrom | ( | OGRFeature * | poSrcFeature, | |
int * | panMap, | |||
int | bForgiving = TRUE | |||
) |
Set one feature from another.
Overwrite the contents of this feature from the geometry and attributes of another. The poSrcFeature does not need to have the same OGRFeatureDefn. Field values are copied according to the provided indices map. Field types do not have to exactly match. SetField() method conversion rules will be applied as needed. This is more efficient than OGR_F_SetFrom() in that this doesn't lookup the fields by their names. Particularly useful when the field names don't match.
This method is the same as the C function OGR_F_SetFromWithMap().
poSrcFeature | the feature from which geometry, and field values will be copied. | |
panMap | Array of the indices of the feature's fields stored at the corresponding index of the source feature's fields. A value of -1 should be used to ignore the source's field. The array should not be NULL and be as long as the number of fields in the source feature. | |
bForgiving | TRUE if the operation should continue despite lacking output fields matching some of the source fields. |
References GetFieldAsDouble(), GetFieldAsInteger(), GetFieldAsString(), GetFieldCount(), GetFieldDefnRef(), GetGeometryRef(), GetRawFieldRef(), GetStyleString(), OGRFieldDefn::GetType(), IsFieldSet(), OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime, SetFID(), SetField(), SetGeometry(), SetStyleString(), and UnsetField().
OGRErr OGRFeature::SetFrom | ( | OGRFeature * | poSrcFeature, | |
int | bForgiving = TRUE | |||
) |
Set one feature from another.
Overwrite the contents of this feature from the geometry and attributes of another. The poSrcFeature does not need to have the same OGRFeatureDefn. Field values are copied by corresponding field names. Field types do not have to exactly match. SetField() method conversion rules will be applied as needed.
This method is the same as the C function OGR_F_SetFrom().
poSrcFeature | the feature from which geometry, and field values will be copied. | |
bForgiving | TRUE if the operation should continue despite lacking output fields matching some of the source fields. |
References GetFieldCount(), GetFieldDefnRef(), GetFieldIndex(), and OGRFieldDefn::GetNameRef().
Referenced by OGRDataSource::CopyLayer().
OGRErr OGRFeature::SetGeometry | ( | OGRGeometry * | poGeomIn | ) |
Set feature geometry.
This method updates the features geometry, and operate exactly as SetGeometryDirectly(), except that this method does not assume ownership of the passed geometry, but instead makes a copy of it.
This method is the same as the C function OGR_F_SetGeometry().
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
References OGRGeometry::clone().
OGRErr OGRFeature::SetGeometryDirectly | ( | OGRGeometry * | poGeomIn | ) |
Set feature geometry.
This method updates the features geometry, and operate exactly as SetGeometry(), except that this method assumes ownership of the passed geometry.
This method is the same as the C function OGR_F_SetGeometryDirectly().
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
void OGRFeature::SetStyleString | ( | const char * | pszString | ) | [virtual] |
Set feature style string. This method operate exactly as OGRFeature::SetStyleStringDirectly() except that it does not assume ownership of the passed string, but instead makes a copy of it.
This method is the same as the C function OGR_F_SetStyleString().
pszString | the style string to apply to this feature, cannot be NULL. |
Referenced by Clone(), OGRStyleMgr::SetFeatureStyleString(), and SetFrom().
void OGRFeature::SetStyleStringDirectly | ( | char * | pszString | ) | [virtual] |
Set feature style string. This method operate exactly as OGRFeature::SetStyleString() except that it assumes ownership of the passed string.
This method is the same as the C function OGR_F_SetStyleStringDirectly().
pszString | the style string to apply to this feature, cannot be NULL. |
OGRGeometry * OGRFeature::StealGeometry | ( | ) |
Take away ownership of geometry.
Fetch the geometry from this feature, and clear the reference to the geometry on the feature. This is a mechanism for the application to take over ownship of the geometry from the feature without copying. Sort of an inverse to SetGeometryDirectly().
After this call the OGRFeature will have a NULL geometry.
void OGRFeature::UnsetField | ( | int | iField | ) |
Clear a field, marking it as unset.
This method is the same as the C function OGR_F_UnsetField().
iField | the field to unset. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OGRField::nMarker1, OGRField::nMarker2, OFTBinary, OFTIntegerList, OFTRealList, OFTString, OFTStringList, OGRField::paData, OGRField::paList, and OGRField::Set.
Referenced by SetFrom().