/// <summary> /// 获取字段的唯一值个数 /// </summary> /// <param name="fieldName"></param> /// <returns></returns> public int GetUniqueCountOfField(string fieldName) { int uniqueCount; //有属性表 uniqueCount = RasterTableFunction.IsRasterLayerHaveTable(rasterLayer.Raster) ? GetUniqueCountByTable(rasterLayer, fieldName) : GetFloatValueUniqueCount(rasterLayer); return(uniqueCount); }
/// <summary> /// 判断是否是字符串类型字段 /// </summary> /// <param name="fieldName">字段名</param> /// <returns></returns> public bool IsStringField(string fieldName) { //没有属性表则为浮点型,不是字符串类型 if (!RasterTableFunction.IsRasterLayerHaveTable(rasterLayer.Raster)) { return(false); } ITable iTable = (ITable)rasterLayer; IFields fields = iTable.Fields; IField field = fields.Field[fields.FindField(fieldName)]; return(field.Type == esriFieldType.esriFieldTypeString); }
/// <summary> /// 根据图层获取空间表格 /// </summary> /// <param name="layer">图层</param> /// <returns>空间表格</returns> public static ITable GetITableByLayer(ILayer layer) { if (layer == null) { return(null); } ITable iTable = null; if (layer is IFeatureLayer) { iTable = (ITable)layer; } else { IRasterLayer rasLayer = layer as IRasterLayer; //判断是否存在属性表 if (rasLayer != null && RasterTableFunction.IsRasterLayerHaveTable(rasLayer.Raster)) { iTable = (ITable)layer; } } return(iTable); }
/// <summary> /// 是否是浮点数据栅格图层 /// </summary> /// <returns></returns> public bool IsFloatRasterLayer() { return(!RasterTableFunction.IsRasterLayerHaveTable(rasterLayer.Raster)); }