当前位置: 首页>>代码示例>>C#>>正文


C# IGeometry.SnapToSpatialReference方法代码示例

本文整理汇总了C#中IGeometry.SnapToSpatialReference方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometry.SnapToSpatialReference方法的具体用法?C# IGeometry.SnapToSpatialReference怎么用?C# IGeometry.SnapToSpatialReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGeometry的用法示例。


在下文中一共展示了IGeometry.SnapToSpatialReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIntersectFeature

 public static ArrayList GetIntersectFeature(IGeoFeatureLayer pLayer, IGeometry pGeom)
 {
     ArrayList list = new ArrayList();
     if (pLayer != null)
     {
         if ((pGeom == null) || pGeom.IsEmpty)
         {
             return list;
         }
         ISpatialReference reference = (pLayer.FeatureClass as IGeoDataset).SpatialReference;
         if (reference != null)
         {
             pGeom.SpatialReference = reference;
             pGeom.SnapToSpatialReference();
         }
         ISpatialFilter filter = new SpatialFilterClass();
         filter.Geometry = pGeom;
         filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
         IFeatureCursor o = pLayer.FeatureClass.Search(filter, false);
         for (IFeature feature = o.NextFeature(); feature != null; feature = o.NextFeature())
         {
             list.Add(feature);
         }
         System.Runtime.InteropServices.Marshal.ReleaseComObject(o);
     }
     return list;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:27,代码来源:LayerHelper.cs

示例2: merge

        public static IGeometry merge(IGeometry g1, IGeometry g2, ISDUTExtension ext)
        {
            ITopologicalOperator2 op_2 = (ITopologicalOperator2)g2;
            if(g1 == null)
            {
                if( g2 == null )
                    return null;

                op_2.IsKnownSimple_2 = false;
                try
                {
                    op_2.Simplify();
                }
                catch (Exception e)
                {
                    Logger.Warn(e);
                }
                return g2;
            }

            ITopologicalOperator2 op_1 = (ITopologicalOperator2)g1;
            if(g2 == null)
            {
                op_1.IsKnownSimple_2 = false;
                try
                {
                    op_1.Simplify();
                }
                catch (Exception e)
                {
                    Logger.Warn(e);
                }
                return g1;
            }

            // http://forums.esri.com/Thread.asp?c=93&f=1170&t=88297#242834

            op_1.IsKnownSimple_2 = false;
            try
            {
                op_1.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            op_2.IsKnownSimple_2 = false;
            try
            {
                op_2.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            if (g1.SpatialReference == null || g1.SpatialReference is IUnknownCoordinateSystem)
            {
                g1.SpatialReference = ext.FocusMap.SpatialReference;
            }

            if (g2.SpatialReference == null || g2.SpatialReference is IUnknownCoordinateSystem)
            {
                g2.SpatialReference = ext.FocusMap.SpatialReference;
            }

            g2.Project(g1.SpatialReference);

            ISpatialReference sr = g1.SpatialReference;

            g1.SnapToSpatialReference();
            g2.SnapToSpatialReference();

            IGeometry r = (IGeometry)(op_1.Union(g2));
            r.SpatialReference = sr;

            if (r.SpatialReference == null || r.SpatialReference is IUnknownCoordinateSystem)
            {
                r.SpatialReference = ext.FocusMap.SpatialReference;
            }

            ITopologicalOperator2 op_r = (ITopologicalOperator2)r;
            op_r.IsKnownSimple_2 = false;
            try
            {
                op_r.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            return r;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:95,代码来源:CmdNew.cs


注:本文中的IGeometry.SnapToSpatialReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。