Examples of RasterLayerInfo


Examples of org.geomajas.configuration.RasterLayerInfo

    return resolutions;
  }

  public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
    if (null == layerInfo) {
      layerInfo = new RasterLayerInfo();
    }
    layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
    crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
    layerInfo.setTileWidth(tileSize);
    layerInfo.setTileHeight(tileSize);
View Full Code Here

Examples of org.geomajas.configuration.RasterLayerInfo

    String layerId = parseLayerId(request);
    WmsLayer layer = getLayer(layerId);
    if (layer == null) {
      throw new LayerException(ExceptionCode.LAYER_NOT_FOUND, layerId);
    }
    RasterLayerInfo layerInfo = layer.getLayerInfo();

    String url = layer.getBaseWmsUrl() + "?" + request.getQueryString();
    InputStream stream = null;

    try {
      response.setContentType(layer.getFormat());
      stream = httpService.getStream(url, layer.getAuthentication());
      ServletOutputStream out = response.getOutputStream();
      int b;
      while ((b = stream.read()) >= 0 ) {
        out.write(b);
      }
    } catch (Exception e) {
      log.error("Cannot get original WMS image", e);
      // Create an error image to make the reason for the error visible:
      byte[] b = createErrorImage(layerInfo.getTileWidth(), layerInfo.getTileHeight(), e);
      response.setContentType("image/png");
      response.getOutputStream().write(b);
    } finally {
      if (null != stream) {
        try {
View Full Code Here

Examples of org.geomajas.configuration.RasterLayerInfo

      throw new BeanInitializationException("Invalid configuration", e);
    }
  }

  private void postProcess(RasterLayer layer) throws LayerException {
    RasterLayerInfo info = layer.getLayerInfo();
    for (ScaleInfo scale : info.getZoomLevels()) {
      // for raster layers we don't accept x:y notation !
      if (scale.getDenominator() != 0) {
        throw new LayerException(ExceptionCode.CONVERSION_PROBLEM, "Raster layer " + layer.getId()
            + " has zoom level " + scale.getNumerator() + ":" + scale.getDenominator()
            + " in disallowed x:y notation");
      }
      // add the resolution for deprecated api support
      info.getResolutions().add(1. / scale.getPixelPerUnit());
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.