com.partnersoft.maps.model
Class MapViewFrame

java.lang.Object
  extended by com.partnersoft.maps.model.MapViewFrame

public class MapViewFrame
extends java.lang.Object

The various numbers needed to describe the location, size, scale, and orientation of a view of the map. This represents a rectangle of renderable map, possible rotated, at a certain scale and position.

Author:
Paul Reavis Copyright 2003 Partner Software, Inc.

Field Summary
 double centerX
          The x-coordinate of the center of the map view, in map coordinates.
 double centerY
          The y-coordinate of the center of the map view, in map coordinates.
 java.awt.geom.AffineTransform inverseTransform
           
 int lod
          May be removed at some point - the level-of-detail for the given frame.
 int pixelHeight
          Height of the map view, in pixels.
 int pixelWidth
          Width of the map view, in pixels.
 double rotation
          Rotation of the map view, in cartesian degrees.
 double scale
          Scale of the map view, in map coordinates per pixel.
 java.awt.geom.AffineTransform transform
           
 
Constructor Summary
MapViewFrame()
           
MapViewFrame(int pixelWidth, int pixelHeight)
          Creates an orthogonal frame that matches pixel space (but not inverted; i.e.
 
Method Summary
 java.lang.Object clone()
           
 boolean contains(double x, double y)
           
 MapViewFrame copy()
           
 boolean equals(java.lang.Object nother)
           
 boolean firmlyContains(double x, double y)
          Returns true if point is inside the view, but not less than 10% near the edges.
 double getCenterX()
          Gets the value of centerX
 double getCenterY()
          Gets the value of centerY
 double getHeight()
           
 Point getNECorner()
           
 Point getNWCorner()
           
 int getPixelHeight()
           
 int getPixelWidth()
           
 double getRotation()
          Gets the value of rotation
 double getScale()
          Gets the value of scale
 Point getSECorner()
           
 Point getSWCorner()
           
 double getWidth()
           
 void pixelsToPoints(DoubleBuffer coords)
           
 Point pixelToPoint(int pixelX, int pixelY)
           
 void placeCoordAtPixel(double locusX, double locusY, int locusPixelX, int locusPixelY)
          Kind of weird.
 void pointsToPixels(DoubleBuffer coords)
           
 Point pointToPixel(double x, double y)
           
 Point pointToPixel(double x, double y, int offsetX, int offsetY)
           
 void resetTransform()
           
 boolean samePixelSize(MapViewFrame nother)
           
 boolean sameScaleAndSize(MapViewFrame nother)
           
 boolean sameSize(MapViewFrame nother)
           
 void setCenterX(double argCenterX)
          Sets the value of centerX
 void setCenterY(double argCenterY)
          Sets the value of centerY
 void setRotation(double argRotation)
          Sets the value of rotation
 void setScale(double argScale)
          Sets the value of scale
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

centerX

public double centerX
The x-coordinate of the center of the map view, in map coordinates.


centerY

public double centerY
The y-coordinate of the center of the map view, in map coordinates.


scale

public double scale
Scale of the map view, in map coordinates per pixel.


pixelWidth

public int pixelWidth
Width of the map view, in pixels.


pixelHeight

public int pixelHeight
Height of the map view, in pixels.


rotation

public double rotation
Rotation of the map view, in cartesian degrees. Rotation is of the contents, not the rectangular frame.


lod

public int lod
May be removed at some point - the level-of-detail for the given frame.


transform

public transient java.awt.geom.AffineTransform transform

inverseTransform

public transient java.awt.geom.AffineTransform inverseTransform
Constructor Detail

MapViewFrame

public MapViewFrame()

MapViewFrame

public MapViewFrame(int pixelWidth,
                    int pixelHeight)
Creates an orthogonal frame that matches pixel space (but not inverted; i.e. origin is bottom left of frame and y increases as you go "up".

Method Detail

pixelToPoint

public Point pixelToPoint(int pixelX,
                          int pixelY)

pointToPixel

public Point pointToPixel(double x,
                          double y)

pointToPixel

public Point pointToPixel(double x,
                          double y,
                          int offsetX,
                          int offsetY)

pointsToPixels

public void pointsToPixels(DoubleBuffer coords)

pixelsToPoints

public void pixelsToPoints(DoubleBuffer coords)

getSWCorner

public Point getSWCorner()

getNECorner

public Point getNECorner()

getSECorner

public Point getSECorner()

getNWCorner

public Point getNWCorner()

contains

public boolean contains(double x,
                        double y)

firmlyContains

public boolean firmlyContains(double x,
                              double y)
Returns true if point is inside the view, but not less than 10% near the edges.


resetTransform

public void resetTransform()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

copy

public MapViewFrame copy()

equals

public boolean equals(java.lang.Object nother)
Overrides:
equals in class java.lang.Object

sameSize

public boolean sameSize(MapViewFrame nother)

samePixelSize

public boolean samePixelSize(MapViewFrame nother)

sameScaleAndSize

public boolean sameScaleAndSize(MapViewFrame nother)

getPixelWidth

public int getPixelWidth()

getPixelHeight

public int getPixelHeight()

getWidth

public double getWidth()

getHeight

public double getHeight()

toString

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

placeCoordAtPixel

public void placeCoordAtPixel(double locusX,
                              double locusY,
                              int locusPixelX,
                              int locusPixelY)
Kind of weird. Sets the center point so that the given coordinate is at the given pixel.


getCenterX

public double getCenterX()
Gets the value of centerX

Returns:
the value of centerX

setCenterX

public void setCenterX(double argCenterX)
Sets the value of centerX

Parameters:
argCenterX - Value to assign to this.centerX

getCenterY

public double getCenterY()
Gets the value of centerY

Returns:
the value of centerY

setCenterY

public void setCenterY(double argCenterY)
Sets the value of centerY

Parameters:
argCenterY - Value to assign to this.centerY

getScale

public double getScale()
Gets the value of scale

Returns:
the value of scale

setScale

public void setScale(double argScale)
Sets the value of scale

Parameters:
argScale - Value to assign to this.scale

getRotation

public double getRotation()
Gets the value of rotation

Returns:
the value of rotation

setRotation

public void setRotation(double argRotation)
Sets the value of rotation

Parameters:
argRotation - Value to assign to this.rotation