net.sourceforge.arbaro.gui
Class PreviewTree
java.lang.Object
net.sourceforge.arbaro.gui.PreviewTree
- All Implemented Interfaces:
- Tree
public final class PreviewTree
- extends java.lang.Object
- implements Tree
A tree used to preview the edited tree, it draws
the stems and leaves with lines to Graphics context
and modifies the level and branching parameters to
calculate and draw only parts of the tree, reducing
calculation time as well.
- Author:
- wdiestel
Field Summary |
protected javax.swing.event.ChangeEvent |
changeEvent
|
protected javax.swing.event.EventListenerList |
listenerList
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
changeEvent
protected javax.swing.event.ChangeEvent changeEvent
listenerList
protected javax.swing.event.EventListenerList listenerList
PreviewTree
public PreviewTree(Params params)
- Parameters:
params
- tree parameters
getParams
public Params getParams()
setParams
public void setParams(Params params)
traverseTree
public boolean traverseTree(TreeTraversal traversal)
- Description copied from interface:
Tree
- used with the TreeTraversal interface
- Specified by:
traverseTree
in interface Tree
- Returns:
- when false stop travers the tree
getStemCount
public long getStemCount()
- Specified by:
getStemCount
in interface Tree
- Returns:
- the number of all stems of all levels of the tree
getLeafCount
public long getLeafCount()
- Specified by:
getLeafCount
in interface Tree
- Returns:
- the number of leaves of the tree
getMaxPoint
public Vector getMaxPoint()
- Specified by:
getMaxPoint
in interface Tree
- Returns:
- a vector with the highest coordinates of the tree.
(Considering all stems of all levels)
getMinPoint
public Vector getMinPoint()
- Specified by:
getMinPoint
in interface Tree
- Returns:
- a vector with the lowest coordinates of the tree.
(Considering all stems of all levels)
getSeed
public int getSeed()
- Specified by:
getSeed
in interface Tree
- Returns:
- the seed of the tree. It is used for randomnization.
getHeight
public double getHeight()
- Specified by:
getHeight
in interface Tree
- Returns:
- the height of the tree (highest z-coordinate)
getWidth
public double getWidth()
- Specified by:
getWidth
in interface Tree
- Returns:
- the widht of the tree (highest value of sqrt(x*x+y*y))
paramsToXML
public void paramsToXML(java.io.PrintWriter w)
- Description copied from interface:
Tree
- Writes the trees parameters to a stream
- Specified by:
paramsToXML
in interface Tree
getSpecies
public java.lang.String getSpecies()
- Specified by:
getSpecies
in interface Tree
- Returns:
- the tree species name
getLevels
public int getLevels()
- Specified by:
getLevels
in interface Tree
- Returns:
- the tree stem levels
getLeafShape
public java.lang.String getLeafShape()
- Specified by:
getLeafShape
in interface Tree
- Returns:
- the leaf shape name
getLeafWidth
public double getLeafWidth()
- Specified by:
getLeafWidth
in interface Tree
- Returns:
- the leaf width
getLeafLength
public double getLeafLength()
- Specified by:
getLeafLength
in interface Tree
- Returns:
- the leaf length
getLeafStemLength
public double getLeafStemLength()
- Specified by:
getLeafStemLength
in interface Tree
- Returns:
- the virtual leaf stem length, i.e. the distance of
the leaf from the stem center line
getVertexInfo
public java.lang.String getVertexInfo(int level)
- Description copied from interface:
Tree
- Use this for verbose output when generating a mesh or
exporting a tree
- Specified by:
getVertexInfo
in interface Tree
- Returns:
- an information string with the number of section
points for this stem level and if smoothing should be used
setShowLevel
public void setShowLevel(int l)
getShowLevel
public int getShowLevel()
remake
public void remake(boolean doFireStateChanged)
getMesh
public Mesh getMesh()
getLeafMesh
public LeafMesh getLeafMesh()
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
fireStateChanged
protected void fireStateChanged()