• 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;
    }

  • 相关阅读:
    Revit命令之平面区域
    Revit平面视图控制
    电动手摇两用风机Revit族模型
    中田麻吉
    传递项目标准工具
    Sketchup机电专业BIM插件EngeeringToolBox
    机电专业协同模式
    lumion2.5下载及破解安装详细过程
    人防工程空调设计规范
    BIM软件之BIMsight
  • 原文地址:https://www.cnblogs.com/kogame/p/10017425.html
Copyright © 2020-2023  润新知