Package org.geomajas.configuration.client

Examples of org.geomajas.configuration.client.ClientMapInfo


    new LegendAssert(mapInfo).assertEqualImage("legend.png", writeImages, DELTA);
  }

  @Test
  public void testLegendDynamic() throws Exception {
    ClientMapInfo mapInfo = new ClientMapInfo();
    MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
    // set the bounds so no features are visible
    mapRasterizingInfo.setBounds(new Bbox(-180, -90, -170, -80));
    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


    request.setMapId(MAP_ID);
    CommandResponse response = commandDispatcher.execute(GetMapConfigurationRequest.COMMAND, request,
        securityContext.getToken(), "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof GetMapConfigurationResponse);
    ClientMapInfo mapInfo = ((GetMapConfigurationResponse)response).getMapInfo();

    Assert.assertEquals(MAP_ID, mapInfo.getId());
    Assert.assertEquals("EPSG:4326", mapInfo.getCrs());

    ClientToolbarInfo toolbar = mapInfo.getToolbar();
    Assert.assertNotNull(toolbar);
    Assert.assertEquals("toolbar", toolbar.getId());
    Assert.assertEquals(1, toolbar.getTools().size());
    Assert.assertEquals("ZoomToSelection", toolbar.getTools().get(0).getId());

    List<ClientLayerInfo> layers = mapInfo.getLayers();
    Assert.assertEquals(0, layers.size());
  }
View Full Code Here

    request.setMapId(MAP_ID);
    CommandResponse response = commandDispatcher.execute(GetMapConfigurationRequest.COMMAND, request,
        securityContext.getToken(), "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof GetMapConfigurationResponse);
    ClientMapInfo mapInfo = ((GetMapConfigurationResponse)response).getMapInfo();

    Assert.assertEquals(MAP_ID, mapInfo.getId());
    Assert.assertEquals("EPSG:4326", mapInfo.getCrs());

    ClientToolbarInfo toolbar = mapInfo.getToolbar();
    Assert.assertNotNull(toolbar);
    Assert.assertEquals("toolbar", toolbar.getId());
    Assert.assertEquals(4, toolbar.getTools().size());

    List<ClientLayerInfo> layers = mapInfo.getLayers();
    Assert.assertEquals(1, layers.size());
    ClientLayerInfo layer = layers.get(0);
    Assert.assertEquals(CLIENT_LAYER_ID, layer.getId());
    Assert.assertEquals(LAYER_ID, layer.getServerLayerId());
    Assert.assertEquals("Test beans", layer.getLabel());
View Full Code Here

  }

  protected 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

    if (isVisible()) {
      bbox = createBbox();
      Collections.addAll(selectedFeatures, getSelectedFeatureIds());
      // Fetch features
      try {
        ClientMapInfo map = configurationService.getMapInfo(getMap().getMapId(), getMap().getApplicationId());

        // 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();

        // If the transform is null then just use the bbox for the filter
        // Else if the transform is not null then transform the bbox for the filter
        Filter filter = filterService.createBboxFilter(layerCrs, layerBbox, geomName);

        if (getFilter() != null) {
          filter = filterService.createAndFilter(filterService.parseFilter(getFilter()), filter);
        }

        features = layerService.getFeatures(getLayerId(), geoService.getCrs2(map.getCrs()), filter, styleInfo,
            VectorLayerService.FEATURE_INCLUDE_ALL);

      } catch (Exception e) {
        log.error("Error getting features", e);
      }
View Full Code Here

    Color fillColor = context.getColor(style.getFillColor(), style.getFillOpacity());
    Color strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity());
    float[] dashArray = context.getDashArray(style.getDashArray());

    // check if the feature is selected
    ClientMapInfo map = configurationService.getMapInfo(getMap().getMapId(), getMap().getApplicationId());
    if (selectedFeatures.contains(f.getId())) {
      if (f.getGeometry() instanceof MultiPolygon || f.getGeometry() instanceof Polygon) {
        style = mergeStyle(style, map.getPolygonSelectStyle());
        fillColor = context.getColor(style.getFillColor(), style.getFillOpacity());
        strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity());
      } else if (f.getGeometry() instanceof MultiLineString || f.getGeometry() instanceof LineString) {
        style = mergeStyle(style, map.getLineSelectStyle());
        strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity());
      } else if (f.getGeometry() instanceof MultiPoint || f.getGeometry() instanceof Point) {
        style = mergeStyle(style, map.getPointSelectStyle());
        strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity());
      }
    }

    float lineWidth = style.getStrokeWidth();
View Full Code Here

  @Autowired
  private GeoService geoService;

  public void execute(PipelineContext context, RasterizingContainer response) throws GeomajasException {
    ClientMapInfo clientMapInfo = context.get(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, ClientMapInfo.class);
    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()) {
      clientLayerInfo.getWidgetInfo(RasterizingConstants.WIDGET_KEY);
      Layer layer = layerFactoryService.createLayer(mapContext, clientLayerInfo);
      boolean showing = (Boolean) layer.getUserData().get(LayerFactory.USERDATA_KEY_SHOWING);
      if (showing) {
        mapContext.addLayer(layer);
View Full Code Here

  }

  @Override
  public void visit(LegendComponent legend) {
    legend.clearItems();
    ClientMapInfo map = configurationService.getMapInfo(legend.getMapId(), legend.getApplicationId());
    for (ClientLayerInfo info : map.getLayers()) {
      if (info instanceof ClientVectorLayerInfo) {
        legend.addVectorLayer((ClientVectorLayerInfo) info);
      } else if (info instanceof ClientRasterLayerInfo) {
        legend.addRasterLayer((ClientRasterLayerInfo) info);
      }
View Full Code Here

  }

  @Override
  public void visit(MapComponent mapComponent) {
    mapComponent.clearLayers();
    ClientMapInfo map = configurationService.getMapInfo(mapComponent.getMapId(), mapComponent.getApplicationId());
    List<BaseLayerComponent> layers = new ArrayList<BaseLayerComponent>();
    for (ClientLayerInfo info : map.getLayers()) {
      if (info instanceof ClientVectorLayerInfo) {
        VectorLayerComponentInfo vectorInfo = new VectorLayerComponentInfo();
        vectorInfo.setLabelsVisible(false);
        vectorInfo.setLayerId(info.getServerLayerId());
        vectorInfo.setStyleInfo(((ClientVectorLayerInfo) info).getNamedStyleInfo());
View Full Code Here

    ticWidth = ticWidthInUnits * getMap().getPpUnit();
    ticHeight = ticWidth * 0.3f;
    int ticCount = getTicNumber();

    // Calculate the labels
    ClientMapInfo map = configurationService.getMapInfo(getMap().getMapId(), getMap().getApplicationId());
    if (map != null) {
      log.debug("calculateSize getMap.getId({}), res {}", getMap().getId(), map);
      Crs crs;
      try {
        crs = geoService.getCrs2(map.getCrs());
        unit = crs.getCoordinateSystem().getAxis(0).getUnit().toString();
      } catch (Exception e) {
        log.error("could not calculate map unit", e);
      }
    }
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.