org.rosuda.ibase.toolkit
Interface PlotPrimitive

All Known Implementing Classes:
Outlier, PPrimBase, PPrimBox, PPrimCircle, PPrimHam, PPrimMosaic, PPrimPolygon, PPrimRectangle

public interface PlotPrimitive

PlotPrimitive provides a generic interfrace to objects on the screen and their linkage to cases. A subclass of BaseCanvas is free to use its own implementation (for example optimized for speed). Default methods of BaseCanvas use an array of PlotPrimitives to display graphical objects and map them into cases of the underlying dataset. The mapping can be 1:1 (see scatterplot), 1:n (see histograms), m:1 (see maps) or m:n (see faceplots). Please note that PlotPrimitives are geometric objects, that is their position is specified in geometry coorditates (for speed).

Since 10/2003 PlotPrimitive is just an interface. Basic linking capabilities are implemented by the PPrimBase class, real graphical representations are provided by its subclasses PPrimRectangle and PPrimPolygon.

Version:
$Id: PlotPrimitive.java 2540 2006-06-17 09:45:53Z wichtreyt $

Method Summary
 int cases()
          returns the number of cases this primitive represents
 boolean contains(int x, int y)
          checks whether the PlotPrimitive contains (or in case of a point primitive equals to) the given point.
 int[] getCaseIDs()
          returns the IDs of all cases represented by this primitive.
 java.awt.Color getColor()
          returns the main color of the primitive (this is usually the fill color for primitives that have both fill and draw colors
 double getMarkedProportion(SMarker m, int mark)
          calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive.
 int getPrimaryCase()
          returns the case ID for 1:1 (or m:1) relationships
 boolean hilitcontains(int x, int y)
           
 boolean intersects(java.awt.Rectangle rt)
          checks whether the PlotPrimitive intersects (or is contained) in the given rectangle.
 boolean isPerformingAlphaBlending()
           
 boolean isQueryable()
          returns whether this primitive should respond to queries.
 boolean isVisible()
          returns whether this primitive is visible
 void paint(PoGraSS g, int orientation, SMarker m)
          paint the primitive (w/o selection)
 void paintSelected(PoGraSS g, int orientation, SMarker m)
          paint the selection
 boolean representsCase(int cid)
          checks whether the specified case is represented by this primitive.
 void setMark(SMarker m, boolean setTo)
          sets mark for cases represented by this PlotPrimitive in following fashion: if the case is already marked then its mark is set to setTo, otherwise the mark is set to 1.
 void setVisible(boolean b)
          sets visibility of this primitive
 

Method Detail

contains

boolean contains(int x,
                 int y)
checks whether the PlotPrimitive contains (or in case of a point primitive equals to) the given point.


hilitcontains

boolean hilitcontains(int x,
                      int y)

intersects

boolean intersects(java.awt.Rectangle rt)
checks whether the PlotPrimitive intersects (or is contained) in the given rectangle.


getColor

java.awt.Color getColor()
returns the main color of the primitive (this is usually the fill color for primitives that have both fill and draw colors


paint

void paint(PoGraSS g,
           int orientation,
           SMarker m)
paint the primitive (w/o selection)


paintSelected

void paintSelected(PoGraSS g,
                   int orientation,
                   SMarker m)
paint the selection


setMark

void setMark(SMarker m,
             boolean setTo)
sets mark for cases represented by this PlotPrimitive in following fashion: if the case is already marked then its mark is set to setTo, otherwise the mark is set to 1.


getMarkedProportion

double getMarkedProportion(SMarker m,
                           int mark)
calculates the proportion of cases with the given mark in relation to total population of cases represented by this PlotPrimitive. The value ranges between 0.0 (no cases with such mark or cases=0) to 1.0 (all cases with that mark)


getCaseIDs

int[] getCaseIDs()
returns the IDs of all cases represented by this primitive. null is valid and means that this primitive represents no data

Returns:
list of case IDs

getPrimaryCase

int getPrimaryCase()
returns the case ID for 1:1 (or m:1) relationships

Returns:
if exactly one case is associated with this primitive, then its case ID is returned. Otherwise -1 is returned.

representsCase

boolean representsCase(int cid)
checks whether the specified case is represented by this primitive.

Parameters:
cid - case ID to check for
Returns:
true if the case is represented by this primitive

cases

int cases()
returns the number of cases this primitive represents

Returns:
number of cases this primitive represents

isQueryable

boolean isQueryable()
returns whether this primitive should respond to queries.


setVisible

void setVisible(boolean b)
sets visibility of this primitive


isVisible

boolean isVisible()
returns whether this primitive is visible


isPerformingAlphaBlending

boolean isPerformingAlphaBlending()