Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Envelope


  @Test
  public void testConversion() throws Exception {
    Coordinate latlon = new Coordinate(50, 4);
    Coordinate google = GeoUtil.convertToGoogle(latlon);
    Envelope env = service.transform(new Envelope(0, 4, 0, 50), "EPSG:4326", "EPSG:900913");
    Assert.assertEquals(google.getX(), env.getMaxX(), 0.01);
    Assert.assertEquals(google.getY(), env.getMaxY(), 0.01);
  }
View Full Code Here


    Assert.assertEquals(0.0, transformed.getMaxY(), DELTA);
  }

  @Test
  public void transformEnvelopeTest() throws Exception {
    Envelope envelope = new Envelope(50, 150, 50, 60);
    Envelope transformed = geoService.transform(envelope, LONLAT, LAMBERT72);
    Assert.assertEquals(2574604.73895413, transformed.getMinX(), DELTA);
    Assert.assertEquals(1050557.6016714368, transformed.getMinY(), DELTA);
    Assert.assertEquals(5261856.632877763, transformed.getMaxX(), DELTA);
    Assert.assertEquals(4226349.363675014, transformed.getMaxY(), DELTA);
  }
View Full Code Here

    Assert.assertEquals(4226349.363675014, transformed.getMaxY(), DELTA);
  }

  @Test
  public void transformEnvelopeOutsideAreaTest() throws Exception {
    Envelope envelope = new Envelope(120, 130, 50, 60);
    Envelope transformed = geoService.transform(envelope, LONLAT, LAMBERT72);
    Assert.assertTrue(transformed.isNull());
  }
View Full Code Here

  private DtoConverterService converterService;

  @Test
  public void testToInternal() {
    Bbox bbox = new Bbox(10, 20, 30, 40);
    Envelope envelope = converterService.toInternal(bbox);
    Assert.assertEquals(10, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(20, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(40, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(60, envelope.getMaxY(), ALLOWANCE);
  }
View Full Code Here

    Assert.assertEquals(60, envelope.getMaxY(), ALLOWANCE);
  }

  @Test
  public void testToDto() {
    Envelope envelope = new Envelope(10, 20, 30, 40);
    Bbox bbox = converterService.toDto(envelope);
    Assert.assertEquals(10, bbox.getX(), ALLOWANCE);
    Assert.assertEquals(30, bbox.getY(), ALLOWANCE);
    Assert.assertEquals(20, bbox.getMaxX(), ALLOWANCE);
    Assert.assertEquals(40, bbox.getMaxY(), ALLOWANCE);
View Full Code Here

  @Autowired
  private DtoConverterService converterService;

  @Test
  public void testToDto() throws GeomajasException {
    InternalTileImpl internalTile = new InternalTileImpl(0, 0, 0, new Envelope(0, 0, 10, 10), 0);
    internalTile.setContentType(VectorTileContentType.STRING_CONTENT);
    VectorTile tile = converterService.toDto(internalTile);
    Assert.assertNotNull(tile);
  }
View Full Code Here

   * @param scale
   *            scale
   * @return true if clipping is needed
   */
  private boolean exceedsScreenDimensions(InternalFeature f, double scale) {
    Envelope env = f.getBounds();
    return (env.getWidth() * scale > MAXIMUM_TILE_COORDINATE) ||
        (env.getHeight() * scale > MAXIMUM_TILE_COORDINATE);
  }
View Full Code Here

    // double x2 = x1 + (nrOfTilesX * tileWidth * 2);
    double x2 = panOrigin.x + nrOfTilesX * tile.getTileWidth();
    double y1 = panOrigin.y - nrOfTilesY * tile.getTileHeight();
    // double y2 = y1 + (nrOfTilesY * tileHeight * 2);
    double y2 = panOrigin.y + nrOfTilesY * tile.getTileHeight();
    return new Envelope(x1, x2, y1, y2);
  }
View Full Code Here

    if (layerSize[0] == 0) {
      return null;
    }
    double cX = maxExtent.getMinX() + code.getX() * layerSize[0];
    double cY = maxExtent.getMinY() + code.getY() * layerSize[1];
    return new Envelope(cX, cX + layerSize[0], cY, cY + layerSize[1]);
  }
View Full Code Here

    Assert.assertFalse(and.evaluate(f));
  }

  @Test
  public void testBboxFilter() throws GeomajasException, ParseException {
    Filter bbox = filterService.createBboxFilter("EPSG:4326", new Envelope(0, 1, 0, 1), "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", wkt.read("POINT(0.5 0.5)"));
    Assert.assertTrue(bbox.evaluate(f));
    f.clear();
    f.expectAndReturn("geometry", wkt.read("POINT(1.0001 1.0001)"));
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Envelope

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.