Package com.spatial4j.core.shape.impl

Examples of com.spatial4j.core.shape.impl.RectangleImpl


  }

  @Test
  public void testMakeRect() {
    //test rectangle constructor
    assertEquals(new RectangleImpl(1,3,2,4, ctx),
        new RectangleImpl(new PointImpl(1,2, ctx),new PointImpl(3,4, ctx), ctx));

    //test ctx.makeRect
    assertEquals(ctx.makeRectangle(1, 3, 2, 4),
        ctx.makeRectangle(ctx.makePoint(1, 2), ctx.makePoint(3, 4)));
  }
View Full Code Here


    ctx = call("geo","false",
        "distCalculator","cartesian^2",
        "worldBounds","ENVELOPE(-100, 75, 200, 0)");//xMin, xMax, yMax, yMin
    assertEquals(new CartesianDistCalc(true),ctx.getDistCalc());
    assertEquals(new RectangleImpl(-100, 75, 0, 200, ctx), ctx.getWorldBounds());

    ctx = call("geo","true",
        "distCalculator","lawOfCosines");
    assertTrue(ctx.isGeo());
    assertEquals(new GeodesicSphereDistCalc.LawOfCosines(),
View Full Code Here

public class TestShapes2D extends AbstractTestShapes {

  @ParametersFactory
  public static Iterable<Object[]> parameters() {
    final Rectangle WB = new RectangleImpl(-2000, 2000, -300, 300, null);//whatever

    List<Object[]> ctxs = new ArrayList<Object[]>();
    ctxs.add($(new SpatialContextFactory() {{geo = false; worldBounds = WB;}}.newSpatialContext()));
    ctxs.add($(new JtsSpatialContextFactory() {{geo = false; worldBounds = WB;}}.newSpatialContext()));
    return ctxs;
View Full Code Here

  }

  @Test
  public void testRectIntersect() {
    SpatialContext ctx = new SpatialContextFactory()
      {{geo = false; worldBounds = new RectangleImpl(-100, 100, -50, 50, null);}}.newSpatialContext();

    new ShapeCollectionRectIntersectionTestHelper(ctx).testRelateWithRectangle();
  }
View Full Code Here

  private void setupQuadGrid(int maxLevels) {
    //non-geospatial makes this test a little easier (in gridSnap), and using boundary values 2^X raises
    // the prospect of edge conditions we want to test, plus makes for simpler numbers (no decimals).
    SpatialContextFactory factory = new SpatialContextFactory();
    factory.geo = false;
    factory.worldBounds = new RectangleImpl(0, 256, -128, 128, null);
    this.ctx = factory.newSpatialContext();
    //A fairly shallow grid, and default 2.5% distErrPct
    if (maxLevels == -1)
      maxLevels = randomIntBetween(1, 8);//max 64k cells (4^8), also 256*256
    this.grid = new QuadPrefixTree(ctx, maxLevels);
View Full Code Here

    public void geoShapeFilter() throws Exception {
        FilterBuilder filter = null;

        // Shape within another
        filter = FilterBuilders.geoShapeFilter("location",
                new RectangleImpl(0,10,0,10,SpatialContext.GEO))
                .relation(ShapeRelation.WITHIN);

        // Intersect shapes
        filter = FilterBuilders.geoShapeFilter("location",
                new PointImpl(0, 0, SpatialContext.GEO))
View Full Code Here

    @Test
    public void geoShapeSearch() throws Exception {
        QueryBuilder qb = null;
        // create the query
        qb = QueryBuilders.geoShapeQuery("location",
                new RectangleImpl(0, 10, 0, 10,SpatialContext.GEO))
            .relation(ShapeRelation.WITHIN);
        logger.info("Your query is : {}", qb);

        qb = QueryBuilders.geoShapeQuery("location",
                new PointImpl(0, 0, SpatialContext.GEO))
View Full Code Here

TOP

Related Classes of com.spatial4j.core.shape.impl.RectangleImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.