CreateFeature
static OGRFeature *CreateFeature(OGRFeatureDefn *)
要素工厂
参数:
poDefn -- 定义模式的功能定义。
返回: 具有空字段且没有几何图形的新功能对象,或者从 GDAL 2.1 开始,在内存不足的情况下为 NULL。可以使用 DestroyFeature() 删除
DestroyFeature
static void DestroyFeature(OGRFeature*)
销毁要素
参数:poFeature -- 要删除的要素
static inline OGRFeatureH ToHandle(OGRFeature *poFeature )
将 OGRFeature* 转换为 OGRFeatureH
static inline OGRFeature *FromHandle(OGRFeatureH hFeature)
将 OGRFeatureH 转换为 OGRFeature*
class FieldValue
Public Functions
void SetNull()
为字段设置空值
void clear()
取消设置该字段
inline void Unset()
取消设置该字段
void SetDateTime(int nYear, int nMonth, int nDay, int nHour = 0, int nMinute = 0, float fSecond = 0.f, int nTZFlag = 0)
设置日期时间值
int GetIndex() const
返回字段索引
const OGRFieldDefn *GetDefn() const
返回字段定义
const OGRFieldDefn *fieldDefn = feature->GetDefn()->GetFieldDefn(i);
const char *fieldName = fieldDefn->GetNameRef();
OGRFieldType fieldType = fieldDefn->GetType();
int fieldWidth = fieldDefn->GetWidth();
int fieldPrecision = fieldDefn->GetPrecision();
bool isNullable = fieldDefn->IsNullable();
inline const char *GetName() const
返回字段名称
inline OGRFieldType GetType() const
返回字段类型
inline OGRFieldSubType GetSubType() const
返回字段子类型
inline bool empty() const
返回字段值是否未设置/为空
bool IsUnset() const
返回字段值是否未设置/为空
bool IsNull() const
返回字段值是否为空
const OGRField *GetRawValue() const
返回原始字段值
const OGRField* rawValue = feature->GetRawValue();
inline int GetInteger() const
返回整数值 仅当 GetType() == OFTInteger 时才使用该方法
inline double GetDouble() const
返回双精度值 仅当 GetType() == OFTReal 时才使用该方法
inline GIntBig GetInteger64() const
返回 64 位整数值 仅当 GetType() == OFTInteger64 时才使用该方法
inline const char *GetString() const
返回字符串值 仅当 GetType() == OFTString 时才使用该方法
inline operator int() const
将字段值作为整数返回,并可能进行转换
inline operator GIntBig() const
将字段值作为 64 位整数返回,并可能进行转换
inline operator double() const
将字段值返回为双精度,并可能进行的转换。
inline operator const char*() const
将字段值作为字符串返回,并可能进行转换