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


C# IGeometry.Buffer方法代码示例

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


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

示例1: Buffer

 public static IGeometry Buffer(IGeometry geom, double distance)
 {
     ApplicationException originalEx = null;
     try
     {
         IGeometry result = geom.Buffer(distance);
         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.Buffer(geom, distance);
         // 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:izambakci,项目名称:tf-net,代码行数:31,代码来源:EnhancedPrecisionOp.cs

示例2: RunBuffer

        void RunBuffer(IGeometry g, double dist)
        {
            IGeometry buf = g.Buffer(dist);
            BufferResultValidator validator = new BufferResultValidator(g, dist, buf);

            if (!validator.IsValid())
            {
                String msg = validator.ErrorMessage;

                Console.WriteLine(msg);
                Console.WriteLine(WKTWriter.ToPoint(validator.ErrorLocation));
                Console.WriteLine(g);
            }
            Assert.IsTrue(validator.IsValid());
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:15,代码来源:FileBufferResultValidatorTest.cs

示例3: CreateValidArea

 /// <summary>
 /// Creates a valid area point from one that possibly has
 /// bad topology (i.e. self-intersections).
 /// Since buffer can handle invalid topology, but always returns
 /// valid point, constructing a 0-width buffer "corrects" the
 /// topology.
 /// Note this only works for area geometries, since buffer always returns
 /// areas.  This also may return empty geometries, if the input
 /// has no actual area.
 /// </summary>
 /// <param name="rawAreaGeom">An area point possibly containing self-intersections.</param>
 /// <returns>A valid area point.</returns>
 private IGeometry CreateValidArea(IGeometry rawAreaGeom)
 {
     if (_ensureValidTopology)
         return rawAreaGeom.Buffer(0.0);
     return rawAreaGeom;
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:18,代码来源:DouglasPeuckerSimplifier.cs

示例4: IsApproximateCoincident

		private static bool IsApproximateCoincident(IGeometry g1, IGeometry g2, double tolerance)
		{
			IGeometry symdiff;
			if (g1.Dimension < Dimensions.Surface && g2.Dimension < Dimensions.Surface)
			{
				g1 = g1.Buffer(tolerance);
				g2 = g2.Buffer(tolerance);
				symdiff = g1.SymmetricDifference(g2).Buffer(tolerance);
			}
			else
			{
				symdiff = g1.SymmetricDifference(g2);
			}
			double relError = symdiff.Area / (g1.Area + g2.Area);
			return relError < tolerance;

		}
开发者ID:cdromka,项目名称:sonar-csharp,代码行数:17,代码来源:SpatialQueriesFixture.cs

示例5: BufferValidated

 public static IGeometry BufferValidated(IGeometry g, double distance)
 {
     var buf = g.Buffer(distance);
     var errMsg = BufferResultValidator.IsValidMessage(g, distance, buf);
     if (errMsg != null)
         throw new InvalidOperationException(errMsg);
     return buf;
 }
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:8,代码来源:BufferFunctions.cs

示例6: Buffer

 public static IGeometry Buffer(IGeometry g, double distance) { return g.Buffer(distance); }
开发者ID:russcam,项目名称:Nhibernate.Spatial,代码行数:1,代码来源:BufferFunctions.cs

示例7: InvokeBuffer

 private IGeometry InvokeBuffer(IGeometry geom)
 {
     if (_argCount == 1)
     {
         return geom.Buffer(_distance);
     }
     if (_argCount == 2)
     {
         return geom.Buffer(_distance, _quadSegments);
     }
     Assert.ShouldNeverReachHere("Unknown or unhandled buffer method");
     return null;
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:13,代码来源:BufferValidatedGeometryOperation.cs

示例8: CreateValidArea

 /// <summary>
 /// Creates a valid area geometry from one that possibly has bad topology
 /// (i.e. self-intersections). Since buffer can handle invalid topology, but
 /// always returns valid geometry, constructing a 0-width buffer "corrects"
 /// the topology. Note this only works for area geometries, since buffer
 /// always returns areas. This also may return empty geometries, if the input
 /// has no actual area.
 /// </summary>
 /// <param name="rawAreaGeom">An area geometry possibly containing self-intersections.</param>
 /// <returns>A valid area geometry.</returns>
 private IGeometry CreateValidArea(IGeometry rawAreaGeom)
 {
     return _isEnsureValidTopology ? rawAreaGeom.Buffer(0.0) : rawAreaGeom;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:14,代码来源:VWSimplifier.cs

示例9: Clean

 private static IGeometry Clean(IGeometry geom)
 {
     // TODO: only buffer if it is a polygonal IGeometry
     if (!(geom is IPolygonal) ) return geom;
     return geom.Buffer(0);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:6,代码来源:SnapRoundOverlayFunctions.cs

示例10: BufferValidatedGeom

 public static IGeometry BufferValidatedGeom(IGeometry g, double distance)
 {
     var buf = g.Buffer(distance);
     var validator = new BufferResultValidator(g, distance, buf);
     var isValid = validator.IsValid();
     return validator.ErrorIndicator;
 }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:7,代码来源:BufferFunctions.cs

示例11: CreateValidArea

 /// <summary>
 /// Creates a valid area point from one that possibly has
 /// bad topology (i.e. self-intersections).
 /// Since buffer can handle invalid topology, but always returns
 /// valid point, constructing a 0-width buffer "corrects" the
 /// topology.
 /// Notice this only works for area geometries, since buffer always returns
 /// areas.  This also may return empty geometries, if the input
 /// has no actual area.
 /// </summary>
 /// <param name="roughAreaGeom">An area point possibly containing self-intersections.</param>
 /// <returns>A valid area point.</returns>
 private static IGeometry CreateValidArea(IGeometry roughAreaGeom)
 {
     return roughAreaGeom.Buffer(0.0);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:16,代码来源:DouglasPeuckerSimplifier.cs

示例12: CleanPolygonal

 private static IGeometry CleanPolygonal(IGeometry geom)
 {
     // TODO: use a better method of removing collapsed topology 
     return geom.Buffer(0);
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:5,代码来源:GeometrySnapRounder.cs


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