## com.bbn.openmap.proj
Class AspectRatioProjection

    java.lang.Object
      com.bbn.openmap.proj.Proj
          com.bbn.openmap.proj.AspectRatioProjection

All Implemented Interfaces:
  java.lang.Cloneable, Projection, java.io.Serializable

public class AspectRatioProjection
extends Proj

A Projection that wraps another projection, but stretch the image to another aspect ratio.

The motivation for this projection is to support the following clause in wms 1.1.1.

OGC 01-068r3 (wms 1.1.1) 7.2.3.8. "In the case where the aspect ratio of the BBOX and the ratio width/height are different, the WMS shall stretch the returned map so that the resulting pixels could themselves be rendered in the aspect ratio of the BBOX"

Author:
  halset
See Also:
  Serialized Form

Field Summary

Fields inherited from class com.bbn.openmap.proj.Proj
`ctrLat, ctrLon, DATELINE, height, maxscale, mercator, MIN_HEIGHT, MIN_WIDTH, minscale, NORTH_POLE, NUM_DEFAULT_CIRCLE_VERTS, NUM_DEFAULT_GREAT_SEGS, pixelsPerMeter, planetPixelCircumference, planetPixelRadius, planetRadius, projID, scale, scaled_radius, SOUTH_POLE, type, width, XSCALE_THRESHOLD, XTHRESHOLD`

Constructor Summary
`AspectRatioProjection(Proj proj, int w, int h)` Constructor that takes a projection and the new width/height.

Method Summary
`protected java.util.ArrayList` `_forwardPoly(float[] rawllpts, int ltype, int nsegs, boolean isFilled)` Forward project a lat/lon Poly.
`protected void` `computeParameters()` Called when some fundamental parameters change.
`void` `drawBackground(java.awt.Graphics g)` Assume that the Graphics has been set with the Paint/Color needed, just render the shape of the background.
`void` `drawBackground(java.awt.Graphics2D g, java.awt.Paint p)` Draw the background for the projection.
`java.awt.Point` `forward(float lat, float lon, java.awt.Point pt)` Forward projects lat,lon coordinates into XY space and returns a Point.
`java.awt.Point` `forward(float lat, float lon, java.awt.Point pt, boolean isRadian)` Forward projects lat,lon coordinates into XY space and returns a Point.
`java.awt.Point` `forward(LatLonPoint llp, java.awt.Point pt)` Forward projects a LatLonPoint into XY space and return a Point.
`boolean` `forwardRaw(float[] rawllpts, int rawoff, int[] xcoords, int[] ycoords, boolean[] visible, int copyoff, int copylen)` Forward project a raw array of radian points.
`LatLonPoint` `getLowerRight()` Get the lower right (southeast) point of the projection.
`LatLonPoint` `getUpperLeft()` Get the upper left (northwest) point of the projection.
`LatLonPoint` `inverse(int x, int y, LatLonPoint llpt)` Inverse project x,y coordinates into a LatLonPoint.
`LatLonPoint` `inverse(java.awt.Point point, LatLonPoint llpt)` Inverse project a point with llpt.
`boolean` `isPlotable(float lat, float lon)` Checks if a LatLonPoint is plot-able.
`float` `normalize_latitude(float lat)` Sets radian latitude to something sane.

Methods inherited from class com.bbn.openmap.proj.Proj

`clone, doPolyDispatch, equals, forward, forward, forwardArc, forwardArc, forwardArc, forwardCircle, forwardCircle, forwardCircle, forwardGreatPoly, forwardLine, forwardLine, forwardPoly, forwardPoly, forwardRaster, forwardRect, forwardRect, forwardRect, forwardRhumbPoly, getCenter, getHeight, getMaxScale, getMinScale, getName, getPlanetPixelCircumference, getPlanetPixelRadius, getPlanetRadius, getPPM, getProjectionID, getProjectionType, getScale, getScale, getWidth, hashCode, init, inverse, inverse, isComplicatedLineType, isPlotable, makeClone, pan, pan, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setCenter, setHeight, setMaxScale, setMinScale, setParms, setPlanetRadius, setPPM, setProjectionID, setScale, setWidth, toString, wrap_longitude`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AspectRatioProjection

    public AspectRatioProjection(Proj proj,
                                 int w,
                                 int h)

  Constructor that takes a projection and the new width/height.

Parameters:
  `proj` - a projection to wrap
  `w` - a int with the new width
  `h` - a int with the new height

Method Detail

### _forwardPoly

    protected java.util.ArrayList _forwardPoly(float[] rawllpts,
                                               int ltype,
                                               int nsegs,
                                               boolean isFilled)

  Description copied from class: `Proj`
  Forward project a lat/lon Poly. Remember to specify vertices in radians!

  Specified by:
    `_forwardPoly` in class `Proj`
  Parameters:
    `rawllpts` - float[] of lat,lon,lat,lon,... in RADIANS!
    `ltype` - line type (straight, rhumbline, greatcircle)
    `nsegs` - number of segment points (only for greatcircle or rhumbline line types, and if < 1, this value is generated internally)
    `isFilled` - filled poly?
  Returns:
    ArrayList of x[], y[], x[], y[], ... projected poly

### computeParameters

    protected void computeParameters()

  Description copied from class: `Proj`
  Called when some fundamental parameters change.

  Each projection will decide how to respond to this change. For instance, they may need to recalculate "constant" paramters used in the forward() and inverse() calls.

  Specified by:
    `computeParameters` in class `Proj`

### drawBackground

    public void drawBackground(java.awt.Graphics2D g,
                               java.awt.Paint p)

  Description copied from class: `Proj`
  Draw the background for the projection.

  Specified by:
    `drawBackground` in class `Proj`
  Parameters:
    `g` - Graphics2D
    `p` - Paint to use for the background

### drawBackground

    public void drawBackground(java.awt.Graphics g)

  Description copied from class: `Proj`
  Assume that the Graphics has been set with the Paint/Color needed, just render the shape of the background.

  Specified by:
    `drawBackground` in class `Proj`

### normalize_latitude

    public float normalize_latitude(float lat)

  Description copied from class: `Proj`
  Sets radian latitude to something sane.

  Normalizes the latitude according to the particular projection.

  Specified by:
    `normalize_latitude` in class `Proj`
  Parameters:
    `lat` - float latitude in radians
  Returns:
    float latitude (-PI/2 <= y <= PI/2)
  See Also:
    `ProjMath.normalize_latitude(float, float)`, `LatLonPoint.normalize_latitude(float)`

### forward

    public java.awt.Point forward(LatLonPoint llp,
                                  java.awt.Point pt)

  Description copied from interface: `Projection`
  Forward projects a LatLonPoint into XY space and return a Point.

  Parameters:
    `llp` - LatLonPoint to be projected
    `pt` - Resulting XY Point
  Returns:
    Point pt

### forward

    public java.awt.Point forward(float lat,
                                  float lon,
                                  java.awt.Point pt)

  Description copied from interface: `Projection`
  Forward projects lat,lon coordinates into XY space and returns a Point.

  Parameters:
    `lat` - float latitude in decimal degrees
    `lon` - float longitude in decimal degrees
    `pt` - Resulting XY Point
  Returns:
    Point pt

### forward

    public java.awt.Point forward(float lat,
                                  float lon,
                                  java.awt.Point pt,
                                  boolean isRadian)

  Description copied from interface: `Projection`
  Forward projects lat,lon coordinates into XY space and returns a Point.

  Parameters:
    `lat` - float latitude in radians
    `lon` - float longitude in radians
    `pt` - Resulting XY Point
    `isRadian` - placeholder argument indicating that lat,lon arguments are in radians (can be true or false)
  Returns:
    Point pt
  See Also:
    `Projection.forward(float,float,Point)`

### forwardRaw

    public boolean forwardRaw(float[] rawllpts,
                              int rawoff,
                              int[] xcoords,
                              int[] ycoords,
                              boolean[] visible,
                              int copyoff,
                              int copylen)

  Description copied from interface: `Projection`
  Forward project a raw array of radian points. This assumes nothing about the array of coordinates. In no way does it assume the points are connected or that the composite figure is to be filled.

  It does populate a visible array indicating whether the points are visible on the projected view of the world.

  Parameters:
    `rawllpts` - array of lat,lon,... in RADIANS!
    `rawoff` - offset into rawllpts
    `xcoords` - x coordinates
    `ycoords` - y coordinates
    `visible` - coordinates visible?
    `copyoff` - offset into x,y,visible arrays
    `copylen` - number of coordinates (coordinate arrays should be at least this long, rawllpts should be at least twice as long).
  Returns:
    boolean true if all points visible, false if some points not visible.

### getLowerRight

    public LatLonPoint getLowerRight()

  Description copied from interface: `Projection`
  Get the lower right (southeast) point of the projection.

  Returns the lower right point (or closest equivalent) of the projection based on the center point and height and width of screen.

  This is trivial for most cylindrical projections, but much more complicated for azimuthal projections.

  Returns:
    LatLonPoint

### getUpperLeft

    public LatLonPoint getUpperLeft()

  Description copied from interface: `Projection`
  Get the upper left (northwest) point of the projection.

  Returns the upper left point (or closest equivalent) of the projection based on the center point and height and width of screen.

  This is trivial for most cylindrical projections, but much more complicated for azimuthal projections.

  Returns:
    LatLonPoint

### inverse

    public LatLonPoint inverse(java.awt.Point point,
                               LatLonPoint llpt)

  Description copied from interface: `Projection`
  Inverse project a point with llpt.

  Parameters:
    `point` - x,y Point
    `llpt` - resulting LatLonPoint
  Returns:
    LatLonPoint llpt

### inverse

    public LatLonPoint inverse(int x,
                               int y,
                               LatLonPoint llpt)

  Description copied from interface: `Projection`
  Inverse project x,y coordinates into a LatLonPoint.

  Parameters:
    `x` - integer x coordinate
    `y` - integer y coordinate
    `llpt` - LatLonPoint
  Returns:
    LatLonPoint llpt
  See Also:
    `Proj.inverse(Point)`

### isPlotable

    public boolean isPlotable(float lat,
                              float lon)

  Description copied from interface: `Projection`
  Checks if a LatLonPoint is plot-able.

  Call this to check and see if a LatLonPoint can be plotted. This is meant to be used for checking before projecting and rendering Point objects (bitmaps or text objects tacked at a LatLonPoint for instance).

  Parameters:
    `lat` - float latitude in decimal degrees
    `lon` - float longitude in decimal degrees
  Returns:
    boolean

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details