/** * Returns the maximum scale (maximum zoom in) of this map. The minimum scale is indirectly determined from the * maximum bounds. As a better alternative for this value, use {@link #getScaleConfiguration}. * * @return the maximum scale (pixels/unit) * @deprecated use {@link #getScaleConfiguration} */ @Deprecated public float getMaximumScale() { return (float) getScaleConfiguration().getMaximumScale().getPixelPerUnit(); }
protected FixedStepZoomStrategy(ClientMapInfo mapInfo, Bbox maxBounds) { super(mapInfo, maxBounds); // Check for the existence of resolutions: if (mapInfo.getScaleConfiguration().getZoomLevels() == null || mapInfo.getScaleConfiguration().getZoomLevels().size() == 0) { throw new IllegalArgumentException("When using the FixedStepZoomStrategy, make sure that" + " the map configuration has defined at least one zoom level."); } // Get the full set of resolutions: scales = new ArrayList<Double>(); for (ScaleInfo scale : mapInfo.getScaleConfiguration().getZoomLevels()) { scales.add(scale.getPixelPerUnit()); } }
/** * Set maximum scale (maximum zoom in) of this map. As a better alternative for this value, use * {@link #getScaleConfiguration}. * * @param maximumScale * the maximum scale (pixels/unit) * @deprecated use {@link #setScaleConfiguration} */ @Deprecated public void setMaximumScale(float maximumScale) { getScaleConfiguration().setMaximumScale(new ScaleInfo((double) maximumScale)); }
protected FreeForAllZoomStrategy(ClientMapInfo mapInfo, Bbox maxBounds) { ScaleConfigurationInfo scaleConfigurationInfo = mapInfo.getScaleConfiguration(); maximumScale = scaleConfigurationInfo.getMaximumScale().getPixelPerUnit(); this.maxBounds = maxBounds; }
@Override public void initialize(ClientMapInfo mapInfo, MapEventBus eventBus) { this.mapInfo = mapInfo; this.eventBus = eventBus; crs = mapInfo.getCrs(); // Calculate maximum bounds: maxBounds = new Bbox(mapInfo.getMaxBounds().getX(), mapInfo.getMaxBounds().getY(), mapInfo.getMaxBounds() .getWidth(), mapInfo.getMaxBounds().getHeight()); // if the max bounds was not configured, take the union of initial and layer bounds if (BboxService.equals(maxBounds, Bbox.ALL, 1e-10)) { maxBounds = new Bbox(mapInfo.getInitialBounds().getX(), mapInfo.getInitialBounds().getY(), mapInfo .getInitialBounds().getWidth(), mapInfo.getInitialBounds().getHeight()); if (mapInfo.getLayers() != null && mapInfo.getLayers().size() > 0) { for (ClientLayerInfo layerInfo : mapInfo.getLayers()) { if (layerInfo.getMaxExtent() != null) { maxBounds = BboxService.union(maxBounds, layerInfo.getMaxExtent()); } } } } // Set the best zoom strategy given the map info: if (mapInfo.getScaleConfiguration().getZoomLevels() != null && mapInfo.getScaleConfiguration().getZoomLevels().size() > 0) { zoomStrategy = new FixedStepZoomStrategy(mapInfo, maxBounds); } else { zoomStrategy = new FreeForAllZoomStrategy(mapInfo, maxBounds); } zoomStrategy.setMapSize(mapWidth, mapHeight); initialized = true; }