org.knime.base.node.viz.plotter.scatter
Class DotInfo

java.lang.Object
  extended by org.knime.base.node.viz.plotter.scatter.DotInfo

public class DotInfo
extends Object

This is a helper class for the ScatterPlotView. It keeps info (like the screen coordinates and color) for each data point that is plotted.

Author:
Christoph Sieb, University of Konstanz, Peter Ohl, University of Konstanz

Constructor Summary
DotInfo(int x, int y, RowKey rowKey, boolean hilit, ColorAttr colorAttr, double size, int rowIndex)
          Creates a new object storing the characteristics of one dot.
 
Method Summary
 float distance(DotInfo dot)
          Computes the euclidian distance between given dot and itself.
 float distanceSq(DotInfo dot)
          Computes the squared euclidian distance between given dot and itself.
 ColorAttr getColor()
           
 RowKey getRowID()
           
 int getRowIndex()
           
 ShapeFactory.Shape getShape()
           
 double getSize()
           
 int getXCoord()
           
 DataCell getXDomainValue()
           
 int getYCoord()
           
 DataCell getYDomainValue()
           
 boolean isHiLit()
           
 boolean paintDot()
           
 void setHiLit(boolean h)
           
 void setShape(ShapeFactory.Shape shape)
           
 void setXCoord(int x)
           
 void setXDomainValue(DataCell xDomainValue)
           
 void setYCoord(int y)
           
 void setYDomainValue(DataCell yDomainValue)
           
 String toString()
          Returns a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DotInfo

public DotInfo(int x,
               int y,
               RowKey rowKey,
               boolean hilit,
               ColorAttr colorAttr,
               double size,
               int rowIndex)
Creates a new object storing the characteristics of one dot.

Parameters:
x - the x coordinates of the point
y - the y coordinates of the point
rowKey - of the row represented by this dotInfo, containing rowID and color attributes
hilit - true if this dot is hilited
colorAttr - the color of this dot
size - the relative size of this dot
rowIndex - the indes of the row this dot was created from important to map back to the rows in the data container
Method Detail

getRowID

public RowKey getRowID()
Returns:
the DataCell containing the row key of the row this data point is extracted from.

getXCoord

public int getXCoord()
Returns:
the X Coordinate in the drawing pane. If negative dot shouldn't be painted.

setXCoord

public void setXCoord(int x)
Parameters:
x - the new screen X coordinate for this point. If negative the paintDot() method will return false.

getYCoord

public int getYCoord()
Returns:
the Y Coordinate in the drawing pane. If negative dot shouldn't be painted.

setYCoord

public void setYCoord(int y)
Parameters:
y - the new screen Y coordinate for this point. If negative the paintDot() method will return false.

paintDot

public boolean paintDot()
Returns:
false if the dot shouldn't be painted. Negative screen coordinates are used as flag for this.

getColor

public ColorAttr getColor()
Returns:
the Color this dot is supposed to be drawn with

isHiLit

public boolean isHiLit()
Returns:
the status if the highlighting of this dot true if hilited, false if not.

setHiLit

public void setHiLit(boolean h)
Parameters:
h - true if the dot should be hilited, false if not.

setShape

public void setShape(ShapeFactory.Shape shape)
Parameters:
shape - the shape for this dot.

getShape

public ShapeFactory.Shape getShape()
Returns:
a new instance of the associated shape of this dot.

setXDomainValue

public void setXDomainValue(DataCell xDomainValue)
Parameters:
xDomainValue - the original x value.

getXDomainValue

public DataCell getXDomainValue()
Returns:
the original x value.

setYDomainValue

public void setYDomainValue(DataCell yDomainValue)
Parameters:
yDomainValue - the original y value.

getYDomainValue

public DataCell getYDomainValue()
Returns:
the original y value.

toString

public String toString()
Returns a string. Containing an open brace the RowKey in single quotes, a '@' sign, the x and y coordinates, comma separated together in parantheses, and either "Col:" (if not hilighted) or "HLT:" (if hilited) followed by rXXXgXXXbXXX, with xxx being the value of the corresponding color component (r=red, g=green, and b=blue). The whole thing will be terminated by a closing brace.

Overrides:
toString in class Object
See Also:
Object.toString()

distance

public float distance(DotInfo dot)
Computes the euclidian distance between given dot and itself.

Parameters:
dot - Given dot to compute distance with.
Returns:
The euclidian distance between given dot and itself.

distanceSq

public float distanceSq(DotInfo dot)
Computes the squared euclidian distance between given dot and itself.

Parameters:
dot - Given dot to compute distance with
Returns:
The squared euclidian distance between given dot and itself

getSize

public double getSize()
Returns:
returns the size of a dot

getRowIndex

public int getRowIndex()
Returns:
the index of the corresponding data row


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.