org.gicentre.treemappa
Class PTreeMappa

java.lang.Object
  extended by org.gicentre.treemappa.PTreeMappa

public class PTreeMappa
extends java.lang.Object

Wrapper class to allow Processing sketches to load, create and draw treemaps.

Version:
3.0.1, 4th April, 2011.
Author:
Jo Wood, giCentre.

Constructor Summary
PTreeMappa(processing.core.PApplet parent)
          Creates an object capable of building and representing a treemap.
PTreeMappa(processing.core.PApplet parent, java.lang.String configFileName)
          Creates a treemap from the details supplied in the given configuration file.
 
Method Summary
 processing.core.PImage createImage()
          Draws and provides an image containing the current treemap.
 void draw()
          Draws the treemap directly in the parent sketch.
 TreeMappa getTreeMappa()
          Provides the TreeMappa object used to build and display treemaps.
 TreeMapPanel getTreeMapPanel()
          Provides a TreeMapPanel used to customise the appearance of the treemap.
 void readData(java.lang.String dataFileName)
          Reads in CSV tree data from the Processing sketch's data folder.
 void readData(java.lang.String dataFileName, java.lang.String fileFormat)
          Reads in tree data in the given format from the Processing sketch's data folder.
 void setColourTable(java.lang.String cTableFileName)
          Sets a new colour table from a colour table file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PTreeMappa

public PTreeMappa(processing.core.PApplet parent)
Creates an object capable of building and representing a treemap.

Parameters:
parent - Sketch in which this treemap will be used.

PTreeMappa

public PTreeMappa(processing.core.PApplet parent,
                  java.lang.String configFileName)
Creates a treemap from the details supplied in the given configuration file.

Parameters:
parent - Sketch in which this treemap will be used.
configFileName - Name of file containing the treemap configuration.
Method Detail

readData

public void readData(java.lang.String dataFileName)
Reads in CSV tree data from the Processing sketch's data folder. If you need to read data from other locations, use TreeMappa's file reading methods instead.

Parameters:
dataFileName - Name of CSV file in the data folder representing the tree data.

readData

public void readData(java.lang.String dataFileName,
                     java.lang.String fileFormat)
Reads in tree data in the given format from the Processing sketch's data folder. If you need to read data from other locations or need to control format options, use TreeMappa's file reading methods instead.

Parameters:
dataFileName - Name of file in the data folder representing the tree data.
fileFormat - Format of data file, can be 'csv', 'csvSpatial', 'csvCompact' or 'treeML;

createImage

public processing.core.PImage createImage()
Draws and provides an image containing the current treemap. Note that this will update the treemap with the current layout settings so should not be called repeatedly if no changes have been made since the previous call. Instead, call it once and store the resulting image as a PImage variable.

Returns:
Image representing the treemap.

draw

public void draw()
Draws the treemap directly in the parent sketch. This is an alternative to calling createImage() and will use the currently selected font and stroke from the parent sketch. Treemap nodes are filled according to the colour rules set for the treemap.


setColourTable

public void setColourTable(java.lang.String cTableFileName)
Sets a new colour table from a colour table file. Assumes the colour table file is stored in the data directory of the sketch.

Parameters:
cTableFileName - Name of file containing the colour table to use to represent treemap nodes.

getTreeMappa

public TreeMappa getTreeMappa()
Provides the TreeMappa object used to build and display treemaps. This object can be used to customise the features of the treemap that affect layout.

Returns:
TreeMappa object used to build and display treemaps.

getTreeMapPanel

public TreeMapPanel getTreeMapPanel()
Provides a TreeMapPanel used to customise the appearance of the treemap. This object can be used to customise the features of the treemap that affect appearance but not layout.

Returns:
Treemap panel used to display treemaps.


treeMappa V.3.0.1, API documentation generated 4th April, 2011