zoukankan      html  css  js  c++  java
  • C# GIS 空间分析

    Intersection

    public bool Intersection(IFeatureSet self, IFeatureSet other, IFeatureSet output)
            {            
                int maxFeature = self.ShapeIndices.Count;
                int privious = 0;
                output.CopyTableSchema(FeatureSetExt.CombinedFields(self, other));
                FeatureAttributesSet.AddFeatureAttributes(output.DataTable.Columns);
    
                for (int i = 0; i < self.ShapeIndices.Count; i++)
                {
                    IFeature iTF, iSF, f;
                    iTF = self.GetFeature(i);
                    for (int j = 0; j < other.ShapeIndices.Count; j++)
                    {
                        iSF = other.GetFeature(j);
                        if (iSF.Geometry.Envelope.Intersects(iTF.Geometry.Envelope)) 
                        {
                            f = iTF.Intersection(iSF.Geometry);
    
                            if (f != null && f.FeatureType == FeatureType.Polygon) 
                            {
                                IFeature feature = new Feature(f.Geometry);
                                output.Features.Add(feature);
                                feature.CopyAttributes(self.GetFeature(i));
                                feature.CopyAttributes(other.GetFeature(j));
                                FeatureAttributesSet.SetFeatureAttributes(output.DataTable.Rows[output.DataTable.Rows.Count - 1], f.Geometry);
                            }
                        }
                    }                
                }
               
                return true;
            }

    Difference

    private bool DifferentFeatures(IFeatureSet targetFeatures, IFeatureSet sourceFeatures, IFeatureSet featureSet)
            {            
                bool bResult = true;
                int privious = 0;
    
                featureSet.CopyTableSchema(targetFeatures);
    
                FeatureAttributesSet.AddFeatureAttributes(featureSet.DataTable.Columns);
    
                for (int i = 0; i < targetFeatures.ShapeIndices.Count; i++)
                {
                    var tf = targetFeatures.GetFeature(i);
                    for (int j = 0; j < sourceFeatures.ShapeIndices.Count; j++)
                    {
                        var sf = sourceFeatures.GetFeature(j);
    
                        if (sf.Geometry.Envelope.Intersects(tf.Geometry.Envelope))
                        {
                            tf = tf.Difference(sf.Geometry);
                        }
    
                        if (tf == null) break;
                    }
    
                    if (tf != null)
                    {
                        featureSet.AddFeature(tf.Geometry).CopyAttributes(targetFeatures.GetFeature(i));
                        FeatureAttributesSet.SetFeatureAttributes(featureSet.DataTable.Rows[featureSet.DataTable.Rows.Count - 1], tf.Geometry);
                    }                
                }
                
                return bResult;
            }  

    .

  • 相关阅读:
    使用nexus 管理pip 私有包
    gitingore && opensource license 自动生成的网站
    lua-resty-qless-web UI 界面运行
    自定义pip 包开发简单说明
    ethr 微软开源的tcp udp http 网络性能测试工具
    openresty 集成lua-resty-mail +smtp2http 扩展灵活的mail 服务
    masterlab 敏捷项目管理工具
    luarocks 自定义包发布试用
    vorpal 又一个方便的cli 开发包
    gogs wekan 集成试用
  • 原文地址:https://www.cnblogs.com/lili9696189/p/11345652.html
Copyright © 2011-2022 走看看