本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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() !");
}
}
示例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;
}