Examples of TileMetadata


Examples of org.geomajas.layer.tile.TileMetadata

    this.id = id;
  }

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    TileMetadata metadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);

    // Get the features:
    List<InternalFeature> features = layerService
        .getFeatures(metadata.getLayerId(), layer.getCrs(), filter, metadata.getStyleInfo(),
            VectorLayerService.FEATURE_INCLUDE_ALL);
    // Put them all in the tile to make them available to the next step
    response.getTile().setFeatures(features);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    InternalTile tile = response.getTile();
    if (null == tile.getFeatureContent()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      TileMetadata metadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);

      tile.setContentType(VectorTile.VectorTileContentType.STRING_CONTENT);
      Coordinate panOrigin = new Coordinate(metadata.getPanOrigin().getX(), metadata.getPanOrigin().getY());
      TilePainter tilePainter = new StringContentTilePainter(layer, metadata.getStyleInfo(), metadata
          .getRenderer(), metadata.getScale(), panOrigin, geoService, textService);
      tilePainter.setPaintGeometries(metadata.isPaintGeometries());
      tilePainter.setPaintLabels(metadata.isPaintLabels());
      log.debug("Going to paint features {}", tile.getFeatures());

      tilePainter.paint(tile);
    }
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

    this.id = id;
  }

  public void execute(PipelineContext context, GetTileContainer tileContainer) throws GeomajasException {
    VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
    TileMetadata tileMetadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    // put the image in a raster container
    RasterizingContainer rasterizingContainer = new RasterizingContainer();
    NamedStyleInfo style = tileMetadata.getStyleInfo();
    if (style == null) {
      // no style specified, take the first
      style = layer.getLayerInfo().getNamedStyleInfos().get(0);
    } else if (style.getFeatureStyles().isEmpty()) {
      // only name specified, find it
      style = layer.getLayerInfo().getNamedStyleInfo(style.getName());
    }
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(converterService.toDto(tileContainer.getTile().getBounds()));
    mapInfo.setCrs(tileMetadata.getCrs());
    mapRasterizingInfo.setScale(tileMetadata.getScale());
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
    ClientVectorLayerInfo clientVectorLayerInfo = new ClientVectorLayerInfo();
    clientVectorLayerInfo.setServerLayerId(tileMetadata.getLayerId());
    clientVectorLayerInfo.setNamedStyleInfo(style);
    VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
    vectorLayerRasterizingInfo.setFilter(tileMetadata.getFilter());
    vectorLayerRasterizingInfo.setPaintGeometries(tileMetadata.isPaintGeometries());
    vectorLayerRasterizingInfo.setPaintLabels(tileMetadata.isPaintLabels());
    vectorLayerRasterizingInfo.setFilter(tileMetadata.getFilter());
    vectorLayerRasterizingInfo.setStyle(style);
    clientVectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
    mapInfo.getLayers().add(clientVectorLayerInfo);

    ByteArrayOutputStream imageStream = new ByteArrayOutputStream(1024 * 10);
 
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  private TestRecorder recorder;

  public void execute(PipelineContext context, GetTileContainer container) throws GeomajasException {
    recorder.record(CacheCategory.REBUILD, "Put item in cache");
    RebuildCacheContainer rcc = new RebuildCacheContainer();
    TileMetadata tileMetadata = context.get(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    rcc.setMetadata(tileMetadata);
    cachingSupportService.putContainer(context, securityContextAdder, CacheCategory.REBUILD, KEYS,
        RasterizingPipelineCode.IMAGE_ID_KEY, RasterizingPipelineCode.IMAGE_ID_CONTEXT, rcc,
        container.getTile().getBounds());
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  public void setId(String id) {
    this.id = id;
  }

  public void execute(PipelineContext context, GetTileContainer response) throws GeomajasException {
    TileMetadata tileMetadata = context.getOptional(PipelineCode.TILE_METADATA_KEY, TileMetadata.class);
    if (tileMetadata != null) {
      // set to origin
      tileMetadata.setPanOrigin(new Coordinate());
    }
  }   
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  public void setId(String id) {
    this.id = id;
  }

  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
    Coordinate panOrigin = new Coordinate(metadata.getPanOrigin().getX(), metadata.getPanOrigin().getY());
    tiledFeatureService.clipTile(response.getTile(), metadata.getScale(), panOrigin);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  }


  @Test
  public void getTile()  throws Exception {
    TileMetadata tileMetadata = getTileMetadata();
    InternalTile tile = layerService.getTile(tileMetadata);
    Assert.assertNotNull(tile);
    Assert.assertNotNull(tile.getFeatures());
    Assert.assertEquals(3, tile.getFeatures().size());
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

    Assert.assertEquals(3, tile.getFeatures().size());
  }

  @Test
  public void getFilteredTile()  throws Exception {
    TileMetadata tileMetadata = getTileMetadata();
    tileMetadata.setFilter("doubleAttr is null");
    InternalTile tile = layerService.getTile(tileMetadata);
    Assert.assertNotNull(tile);
    Assert.assertNotNull(tile.getFeatures());
    Assert.assertEquals(2, tile.getFeatures().size());
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

    Assert.assertEquals(2, tile.getFeatures().size());

  }

  private TileMetadata getTileMetadata() {
    TileMetadata tileMetadata = new TileMetadataImpl();
    tileMetadata.setCrs("EPSG:4326");
    tileMetadata.setCode(new TileCode(0,0,0));
    tileMetadata.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tileMetadata.setLayerId(LAYER_ID);
    tileMetadata.setPaintGeometries(true);
    tileMetadata.setScale(1.0);
    NamedStyleInfo styleInfo = new NamedStyleInfo();
    styleInfo.setName("beansStyleInfo");
    tileMetadata.setStyleInfo(styleInfo);
    tileMetadata.setPanOrigin(new org.geomajas.geometry.Coordinate(0, 0));
    return tileMetadata;
  }
View Full Code Here

Examples of org.geomajas.layer.tile.TileMetadata

  }

  @Test
  public void testGetTile() throws Exception {
    InternalTile tile;
    TileMetadata tmd = new GetVectorTileRequest();
    tmd.setCrs("EPSG:4326");
    tmd.setCode(new TileCode(1,0,0));
    tmd.setLayerId(LAYER_BEANS);
    tmd.setRenderer(TileMetadata.PARAM_SVG_RENDERER);
    tmd.setScale(1.0);
    tmd.setPanOrigin(new Coordinate(0, 0));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,0,0));
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-0-0\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-0-0.0\"><path fill-rule=\"evenodd\" d=\"M0 0l1 0 0 -1 -1 0 0 1 Z\" id=\"1\"/></g></g>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,1,0));
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-1-0\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-1-0.0\"><path fill-rule=\"evenodd\" d=\"M4 0l2 0 0 -3 -2 0 0 3 Z\" id=\"2\"/></g></g>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,1,1));
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-1-1\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-1-1.0\"><path fill-rule=\"evenodd\" d=\"M2 -1l4 0 1 -1 -5 0 0 1 Z\" id=\"3\"/></g></g>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,0,1));
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-0-1\"/>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // first run, this should put things in the cache
    recorder.clear();
    tmd.setCode(new TileCode(1,1,1));
    tmd.setScale(2.0);
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-1-1\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-1-1.0\"><path fill-rule=\"evenodd\" d=\"M4 -2l8 0 2 -2 -10 0 0 2 Z\" id=\"3\"/></g></g>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE, "Put item in cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Put item in cache"));

    // get tile again, the result should be different because we changed the cached value
    recorder.clear();
    tmd.setCode(new TileCode(1,1,0));
    tmd.setScale(1.0);
    tile = vectorLayerService.getTile(tmd);
    Assert.assertNotNull(tile);
    Assert.assertEquals("<g id=\"beans.features.1-1-0\"><g style=\"fill:#995500;fill-opacity:0.6;stroke:#995500;stroke-opacity:0.3;stroke-width:1px;\" id=\"beans.features.1-1-0.0\"><path fill-rule=\"evenodd\" d=\"M4 0l2 0 0 -3 -2 0 0 3 Z\" id=\"2\"/></g></g>", tile.getFeatureContent());
    Assert.assertEquals("", recorder.matches(CacheCategory.TILE, "Got item from cache"));
    Assert.assertEquals("", recorder.matches(CacheCategory.FEATURE));
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.