Package org.geomajas.configuration.client

Examples of org.geomajas.configuration.client.ClientMapInfo


    Assert.assertTrue(layer instanceof VectorLayer);
  }

  @Test
  public void getMapTest() throws Exception {
    ClientMapInfo map = configurationService.getMap(MAP_ID, APPLICATION_ID);
    Assert.assertNotNull(map);
    Assert.assertEquals(MAP_ID, map.getId());
  }
View Full Code Here


  public void createImageUrl(MapWidget map, ImageUrlCallback imageCallBack) {
    createImageUrl(map, imageCallBack, true);
  }

  public void makeRasterizable(MapWidget map) {
    ClientMapInfo mapInfo = map.getMapModel().getMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    MapView mapView = map.getMapModel().getMapView();
    mapRasterizingInfo.setBounds(GeometryConverter.toDto(map.getMapModel().getMapView().getBounds()));
    mapRasterizingInfo.setScale(mapView.getCurrentScale());
    mapRasterizingInfo.setTransparent(true);
    LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo();
    legendRasterizingInfo.setTitle("Legend");
    FontStyleInfo font = new FontStyleInfo();
    font.applyDefaults();
    legendRasterizingInfo.setFont(font);
    mapRasterizingInfo.setLegendRasterizingInfo(legendRasterizingInfo);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
    for (Layer<?> layer : map.getMapModel().getLayers()) {
      if (layer instanceof VectorLayer) {
        VectorLayer vectorLayer = (VectorLayer) layer;
        VectorLayerRasterizingInfo vectorRasterizingInfo = new VectorLayerRasterizingInfo();
        vectorRasterizingInfo.setPaintGeometries(true);
        vectorRasterizingInfo.setPaintLabels(layer.isLabeled());
        vectorRasterizingInfo.setShowing(layer.isShowing());
        ClientVectorLayerInfo layerInfo = vectorLayer.getLayerInfo();
        vectorRasterizingInfo.setStyle(layerInfo.getNamedStyleInfo());
        if (vectorLayer.getSelectedFeatures().size() > 0) {
          Set<String> selectedFeatures = vectorLayer.getSelectedFeatures();
          vectorRasterizingInfo.setSelectedFeatureIds(selectedFeatures.toArray(new String[selectedFeatures
              .size()]));
          FeatureStyleInfo selectStyle = null;
          switch (layerInfo.getLayerType()) {
            case GEOMETRY:
              break;
            case LINESTRING:
            case MULTILINESTRING:
              selectStyle = mapInfo.getLineSelectStyle();
              break;
            case MULTIPOINT:
            case POINT:
              selectStyle = mapInfo.getPointSelectStyle();
              break;
            case MULTIPOLYGON:
            case POLYGON:
              selectStyle = mapInfo.getPolygonSelectStyle();
              break;
          }
          selectStyle.applyDefaults();
          vectorRasterizingInfo.setSelectionStyle(selectStyle);
        }
View Full Code Here

        GetMapConfigurationRequest.COMMAND, request, null, "en");
    if (response.isError()) {
      response.getErrors().get(0).printStackTrace();
    }
    Assert.assertFalse(response.isError());
    ClientMapInfo mapInfo = response.getMapInfo();
    Assert.assertNotNull(mapInfo);
    Bbox mapMaxExtent = mapInfo.getLayers().get(0).getMaxExtent();
    // these values were registered during a first run, they have *not* been externally verified
    Assert.assertEquals(-9467848.347161204, mapMaxExtent.getX(), DOUBLE_TOLERANCE);
    Assert.assertEquals(-2.0037508342789236E7, mapMaxExtent.getY(), DOUBLE_TOLERANCE);
    Assert.assertEquals(1.8935696632026553E7, mapMaxExtent.getWidth(), DOUBLE_TOLERANCE);
    Assert.assertEquals(4.007501596344786E7, mapMaxExtent.getHeight(), DOUBLE_TOLERANCE);

    // user data
    ClientUserDataInfo info = mapInfo.getUserData();
    Assert.assertNotNull(info);
    Assert.assertTrue(info instanceof ClientApplicationInfo.DummyClientUserDataInfo);
    Assert.assertEquals("some data", ((ClientApplicationInfo.DummyClientUserDataInfo) info).getDummy());

    // widget data
    Assert.assertNotNull(mapInfo.getWidgetInfo());
    Assert.assertNull(mapInfo.getWidgetInfo("mapSelect"));
    Assert.assertNotNull(mapInfo.getWidgetInfo("layerTree"));
    Assert.assertEquals("layer1, layer2",
        ((ClientApplicationInfo.DummyClientWidgetInfo) mapInfo.getWidgetInfo("layerTree")).getDummy());
  }
View Full Code Here

  }

  private void checkOrRender(String fileName, boolean paintLabels, boolean paintGeometries, VectorLayer layer,
      NamedStyleInfo styleInfo, Bbox box) throws Exception {

    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(box);
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(1);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
    ClientVectorLayerInfo clientVectorLayerInfo = new ClientVectorLayerInfo();
    clientVectorLayerInfo.setVisible(true);
    clientVectorLayerInfo.setServerLayerId(layer.getId());
    clientVectorLayerInfo.setNamedStyleInfo(styleInfo);
    VectorLayerRasterizingInfo vectorLayerRasterizingInfo = new VectorLayerRasterizingInfo();
    vectorLayerRasterizingInfo.setPaintGeometries(true);
    vectorLayerRasterizingInfo.setPaintLabels(true);
    vectorLayerRasterizingInfo.setStyle(styleInfo);
    clientVectorLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, vectorLayerRasterizingInfo);
    mapInfo.getLayers().add(clientVectorLayerInfo);
    new MapAssert(mapInfo).assertEqualImage(fileName, writeImages, DELTA);
  }
View Full Code Here

    ThreadScopeContextHolder.clear();
  }

  @Test
  public void testOneVectorLayer() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(1);
    mapRasterizingInfo.setTransparent(true);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
    ClientVectorLayerInfo clientBeansPointLayerInfo = new ClientVectorLayerInfo();
    clientBeansPointLayerInfo.setServerLayerId(layerBeansPoint.getId());
    VectorLayerRasterizingInfo layerRasterizingInfo = new VectorLayerRasterizingInfo();
    layerRasterizingInfo.setStyle(layerBeansPointStyleInfo);
    clientBeansPointLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, layerRasterizingInfo);
    mapInfo.getLayers().add(clientBeansPointLayerInfo);
    new MapAssert(mapInfo).assertEqualImage("onevector.png", writeImages, DELTA);
  }
View Full Code Here

    new MapAssert(mapInfo).assertEqualImage("onevector.png", writeImages, DELTA);
  }

  @Test
  public void testTwoVectorLayers() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(1);
    mapRasterizingInfo.setTransparent(true);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);

    ClientVectorLayerInfo cl1 = new ClientVectorLayerInfo();
    cl1.setServerLayerId(layerBeansPoint.getId());
    VectorLayerRasterizingInfo lr1 = new VectorLayerRasterizingInfo();
    lr1.setStyle(layerBeansPointStyleInfo);
    cl1.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr1);
    mapInfo.getLayers().add(cl1);

    ClientVectorLayerInfo cl2 = new ClientVectorLayerInfo();
    cl2.setServerLayerId(layerBeansMultiLine.getId());
    VectorLayerRasterizingInfo lr2 = new VectorLayerRasterizingInfo();
    lr2.setStyle(layerBeansMultiLineStyleInfo);
    cl2.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr2);
    mapInfo.getLayers().add(cl2);
    new MapAssert(mapInfo).assertEqualImage("twovector.png", writeImages, DELTA);
  }
View Full Code Here

    new MapAssert(mapInfo).assertEqualImage("twovector.png", writeImages, DELTA);
  }

  @Test
  public void testGeometry() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(1);
    mapRasterizingInfo.setTransparent(true);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);

    ClientGeometryLayerInfo geo = new ClientGeometryLayerInfo();
    Geometry point = new Geometry(Geometry.POINT, 4326, 5);
    point.setCoordinates(new Coordinate[] { new Coordinate(20, 50) });
    geo.getGeometries().add(point);
    geo.setStyle(layerBeansPointStyleInfo.getFeatureStyles().get(0));
    geo.setLayerType(LayerType.POINT);
    mapInfo.getLayers().add(geo);
    new MapAssert(mapInfo).assertEqualImage("geometry.png", writeImages, DELTA);
  }
View Full Code Here

    new MapAssert(mapInfo).assertEqualImage("geometry.png", writeImages, DELTA);
  }

  @Test
  public void testOneRasterLayer() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(new Bbox(-180, -90, 360, 180));
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(2);
    mapRasterizingInfo.setTransparent(true);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);

    ClientRasterLayerInfo cl1 = new ClientRasterLayerInfo();
    cl1.setServerLayerId(layerBluemarble.getId());
    RasterLayerRasterizingInfo rr1 = new RasterLayerRasterizingInfo();
    rr1.setCssStyle("opacity:0.5");
    cl1.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rr1);
    mapInfo.getLayers().add(cl1);
    new MapAssert(mapInfo).assertEqualImage("oneraster.png", writeImages, DELTA);
  }
View Full Code Here

      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);
    try {
      imageService.writeMap(imageStream, mapInfo);
      // rasterizingService.rasterize(imageStream, layer, style, tileMetadata, tileContainer.getTile());
View Full Code Here

    ThreadScopeContextHolder.clear();
  }

  @Test
  public void testLegend() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    mapRasterizingInfo.setBounds(new Bbox(-180, -90, 360, 180));
    mapInfo.setCrs("EPSG:4326");
    mapRasterizingInfo.setScale(2);
    mapRasterizingInfo.setTransparent(true);
    mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);

    ClientRasterLayerInfo cl1 = new ClientRasterLayerInfo();
    cl1.setServerLayerId(layerBluemarble.getId());
    cl1.setLabel("Blue Marble");
    RasterLayerRasterizingInfo rr1 = new RasterLayerRasterizingInfo();
    rr1.setCssStyle("opacity:0.5");
    cl1.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rr1);
    mapInfo.getLayers().add(cl1);

    ClientVectorLayerInfo cl2 = new ClientVectorLayerInfo();
    cl2.setServerLayerId(layerBeansPoint.getId());
    cl2.setLayerInfo(layerBeansPoint.getLayerInfo());
    cl2.setLabel(layerBeansPoint.getId());
    VectorLayerRasterizingInfo lr2 = new VectorLayerRasterizingInfo();
    lr2.setStyle(layerBeansPointStyleInfo);
    cl2.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr2);
    mapInfo.getLayers().add(cl2);

    ClientVectorLayerInfo cl3 = new ClientVectorLayerInfo();
    cl3.setServerLayerId(layerBeansMultiLine.getId());
    cl3.setLayerInfo(layerBeansMultiLine.getLayerInfo());
    cl3.setLabel(layerBeansMultiLine.getId());
    VectorLayerRasterizingInfo lr3 = new VectorLayerRasterizingInfo();
    lr3.setStyle(layerBeansMultiLineStyleInfo);
    cl3.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, lr3);
    mapInfo.getLayers().add(cl3);

    LegendRasterizingInfo legendRasterizingInfo = new LegendRasterizingInfo();
    legendRasterizingInfo.setFont(new FontStyleInfo());
    legendRasterizingInfo.getFont().applyDefaults();
    legendRasterizingInfo.getFont().setSize(12);
View Full Code Here

TOP

Related Classes of org.geomajas.configuration.client.ClientMapInfo

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.