zoukankan      html  css  js  c++  java
  • Dotspatial 唯一值专题图

    /// <summary>
    /// 分类专题图,如按林班号分类
    /// </summary>
    /// <param name="mapControl">Map</param>
    /// <param name="catalogFields">分类字段</param>
    public static void ThemeUniqueValues(Map mapControl, string catalogFields)
    {
    //check the number of layers from map control
    if (mapControl.Layers.Count > 0)
    {
    //Delacre a MapPolygonLayer
    MapPolygonLayer stateLayer = default(MapPolygonLayer);
    //Type cast the FirstLayer of MapControl to MapPolygonLayer
    stateLayer = (MapPolygonLayer) mapControl.Layers[0];
    //Check the MapPolygonLayer ( Make sure that it has a polygon layer)
    if (stateLayer == null)
    {
    MessageBox.Show("The layer is not a polygon layer.");
    }
    else
    {
    //Create a new PolygonScheme
    PolygonScheme scheme = new PolygonScheme();
    //Set the ClassificationType for the PolygonScheme via EditotSettings
    scheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
    //Set the UniqueValue field name
    //Here STATE_NAME would be the Unique value field
    scheme.EditorSettings.FieldName = catalogFields; //"林班号";
    //create categories on the scheme based on the attributes table and field name
    //In this case field name is STATE_NAME
    scheme.CreateCategories(stateLayer.DataSet.DataTable);
    //Set the scheme to stateLayer's symbology
    stateLayer.Symbology = scheme;
    }
    }
    else
    {
    MessageBox.Show("Please add a layer to the map.");
    }
    }

    调用方法:

    //唯一值专题图
    string catalogFields = "关键字";
    Lzq_Theme.ThemeUniqueValues(mapMain, catalogFields);

  • 相关阅读:
    P3180 [HAOI2016]地图
    P2787 语文1(chin1)- 理理思维
    P2221 [HAOI2012]高速公路
    P4137 Rmq Problem / mex
    P3746 [六省联考2017]组合数问题
    P2461 [SDOI2008]递归数列
    P3715 [BJOI2017]魔法咒语
    P3195 [HNOI2008]玩具装箱TOY
    Linux下的strerror是否线程安全?
    bash/shell的字符串trim实现
  • 原文地址:https://www.cnblogs.com/kogame/p/12268668.html
Copyright © 2011-2022 走看看