PamView
Class GeneralProjector

java.lang.Object
  extended by PamView.GeneralProjector
Direct Known Subclasses:
DirectDrawProjector, MapProjector, RadarProjector, SpectrogramProjector

public abstract class GeneralProjector
extends java.lang.Object

Author:
Doug Gillespie

GeneralProjector is an abstract class used to draw any type of information contained within a PamDataBlock on a display (e.g. Map, spectrogram, etc).

The display must set the parameter types and the units (these lists can be added to as necessary)

Drawing is all done via calls that the display makes to PanelOverlayDraw.DrawDataUnit(...)

The DataBlocks using the projector will need to check parameter types and units when parsed a projector to check that they can provide these parameters.

The owning display will need to create concrete instances of GeneralProjector which implement getCoord3d. It is also possible that they will need to create other functions which are called by the display to set scaling parameters, scale offsets or other information Required by the projector that may change with time. If a display requires many types of similar projectors (e.g. different map projections) then it will be necessary to create a special interface to manage these functions and to implement that interface in all concrete classes used by that display.

See Also:
Coordinate3d, PanelOverlayDraw

Nested Class Summary
(package private)  class GeneralProjector.MouseHoverAdapter
           
static class GeneralProjector.ParameterType
           
static class GeneralProjector.ParameterUnits
           
 
Field Summary
private  java.util.List<java.lang.Integer> dataUnitSide
           
private  java.util.List<Coordinate3d> hoverCoordinates
           
private  java.util.List<PamDataUnit> hoverDataUnits
           
private  PamDataUnit hoveredDataUnit
           
(package private)  boolean isHoverClearing
          Flag to check that the clear function is being called, if not, then it will not be possible to add hover data to the list.
private  int minHoverDistance
           
(package private)  GeneralProjector.MouseHoverAdapter mouseHoverAdapter
           
static int NPARAMETERS
           
private  GeneralProjector.ParameterType[] parmeterType
           
private  GeneralProjector.ParameterUnits[] parmeterUnits
           
(package private)  javax.swing.JComponent toolTipComponent
           
 
Constructor Summary
GeneralProjector()
           
 
Method Summary
 boolean addHoverData(Coordinate3d coordinate3d, PamDataUnit pamDataUnit)
           
 boolean addHoverData(Coordinate3d coordinate3d, PamDataUnit pamDataUnit, int iSide)
           
 void clearHoverList()
          Any display that is using click hovering should call this at the start of their paintComponent(Graphics g) function.
 int findClosestDataUnitIndex(Coordinate3d coordinate3d)
           
 int findClosestDataUnitIndex(Coordinate3d cTest, int minDistance)
           
abstract  Coordinate3d getCoord3d(double d1, double d2, double d3)
          Function ultimately used by a PamDataBlock to convert it's own data, in whatever form that is in into screen coordinates.
 PamDataUnit getHoveredDataUnit()
           
 GeneralProjector.MouseHoverAdapter getMouseHoverAdapter(javax.swing.JComponent component)
           
 GeneralProjector.ParameterType getParmeterType(int iDim)
          Returns the prameter type for a specific data type required by Coordinate3d
 GeneralProjector.ParameterUnits getParmeterUnits(int iDim)
          Returns the prameter unit for a specific data type required by Coordinate3d
 void setParmeterType(int iDim, GeneralProjector.ParameterType parmeterType)
          Sets the parameter type for a specific data type required by Coordinate3d
 void setParmeterUnits(int iDim, GeneralProjector.ParameterUnits parmeterUnits)
          Sets the parameter unit for a specific data type required by Coordinate3d
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NPARAMETERS

public static final int NPARAMETERS
See Also:
Constant Field Values

parmeterType

private GeneralProjector.ParameterType[] parmeterType

parmeterUnits

private GeneralProjector.ParameterUnits[] parmeterUnits

isHoverClearing

boolean isHoverClearing
Flag to check that the clear function is being called, if not, then it will not be possible to add hover data to the list.


minHoverDistance

private int minHoverDistance

hoverCoordinates

private java.util.List<Coordinate3d> hoverCoordinates

hoverDataUnits

private java.util.List<PamDataUnit> hoverDataUnits

dataUnitSide

private java.util.List<java.lang.Integer> dataUnitSide

hoveredDataUnit

private PamDataUnit hoveredDataUnit

mouseHoverAdapter

GeneralProjector.MouseHoverAdapter mouseHoverAdapter

toolTipComponent

javax.swing.JComponent toolTipComponent
Constructor Detail

GeneralProjector

public GeneralProjector()
Method Detail

getCoord3d

public abstract Coordinate3d getCoord3d(double d1,
                                        double d2,
                                        double d3)
Function ultimately used by a PamDataBlock to convert it's own data, in whatever form that is in into screen coordinates.

Parameters:
d1 - d2 and d3 are data representing whatever is appropriate for the concrete instance of the projector (e.g. Latitude, Longitude, depth, Time Frequency, etc)
Returns:
A 3 dimensional coordinate (realistically z is never currently used)

getParmeterType

public GeneralProjector.ParameterType getParmeterType(int iDim)
Returns the prameter type for a specific data type required by Coordinate3d

Parameters:
iDim - Dimension number (0 - 2)
Returns:
enum ParameterType

setParmeterType

public void setParmeterType(int iDim,
                            GeneralProjector.ParameterType parmeterType)
Sets the parameter type for a specific data type required by Coordinate3d

Parameters:
iDim - dimension number (0 - 2)
parmeterType - Parameter Type (see enum ParmaeterType)

getParmeterUnits

public GeneralProjector.ParameterUnits getParmeterUnits(int iDim)
Returns the prameter unit for a specific data type required by Coordinate3d

Parameters:
iDim - Dimension number (0 - 2)
Returns:
enum ParameterUnit

setParmeterUnits

public void setParmeterUnits(int iDim,
                             GeneralProjector.ParameterUnits parmeterUnits)
Sets the parameter unit for a specific data type required by Coordinate3d

Parameters:
iDim - Dimension number (0 - 2)
parmeterUnits - enum ParameterUnit

getMouseHoverAdapter

public GeneralProjector.MouseHoverAdapter getMouseHoverAdapter(javax.swing.JComponent component)

getHoveredDataUnit

public PamDataUnit getHoveredDataUnit()
Returns:
data unit currently being hovered, or null.

clearHoverList

public void clearHoverList()
Any display that is using click hovering should call this at the start of their paintComponent(Graphics g) function. The list will be repopulated as data are drawn in the PanelOverlayDraw implementations.

See Also:
PanelOverlayDraw

addHoverData

public boolean addHoverData(Coordinate3d coordinate3d,
                            PamDataUnit pamDataUnit)

addHoverData

public boolean addHoverData(Coordinate3d coordinate3d,
                            PamDataUnit pamDataUnit,
                            int iSide)

findClosestDataUnitIndex

public int findClosestDataUnitIndex(Coordinate3d coordinate3d)

findClosestDataUnitIndex

public int findClosestDataUnitIndex(Coordinate3d cTest,
                                    int minDistance)