com.partnersoft.v3x.apps.MapBrowser
Class Scale

java.lang.Object
  extended by com.partnersoft.v3x.apps.MapBrowser.Scale
All Implemented Interfaces:
java.io.Serializable

public class Scale
extends java.lang.Object
implements java.io.Serializable

A visual scale for a map. Defines the pixel<->ground coordinate mapping.

See Also:
Serialized Form

Field Summary
 double pixelHeight
           
 double pixelWidth
           
 
Constructor Summary
Scale()
          Create a new, blank scale.
Scale(double pixelSize)
          Create a scale with the same pixel width and height
Scale(double pixelWidth, double pixelHeight)
          Create a scale with the given pixel height and width.
 
Method Summary
 boolean equals(java.lang.Object nother)
          Compares with another Scale.
 double getPixelHeight()
           
 double getPixelWidth()
           
 boolean isCoarserThan(Scale nother)
          Returns true if this scale is coarser (i.e., each pixel covers more area) than the one given.
 boolean isEqualOrFinerThan(Scale nother)
          Returns true if this scale is the same or finer (i.e., each pixel covers less area) than the one given.
 boolean isFinerThan(Scale nother)
          Returns true if this scale is finer (i.e., each pixel covers less area) than the one given.
 double pixelsToX(int pixels)
          Translates a horizontal distance in pixels to a horizontal distance in ground coordinates.
 double pixelsToY(int pixels)
          Translates a vertical distance in pixels to a vertical distance in ground coordinates.
 void scaleBy(double factor)
          Scales the scale by the given factor (multiplying pixelWidth and pixelHeight by said factor).
 void setPixelHeight(double newHeight)
           
 void setPixelWidth(double newWidth)
           
 java.lang.String toString()
           
 int xToPixels(double x)
          Translates a horizontal distance in ground coordinates to a horizontal distance in pixels.
 int yToPixels(double y)
          Translates a vertical distance in ground coordinates to a vertical distance in pixels.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pixelWidth

public double pixelWidth

pixelHeight

public double pixelHeight
Constructor Detail

Scale

public Scale()
Create a new, blank scale.


Scale

public Scale(double pixelWidth,
             double pixelHeight)
Create a scale with the given pixel height and width.


Scale

public Scale(double pixelSize)
Create a scale with the same pixel width and height

Method Detail

pixelsToX

public double pixelsToX(int pixels)
Translates a horizontal distance in pixels to a horizontal distance in ground coordinates.


pixelsToY

public double pixelsToY(int pixels)
Translates a vertical distance in pixels to a vertical distance in ground coordinates.


xToPixels

public int xToPixels(double x)
Translates a horizontal distance in ground coordinates to a horizontal distance in pixels.


yToPixels

public int yToPixels(double y)
Translates a vertical distance in ground coordinates to a vertical distance in pixels.


equals

public boolean equals(java.lang.Object nother)
Compares with another Scale.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isCoarserThan

public boolean isCoarserThan(Scale nother)
Returns true if this scale is coarser (i.e., each pixel covers more area) than the one given.


isFinerThan

public boolean isFinerThan(Scale nother)
Returns true if this scale is finer (i.e., each pixel covers less area) than the one given.


isEqualOrFinerThan

public boolean isEqualOrFinerThan(Scale nother)
Returns true if this scale is the same or finer (i.e., each pixel covers less area) than the one given.


scaleBy

public void scaleBy(double factor)
Scales the scale by the given factor (multiplying pixelWidth and pixelHeight by said factor).


getPixelWidth

public double getPixelWidth()

setPixelWidth

public void setPixelWidth(double newWidth)

getPixelHeight

public double getPixelHeight()

setPixelHeight

public void setPixelHeight(double newHeight)