protected FreeForAllZoomStrategy(ClientMapInfo mapInfo, Bbox maxBounds) { ScaleConfigurationInfo scaleConfigurationInfo = mapInfo.getScaleConfiguration(); maximumScale = scaleConfigurationInfo.getMaximumScale().getPixelPerUnit(); this.maxBounds = maxBounds; }
/** * Sets the denominator for a relative scale. * * @param denominator * the denominator for a relative scale */ public void setDenominator(double denominator) { this.denominator = denominator; setPixelPerUnitBased(false); postConstruct(); }
@Override public DeskmanagerClientLayerInfo getExtraInfo(ClientLayerInfo cli) { if (cli.getUserData() != null && cli.getUserData() instanceof DeskmanagerClientLayerInfo) { return (DeskmanagerClientLayerInfo) cli.getUserData(); } else { return DEFAULT_ECLI; } }
/** * Copy constructor. Creates a deep copy of the specified {@link ScaleInfo} object. * * @param other the scale info to copy * @since 1.11.0 */ public ScaleInfo(ScaleInfo other) { setDenominator(other.getDenominator()); setNumerator(other.getNumerator()); setPixelPerUnit(other.getPixelPerUnit()); // must copy all state setPixelPerUnitBased(other.isPixelPerUnitBased()); }
public void initialize(ClientMapInfo mapInfo) { pointStyle = mapInfo.getPointSelectStyle(); lineStyle = mapInfo.getLineSelectStyle(); ringStyle = mapInfo.getPolygonSelectStyle(); }
@Override public boolean isShowing() { if (markedAsVisible) { if (viewPort.getScale() >= layerInfo.getMinimumScale().getPixelPerUnit() && viewPort.getScale() <= layerInfo.getMaximumScale().getPixelPerUnit()) { return true; } } return false; } }
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()); } }
/** @todo javadoc unknown. */ public String getServerLayerId() { return layerInfo.getServerLayerId(); }
/** * 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)); }
/** * Set the minimum scale for which this layer should be visible (maximum zoom out). * * @param viewScaleMin * scale (pix/map unit) * @deprecated use {@link #setMinimumScale(ScaleInfo)}} */ @Deprecated public void setViewScaleMin(double viewScaleMin) { setMinimumScale(new ScaleInfo(viewScaleMin)); }
/** * Set the maximum scale for which this layer should be visible (maximum zoom in). * * @param viewScaleMax * scale (pix/map unit) * @deprecated use {@link #setMaximumScale(ScaleInfo)} */ @Deprecated public void setViewScaleMax(double viewScaleMax) { setMaximumScale(new ScaleInfo(viewScaleMax)); }
/** * Get the minimum scale for which this layer should be visible (maximum zoom out). * * @return minimum scale (pix/map unit) * @deprecated use {@link #getMinimumScale()} */ @Deprecated public double getViewScaleMin() { return minimumScale.getPixelPerUnit(); }
/** * Constructs a scale info object with the specified scale value. The scale value should be interpreted as * pixels/map unit. This is especially useful for raster images for which the image resolution indirectly determines * the optimal view scale of the image. * * @param pixelPerUnit * the scale value in pixel per map unit) */ public ScaleInfo(double pixelPerUnit) { if (pixelPerUnit < MINIMUM_PIXEL_PER_UNIT) { pixelPerUnit = MINIMUM_PIXEL_PER_UNIT; } if (pixelPerUnit > MAXIMUM_PIXEL_PER_UNIT) { pixelPerUnit = MAXIMUM_PIXEL_PER_UNIT; } setPixelPerUnit(pixelPerUnit); }
/** Finish configuration. */ @PostConstruct protected void postConstruct() { if (null == zoomToPointScale) { zoomToPointScale = new ScaleInfo(maximumScale); } }
@Override public double toScale(double scaleDenominator) { return mapInfo.getUnitLength() / (mapInfo.getPixelLength() * scaleDenominator); }
/** * 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(); }
/** * Get the maximum scale for which this layer should be visible (maximum zoom in). * * @return maximum scale (pix/map unit) * @deprecated use {@link #getMaximumScale()} */ @Deprecated public double getViewScaleMax() { return maximumScale.getPixelPerUnit(); }
@Override public DeskmanagerClientLayerInfo getExtraInfo(ClientLayerInfo cli) { if (cli.getUserData() != null && cli.getUserData() instanceof DeskmanagerClientLayerInfo) { return (DeskmanagerClientLayerInfo) cli.getUserData(); } else { return DEFAULT_ECLI; } }
/** * Sets the numerator for a relative scale. * * @param numerator * the numerator for a relative scale */ public void setNumerator(double numerator) { this.numerator = numerator; setPixelPerUnitBased(false); if (denominator != 0) { postConstruct(); } }
/** * Sets the scale value in pixel per map unit. * * @param pixelPerUnit * the scale value (pix/map unit) */ public void setPixelPerUnit(double pixelPerUnit) { if (pixelPerUnit < MINIMUM_PIXEL_PER_UNIT) { pixelPerUnit = MINIMUM_PIXEL_PER_UNIT; } if (pixelPerUnit > MAXIMUM_PIXEL_PER_UNIT) { pixelPerUnit = MAXIMUM_PIXEL_PER_UNIT; } this.pixelPerUnit = pixelPerUnit; setPixelPerUnitBased(true); postConstruct(); }