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
 XyBounds bounds
          This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.
 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
          This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.
 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 radians.
 double scale
          Scale of the map view, in map coordinates per pixel.
 double tilt
          Tilt of the map view, in radians.
 java.awt.geom.AffineTransform transform
          This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.
 
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)
           
 boolean contains(XyPoint point)
           
 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.
 XyBounds getBounds()
           
 XyPoint getCenter()
          Gets the center as an XyPoint.
 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 getTilt()
           
 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)
           
 Point pointToPixel(XyPoint point)
           
 void resetTransform()
          Resets the transient, derived properties such as the transform, inverse transform, and bounds.
 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 setPixelHeight(int newHeight)
           
 void setPixelWidth(int newWidth)
           
 void setRotation(double argRotation)
          Sets the value of rotation
 void setScale(double argScale)
          Sets the value of scale
 void setTilt(double newTilt)
           
 XyRectangle toRectangle()
          Converts the frame's geographic coordinates into an XyRectangle.
 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 radians. Rotation is of the contents, not the rectangular frame.


tilt

public double tilt
Tilt of the map view, in radians. Rotation is of the contents, not the rectangular frame. Zero is no tilt.


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
This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.


inverseTransform

public transient java.awt.geom.AffineTransform inverseTransform
This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.


bounds

public transient XyBounds bounds
This is reset during resetTransform(); if you don't call it after changing parameters it is invalid.

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)

pixelsToPoints

public void pixelsToPoints(DoubleBuffer coords)

pointToPixel

public Point pointToPixel(XyPoint point)

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)

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()
Resets the transient, derived properties such as the transform, inverse transform, and bounds.


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()

setPixelWidth

public void setPixelWidth(int newWidth)

getPixelHeight

public int getPixelHeight()

setPixelHeight

public void setPixelHeight(int newHeight)

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.


getCenter

public XyPoint getCenter()
Gets the center as an XyPoint.


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

toRectangle

public XyRectangle toRectangle()
Converts the frame's geographic coordinates into an XyRectangle.

Returns:
rectangle

contains

public boolean contains(XyPoint point)

getBounds

public XyBounds getBounds()

getTilt

public double getTilt()

setTilt

public void setTilt(double newTilt)