GDAL OGR C++ API 学习之路 (8)OGRFeature 篇 代码示例 公共静态函数

 CreateFeature

static OGRFeature *CreateFeatureOGRFeatureDefn *)

要素工厂

参数:

poDefn -- 定义模式的功能定义。

返回: 具有空字段且没有几何图形的新功能对象,或者从 GDAL 2.1 开始,在内存不足的情况下为 NULL。可以使用 DestroyFeature() 删除

DestroyFeature

static void DestroyFeature(OGRFeature*)

销毁要素

参数:poFeature -- 要删除的要素

static inline OGRFeatureH ToHandleOGRFeature *poFeature )

将 OGRFeature* 转换为 OGRFeatureH

static inline OGRFeature *FromHandleOGRFeatureH 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

将字段值作为字符串返回,并可能进行转换

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

场主不吃鍋巴

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值