Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Envelope


  }

  @Test
  public void testSatelliteDs() throws Exception {
    List<RasterTile> tiles = satelliteDs.paint(satelliteDs.getCrs(),
        new Envelope(10000, 10010, 4000, 4010), ZOOMED_IN_SCALE);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://khm0.google.com/kh?v=87&x=8&y=7&z=4", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(8, tile.getCode().getX());
View Full Code Here


  }

  @Test
  public void testTerrainDs() throws Exception {
    List<RasterTile> tiles = physicalDs.paint(physicalDs.getCrs(),
        new Envelope(10000, 10010, 4000, 4010), ZOOMED_IN_SCALE);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://mt0.google.com/vt?lyrs=t@127,r@156000000&x=8&y=7&z=4", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(8, tile.getCode().getX());
View Full Code Here

  }

  @Test
  public void testGetBoundsVisibleArea() throws Exception {
    CoordinateReferenceSystem crs = beanLayer.getCrs();
    Envelope envelope;

    login("luc");
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(0, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);

    login("marino");
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(2, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
  }
View Full Code Here

  }

  @Test
  public void testGetBoundsVisibleArea() throws Exception {
    CoordinateReferenceSystem crs = beanLayer.getCrs();
    Envelope envelope;

    login("luc");
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(0, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
    org.junit.Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Put item in cache"));

    login("marino");
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(2, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
    org.junit.Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Put item in cache"));

    login("luc");
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(0, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
    org.junit.Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Got item from cache"));

    login("marino");
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    Assert.assertEquals(2, envelope.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
    org.junit.Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Got item from cache"));
  }
View Full Code Here

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    TileMetadata metadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);

    // Determine the maximum tile extent
    Envelope maxTileExtent = context.get(PipelineCode.TILE_MAX_EXTENT_KEY, Envelope.class);

    // fill the tiles
    tiledFeatureService.fillTile(response.getTile(), maxTileExtent);

    // clipping of features in tile
View Full Code Here

   * @param bbox
   *            Geomajas <code>Bbox</code>
   * @return JTS envelope
   */
  public Envelope toInternal(Bbox bbox) {
    return new Envelope(bbox.getX(), bbox.getMaxX(), bbox.getY(), bbox.getMaxY());
  }
View Full Code Here

    Assert.assertNotNull(feature.getAttributes().get(STRING_ATTR));
  }

  @Test
  public void testGetBoundsAll() throws Exception {
    Envelope bounds = layerService.getBounds(LAYER_ID, geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), null);
    Assert.assertEquals(0, bounds.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, bounds.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, bounds.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, bounds.getMaxY(), ALLOWANCE);
  }
View Full Code Here

  }

  @Test
  public void testGetBoundsFidFiltered() throws Exception {
    Filter filter = filterService.createFidFilter(new String[]{"2", "3"});
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(2, bounds.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, bounds.getMinY(), ALLOWANCE);
    Assert.assertEquals(7, bounds.getMaxX(), ALLOWANCE);
    Assert.assertEquals(3, bounds.getMaxY(), ALLOWANCE);
  }
View Full Code Here

  public void testGetBoundsIntersectsFiltered() throws Exception {
    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] { new Coordinate(0, 0),
        new Coordinate(-180, 180) });
    Filter filter = filterService.createIntersectsFilter(equator,beanLayer.getLayerInfo().getFeatureInfo().getGeometryType().getName());
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(0, bounds.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, bounds.getMinY(), ALLOWANCE);
    Assert.assertEquals(1, bounds.getMaxX(), ALLOWANCE);
    Assert.assertEquals(1, bounds.getMaxY(), ALLOWANCE);
  }
View Full Code Here

      throws GeomajasException {
    if (null == response.getEnvelope()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      CrsTransform crsTransform = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      Envelope bounds = layer.getBounds(filter);
      bounds = geoService.transform(bounds, crsTransform);
      response.setEnvelope(bounds);
    }
  }
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.