jview
Class JFitsCanvas.PixelCoordinate

java.lang.Object
  extended by jview.AbstractFormattingTransform
      extended by jview.JFitsCanvas.PixelCoordinate
All Implemented Interfaces:
CoordinateTransforming, DeltaFormattedTransforming, DeltaTransforming, FormattedTransforming
Enclosing class:
JFitsCanvas

private class JFitsCanvas.PixelCoordinate
extends AbstractFormattingTransform

This class converts normalized coordinates into true CCD pixel values. It is used for the standard user transformation with the applied fits data offset and binning, as the Array transformation, where we want to get the x and y indices of the pixel arrays, it is used without binning and offset. Binning is treated in a way the, e.g. for a single pixel in the fits frame you get two pixel in user space for a binning factor of two.


Field Summary
private  double mult
          In user transform, this is one, in array transform zero.
private  double off
          In user transform this is zero, in array transform one.
 
Constructor Summary
private JFitsCanvas.PixelCoordinate()
          Pixel coordinate always formats the user space in integers.
private JFitsCanvas.PixelCoordinate(boolean ignorewindow)
          Pixel coordinate always formats the user space in integers.
 
Method Summary
 Format estimateX(double dx)
          From the step-size in user space, estimate a format.
 Format estimateY(double dy)
          From the step-size in user space, estimate a format.
private  DecimalFormat integerFormat(double pixmag)
           
 Point2D toNormalizedDistance(VectorG ul, VectorG dist)
          Converts a pixel distance to a normalized distance.
 Point2D toNormalizedSpace(VectorG user)
          Converts user coordinates to normalized space.
 VectorG toUserDistance(Rectangle2D norm)
          Converts a distance in normalized space to s distance in user space.
 VectorG toUserSpace(Point2D norm)
          Converts the normalized coordinates to user space.
 void useEstimatedFormats(Rectangle2D view, int sx, int sy)
          Does nothing, except if viewport is so small that we want to show non-integer pixel.
 
Methods inherited from class jview.AbstractFormattingTransform
deltaFormatUserSpaceX, deltaFormatUserSpaceY, formatUserCoordinates, formatUserSpaceX, formatUserSpaceY, getFormatUserX, getFormatUserY, setDeltaFormatUserX, setDeltaFormatUserY, setFormatUserX, setFormatUserY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mult

private double mult
In user transform, this is one, in array transform zero.


off

private double off
In user transform this is zero, in array transform one.

Constructor Detail

JFitsCanvas.PixelCoordinate

private JFitsCanvas.PixelCoordinate()
Pixel coordinate always formats the user space in integers.


JFitsCanvas.PixelCoordinate

private JFitsCanvas.PixelCoordinate(boolean ignorewindow)
Pixel coordinate always formats the user space in integers. If the argument is true, we calculate the offset directly to the HDU array.

Method Detail

toUserSpace

public VectorG toUserSpace(Point2D norm)
Converts the normalized coordinates to user space. Care must be taken in flipped images: Normalized is always the upper left corner of the pixel the mouse cursor is in.

Parameters:
norm - A pixel in normalized coordinates.
Returns:
A vector in user space, never null

toNormalizedSpace

public Point2D toNormalizedSpace(VectorG user)
Converts user coordinates to normalized space.

Parameters:
user - A vector of user coordinates.
Returns:
A point in normalized screen coordinate, with 0≤x,y≤1

toUserDistance

public VectorG toUserDistance(Rectangle2D norm)
Converts a distance in normalized space to s distance in user space.


toNormalizedDistance

public Point2D toNormalizedDistance(VectorG ul,
                                    VectorG dist)
Converts a pixel distance to a normalized distance.


useEstimatedFormats

public void useEstimatedFormats(Rectangle2D view,
                                int sx,
                                int sy)
Does nothing, except if viewport is so small that we want to show non-integer pixel.

Specified by:
useEstimatedFormats in interface FormattedTransforming
Overrides:
useEstimatedFormats in class AbstractFormattingTransform

estimateX

public Format estimateX(double dx)
Description copied from interface: FormattedTransforming
From the step-size in user space, estimate a format.


estimateY

public Format estimateY(double dy)
Description copied from interface: FormattedTransforming
From the step-size in user space, estimate a format.


integerFormat

private DecimalFormat integerFormat(double pixmag)