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


C# GeometryFactory.Intersects方法代码示例

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


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

示例1: TestA

 public void TestA() {
     Coordinate p1 = new Coordinate(-123456789, -40);
     Coordinate p2 = new Coordinate(381039468754763d, 123456789);
     Coordinate q  = new Coordinate(0, 0);
     ILineString l = new GeometryFactory().CreateLineString(new Coordinate[] {p1, p2});
     IPoint p = new GeometryFactory().CreatePoint(q);
     Assert.AreEqual(false, l.Intersects(p));
     Assert.AreEqual(false, CGAlgorithms.IsOnLine(q, new Coordinate[] { p1, p2 }));
     Assert.AreEqual(-1, CGAlgorithms.ComputeOrientation(p1, p2, q));
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:10,代码来源:RobustLineIntersectorTest.cs

示例2: ReadByMBRFilter

		/// <summary>
		/// Query shapefile by MBR.
		/// MBR coordinates MUST be in the Shapefile's coordinate system.
		/// 
		/// NOTE: If you are using the default ISpatialIndex (which is an instance of the STRtree NTS class), it has some limitations.
		/// Since it works with MBRs rather than the shapes themselves, you can get some shapes that are not actually in the MBR
		/// you provided just because their MBRs are bounded by the given envelope.
		/// If you wish to avoid this behaviour, send true in the second paramter, but be weary of the consequences listed below.
		/// </summary>
		/// <param name="envelope"> The envlope to query. </param>
		/// <param name="testGeometriesActuallyInMBR"> 
		/// False by default, true to double-check the returned geometries against given Envelope, to avoid index error margin.
		/// 
		/// It is advisable that you implement your own ISpatialIndex with your required precision rather than set this to True.
		/// 
		/// **********
		/// CAUTION: If you choose to set this parameter as True, it will greatly affect performance as it
		/// will cancel any lazy mechanism implemented with reading the geometries from the file.
		/// Do not set this to True unless you either:
		/// A. Do not have any performance restrictions.
		/// Or:
		/// B. Absolutely need that precision in the geographic query.
		/// **********
		/// </param>
		/// <returns></returns>
        public IEnumerable<IShapefileFeature> ReadByMBRFilter(Envelope envelope, bool testGeometriesActuallyInMBR = false)
		{
			if (envelope == null)
			{
				throw new ArgumentNullException("envelope");
			}

			// If index creation task wasnt completed, wait for it to complete.
			if (!m_IsIndexingComplete)
			{
				m_IndexCreationTask.Wait();
			}

			IList<ShapeLocationInFileInfo> shapesInRegion = m_SpatialIndex.Query(envelope);

			if (shapesInRegion.Count == 0)
			{
                return Enumerable.Empty<IShapefileFeature>();
			}

            IEnumerable<IShapefileFeature> results = shapesInRegion.Select(ReadFeature);

			if (!testGeometriesActuallyInMBR)
			{
				return results;
			}
			else
			{
				IGeometry envelopeGeo = new GeometryFactory().ToGeometry(envelope);

				return results.Where(feature =>
					{
						return envelopeGeo.Intersects(feature.Geometry);
					});
			}
		}
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:61,代码来源:ShapeDataReader.cs

示例3: testPredicatesReturnFalseForEmptyGeometries

        public void testPredicatesReturnFalseForEmptyGeometries()
        {
            var p1 = new GeometryFactory().CreatePoint((Coordinate) null);
            var p2 = new GeometryFactory().CreatePoint(new Coordinate(5, 5));
            Assert.AreEqual(false, p1.Equals(p2));
            Assert.AreEqual(true, p1.Disjoint(p2));
            Assert.AreEqual(false, p1.Intersects(p2));
            Assert.AreEqual(false, p1.Touches(p2));
            Assert.AreEqual(false, p1.Crosses(p2));
            Assert.AreEqual(false, p1.Within(p2));
            Assert.AreEqual(false, p1.Contains(p2));
            Assert.AreEqual(false, p1.Overlaps(p2));

            Assert.AreEqual(false, p2.Equals(p1));
            Assert.AreEqual(true, p2.Disjoint(p1));
            Assert.AreEqual(false, p2.Intersects(p1));
            Assert.AreEqual(false, p2.Touches(p1));
            Assert.AreEqual(false, p2.Crosses(p1));
            Assert.AreEqual(false, p2.Within(p1));
            Assert.AreEqual(false, p2.Contains(p1));
            Assert.AreEqual(false, p2.Overlaps(p1));
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:22,代码来源:MiscellaneousTest.cs


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