org.gicentre.treemappa
Class TreeMapPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.gicentre.treemappa.TreeMapPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class TreeMapPanel
extends javax.swing.JPanel

Class to provide a visual representation of the tree map.

Version:
3.0, 25th March, 2011.
Author:
Jo Wood, giCentre.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TreeMapPanel(int width, int height, TreeMappa treeMappa)
          Creates the panel in which to place the visual representation of the tree map.
 
Method Summary
 double[] getBorders()
          Provides the set of ordered border width settings for each level of the treemap hierarchy.
 org.gicentre.utils.colour.ColourTable getColourTable()
          Provides the colour table currently used to identify treemap node colours.
 java.awt.image.BufferedImage getImage()
          Reports the treemap image assuming it can store alpha (transparency) values.
 java.awt.image.BufferedImage getImage(boolean hasAlpha)
          Reports the treemap image.
 java.lang.String[] getLayouts()
          Reports the currently used treemap layouts at each level of the hierarchy.
 java.awt.geom.Point2D getPixelToGeo(java.awt.geom.Point2D pxl)
          Transforms the given point from pixel to georeferenced coordinates.
 boolean oCut(int level)
          Removes the tree data from a the given level of the hierarchy.
 void paintComponent(java.awt.Graphics g)
          Draws the tree map nodes.
 boolean setAlignment(int level, java.lang.String alignment)
          Sets the alignment setting for the given level of the treemap.
 boolean setAlignments(java.lang.String alignment)
          Sets the alignment settings for all levels within the treemap.
 boolean setAllowVerticalLabels(boolean allow)
          Sets a whether or not vertical text labels are allowed for tall thin rectangles.
 boolean setBorder(int level, float borderSize)
          Sets the border size of the nodes at the given level in the treemap.
 boolean setBorderColour(java.awt.Color borderColour)
          Sets the colour used to display treemap borders.
 boolean setBorderColour(int borderColour)
          Sets the colour used to display treemap borders.
 boolean setBorders(double borderSize)
          Sets the border size of the treemap.
 boolean setBranchFont(int level, java.lang.String fontName)
          Sets the font used to display branch text at the given level.
 boolean setBranchFonts(java.lang.String fontName)
          Sets the font used to display text at all branch levels.
 boolean setBranchMaxTextSize(int level, float size)
          Sets the maximum text size of the branch labels at the given branch level.
 boolean setBranchMaxTextSizes(float size)
          Sets the maximum text size of the branch labels at all hierarchy levels.
 boolean setBranchTextColour(int level, java.awt.Color textColour)
          Sets the colour used to display branch text at the given level.
 boolean setBranchTextColour(int level, int textColour)
          Sets the colour used to display branch text at the given level.
 boolean setBranchTextColours(java.awt.Color textColour)
          Sets the colour used to display text at all branch levels.
 boolean setBranchTextColours(int textColour)
          Sets the colour used to display text at all branch levels.
 boolean setBranchVectorWidth(int level, float vectWidth)
          Sets the width of the branch displacement vectors at the given branch level.
 boolean setBranchVectorWidths(float vectWidth)
          Sets the width of the branch displacement vectors at all branch levels.
 boolean setColourTable(org.gicentre.utils.colour.ColourTable cTable)
          Sets a new colour table to be used to identify treemap node colours.
 boolean setLayout(int level, java.lang.String layout)
          Sets the a new layout for the given level in the treemap.
 boolean setLayouts(java.lang.String layout)
          Sets the a new default layout for the treemap.
 boolean setLeafFont(java.lang.String fontName)
          Sets the font used to display leaf text.
 boolean setLeafMaxTextSize(float size)
          Sets the maximum text size of the leaf labels.
 boolean setLeafTextColour(java.awt.Color textColour)
          Sets the colour used to display leaf text.
 boolean setLeafTextColour(int textColour)
          Sets the colour used to display leaf text.
 boolean setLeafVectorWidth(float vectWidth)
          Sets the width of the leaf displacement vectors.
 boolean setMutation(float mutation)
          Sets the mutation value that controls the degree of colour mutation when using evolutionary colour scheme.
 boolean setRandColourLevel(int level)
          Sets the level at which random colour mutation should occur when using an evolutionary colour scheme.
 boolean setSeed(long seed)
          Sets the seed value used to generate random colour mutations in the evolutionary colour scheme.
 boolean setShowArrowHead(boolean showArrowHead)
          Determines whether or not arrow heads are displayed when showing displacement vectors.
 boolean setShowBranchDisplacement(int level, boolean showDisplacement)
          Determines whether or not branch displacement vectors are shown at the given branch level.
 boolean setShowBranchDisplacements(boolean showDisplacement)
          Determines whether or not branch displacement vectors are shown.
 boolean setShowBranchLabels(boolean showLabels)
          Determines whether or not branch labels are to be displayed.
 boolean setShowLeafDisplacement(boolean showDisplacement)
          Determines whether or not leaf displacement vectors are shown.
 boolean setShowLeafLabels(boolean showLabels)
          Determines whether or not leaf labels are to be displayed.
 boolean setUseTransparency(boolean useTransparent)
          Sets whether or not transparency is used to when drawing the treemap.
 boolean showStatistics()
          Display the summary statistics describing the treemap.
 void updateData()
          Updates the entire treemap using new tree data.
 void updateImage()
          Updates the tree map display to be shown in this panel.
 void updateLayout()
          Updates the entire treemap layout.
 boolean writeImage(java.lang.String imgFileName)
          Writes the tree map display to an image or SVG file with the given name.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeMapPanel

public TreeMapPanel(int width,
                    int height,
                    TreeMappa treeMappa)
Creates the panel in which to place the visual representation of the tree map.

Parameters:
width - Default width of the tree map.
height - Default height of the tree map.
treeMappa - Object capable of creating a treemap.
Method Detail

paintComponent

public void paintComponent(java.awt.Graphics g)
Draws the tree map nodes.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - Graphics context in which to draw.

getImage

public java.awt.image.BufferedImage getImage()
Reports the treemap image assuming it can store alpha (transparency) values. This is exactly equivalent to calling getImage(true). Note that the returned image is not suitable for saving as a jpeg, bmp or gif file. To do this, call getImage(false).

Returns:
Image holding the treemap at its natural resolution.

getImage

public java.awt.image.BufferedImage getImage(boolean hasAlpha)
Reports the treemap image. Setting hasAlpha to true is less memory intensive, but can only be saved as a .png file. If this image is needed to be saved as a jpg, bmp or gif file, hasAlpha should be set to false.

Parameters:
hasAlpha - Determines if image is to use transparency or not.
Returns:
Image holding the treemap at its natural resolution.

writeImage

public boolean writeImage(java.lang.String imgFileName)
Writes the tree map display to an image or SVG file with the given name.

Parameters:
imgFileName - Name of image file to write.
Returns:
True if file written successfully.

updateImage

public void updateImage()
Updates the tree map display to be shown in this panel.


updateLayout

public void updateLayout()
Updates the entire treemap layout. Should be called when some properties of the treemap that affect layout have been changed, but not the underlying tree structure, for example, changing the border width. Requests that simply change the rendering style, such as colours or text fonts should call updateImage() instead. Requests that change the underlying tree structure, such as swapping data between hierarchy levels should call updateData().


updateData

public void updateData()
Updates the entire treemap using new tree data. This method should only be called if the underlying tree data have been changed in some way. For changes to layout or display using the current tree data, call updateLayout() or updateImage() instead.


showStatistics

public boolean showStatistics()
Display the summary statistics describing the treemap.

Returns:
True if summary statistics were able to be calculated.

setAllowVerticalLabels

public boolean setAllowVerticalLabels(boolean allow)
Sets a whether or not vertical text labels are allowed for tall thin rectangles. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
allow - If true, vertical labels will be permitted, if not, all labels will be horizontal.
Returns:
True if change has been made successfully.

setBorderColour

public boolean setBorderColour(int borderColour)
Sets the colour used to display treemap borders. This version uses a single RGBA integer to represent the colour and is compatible with Processing's storage of colour values. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
borderColour - New colour in which to display treemap node borders.
Returns:
True if change has been made successfully.

setBorderColour

public boolean setBorderColour(java.awt.Color borderColour)
Sets the colour used to display treemap borders. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
borderColour - New colour in which to display treemap node borders.
Returns:
True if change has been made successfully.

setLeafTextColour

public boolean setLeafTextColour(int textColour)
Sets the colour used to display leaf text. This version uses a single RGBA integer to represent the colour and is compatible with Processing's storage of colour values. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
textColour - New colour in which to display treemap leaf labels.
Returns:
True if change has been made successfully.

setLeafTextColour

public boolean setLeafTextColour(java.awt.Color textColour)
Sets the colour used to display leaf text. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
textColour - New colour in which to display treemap leaf labels.
Returns:
True if change has been made successfully.

setBranchTextColours

public boolean setBranchTextColours(int textColour)
Sets the colour used to display text at all branch levels. This version uses a single RGBA integer to represent the colour and is compatible with Processing's storage of colour values. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
textColour - New colour in which to display treemap branch labels.
Returns:
True if change has been made successfully.

setBranchTextColours

public boolean setBranchTextColours(java.awt.Color textColour)
Sets the colour used to display text at all branch levels. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
textColour - New colour in which to display treemap branch labels.
Returns:
True if change has been made successfully.

setBranchTextColour

public boolean setBranchTextColour(int level,
                                   int textColour)
Sets the colour used to display branch text at the given level. This version uses a single RGBA integer to represent the colour and is compatible with Processing's storage of colour values. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level at which to make the change.
textColour - New colour in which to display treemap branch labels at the given level.
Returns:
True if change has been made successfully.

setBranchTextColour

public boolean setBranchTextColour(int level,
                                   java.awt.Color textColour)
Sets the colour used to display branch text at the given level. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level at which to make the change.
textColour - New colour in which to display treemap branch labels at the given level.
Returns:
True if change has been made successfully.

setBranchFonts

public boolean setBranchFonts(java.lang.String fontName)
Sets the font used to display text at all branch levels. Note that the treemap will not use this new setting until a call to updateImage() is made. Note also that this will have no effect on the treemaps drawn directly in Processing via PTreeMappa.draw(), which uses the currently selected Processing font for all labels.

Parameters:
fontName - Name of new font in which to display treemap branch labels.
Returns:
True if change has been made successfully.

setBranchFont

public boolean setBranchFont(int level,
                             java.lang.String fontName)
Sets the font used to display branch text at the given level. Note that the treemap will not use this new setting until a call to updateImage() is made. Note also that this will have no effect on the treemaps drawn directly in Processing via PTreeMappa.draw(), which uses the currently selected Processing font for all labels.

Parameters:
level - Hierarchy level at which to make the change.
fontName - Name of font in which to display treemap branch labels at the given level.
Returns:
True if change has been made successfully.

setLeafFont

public boolean setLeafFont(java.lang.String fontName)
Sets the font used to display leaf text. Note that the treemap will not use this new setting until a call to updateImage() is made. Note also that this will have no effect on the treemaps drawn directly in Processing via PTreeMappa.draw(), which uses the currently selected Processing font for all labels.

Parameters:
fontName - New font in which to display treemap leaf labels.
Returns:
True if change has been made successfully.

setLeafVectorWidth

public boolean setLeafVectorWidth(float vectWidth)
Sets the width of the leaf displacement vectors. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
vectWidth - Width of leaf displacement vectors in pixel units.
Returns:
True if change has been made successfully.

setBranchMaxTextSize

public boolean setBranchMaxTextSize(int level,
                                    float size)
Sets the maximum text size of the branch labels at the given branch level. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level at which to make the change.
size - Maximum vertical text size in pixel units.
Returns:
True if change has been made successfully.

setBranchMaxTextSizes

public boolean setBranchMaxTextSizes(float size)
Sets the maximum text size of the branch labels at all hierarchy levels. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
size - Maximum vertical text size in pixel units.
Returns:
True if change has been made successfully.

setLeafMaxTextSize

public boolean setLeafMaxTextSize(float size)
Sets the maximum text size of the leaf labels. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
size - Maximum vertical text size in pixel units.
Returns:
True if change has been made successfully.

setMutation

public boolean setMutation(float mutation)
Sets the mutation value that controls the degree of colour mutation when using evolutionary colour scheme. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
mutation - Mutation index between 0 (inherits parent colour exactly) and 1 (independent of parent colour).
Returns:
True if change has been made successfully.

setRandColourLevel

public boolean setRandColourLevel(int level)
Sets the level at which random colour mutation should occur when using an evolutionary colour scheme. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level beyond which colour mutation should occur.
Returns:
True if change has been made successfully.

setSeed

public boolean setSeed(long seed)
Sets the seed value used to generate random colour mutations in the evolutionary colour scheme. This allows a repeatable, but random colour scheme to be used. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
seed - New random seed.
Returns:
True if change has been made successfully.

setShowArrowHead

public boolean setShowArrowHead(boolean showArrowHead)
Determines whether or not arrow heads are displayed when showing displacement vectors. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
showArrowHead - Arrow heads shown if true.
Returns:
True if change has been made successfully.

setShowBranchDisplacement

public boolean setShowBranchDisplacement(int level,
                                         boolean showDisplacement)
Determines whether or not branch displacement vectors are shown at the given branch level. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level at which to make the change.
showDisplacement - Displacement vectors will be shown if true.
Returns:
True if change has been made successfully.

setShowBranchDisplacements

public boolean setShowBranchDisplacements(boolean showDisplacement)
Determines whether or not branch displacement vectors are shown. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
showDisplacement - Displacement vectors will be shown if true.
Returns:
True if change has been made successfully.

setShowLeafDisplacement

public boolean setShowLeafDisplacement(boolean showDisplacement)
Determines whether or not leaf displacement vectors are shown. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
showDisplacement - Displacement vectors will be shown if true.
Returns:
True if change has been made successfully.

setBranchVectorWidth

public boolean setBranchVectorWidth(int level,
                                    float vectWidth)
Sets the width of the branch displacement vectors at the given branch level. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
level - Hierarchy level at which to make the change.
vectWidth - Width of branch displacement vectors in pixel units.
Returns:
True if change has been made successfully.

setBranchVectorWidths

public boolean setBranchVectorWidths(float vectWidth)
Sets the width of the branch displacement vectors at all branch levels. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
vectWidth - Width of branch displacement vectors in pixel units.
Returns:
True if change has been made successfully.

setColourTable

public boolean setColourTable(org.gicentre.utils.colour.ColourTable cTable)
Sets a new colour table to be used to identify treemap node colours. Unlike the other set methods that alter the treemap appearance, this method does not update the TreeMapProperties object associated with the treemap. This is because that property is the name of a colour table file, and the incoming colour table supplied to this method may not have a version saved to file. Note also that the treemap will not use these new colours until a call to updateImage() is made.

Parameters:
cTable - New colour table to use when identifying treemap colours.
Returns:
True if change has been made successfully.

setUseTransparency

public boolean setUseTransparency(boolean useTransparent)
Sets whether or not transparency is used to when drawing the treemap. This can be useful when creating PDF images that cannot display transparent colours correctly. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
useTransparent - Transparency is used if true, otherwise, opaque grey levels are used for text labels.
Returns:
True if change has been made successfully.

setShowBranchLabels

public boolean setShowBranchLabels(boolean showLabels)
Determines whether or not branch labels are to be displayed. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
showLabels - Branch labels will be displayed if true.
Returns:
True if change has been made successfully.

setShowLeafLabels

public boolean setShowLeafLabels(boolean showLabels)
Determines whether or not leaf labels are to be displayed. Note that the treemap will not use this new setting until a call to updateImage() is made.

Parameters:
showLabels - Leaf labels will be displayed if true.
Returns:
True if change has been made successfully.

getColourTable

public org.gicentre.utils.colour.ColourTable getColourTable()
Provides the colour table currently used to identify treemap node colours.

Returns:
Colour table used when identifying treemap colours.

setAlignments

public boolean setAlignments(java.lang.String alignment)
Sets the alignment settings for all levels within the treemap. Note that since this operation requires the recalculation of the treemap layout, no changes will be made until updateLayout() is called.

Parameters:
alignment - Alignment setting to use. Valid values are 'horizontal', 'vertical' and 'free'.
Returns:
True if new property is updated successfully.

setAlignment

public boolean setAlignment(int level,
                            java.lang.String alignment)
Sets the alignment setting for the given level of the treemap. Note that since this operation requires the recalculation of the treemap layout, no changes will be made until updateLayout() is called.

Parameters:
level - Level of the hierarchy at which the given border setting is to apply.
alignment - Alignment setting to use. Valid values are 'horizontal', 'vertical' and 'free'.
Returns:
True if new property is updated successfully.

setBorders

public boolean setBorders(double borderSize)
Sets the border size of the treemap. Note that since this operation requires the recalculation of the treemap layout, no changes will be made until updateLayout() is called.

Parameters:
borderSize - Border size in pixels used to separate treemap nodes.
Returns:
True if new property is updated successfully.

setBorder

public boolean setBorder(int level,
                         float borderSize)
Sets the border size of the nodes at the given level in the treemap. Note that since this operation requires the recalculation of the treemap layout, no changes will be made until updateLayout() is called.

Parameters:
level - Level of the hierarchy at which the given border setting is to apply.
borderSize - Border size in pixels used to separate treemap nodes.
Returns:
True if new property is updated successfully.

setLayouts

public boolean setLayouts(java.lang.String layout)
Sets the a new default layout for the treemap. Note that no visible changes to the layout will be made until updateLayout() is called.

Parameters:
layout - Name of new layout algorithm to use.
Returns:
True if new property is updated successfully.

setLayout

public boolean setLayout(int level,
                         java.lang.String layout)
Sets the a new layout for the given level in the treemap. Note that no visible changes to the layout will be made until updateLayout() is called.

Parameters:
level - Level of the hierarchy at which the given layout setting is to apply.
layout - Name of new layout algorithm to use.
Returns:
True if new property is updated successfully.

getLayouts

public java.lang.String[] getLayouts()
Reports the currently used treemap layouts at each level of the hierarchy.

Returns:
Name of the layouts currently being used to produce the treemap. The first item is the layout of the nodes in the root of the tree, the second the children of the those nodes etc.

oCut

public boolean oCut(int level)
Removes the tree data from a the given level of the hierarchy. If the nodes to cut are leaves, they are removed entirely from the tree. If they are branches, then their children are attached to the removed node's parent. Note that the treemap will not be updated until a call to updateLayout() is made.

Parameters:
level - Level of the hierarchy at which to apply the operation.
Returns:
True if the operation has been performed successfully.

getBorders

public double[] getBorders()
Provides the set of ordered border width settings for each level of the treemap hierarchy.

Returns:
Ordered collection of border width settings.

getPixelToGeo

public java.awt.geom.Point2D getPixelToGeo(java.awt.geom.Point2D pxl)
Transforms the given point from pixel to georeferenced coordinates.

Parameters:
pxl - Pixel coordinate pair to transform.
Returns:
Georeferenced coordinate pair representing the given pixel coordinates.


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