Cartesian (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.proj
Class Cartesian

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

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

    public class Cartesian

extends Proj
implements Projection, java.io.Serializable

The Cartesian projection is a non-wrapping, straight-forward scaling projection drawn in 2D. The simplest projection ever, it can be used for regular plotting.

See Also:
  Serialized Form

Field Summary
`protected double` | `bottomLimit` The coordinate limit of the bottom side of the projection.
`static java.lang.String` | `CartesianName` The Cartesian name.
`protected double` | `hHeight`
`protected double` | `hWidth`
`protected double` | `leftLimit` The coordinate limit of the left side of the projection.
`protected java.awt.geom.Point2D` | `limitAnchorPoint` A point that can be used for force the projection against the limits.
`protected double` | `rightLimit` The coordinate limit of the right side of the projection.
`protected double` | `scaleFactor`
`protected double` | `SFScale`
`protected double` | `topLimit` The coordinate limit of the top side of the projection.
`protected java.awt.geom.AffineTransform` | `transform1`
`protected java.awt.geom.AffineTransform` | `transform2`
`protected java.awt.geom.AffineTransform` | `transform4`

Fields inherited from class com.bbn.openmap.proj.Proj
`centerX, centerY, height, maxscale, MIN_HEIGHT, MIN_WIDTH, minscale, projID, rotationAngle, scale, ucuom, width`

Constructor Summary
`Cartesian(java.awt.geom.Point2D center, float scale, int width, int height)` Create a Cartesian projection that does straight scaling, no wrapping.

Method Summary
`protected void` | `checkLimits()` The method you want to call.
`protected void` | `checkLimits(boolean checkScale)` Should only be called if you've checked there are limits set on the projection.
`protected java.awt.geom.Point2D` | `checkLowerLimits()` Checks the lower limits and returns new center coordinates to keep the limits at the edge if necessary.
`protected double` | `checkScaleAgainstLimits()` Checks the corner values against the limits and returns the right scale to keep limits at the edge if necessary.
`protected java.awt.geom.Point2D` | `checkUpperLimits()` Checks the upper limits and returns new center coordinates to keep the limits at the edge if necessary.
`protected void` | `computeParameters()` Called when some fundamental parameters change.
`java.awt.geom.Point2D` | `forward(double wy, double wx, java.awt.geom.Point2D mapPoint)` Forward project a world coordinate into screen space.
`double` | `getBottomLimit()`
`java.awt.geom.Point2D` | `getCenter()` Get center point of projection.
`double` | `getLeftLimit()`
`java.awt.geom.Point2D` | `getLimitAnchorPoint()`
`java.lang.String` | `getName()` Get the name string of the projection.
`double` | `getRightLimit()`
`float` | `getScale(java.awt.geom.Point2D ulWorldPoint, java.awt.geom.Point2D lrWorldPoint, java.awt.geom.Point2D point1, java.awt.geom.Point2D point2)` Given a couple of points representing a bounding box, find out what the scale should be in order to make those points appear at the corners of the projection.
`double` | `getTopLimit()`
`void` | `init()` Called after the center and scale is set in setParams, but before the scale is checked for legitimacy.
`java.awt.geom.Point2D` | `inverse(double x, double y, java.awt.geom.Point2D worldPoint)` Inverse projection a map coordinate into world space.
`boolean` | `isPlotable(double lat, double lon)` Checks if a location is plot-able.
`void` | `pan(double Az)` Pan half a view.
`void` | `pan(double Az, double c)` Pan the map/projection.
`void` | `setBottomLimit(double bottomLimit)`
`void` | `setLeftLimit(double leftLimit)`
`void` | `setLimitAnchorPoint(java.awt.geom.Point2D limitAnchorPoint)`
`void` | `setLimits(double top, double bottom, double left, double right, java.awt.geom.Point2D anchor)`
`void` | `setRightLimit(double rightLimit)`
`void` | `setTopLimit(double topLimit)`

Methods inherited from class com.bbn.openmap.proj.Proj
`clone, drawBackground, drawBackground, equals, forward, forward, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getRotationAngle, getScale, getUcuom, getUpperLeft, getWidth, hashCode, inverse, inverse, inverse, inverseShape, isPlotable, makeClone, panE, panE, panN, panN, panNE, panNE, panNW, panNW, panS, panS, panSE, panSE, panSW, panSW, panW, panW, setCenter, setCenter, setHeight, setMaxScale, setMinScale, setParms, setProjectionID, setRotationAngle, setScale, setUcuom, setWidth, toString`

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

Methods inherited from interface com.bbn.openmap.proj.Projection
`forward, forward, forward, forward, forward, forwardLine, forwardPoly, forwardPoly, forwardRaw, forwardRaw, forwardRect, forwardShape, getCenter, getHeight, getLowerRight, getMaxScale, getMinScale, getProjectionID, getRotationAngle, getScale, getUcuom, getUpperLeft, getWidth, inverse, inverse, inverse, inverseShape, isPlotable, makeClone`

Field Detail

### CartesianName

    public static final transient java.lang.String CartesianName

  The Cartesian name.

  See Also:
    Constant Field Values

### leftLimit

    protected double leftLimit

  The coordinate limit of the left side of the projection. If the left side of the map projection would show coordinates more left than this value, the center of the map will be changed so that this value is on the edge.

### rightLimit

    protected double rightLimit

  The coordinate limit of the right side of the projection. If the right side of the map projection would show coordinates more right than this value, the center of the map will be changed so that this value is on the edge.

### topLimit

    protected double topLimit

  The coordinate limit of the top side of the projection. If the top side of the map projection would show coordinates higher than this value, the center of the map will be changed so that this value is on the edge.

### bottomLimit

    protected double bottomLimit

  The coordinate limit of the bottom side of the projection. If the bottom side of the map projection would show coordinates lower than this value, the center of the map will be changed so that this value is on the edge.

### limitAnchorPoint

    protected java.awt.geom.Point2D limitAnchorPoint

  A point that can be used for force the projection against the limits. Is only used if the limits are set to be something other than infinity.

### scaleFactor

    protected double scaleFactor

### hWidth

    protected transient double hWidth

### hHeight

    protected transient double hHeight

### SFScale

    protected transient double SFScale

### transform1

    protected transient java.awt.geom.AffineTransform transform1

### transform2

    protected transient java.awt.geom.AffineTransform transform2

### transform4

    protected transient java.awt.geom.AffineTransform transform4

Constructor Detail

### Cartesian

    public Cartesian(java.awt.geom.Point2D center,
                     float scale,
                     int width,
                     int height)

  Create a Cartesian projection that does straight scaling, no wrapping.

  Parameters:
    `center` - the coordinates of the center of the map.
    `scale` - the scale to use for the map, referring to the difference of the ration between pixels versus coordinate values.
    `width` - the pixel width of the map.
    `height` - the pixel height of the map.

Method Detail

### init

    public void init()

  Description copied from class: `Proj`
  Called after the center and scale is set in setParams, but before the scale is checked for legitimacy. This is an opportunity to set constants in subclasses before anything else gets called or checked for validity. This is different than computeParameters() which is called after some checks. This is a good time to pre-calculate constants and set maxscale and minscale.

  Make sure you call super.init() if you override this method.

  Overrides:
    `init` in class `Proj`

### 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" parameters used in the forward() and inverse() calls.

  Specified by:
    `computeParameters` in class `Proj`

### checkLimits

    protected void checkLimits()

  The method you want to call. Checks if there are limits set, and will call setLimits(checkScale) properly.

### checkLimits

    protected void checkLimits(boolean checkScale)

  Should only be called if you've checked there are limits set on the projection.

  Parameters:
    `checkScale` - true the first time through, if the scale changes this method calls itself with false to prevent a loop.

### checkLowerLimits

    protected java.awt.geom.Point2D checkLowerLimits()

  Checks the lower limits and returns new center coordinates to keep the limits at the edge if necessary.

### checkUpperLimits

    protected java.awt.geom.Point2D checkUpperLimits()

  Checks the upper limits and returns new center coordinates to keep the limits at the edge if necessary.

### checkScaleAgainstLimits

    protected double checkScaleAgainstLimits()

  Checks the corner values against the limits and returns the right scale to keep limits at the edge if necessary.

### forward

    public java.awt.geom.Point2D forward(double wy,
                                         double wx,
                                         java.awt.geom.Point2D mapPoint)

  Forward project a world coordinate into screen space.

  Specified by:
    `forward` in interface `Projection`
  Specified by:
    `forward` in class `Proj`
  Parameters:
    `wy` - vertical coordinate component in world units.
    `wx` - horizontal coordinate component in world units.
    `mapPoint` - screen point to load result into. OK if null, a new one will be created and returned.
  Returns:
    Point2D provided or new one created containing map coordinate.

### inverse

    public java.awt.geom.Point2D inverse(double x,
                                         double y,
                                         java.awt.geom.Point2D worldPoint)

  Inverse projection a map coordinate into world space.

  Specified by:
    `inverse` in interface `Projection`
  Specified by:
    `inverse` in class `Proj`
  Parameters:
    `x` - horizontal map coordinate from left side of map.
    `y` - vertical map coordinate from top of map.
    `worldPoint` - a Point2D object to load result into. OK if null, a new one will be created if necessary.
  Returns:
    Point2D provided or new one if created, containing the result.
  See Also:
    `Proj.inverse(Point2D)`

### pan

    public void pan(double Az,
                    double c)

  Description copied from class: `Proj`
  Pan the map/projection.

  Example pans:

  - `pan(180, c)` pan south `c' degrees
  - `pan(-90, c)` pan west `c' degrees
  - `pan(0, c)` pan north `c' degrees
  - `pan(90, c)` pan east `c' degrees

  Specified by:
    `pan` in interface `Projection`
  Specified by:
    `pan` in class `Proj`
  Parameters:
    `Az` - direction, 0 is north, positive is clockwise.
    `c` - number of world coordinates to pan.

### pan

    public void pan(double Az)

  Pan half a view.

  Specified by:
    `pan` in interface `Projection`
  Specified by:
    `pan` in class `Proj`
  Parameters:
    `Az` - azimuth "east of north" in decimal degrees: `-180 <= Az <= 180`

### getName

    public java.lang.String getName()

  Description copied from class: `Proj`
  Get the name string of the projection.

  Specified by:
    `getName` in interface `Projection`
  Overrides:
    `getName` in class `Proj`

### getScale

    public float getScale(java.awt.geom.Point2D ulWorldPoint,
                          java.awt.geom.Point2D lrWorldPoint,
                          java.awt.geom.Point2D point1,
                          java.awt.geom.Point2D point2)

  Description copied from class: `Proj`
  Given a couple of points representing a bounding box, find out what the scale should be in order to make those points appear at the corners of the projection.

  Specified by:
    `getScale` in interface `Projection`
  Specified by:
    `getScale` in class `Proj`
  Parameters:
    `ulWorldPoint` - the upper left coordinates of the bounding box.
    `lrWorldPoint` - the lower right coordinates of the bounding box.
    `point1` - a java.awt.geom.Point2D reflecting a pixel spot on the projection that matches the ll1 coordinate, the upper left corner of the area of interest. Note that this is the location where you want ll1 to go in the new projection scale, not where it is now.
    `point2` - a java.awt.geom.Point2D reflecting a pixel spot on the projection that matches the ll2 coordinate, usually the lower right corner of the area of interest. Note that this is the location where you want ll2 to go in the new projection, not where it is now.

### isPlotable

    public boolean isPlotable(double lat,
                              double lon)

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

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

  Specified by:
    `isPlotable` in interface `Projection`
  Overrides:
    `isPlotable` in class `Proj`
  Parameters:
    `lat` - vertical location component (units depend on the projection implementation).
    `lon` - horizontal location component (units depend on the projection implementation).
  Returns:
    boolean true of plotable.

### getCenter

    public java.awt.geom.Point2D getCenter()

  Description copied from class: `Proj`
  Get center point of projection.

  Specified by:
    `getCenter` in interface `Projection`
  Overrides:
    `getCenter` in class `Proj`
  Returns:
    Point2D center of projection, created just for you.

### getBottomLimit

    public double getBottomLimit()

### setBottomLimit

    public void setBottomLimit(double bottomLimit)

### getLeftLimit

    public double getLeftLimit()

### setLeftLimit

    public void setLeftLimit(double leftLimit)

### getLimitAnchorPoint

    public java.awt.geom.Point2D getLimitAnchorPoint()

### setLimitAnchorPoint

    public void setLimitAnchorPoint(java.awt.geom.Point2D limitAnchorPoint)

### getRightLimit

    public double getRightLimit()

### setRightLimit

    public void setRightLimit(double rightLimit)

### getTopLimit

    public double getTopLimit()

### setTopLimit

    public void setTopLimit(double topLimit)

### setLimits

    public void setLimits(double top,
                          double bottom,
                          double left,
                          double right,
                          java.awt.geom.Point2D anchor)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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