Package org.openstreetmap.josm.gui.layer
Class NativeScaleLayer.ScaleList
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.NativeScaleLayer.ScaleList
-
- Enclosing interface:
- NativeScaleLayer
public static class NativeScaleLayer.ScaleList extends java.lang.Object
List of scales, may include intermediate steps between native resolutions
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<NativeScaleLayer.Scale>
scales
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addScale(NativeScaleLayer.Scale scale)
private NativeScaleLayer.Scale
getNextIn(NativeScaleLayer.Scale scale, double ratio)
private NativeScaleLayer.Scale
getNextOut(NativeScaleLayer.Scale scale, double ratio)
NativeScaleLayer.Scale
getSnapScale(double scale, boolean floor)
Get a scale from this ScaleList or a new scale if zoomed outside.NativeScaleLayer.Scale
getSnapScale(double scale, double ratio, boolean floor)
Get a scale from this ScaleList or a new scale if zoomed outside.NativeScaleLayer.Scale
scaleZoomIn(double scale, double ratio)
Get new scale for zoom in.NativeScaleLayer.Scale
scaleZoomOut(double scale, double ratio)
Get new scale for zoom out.NativeScaleLayer.Scale
scaleZoomTimes(double scale, double ratio, int times)
Get new scale for zoom in/out with a ratio at a number of times.java.lang.String
toString()
NativeScaleLayer.ScaleList
withIntermediateSteps(double ratio)
Returns a ScaleList that has intermediate steps between native scales.
-
-
-
Field Detail
-
scales
private final java.util.List<NativeScaleLayer.Scale> scales
-
-
Method Detail
-
addScale
protected void addScale(NativeScaleLayer.Scale scale)
-
withIntermediateSteps
public NativeScaleLayer.ScaleList withIntermediateSteps(double ratio)
Returns a ScaleList that has intermediate steps between native scales. Native steps are split to equal steps near given ratio.- Parameters:
ratio
- user defined zoom ratio- Returns:
- a
NativeScaleLayer.ScaleList
with intermediate steps
-
getSnapScale
public NativeScaleLayer.Scale getSnapScale(double scale, boolean floor)
Get a scale from this ScaleList or a new scale if zoomed outside.- Parameters:
scale
- previous scalefloor
- use floor instead of round, set true when fitting view to objects- Returns:
- new
NativeScaleLayer.Scale
-
getSnapScale
public NativeScaleLayer.Scale getSnapScale(double scale, double ratio, boolean floor)
Get a scale from this ScaleList or a new scale if zoomed outside.- Parameters:
scale
- previous scaleratio
- zoom ratio from starting from previous scalefloor
- use floor instead of round, set true when fitting view to objects- Returns:
- new
NativeScaleLayer.Scale
-
scaleZoomTimes
public NativeScaleLayer.Scale scaleZoomTimes(double scale, double ratio, int times)
Get new scale for zoom in/out with a ratio at a number of times. Used by mousewheel zoom where wheel can step more than one between events.- Parameters:
scale
- previous scaleratio
- user defined zoom ratiotimes
- number of times to zoom- Returns:
- new
NativeScaleLayer.Scale
object fromNativeScaleLayer.ScaleList
or outside
-
scaleZoomIn
public NativeScaleLayer.Scale scaleZoomIn(double scale, double ratio)
Get new scale for zoom in.- Parameters:
scale
- previous scaleratio
- user defined zoom ratio- Returns:
- next scale in list or a new scale when zoomed outside
-
scaleZoomOut
public NativeScaleLayer.Scale scaleZoomOut(double scale, double ratio)
Get new scale for zoom out.- Parameters:
scale
- previous scaleratio
- user defined zoom ratio- Returns:
- next scale in list or a new scale when zoomed outside
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getNextIn
private NativeScaleLayer.Scale getNextIn(NativeScaleLayer.Scale scale, double ratio)
-
getNextOut
private NativeScaleLayer.Scale getNextOut(NativeScaleLayer.Scale scale, double ratio)
-
-