org.knime.base.node.viz.plotter.basic
Class BasicDrawingElement

java.lang.Object
  extended by org.knime.base.node.viz.plotter.basic.BasicDrawingElement
Direct Known Subclasses:
Basic2DDrawingElement, BasicLine, BasicText

public abstract class BasicDrawingElement
extends Object

A drawing element consists of points which are already mapped to the drawing pane's dimension. The BasicDrawingElements can be added to the BasicPlotter with #addBasicDrawingElement(BasicDrawingElement). The BasicDrawingElements should be used if only the domain data of the shape is available, since they are automatically mapped to the drawing pane's dimension. There some ready-to-use implementations of the BasicDrawingElement: BasicLine, BasicEllipse, BasicRectangle, BasicText. Each of these implementations restore the original stroke and color of the graphics object. New implementations should keep this behavior.

Author:
Fabian Dill, University of Konstanz

Constructor Summary
BasicDrawingElement()
          Creates an empty shape with default color(black) and default stroke.
 
Method Summary
 void addDomainValue(DataCellPoint domainValue)
          Adds a domain value to the set of domain values that are mapped to the DrawingPane's dimension.
 void addPoint(Point p)
          Adds a (mapped) point of the path.
 Color getColor()
           
 List<DataCellPoint> getDomainValues()
           
 List<Point> getPoints()
           
 Stroke getStroke()
           
abstract  void paint(Graphics2D g2)
          The method which "knows" how to paint it.
 void setColor(Color color)
           
 void setDomainValues(DataCellPoint... points)
          Adds a list of domain values that should be in same order as referring mapped points.
 void setDomainValues(List<DataCellPoint> domainValues)
          Adds a list of domain values that should be in same order as referring mapped points.
 void setPoints(List<Point> points)
          Sets the mapped points.
 void setPoints(Point... points)
          Sets the mapped points.
 void setStroke(Stroke stroke)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDrawingElement

public BasicDrawingElement()
Creates an empty shape with default color(black) and default stroke.

Method Detail

addPoint

public void addPoint(Point p)
Adds a (mapped) point of the path. This method should be used by the BasicPlotter.updateSize() only.

Parameters:
p - one point of the path

addDomainValue

public void addDomainValue(DataCellPoint domainValue)
Adds a domain value to the set of domain values that are mapped to the DrawingPane's dimension.

Parameters:
domainValue - the domain value

setDomainValues

public void setDomainValues(List<DataCellPoint> domainValues)
Adds a list of domain values that should be in same order as referring mapped points.

Parameters:
domainValues - the domain values

setDomainValues

public void setDomainValues(DataCellPoint... points)
Adds a list of domain values that should be in same order as referring mapped points.

Parameters:
points - domain points

getDomainValues

public List<DataCellPoint> getDomainValues()
Returns:
the domain values

setPoints

public void setPoints(List<Point> points)
Sets the mapped points. Should be used by the BasicPlotter only.

Parameters:
points - the mapped points making up this drawing element

setPoints

public void setPoints(Point... points)
Sets the mapped points. Should be used by the BasicPlotter only.

Parameters:
points - mapped points

getPoints

public List<Point> getPoints()
Returns:
the mapped points making up this drawing element

getColor

public Color getColor()
Returns:
the color of this element

setColor

public void setColor(Color color)
Parameters:
color - the color of this element

setStroke

public void setStroke(Stroke stroke)
Parameters:
stroke - the stroke of this element

getStroke

public Stroke getStroke()
Returns:
the stroke of this element

paint

public abstract void paint(Graphics2D g2)
The method which "knows" how to paint it.

Parameters:
g2 - the graphics object


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.