org.opensourcephysics.cabrillo.tracker
Class TMat

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.TMat
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Drawable, Measurable, Trackable

public class TMat
extends java.lang.Object
implements Measurable, Trackable, java.beans.PropertyChangeListener

This is a trackable rectangular background mat that draws itself on a tracker panel behind the video.

Author:
Douglas Brown

Field Summary
protected  java.awt.Rectangle drawingBounds
           
protected  boolean isValidMeasure
           
protected  java.awt.Rectangle mat
           
 
Constructor Summary
TMat(TrackerPanel panel)
          Creates a mat for the specified tracker panel
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the image mat on the panel.
 java.awt.Paint getPaint()
          Gets the paint.
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getXOffset()
          Gets the x offset of this mat relative to the image origin
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getYOffset()
          Gets the y offset of this mat relative to the image origin
 boolean isMeasured()
          Reports whether information is available to set min/max values.
 boolean isVisible()
          Gets the visibility of this mat.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
 void refresh()
          Refreshes this mat.
 void setPaint(java.awt.Paint paint)
          Sets the paint.
 void setVisible(boolean visible)
          Shows or hides this mat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mat

protected java.awt.Rectangle mat

isValidMeasure

protected boolean isValidMeasure

drawingBounds

protected java.awt.Rectangle drawingBounds
Constructor Detail

TMat

public TMat(TrackerPanel panel)
Creates a mat for the specified tracker panel

Parameters:
panel - the tracker panel
Method Detail

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the image mat on the panel.

Specified by:
draw in interface Drawable
Parameters:
panel - the drawing panel requesting the drawing
g - the graphics context on which to draw

getPaint

public java.awt.Paint getPaint()
Gets the paint.

Returns:
the paint used to draw the mat

setPaint

public void setPaint(java.awt.Paint paint)
Sets the paint.

Parameters:
paint - the desired paint

setVisible

public void setVisible(boolean visible)
Shows or hides this mat.

Parameters:
visible - true to show this mat.

isVisible

public boolean isVisible()
Gets the visibility of this mat.

Returns:
true if this mat is visible

getXMin

public double getXMin()
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
minimum x

getXMax

public double getXMax()
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
maximum x

getYMin

public double getYMin()
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
minimum y

getYMax

public double getYMax()
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Returns:
maximum y

isMeasured

public boolean isMeasured()
Reports whether information is available to set min/max values.

Specified by:
isMeasured in interface Measurable
Returns:
true if min/max values are valid

refresh

public void refresh()
Refreshes this mat.


getXOffset

public double getXOffset()
Gets the x offset of this mat relative to the image origin

Returns:
x offset

getYOffset

public double getYOffset()
Gets the y offset of this mat relative to the image origin

Returns:
y offset

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. TMat listens for the following events: "transform" from the tracker panel's image coordinate system and "coords" from the tracker panel

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
e - the property change event