zoukankan      html  css  js  c++  java
  • Dotspatial 要素重叠分析

    private void toolStripButton30_Click(object sender, EventArgs e)
    {
      //面状重叠分析
      if (mapMain.Layers.Count == 0)
      {
        return;
      }
    //重叠分析
    //遍历要素,显示面积
    FeatureSet fs = null;

    fs = Lzq_LayerManager.getFeatureSetByName(layerNamePolygon, mapMain); //(FeatureSet) map1.Layers[0].DataSet;

    //MessageBox.Show("图层类型:" + fs.FeatureType.ToString());
    if (fs.FeatureType != FeatureType.Polygon)
    {
    return;
    }

    DotSpatial.Topology.Geometry gm1, gm2;
    for (int i = 0; i < fs.Features.Count; i++)
    {
    gm1 = (DotSpatial.Topology.Geometry) (fs.Features[i].BasicGeometry);
    for (int j = i + 1; j < fs.Features.Count; j++)
    {
    gm2 = (DotSpatial.Topology.Geometry) (fs.Features[j].BasicGeometry);
    if (gm1.IsSimple && gm2.IsSimple)
    {
    try
    {
    if (gm1.Overlaps(gm2)) //重叠
    {
    //try
    //{
    Geometry p = (Geometry)gm1.Intersection(gm2);
    DotSpatial.Topology.CoordinateArrays.RemoveRepeatedPoints(p.Coordinates);
    if (p.Area > 0.001)
    {
    MessageBox.Show(" gm1——lb:" +
    fs.Features[i].DataRow["林班号"].ToString() + " xb:" +
    fs.Features[i].DataRow["小班号"].ToString() + "——gm1 Area" +
    gm1.Area.ToString() +
    " gm2——lb:" +
    fs.Features[j].DataRow["林班号"].ToString() + " xb:" +
    fs.Features[j].DataRow["小班号"].ToString() + "——gm2 Area" +
    gm2.Area.ToString() +
    " 重叠 面积:" +
    p.Area);
    }
    //}
    //catch
    //{
    //}
    }
    }
    catch
    {
    }
    }
    //}
    //catch (Exception exc)
    //{
    // // MessageBox.Show(exc.Message);
    //}
    }
    }
    fs = null;
    }

  • 相关阅读:
    制作你的第一个HTML 5游戏
    拒绝臆想,让我们脚踏实地做设计!
    HTML 5或者Silverlight?
    如何替换掉回车键
    杀死团队的武器与修复团队的方法
    Google趋势中显示jQuery是最流行的JavaScript框架
    关于脚本载入器的思考
    简化Web开发的12个HTML5CSS框架
    线框图(demo草图)制作的总结
    江苏南通周边经纬度
  • 原文地址:https://www.cnblogs.com/kogame/p/10017425.html
Copyright © 2011-2022 走看看