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

    .

  • 相关阅读:
    linux
    查看字符的编码数字
    各种语系的unicode对应以及local编码方式
    Unicode字符集,各个语言的区间
    深入理解Python的字符编码
    php 快排
    归并排序
    检测到在集成的托管管道模式下不适用的 ASP.NET 设置的解决方法
    分布式缓存MemcacheHelper
    单例模式
  • 原文地址:https://www.cnblogs.com/lili9696189/p/11345652.html
Copyright © 2011-2022 走看看