public SpatialRelation Relate(NtsGeometry jtsGeometry) { IGeometry oGeom = jtsGeometry.geom; //don't bother checking bbox since geom.relate() does this already return(IntersectionMatrixToSpatialRelation(geom.Relate(oGeom))); }
public void testArea() { //simple bbox Rectangle r = RandomRectangle(20); var ctxJts = (NtsSpatialContext) ctx; var rPoly = new NtsGeometry(ctxJts.GetGeometryFrom(r), ctxJts, false); CustomAssert.EqualWithDelta(r.GetArea(null), rPoly.GetArea(null), 0.0); CustomAssert.EqualWithDelta(r.GetArea(ctx), rPoly.GetArea(ctx), 0.000001); //same since fills 100% CustomAssert.EqualWithDelta(1300, POLY_SHAPE.GetArea(null), 0.0); //fills 27% CustomAssert.EqualWithDelta(0.27, POLY_SHAPE.GetArea(ctx)/POLY_SHAPE.GetBoundingBox().GetArea(ctx), 0.009); Assert.True(POLY_SHAPE.GetBoundingBox().GetArea(ctx) > POLY_SHAPE.GetArea(ctx)); }
public NtsPolygonTest() : base(NtsSpatialContext.GEO_KM) { POLY_SHAPE = (NtsGeometry) ctx.ReadShape(POLY_STR); if (TEST_DL_POLY && ctx.IsGeo()) { var pGeom = POLY_SHAPE.GetGeom(); Assert.True(pGeom.IsValid); //shift 180 to the right pGeom = (IGeometry) pGeom.Clone(); pGeom.Apply(new NtsPolygonTestCoordinateFilter((NtsSpatialContext) ctx)); pGeom.GeometryChanged(); Assert.False(pGeom.IsValid); POLY_SHAPE_DL = (NtsGeometry) ctx.ReadShape(pGeom.AsText()); Assert.True( POLY_SHAPE_DL.GetBoundingBox().GetCrossesDateLine() || 360 == POLY_SHAPE_DL.GetBoundingBox().GetWidth()); } }
public SpatialRelation Relate(NtsGeometry jtsGeometry) { IGeometry oGeom = jtsGeometry.geom; //don't bother checking bbox since geom.relate() does this already return IntersectionMatrixToSpatialRelation(geom.Relate(oGeom)); }
public virtual SpatialRelation Relate(NtsGeometry ntsGeometry) { //don't bother checking bbox since geom.relate() does this already return(Relate(ntsGeometry.geom)); }