Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.ReferencedEnvelope


          "VectorLayerFactory.createLayer() should only be called using ClientVectorLayerInfo");
    }
    ClientVectorLayerInfo vectorInfo = (ClientVectorLayerInfo) clientLayerInfo;
    VectorLayerRasterizingInfo extraInfo = (VectorLayerRasterizingInfo) vectorInfo
        .getWidgetInfo(VectorLayerRasterizingInfo.WIDGET_KEY);
    ReferencedEnvelope areaOfInterest = mapContext.getAreaOfInterest();
    VectorLayer layer = configurationService.getVectorLayer(vectorInfo.getServerLayerId());
    // need to clone the extra info object before changing it !
    VectorLayerRasterizingInfo copy = cloneInfo(extraInfo);
    // we now replace the style filters by simple filters on an artificial extra style attribute
    for (FeatureStyleInfo style : copy.getStyle().getFeatureStyles()) {
      style.setFormula(STYLE_INDEX_ATTRIBUTE_NAME + " = " + style.getIndex());
    }
    // create the style
    Style style = styleFactoryService.createStyle(layer, copy);
    // estimate the buffer
    MetaBufferEstimator estimator = new MetaBufferEstimator();
    estimator.visit(style);
    int bufferInPixels = estimator.getBuffer();
    // expand area to include buffer
    Rectangle tileInpix = mapContext.getViewport().getScreenArea();
    ReferencedEnvelope metaArea = new ReferencedEnvelope(areaOfInterest);
    metaArea.expandBy(bufferInPixels / tileInpix.getWidth() * areaOfInterest.getWidth(),
        bufferInPixels / tileInpix.getHeight() * areaOfInterest.getHeight());
    // fetch features in meta area
    Crs layerCrs = vectorLayerService.getCrs(layer);
    Envelope layerBounds = geoService.transform(metaArea, (Crs) areaOfInterest.getCoordinateReferenceSystem(),
        layerCrs);
View Full Code Here


    }
  }

  protected void addImage(Graphics2D graphics, ImageResult imageResult, MapViewport viewport) throws IOException {
    Rectangle screenArea = viewport.getScreenArea();
    ReferencedEnvelope worldBounds = viewport.getBounds();
    // convert map bounds to application bounds
    double rasterScale = screenArea.getWidth() / worldBounds.getWidth();
    Envelope applicationBounds = new Envelope(worldBounds.getMinX() * rasterScale, worldBounds.getMaxX()
        * rasterScale, -worldBounds.getMinY() * rasterScale, -worldBounds.getMaxY() * rasterScale);
    Bbox imageBounds = imageResult.getRasterImage().getBounds();
    // find transform between image bounds and application bounds
    double tx = (imageBounds.getX() - applicationBounds.getMinX());
    double ty = (imageBounds.getY() - applicationBounds.getMinY());
    BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageResult.getImage()));
View Full Code Here

    }
  }

  protected void addLoadError(Graphics2D graphics, ImageException imageResult, MapViewport viewport) {
    Bbox imageBounds = imageResult.getRasterImage().getBounds();
    ReferencedEnvelope viewBounds = viewport.getBounds();
    double rasterScale = viewport.getScreenArea().getWidth() / viewport.getBounds().getWidth();
    double width = imageBounds.getWidth();
    double height = imageBounds.getHeight();
    // subtract screen position of lower-left corner
    double x = imageBounds.getX() - rasterScale * viewBounds.getMinX();
    // shift y to lowerleft corner, flip y to user space and subtract
    // screen position of lower-left
    // corner
    double y = -imageBounds.getY() - imageBounds.getHeight() - rasterScale * viewBounds.getMinY();
    if (log.isDebugEnabled()) {
      log.debug("adding image, width=" + width + ",height=" + height + ",x=" + x + ",y=" + y);
    }
    // opacity
    log.debug("before drawImage");
View Full Code Here

          "RasterLayerFactory.createLayer() should only be called using ClientRasterLayerInfo");
    }
    ClientRasterLayerInfo rasterInfo = (ClientRasterLayerInfo) clientLayerInfo;
    RasterLayerRasterizingInfo extraInfo = (RasterLayerRasterizingInfo) rasterInfo
        .getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY);
    ReferencedEnvelope areaOfInterest = mapContext.getAreaOfInterest();
    RasterLayer layer = configurationService.getRasterLayer(clientLayerInfo.getServerLayerId());
    MapViewport port = mapContext.getViewport();
    double rasterScale = port.getScreenArea().getWidth() / port.getBounds().getWidth();
    List<RasterTile> tiles = rasterLayerService.getTiles(clientLayerInfo.getServerLayerId(),
        areaOfInterest.getCoordinateReferenceSystem(), areaOfInterest, rasterScale);
    RasterDirectLayer rasterLayer = new RasterDirectLayer(tiles, layer.getLayerInfo().getTileWidth(), layer
        .getLayerInfo().getTileHeight(), extraInfo.getCssStyle());
    rasterLayer.setTitle(clientLayerInfo.getLabel());
    rasterLayer.getUserData().put(USERDATA_KEY_SHOWING, extraInfo.isShowing());
    return rasterLayer;
View Full Code Here

   * @param geomName
   *            The name of the geometry field ("the_geom")
   * @return filter
   */
  public Filter createBboxFilter(Crs crs, Envelope bbox, String geomName) {
    return FF.bbox(FF.property(geomName), new ReferencedEnvelope(bbox, crs));
  }
View Full Code Here

  public void writeMap(OutputStream stream, ClientMapInfo clientMapInfo) throws GeomajasException {
    PipelineContext context = pipelineService.createContext();
    DefaultMapContext mapContext = new DefaultMapContext();
    mapContext.setCoordinateReferenceSystem(geoService.getCrs2(clientMapInfo.getCrs()));
    MapRasterizingInfo mapInfo = (MapRasterizingInfo) clientMapInfo.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
    mapContext.setAreaOfInterest(new ReferencedEnvelope(dtoConverterService.toInternal(mapInfo.getBounds()),
        mapContext.getCoordinateReferenceSystem()));
    RenderingHints renderingHints = new Hints();
    renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    RasterizingContainer response = new RasterizingContainer();
    context.put(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, clientMapInfo);
View Full Code Here

  public void writeLegend(OutputStream stream, ClientMapInfo clientMapInfo) throws GeomajasException {
    PipelineContext context = pipelineService.createContext();
    DefaultMapContext mapContext = new DefaultMapContext();
    mapContext.setCoordinateReferenceSystem(geoService.getCrs2(clientMapInfo.getCrs()));
    MapRasterizingInfo mapInfo = (MapRasterizingInfo) clientMapInfo.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
    mapContext.setAreaOfInterest(new ReferencedEnvelope(dtoConverterService.toInternal(mapInfo.getBounds()),
        mapContext.getCoordinateReferenceSystem()));
    RenderingHints renderingHints = new Hints();
    renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    RasterizingContainer response = new RasterizingContainer();
    context.put(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, clientMapInfo);
View Full Code Here

    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);

    DefaultMapContext mapContext = new DefaultMapContext();
    mapContext.setCoordinateReferenceSystem(geoService.getCrs2("EPSG:4326"));
    mapContext.getViewport().setBounds(
        new ReferencedEnvelope(0, 100, 0, 100, mapContext.getCoordinateReferenceSystem()));
    mapContext.getViewport().setCoordinateReferenceSystem(mapContext.getCoordinateReferenceSystem());
    mapContext.getViewport().setScreenArea(new Rectangle(0, 0, 100, 100));
    GeometryDirectLayer layer = (GeometryDirectLayer) layerFactory.createLayer(mapContext, geo);
    BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR);
    layer.draw(image.createGraphics(), mapContext, mapContext.getViewport());
View Full Code Here

    DefaultMapContext mapContext = new DefaultMapContext();
    mapContext.setCoordinateReferenceSystem(layerBluemarble.getCrs());
    mapContext.getViewport().setCoordinateReferenceSystem(mapContext.getCoordinateReferenceSystem());
    mapContext.getViewport().setScreenArea(new Rectangle(1024, 512));
    mapContext.getViewport().setBounds(new ReferencedEnvelope(-180, 180, -90, 90, layerBluemarble.getCrs()));
    RasterDirectLayer layer = (RasterDirectLayer) layerFactory.createLayer(mapContext, cl1);
    new DirectLayerAssert(layer, mapContext).assertEqualImage("wms.png", writeImages, DELTA);
  }
View Full Code Here

    MapContext mapContext = context.get(RasterizingPipelineCode.MAP_CONTEXT_KEY, MapContext.class);
    MapRasterizingInfo mapRasterizingInfo = (MapRasterizingInfo) clientMapInfo
        .getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
    mapContext.getUserData().put(LayerFactory.USERDATA_RASTERIZING_INFO, mapRasterizingInfo);
    Crs mapCrs = geoService.getCrs2(clientMapInfo.getCrs());
    ReferencedEnvelope mapArea = new ReferencedEnvelope(
        converterService.toInternal(mapRasterizingInfo.getBounds()), mapCrs);
    Rectangle paintArea = new Rectangle((int) (mapRasterizingInfo.getScale() * mapArea.getWidth()),
        (int) (mapRasterizingInfo.getScale() * mapArea.getHeight()));
    mapContext.getViewport().setBounds(mapArea);
    mapContext.getViewport().setCoordinateReferenceSystem(mapCrs);
    mapContext.getViewport().setScreenArea(paintArea);
    // add the configured layers
    for (ClientLayerInfo clientLayerInfo : clientMapInfo.getLayers()) {
View Full Code Here

TOP

Related Classes of org.geotools.geometry.jts.ReferencedEnvelope

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.