本文整理汇总了C#中OSGeo.GetFID方法的典型用法代码示例。如果您正苦于以下问题:C# OSGeo.GetFID方法的具体用法?C# OSGeo.GetFID怎么用?C# OSGeo.GetFID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSGeo
的用法示例。
在下文中一共展示了OSGeo.GetFID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_mapped_value
public object get_mapped_value(OSGeo.OGR.Feature feature, int esriFieldsIndex)
{
// get the ESRI Field
ESRI.ArcGIS.Geodatabase.IField pField = m_fields.get_Field(esriFieldsIndex);
if (esriFieldsIndex == m_oidFieldIndex)
return feature.GetFID();
if (esriFieldsIndex == m_geometryFieldIndex)
{
System.Diagnostics.Debug.Assert(false);
return null; // this should never be called for geometries
}
int ogrIndex = (int) m_fieldMapping[esriFieldsIndex];
if (!feature.IsFieldSet(ogrIndex))
return null;
switch (feature.GetFieldType(ogrIndex))
{
// must be kept in sync with utilities library
case OSGeo.OGR.FieldType.OFTInteger:
return feature.GetFieldAsInteger(ogrIndex);
case OSGeo.OGR.FieldType.OFTReal:
return feature.GetFieldAsDouble(ogrIndex);
case OSGeo.OGR.FieldType.OFTString:
return ogr_utils.ghetto_fix_ogr_string(feature.GetFieldAsString(ogrIndex));
case OSGeo.OGR.FieldType.OFTBinary:
// WTF, the C# bindings don't have a blob retrieval until this ticket gets solved
// http://trac.osgeo.org/gdal/ticket/4457#comment:2
return null;
case OSGeo.OGR.FieldType.OFTDateTime:
{
int year, month, day, hour, minute, second, flag;
feature.GetFieldAsDateTime(ogrIndex, out year, out month, out day, out hour, out minute, out second, out flag);
DateTime date = new DateTime(year, month, day, hour, minute, second);
return date;
}
default:
return ogr_utils.ghetto_fix_ogr_string(feature.GetFieldAsString(ogrIndex)); //most things coerce as strings
}
}