ucar.unidata.idv.control.chart
Class TrackSegment

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.collab.PropertiedThing
          extended by ucar.unidata.idv.control.chart.ChartAnnotation
              extended by ucar.unidata.idv.control.chart.TrackSegment
All Implemented Interfaces:
PropertyChangeListener, EventListener, org.jfree.chart.annotations.XYAnnotation, Sharable

public class TrackSegment
extends ChartAnnotation

Provides a time series chart

Version:
$Revision: 1.12 $
Author:
IDV Development Team

Field Summary
 
Fields inherited from class ucar.unidata.idv.control.chart.ChartAnnotation
COLOR_SELECTED, transform, x, y
 
Fields inherited from class ucar.unidata.collab.PropertiedThing
propertiesDialog
 
Constructor Summary
TrackSegment()
          Default ctor
TrackSegment(WayPoint wayPoint1, WayPoint wayPoint2, PlotWrapper plotWrapper)
          Ctor
 
Method Summary
 double distance(int x, int y)
          Distance to the x/y.
 void draw(Graphics2D g2, org.jfree.chart.plot.XYPlot plot, Rectangle2D dataArea, org.jfree.chart.axis.ValueAxis domainAxis, org.jfree.chart.axis.ValueAxis rangeAxis, int rendererIndex, org.jfree.chart.plot.PlotRenderingInfo info)
          Draws the wayPoint.
 double getCenterValue()
          Get the domain value at the center of the segment
 WayPoint getLeft()
          Get the left most waypoint.
 WayPoint getRight()
          Get the right most waypoint.
 String getToolTipText()
          Get the tool tip text
 String getTypeName()
          Type of annotation
 WayPoint getWayPoint1()
          Get the WayPoint1 property.
 WayPoint getWayPoint2()
          Get the WayPoint2 property.
 void setPosition(int x, int y)
          Set the position to the given x/y screen coordinate
 void setWayPoint1(WayPoint value)
          Set the WayPoint1 property.
 void setWayPoint2(WayPoint value)
          Set the WayPoint2 property.
 
Methods inherited from class ucar.unidata.idv.control.chart.ChartAnnotation
addPropertyChangeListener, applyProperties, distance, doRemove, formatValue, getColor, getName, getPlotWrapper, getPropertiesComponents, getSelected, getX, getY, isActive, removePropertyChangeListener, setActive, setColor, setGraphicsState, setName, setPlotWrapper, setPosition, setSelected, showColorInProperties, toString
 
Methods inherited from class ucar.unidata.collab.PropertiedThing
doApplyProperties, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, propertyChange, showProperties, showProperties
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrackSegment

public TrackSegment()
Default ctor


TrackSegment

public TrackSegment(WayPoint wayPoint1,
                    WayPoint wayPoint2,
                    PlotWrapper plotWrapper)
Ctor

Parameters:
wayPoint1 - wayPoint1
wayPoint2 - wayPoint1
plotWrapper - The chart I'm in
Method Detail

getToolTipText

public String getToolTipText()
Get the tool tip text

Overrides:
getToolTipText in class ChartAnnotation
Returns:
Tool tip text

getTypeName

public String getTypeName()
Type of annotation

Specified by:
getTypeName in class ChartAnnotation
Returns:
Type of annotation

setPosition

public void setPosition(int x,
                        int y)
Set the position to the given x/y screen coordinate

Overrides:
setPosition in class ChartAnnotation
Parameters:
x - x
y - y

getCenterValue

public double getCenterValue()
Get the domain value at the center of the segment

Returns:
center value

draw

public void draw(Graphics2D g2,
                 org.jfree.chart.plot.XYPlot plot,
                 Rectangle2D dataArea,
                 org.jfree.chart.axis.ValueAxis domainAxis,
                 org.jfree.chart.axis.ValueAxis rangeAxis,
                 int rendererIndex,
                 org.jfree.chart.plot.PlotRenderingInfo info)
Draws the wayPoint.

Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.
domainAxis - the domain axis.
rangeAxis - the range axis.
rendererIndex - the renderer index.
info - an optional info object that will be populated with entity information.

getLeft

public WayPoint getLeft()
Get the left most waypoint. The one with the smallest domain value

Returns:
Waypoint on left

getRight

public WayPoint getRight()
Get the right most waypoint. the one with the largest domain value

Returns:
Waypoint on right

setWayPoint1

public void setWayPoint1(WayPoint value)
Set the WayPoint1 property.

Parameters:
value - The new value for WayPoint1

getWayPoint1

public WayPoint getWayPoint1()
Get the WayPoint1 property.

Returns:
The WayPoint1

setWayPoint2

public void setWayPoint2(WayPoint value)
Set the WayPoint2 property.

Parameters:
value - The new value for WayPoint2

getWayPoint2

public WayPoint getWayPoint2()
Get the WayPoint2 property.

Returns:
The WayPoint2

distance

public double distance(int x,
                       int y)
Distance to the x/y. If the mouse is left of the left waypoint then use the distance to the left point. Same with the right waypoint. If is is between the end points then use the y distance.

Overrides:
distance in class ChartAnnotation
Parameters:
x - mouse x
y - mouse y
Returns:
distance