public class PTreeMappa
extends java.lang.Object
Constructor and Description |
---|
PTreeMappa(processing.core.PApplet parent)
Creates an object capable of building and representing a treemap.
|
PTreeMappa(processing.core.PApplet parent,
int w,
int h)
Creates an object capable of building and representing a treemap with the given default image dimensions.
|
PTreeMappa(processing.core.PApplet parent,
java.lang.String configFileName)
Creates a treemap from the details supplied in the given configuration file.
|
PTreeMappa(processing.core.PApplet parent,
java.lang.String configFileName,
int w,
int h)
Creates a treemap of the given display dimensions from the details supplied in the given configuration file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
buildTreeMap()
Builds the treemap from the hierarchical data stored in this object.
|
processing.core.PImage |
createImage()
Draws and provides an image containing the current treemap.
|
void |
draw()
Draws the treemap directly in the parent sketch.
|
void |
draw(float x,
float y,
float w,
float h)
Draws the treemap directly in the parent sketch at the given position and size.
|
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 |
setBranchTextAlignment(int alignX,
int alignY)
Sets the text alignment for branch labels.
|
void |
setColourTable(java.lang.String cTableFileName)
Sets a new colour table from a colour table file.
|
void |
setLeafTextAlignment(int alignX,
int alignY)
Sets the text alignment for leaf labels.
|
void |
setRenderer(Drawable renderer)
Sets the renderer to be used for drawing treemaps.
|
public PTreeMappa(processing.core.PApplet parent)
parent
- Sketch in which this treemap will be used.public PTreeMappa(processing.core.PApplet parent, int w, int h)
parent
- Sketch in which this treemap will be used.w
- Initial width of the treemap in screen coordinates. If 0, the width of the parent sketch is used.h
- Initial height of the treemap in screen coordinates. If 0, the height of the parent sketch is used.public PTreeMappa(processing.core.PApplet parent, java.lang.String configFileName)
parent
- Sketch in which this treemap will be used.configFileName
- Name of file containing the treemap configuration.public PTreeMappa(processing.core.PApplet parent, java.lang.String configFileName, int w, int h)
parent
- Sketch in which this treemap will be used.configFileName
- Name of file containing the treemap configuration.w
- Initial width of the treemap in screen coordinates. If 0, the width provided in the configuration file is used.h
- Initial height of the treemap in screen coordinates. If 0, the height provided in the configuration file is used.public void readData(java.lang.String dataFileName)
dataFileName
- Name of CSV file in the data folder representing the tree data.public void readData(java.lang.String dataFileName, java.lang.String fileFormat)
dataFileName
- Name of file in the data folder representing the tree data.fileFormat
- Format of data file, can be 'csv', 'csvSpatial', 'csvCompact' or 'treeML;public boolean buildTreeMap()
buildTreeMap()
in the TreeMappa
class since it will update the treemap panel used
for drawing in Processing.public processing.core.PImage createImage()
public void draw(float x, float y, float w, float h)
x
- Coordinate of the left hand side of the treemap in pixel units.y
- Coordinate of the top of the treemap in pixel units.w
- Width of the treemap in pixel units.h
- Height of the treemap in pixel units.public void draw()
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.public void setColourTable(java.lang.String cTableFileName)
cTableFileName
- Name of file containing the colour table to use to represent treemap nodes.public void setRenderer(Drawable renderer)
renderer
- New renderer to use or null if default rendering is to be used.public void setLeafTextAlignment(int alignX, int alignY)
alignX
- Horizontal alignment of text can be Processing constants LEFT, CENTER or RIGHT.alignY
- Vertical alignment of text can be Processing constants TOP, CENTER, or BOTTOM.public void setBranchTextAlignment(int alignX, int alignY)
alignX
- Horizontal alignment of text can be Processing constants LEFT, CENTER or RIGHT.alignY
- Vertical alignment of text can be Processing constants TOP, CENTER, or BOTTOM.public TreeMappa getTreeMappa()
public TreeMapPanel getTreeMapPanel()