Package org.geomajas.plugin.printing.component.dto

Examples of org.geomajas.plugin.printing.component.dto.MapComponentInfo


    return page;
  }

  @Override
  protected MapComponentInfo buildMap() {
    MapComponentInfo map = super.buildMap();
    map.getLayoutConstraint().setMarginX(marginX);
    map.getLayoutConstraint().setMarginY(marginY);
    MapView view = mapModel.getMapView();
    double mapWidth = getPageWidth() - 2 * marginX;
    double mapHeight = getPageHeight() - 2 * marginY;
    Coordinate origin = view.getBounds().createFittingBox(mapWidth, mapHeight).getOrigin();
    map.setLocation(new org.geomajas.geometry.Coordinate(origin.getX(), origin.getY()));
    map.setPpUnit((float) (mapWidth / view.getBounds().createFittingBox(mapWidth, mapHeight).getWidth()));
    map.setTag("map");
    map.setMapId(mapModel.getMapInfo().getId());
    map.setApplicationId(applicationId);
    map.setRasterResolution(rasterDpi);
    List<PrintComponentInfo> layerChildren = new ArrayList<PrintComponentInfo>();
    for (Layer layer : mapModel.getLayers()) {
      if (layer instanceof VectorLayer && layer.isShowing()) {
        VectorLayerComponentInfo info = new VectorLayerComponentInfo();
        VectorLayer vectorLayer = (VectorLayer) layer;
        info.setLayerId(vectorLayer.getServerLayerId());
        ClientVectorLayerInfo layerInfo = vectorLayer.getLayerInfo();
        info.setStyleInfo(layerInfo.getNamedStyleInfo());
        info.setFilter(vectorLayer.getFilter());
        info.setLabelsVisible(vectorLayer.isLabeled());
        info.setSelected(vectorLayer.isSelected());
        Set<String> features = vectorLayer.getSelectedFeatures();
        info.setSelectedFeatureIds(features.toArray(new String[features.size()]));
        layerChildren.add(info);
      } else if (layer instanceof RasterLayer && layer.isShowing()) {
        RasterLayerComponentInfo info = new RasterLayerComponentInfo();
        RasterLayer rasterLayer = (RasterLayer) layer;
        info.setLayerId(rasterLayer.getServerLayerId());
        info.setStyle(rasterLayer.getLayerInfo().getStyle());
        layerChildren.add(info);
      }
    }
    map.getChildren().addAll(0, layerChildren);
    return map;
  }
View Full Code Here


    page.setTag("page");
    return page;
  }

  protected MapComponentInfo buildMap() {
    MapComponentInfo map = new MapComponentInfo();
    map.addChild(buildScaleBar());
    map.addChild(buildLegend());
    map.addChild(buildArrow());
    return map;
  }
View Full Code Here

    return page;
  }

  @Override
  protected MapComponentInfo buildMap() {
    MapComponentInfo map = super.buildMap();
    map.getLayoutConstraint().setMarginX(marginX);
    map.getLayoutConstraint().setMarginY(marginY);
    MapView view = mapModel.getMapView();
    double mapWidth = getPageWidth() - 2 * marginX;
    double mapHeight = getPageHeight() - 2 * marginY;
    Coordinate origin = view.getBounds().createFittingBox(mapWidth, mapHeight).getOrigin();
    map.setLocation(new org.geomajas.geometry.Coordinate(origin.getX(), origin.getY()));
    map.setPpUnit((float) (mapWidth / view.getBounds().createFittingBox(mapWidth, mapHeight).getWidth()));
    map.setTag("map");
    map.setMapId(mapModel.getMapInfo().getId());
    map.setApplicationId(applicationId);
    map.setRasterResolution(rasterDpi);
    List<PrintComponentInfo> layers = new ArrayList<PrintComponentInfo>();
    // use the normal way for raster layers (TODO: add support for dpi to rasterized part)
    for (Layer layer : mapModel.getLayers()) {
      if (layer instanceof RasterLayer && layer.isShowing()) {
        RasterLayerComponentInfo info = new RasterLayerComponentInfo();
        RasterLayer rasterLayer = (RasterLayer) layer;
        info.setLayerId(rasterLayer.getServerLayerId());
        info.setStyle(rasterLayer.getLayerInfo().getStyle());
        layers.add(info);
      }
    }
    // use the rasterized layers way for vector layers
    for (ClientLayerInfo layerInfo : mapModel.getMapInfo().getLayers()) {
      // we must skip the raster layers or we have them twice !
      if (layerInfo instanceof ClientRasterLayerInfo) {
        RasterLayerRasterizingInfo rInfo = (RasterLayerRasterizingInfo) layerInfo
            .getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY);
        rInfo.setShowing(false);
      }
    }
    RasterizedLayersComponentInfo rasterizedLayersComponentInfo = new RasterizedLayersComponentInfo();
    rasterizedLayersComponentInfo.setMapInfo(mapModel.getMapInfo());
    layers.add(rasterizedLayersComponentInfo);
    map.getChildren().addAll(0, layers);
    return map;
  }
View Full Code Here

    page.setTag("page");
    return page;
  }

  protected MapComponentInfo buildMap() {
    MapComponentInfo map = new MapComponentInfo();
    if (PrintingLayout.templateIncludeScaleBar) {
      map.addChild(buildScaleBar());
    }
    if (PrintingLayout.templateIncludeLegend) {
      map.addChild(buildLegend());
    }
    if (PrintingLayout.templateIncludeNorthArrow) {
      map.addChild(buildArrow());
    }
    return map;
  }
View Full Code Here

TOP

Related Classes of org.geomajas.plugin.printing.component.dto.MapComponentInfo

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.