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


C# IGeometry.Union方法代码示例

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


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

示例1: Union

 /// <summary>
 /// Computes the set-theoretic union of two <c>Geometry</c>s, using enhanced precision.
 /// </summary>
 /// <param name="geom0">The first Geometry.</param>
 /// <param name="geom1">The second Geometry.</param>
 /// <returns>The Geometry representing the set-theoretic union of the input Geometries.</returns>
 public static IGeometry Union(IGeometry geom0, IGeometry geom1)
 {
     ApplicationException originalEx = null;
     try
     {
         IGeometry result = geom0.Union(geom1);
         return result;
     }
     catch (ApplicationException ex)
     {
         originalEx = ex;
     }
     /*
      * If we are here, the original op encountered a precision problem
      * (or some other problem).  Retry the operation with
      * enhanced precision to see if it succeeds
      */
     try
     {
         CommonBitsOp cbo = new CommonBitsOp(true);
         IGeometry resultEP = cbo.Union(geom0, geom1);
         // check that result is a valid point after the reshift to orginal precision
         if (!resultEP.IsValid)
             throw originalEx;
         return resultEP;
     }
     catch (ApplicationException)
     {
         throw originalEx;
     }
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:37,代码来源:EnhancedPrecisionOp.cs

示例2: BufferBySegments

 /// <summary>
 /// Buffer polygons by buffering the individual boundary segments and
 /// either unioning or differencing them.
 /// </summary>
 /// <param name="g"></param>
 /// <param name="distance"></param>
 /// <returns>The buffer geometry</returns>
 public static IGeometry BufferBySegments(IGeometry g, double distance)
 {
     var segs = LineHandlingFunctions.ExtractSegments(g);
     var posDist = Math.Abs(distance);
     var segBuf = BufferByComponents(segs, posDist);
     if (distance < 0.0)
         return g.Difference(segBuf);
     return g.Union(segBuf);
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:16,代码来源:BufferByUnionFunctions.cs

示例3: DissolveLines

 private static IGeometry DissolveLines(IGeometry lines)
 {
     IGeometry dissolved = lines.Union();
     LineMerger merger = new LineMerger();
     merger.Add(dissolved);
     IList<IGeometry> mergedColl = merger.GetMergedLineStrings();
     IGeometry merged = lines.Factory.BuildGeometry(mergedColl);
     return merged;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:9,代码来源:LineDissolveStressTest.cs

示例4: BufferByChains

 public static IGeometry BufferByChains(IGeometry g, double distance, int maxChainSize)
 {
     if (maxChainSize <= 0)
         throw new ArgumentOutOfRangeException("maxChainSize", "Maximum Chain Size must be specified as an input parameter");
     var segs = LineHandlingFunctions.ExtractChains(g, maxChainSize);
     double posDist = Math.Abs(distance);
     var segBuf = BufferByComponents(segs, posDist);
     if (distance < 0.0)
         return g.Difference(segBuf);
     return g.Union(segBuf);
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:11,代码来源:BufferByUnionFunctions.cs

示例5: UnionWithNull

        //private static ICollection<IGeometry> ToCollection<T>(IEnumerable<T> items) where T : IGeometry
        //{
        //    var ret = new List<IGeometry>();
        //    foreach (IGeometry geometry in items)
        //        ret.Add(geometry);
        //    return ret;
        //}

        ///<summary>
        /// Computes the union of two geometries, either of both of which may be null.
        ///</summary>
        /// <param name="g0"></param>
        /// <param name="g1"></param>
        /// <returns>
        /// The union of the input(s)
        /// or <value>null</value> if both inputs are <value>null</value>
        /// </returns>
        private static IGeometry UnionWithNull(IGeometry g0, IGeometry g1)
        {
            if (g0 == null && g1 == null)
                return null;

            if (g1 == null)
                return g0;
            if (g0 == null)
                return g1;

            return g0.Union(g1);
        }
开发者ID:barentswatch,项目名称:NetTopologySuite,代码行数:29,代码来源:UnaryUnionOp.cs

示例6: UnionGeometryCollection

 private static IGeometry UnionGeometryCollection(IGeometry geom)
 {
     if (geom is GeometryCollection)
     {
         return geom.Union();
     }
     return geom;
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:8,代码来源:NtsGeometry.cs

示例7: UnionActual

 /// <summary>
 /// Encapsulates the actual unioning of two polygonal geometries.
 /// </summary>
 private static IGeometry UnionActual(IGeometry g0, IGeometry g1)
 {
     return RestrictToPolygons(g0.Union(g1));
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:7,代码来源:CascadedPolygonUnion.cs

示例8: InvokeGeometryOverlayMethod

        public static IGeometry InvokeGeometryOverlayMethod(SpatialFunction opCode, IGeometry g0, IGeometry g1)
        {
            switch (opCode)
            {
                case SpatialFunction.Intersection:
                    return g0.Intersection(g1);

                case SpatialFunction.Union:
                    return g0.Union(g1);

                case SpatialFunction.Difference:
                    return g0.Difference(g1);

                case SpatialFunction.SymDifference:
                    return g0.SymmetricDifference(g1);
            }
            throw new ArgumentException(@"Unknown overlay op code");
        }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:18,代码来源:OverlayValidatedGeometryOperation.cs

示例9: measure

 /*
 public static double measure(Geometry a, Geometry b)
 {
 AreaSimilarityMeasure gv = new AreaSimilarityMeasure(a, b);
 return gv.measure();
 }
 */
 public double Measure(IGeometry g1, IGeometry g2)
 {
     double areaInt = g1.Intersection(g2).Area;
     double areaUnion = g1.Union(g2).Area;
     return areaInt / areaUnion;
 }
开发者ID:leoliusg,项目名称:NetTopologySuite,代码行数:13,代码来源:AreaSimilarityMeasure.cs

示例10: InsertCurvePoint

        public static IGeometry InsertCurvePoint(IGeometry geometry, ICoordinate coordinate, int index)
        {
            var vertices = new List<ICoordinate>(geometry.Coordinates);
            vertices.Insert(index, coordinate);
            var geometryFactory = new GeometryFactory();

            if (geometry is ILineString)
            {
                return geometryFactory.CreateLineString(vertices.ToArray());
            }
            if (geometry is IPolygon)
            {
                return geometryFactory.CreatePolygon(geometryFactory.CreateLinearRing(vertices.ToArray()), null);
            }
            return geometry.Union(geometryFactory.CreatePoint(coordinate));
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:16,代码来源:GeometryHelper.cs

示例11: unaryUnion

 public static IGeometry unaryUnion(IGeometry a)
 {
     return a.Union();
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:4,代码来源:OverlayFunctions.cs

示例12: union

 public static IGeometry union(IGeometry a, IGeometry b)
 {
     return a.Union(b);
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:4,代码来源:OverlayFunctions.cs

示例13: UnionActual

 private IGeometry UnionActual(IGeometry g0, IGeometry g1)
 {
    return g0.Union(g1);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:4,代码来源:CascadedPolygonUnion.cs


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