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


C# IGeometry.Intersects方法代码示例

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


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

示例1: GetFeatures

		public IEnumerable<IFeature> GetFeatures(IGeometry geom, string filter, double scale)
		{
			LinkedList<IFeature> ret = new LinkedList<IFeature>();
			foreach (MapInfoObject f in m_miffile)
			{
				//linear cull
				if (geom.Intersects(f.Geometry)) ret.AddLast(f);
			}
			return ret;
		}
开发者ID:mustafayalcin,项目名称:littlesharprenderengine,代码行数:10,代码来源:MIFProvider.cs

示例2: DoPredicates

 public void DoPredicates(IGeometry a, IGeometry b)
 {
     Assert.IsTrue(a.Contains(b) == a.Relate(b).IsContains());
     Assert.IsTrue(a.Crosses(b) == a.Relate(b).IsCrosses(a.Dimension, b.Dimension));
     Assert.IsTrue(a.Disjoint(b) == a.Relate(b).IsDisjoint());
     Assert.IsTrue(a.Equals(b) == a.Relate(b).IsEquals(a.Dimension, b.Dimension));
     Assert.IsTrue(a.Intersects(b) == a.Relate(b).IsIntersects());
     Assert.IsTrue(a.Overlaps(b) == a.Relate(b).IsOverlaps(a.Dimension, b.Dimension));
     Assert.IsTrue(a.Touches(b) == a.Relate(b).IsTouches(a.Dimension, b.Dimension));
     Assert.IsTrue(a.Within(b) == a.Relate(b).IsWithin());
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:11,代码来源:PredicateShortCircuitTest.cs

示例3: intersects

 public static IGeometry intersects(IGeometry a, IGeometry mask)
 {
     var selected = new List<IGeometry>();
     for (int i = 0; i < a.NumGeometries; i++)
     {
         var g = a.GetGeometryN(i);
         if (mask.Intersects(g))
         {
             selected.Add(g);
         }
     }
     return a.Factory.BuildGeometry(selected);
 }
开发者ID:abrobston,项目名称:NHibernate.Spatial,代码行数:13,代码来源:SelectionFunctions.cs

示例4: CheckIntersects

            private static Boolean CheckIntersects(IGeometry target, IGeometry test)
            {
                bool expectedResult = target.Intersects(test);

                PreparedGeometryFactory pgFact = new PreparedGeometryFactory();
                IPreparedGeometry prepGeom = pgFact.Create(target);

                bool prepResult = prepGeom.Intersects(test);

                if (prepResult != expectedResult)
                {
                    return false;
                }
                return true;
            }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:15,代码来源:PreparedPolygonStressTest.cs

示例5: RunRectanglePred

        private void RunRectanglePred(IGeometry rect, IGeometry testGeom)
        {
            bool intersectsValue = rect.Intersects(testGeom);
            bool relateIntersectsValue = rect.Relate(testGeom).IsIntersects();
            bool intersectsOK = intersectsValue == relateIntersectsValue;

            bool containsValue = rect.Contains(testGeom);
            bool relateContainsValue = rect.Relate(testGeom).IsContains();
            bool containsOK = containsValue == relateContainsValue;

            //System.out.println(testGeom);
            if (!intersectsOK || !containsOK)
            {
                Console.WriteLine(testGeom);
            }
            Assert.IsTrue(intersectsOK);
            Assert.IsTrue(containsOK);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:18,代码来源:RectanglePredicateTest.cs

示例6: GetFeatures

		public IEnumerable<IFeature> GetFeatures(IGeometry geom, string filter, double scale)
		{
			if (geom is IPoint)
			{
				IPoint p = (IPoint)geom;
				Envelope e = new Envelope(p.X, p.X, p.Y, p.Y);
				LinkedList<IFeature> ret = new LinkedList<IFeature>();
				m_tree.Query(e, new FeatureLinkedListVisitor(ret));
				return ret;
			}
			else
			{
				LinkedList<IFeature> ret = new LinkedList<IFeature>();
				foreach (Feature f in m_layer.Features)
				{
					//linear cull
					if (geom.Intersects(f.Geometry)) ret.AddLast(f);
				}
				return ret;
			}
		}
开发者ID:mustafayalcin,项目名称:littlesharprenderengine,代码行数:21,代码来源:MapInfoProvider.cs

示例7: TestOriginal

 private static int TestOriginal(IGeometry g, IEnumerable<IGeometry> lines)
 {
     Console.WriteLine("Using orginal JTS algorithm");
     var count = 0;
     foreach (var line in lines)
     {
         if (g.Intersects(line))
             count++;
     }
     return count;
 }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:11,代码来源:PreparedPolygonIntersectsPerformanceTest.cs

示例8: IntersectionArea

 private static double IntersectionArea(IGeometry geometry, IGeometry other)
 {
     if (geometry.Intersects(other.Envelope))
     {
         OverlayOp.NodingValidatorDisabled = true;
         double area;
         try
         {
             area = geometry.Intersection(other).Area;
         }
         catch (Exception)
         {
             area = GetSampledIntersectionArea(geometry, other);
         }
         OverlayOp.NodingValidatorDisabled = false;
         return area;
     }
     return 0.0;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:19,代码来源:GeometryHelper.cs

示例9: TestResultsEqual

        public void TestResultsEqual(IGeometry g, ILineString line)
        {
            bool slowIntersects = g.Intersects(line);

            PreparedGeometryFactory pgFact = new PreparedGeometryFactory();
            IPreparedGeometry prepGeom = pgFact.Create(g);

            bool fastIntersects = prepGeom.Intersects(line);

            if (slowIntersects != fastIntersects)
            {
                Console.WriteLine(line);
                Console.WriteLine("Slow = " + slowIntersects + ", Fast = " + fastIntersects);
                throw new Exception("Different results found for intersects() !");
            }
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:16,代码来源:PreparedPolygonIntersectsStressTest.cs

示例10: getWithin

        // get features within geometry
        public List<Feature> getWithin(IGeometry rect)
        {
            // if node is completely inside geometry, return all features
            if (rect.Contains(gboundary))
                return getAll();
            // if node is completely outside geometry, return no features
            if (!rect.Intersects(gboundary))
                return new List<Feature>();

            // create list for returning features
            List<Feature> retfeatures = new List<Feature>();

            // recursively add features from children
            if (hasChildren)
                foreach (QuadTree qt in children)
                    retfeatures.AddRange(qt.getWithin(rect));

            // check each feature in current node
            foreach (Feature f in features)
                if (rect.Intersects(f.Geometry))
                    retfeatures.Add(f);
            return retfeatures;
        }
开发者ID:hakbra,项目名称:SGIS,代码行数:24,代码来源:QuadTree.cs


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