Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Envelope


    String finalName = parsePropertyName(propertyName, userData);
    return Restrictions.isNull(finalName);
  }

  public Object visit(BBOX filter, Object userData) {
    Envelope env = new Envelope(filter.getMinX(), filter.getMaxX(), filter.getMinY(), filter.getMaxY());
    String finalName = parsePropertyName(geomName, userData);
    return SpatialRestrictions.filter(finalName, env, srid);
  }
View Full Code Here


    Assert.assertEquals(null, securityContext.getUserId());
  }

  private void checkLuc() throws Exception {
    CoordinateReferenceSystem crs = beanLayer.getCrs();
    Envelope envelope;
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    junit.framework.Assert.assertEquals(0, envelope.getMinX(), ALLOWANCE);
    junit.framework.Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    junit.framework.Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    junit.framework.Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
  }
View Full Code Here

    junit.framework.Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
  }

  private void checkMarino() throws Exception {
    CoordinateReferenceSystem crs = beanLayer.getCrs();
    Envelope envelope;
    recorder.clear();
    envelope = layerService.getBounds(LAYER_ID, crs, null);
    junit.framework.Assert.assertEquals(2, envelope.getMinX(), ALLOWANCE);
    junit.framework.Assert.assertEquals(0, envelope.getMinY(), ALLOWANCE);
    junit.framework.Assert.assertEquals(7, envelope.getMaxX(), ALLOWANCE);
    junit.framework.Assert.assertEquals(3, envelope.getMaxY(), ALLOWANCE);
  }
View Full Code Here

        // If MapCRS does not equal LayerCRS then instantiate
        // the CrsTransform which will be used for transforming the bbox
        VectorLayerInfo layerInfo = configurationService.getVectorLayerInfo(getLayerId());
        String mapCrs = map.getCrs();
        String layerCrs = layerInfo.getCrs();
        Envelope layerBbox = bbox;
        if (!mapCrs.equals(layerCrs)) {
          layerBbox = geoService.transform(layerBbox, mapCrs, layerCrs);
        }

        String geomName = layerInfo.getFeatureInfo().getGeometryType().getName();
View Full Code Here

  private Envelope envelope;
  private Envelope overlappingEnvelope;

  @Before
  public void init() throws Exception {
    envelope = new Envelope(0, 10, 0, 10);
    overlappingEnvelope = new Envelope(5, 15, 5, 15);
  }
View Full Code Here

  private Envelope envelope;
  private Envelope overlappingEnvelope;

  @Before
  public void init() throws Exception {
    envelope = new Envelope(0, 10, 0, 10);
    overlappingEnvelope = new Envelope(5, 15, 5, 15);
  }
View Full Code Here

        context.put(PipelineCode.TILE_METADATA_KEY, tileMetadata);
        Crs crs = geoService.getCrs2(tileMetadata.getCrs());
        context.put(PipelineCode.CRS_KEY, crs);
        CrsTransform layerToMap = geoService.getCrsTransform(layer.getCrs(), crs);
        context.put(PipelineCode.CRS_TRANSFORM_KEY, layerToMap);
        Envelope layerExtent = dtoConverterService.toInternal(layer.getLayerInfo().getMaxExtent());
        Envelope tileExtent = geoService.transform(layerExtent, layerToMap);
        context.put(PipelineCode.TILE_MAX_EXTENT_KEY, tileExtent);
        // can't stop here, we have only prepared the context, not built the tile !
        InternalTile tile = new InternalTileImpl(tileMetadata.getCode(), tileExtent, tileMetadata.getScale());
        tileContainer.setTile(tile);
        securityContextAdder.restoreSecurityContext(rebuildCacheContainer.getContext());
View Full Code Here

      if (c != null) {
        criteria.add(c);
      }
      criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
      List<?> features = criteria.list();
      Envelope bounds = new Envelope();
      for (Object f : features) {
        Envelope geomBounds = getFeatureModel().getGeometry(f).getEnvelopeInternal();
        if (!geomBounds.isNull()) {
          bounds.expandToInclude(geomBounds);
        }
      }
      return bounds;
    } catch (HibernateException he) {
View Full Code Here

  }

  @Test
  public void testGetBounds() throws Exception {
    securityManager.createSecurityContext(null); // assure a security context exists for this thread
    Envelope bounds;

    // first run, this should put things in the cache
    recorder.clear();
    bounds = vectorLayerService.getBounds(LAYER_BEANS, geoService.getCrs2("EPSG:4326"), null);
    Assert.assertNotNull(bounds);
    Assert.assertEquals(0.0, bounds.getMinX(), DELTA);
    Assert.assertEquals(0.0, bounds.getMinY(), DELTA);
    Assert.assertEquals(7.0, bounds.getMaxX(), DELTA);
    Assert.assertEquals(3.0, bounds.getMaxY(), DELTA);
    Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Put item in cache"));

    // verify that data is in the cache
    DummyCacheService cache = (DummyCacheService)cacheManager.getCacheForTesting(LAYER_BEANS, CacheCategory.BOUNDS);
    Assert.assertEquals(1, cache.size());
    String key = cache.getKey();
    BoundsCacheContainer bcc = (BoundsCacheContainer) cache.getObject();
    CacheContext cc = bcc.getContext();
    bcc = new BoundsCacheContainer(new Envelope(0, 10, 0, 10));
    bcc.setContext(cc);
    cache.put(key, bcc);

    // get bounds again, the result should be different because we changed the cached value
    recorder.clear();
    bounds = vectorLayerService.getBounds(LAYER_BEANS, geoService.getCrs2("EPSG:4326"), null);
    Assert.assertNotNull(bounds);
    Assert.assertEquals(0.0, bounds.getMinX(), DELTA);
    Assert.assertEquals(0.0, bounds.getMinY(), DELTA);
    Assert.assertEquals(10.0, bounds.getMaxX(), DELTA);
    Assert.assertEquals(10.0, bounds.getMaxY(), DELTA);
    Assert.assertEquals("", recorder.matches(CacheCategory.BOUNDS,
        "Got item from cache"));

    // ask for different layer, should not be found in cache as context is different
    recorder.clear();
View Full Code Here

  }

  protected Geometry getAuthorizedArea(String layerId) {
    if (null == biggestGeometry) {
      // build Geometry which covers biggest possible area
      Envelope maxBounds = new Envelope(-Double.MAX_VALUE, Double.MAX_VALUE,
          -Double.MAX_VALUE, Double.MAX_VALUE);
      PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING);
      GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
      biggestGeometry = geometryFactory.toGeometry(maxBounds);
    }
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.