datavisualizer.LineGraphDataRequest Class Reference

Creates different types of line graphs for detailed output files. More...

Inheritance diagram for datavisualizer.LineGraphDataRequest:

datavisualizer.DataRequest

List of all members.

Public Member Functions

 LineGraphDataRequest (DetailedOutputFileManager oManager, String sChartName, int iChartType, int iTreeType, int iDeadCode)
 Constructor.
boolean WantAnyTreeFloats ()
 This wants diameter values for all trees.
boolean WantAnyDeadTreeFloats ()
 This wants diameter values for all trees.
void AddTreeFloatDataMemberCode (int iSpecies, int iType, String sLabel, int iCode)
 Accepts a tree float data member code.
void AddTreeFloatData (int iSpecies, int iType, int iCode, float fVal)
 Accepts a tree float data member value.
void AddDeadTreeFloatData (int iSpecies, int iType, int iCode, int iDeadCode, float fVal)
 Accepts a tree float data member value.
void actionPerformed (java.awt.event.ActionEvent oEvent)
 Performs actions for the controls in the Histogram window.

Static Public Attributes

static final int RELATIVE_BASAL_AREA = 1
 Chart type is relative basal area.
static final int RELATIVE_DENSITY = 2
 Chart type is relative density.
static final int ABSOLUTE_BASAL_AREA = 3
 Chart type is absolute basal area.
static final int ABSOLUTE_DENSITY = 4
 Chart type is absolute density.
static final int ABSOLUTE_VOLUME = 5
 Chart type is absolute volume.
static final int RELATIVE_VOLUME = 6
 Chart type is relative volume.
static final int ABSOLUTE_BIOMASS = 7
 Chart type is absolute biomass.
static final int RELATIVE_BIOMASS = 8
 Chart type is relative biomass.

Protected Member Functions

void WriteChartDataToFile (java.io.FileWriter jOut) throws java.io. IOException, javawrapper.ModelException
 Writes the line graph's data to tab-delimited text.
DefaultXYDataset AdjustVisibleSpecies (DefaultXYDataset oDataset, Legend oLegend) throws javawrapper.ModelException
 This will take a dataset and make a copy with only series for species which are supposed to be visible.

Package Functions

void UpdateChart (Legend oLegend) throws javawrapper.ModelException
 This will update the chart only if the user has changed which species are visible or unless the number of timesteps is different.
ModelInternalFrame DrawChart (Legend oLegend, String sChartTitle) throws javawrapper.ModelException
 Draws the chart.
void ClearData () throws javawrapper.ModelException
 Does nothing, because the charts don't operate on the detailed output file update protocol.

Private Member Functions

DefaultXYDataset MakeDataset (DetailedOutputLegend oLegend) throws javawrapper.ModelException
 Creates the chart dataset.

Private Attributes

DefaultXYDataset m_oDataset = null
 The dataset with all species.
float[][] mp_fData
 Data array.
float[] mp_fTotal
 Data totals for absolute chart types.
int[] mp_iDataCode
 Holds the data codes for the data being graphed.
boolean[] mp_bWhichSpeciesShown
 A copy of which species are being displayed, so we know if the user changed it.
JCheckBox m_jUseTotals = null
 Checkbox for displaying the total.
float m_fPlotAreaInHectares
 Area of the plot, in hectares.
int m_iCurrentTimestep = -1
 The current timestep.
int m_iNumTimesteps = -1
 The total number of timesteps.
int m_iChartType
 The type of chart - absolute or relative / basal area or density.
int m_iTreeType
 Tree type of chart - seedling - snag.
int m_iDeadCode
 Dead code for trees (including NOTDEAD).


Detailed Description

Creates different types of line graphs for detailed output files.

It can produce absolute and relative graphs of density, basal area, biomass, or volume for saplings, adults, and snags; and absolute and relative graphs of density alone for seedlings.

This chart is different from other charts in that it displays data from all timesteps at once, instead of one timestep at a time. Thus, it tends to ignore normal chart drawing requests and has its own code to force parsing of all timestep files in a detailed output package at once.

Technically, density data could be extracted from any tree data member, since counting up the total is all that is required. I didn't do it that way because I'm a little lazy, and I'll wait for a hue and cry from the users before unnecessarily complicating my code.

Copyright: Copyright (c) Charles D. Canham 2003 Company: Institute of Ecosystem Studies

Author:
Lora E. Murphy
Version:
1.1

Edit history:
------------------
November 15, 2004: Created (LEM)
November 18, 2004: Updated for real-time data visualization (LEM)
March 9, 2005: Added line graph support for volume and made version 1.1 (LEM)
December 20, 2006: Added a checkbox to turn off totals (LEM)
January 5, 2007: Updated for upgrade to JFreeChart 1.0.3 (LEM)
November 10, 2010: Added biomass (LEM)
March 10, 2011: Added support for dead trees (LEM)

Constructor & Destructor Documentation

datavisualizer.LineGraphDataRequest.LineGraphDataRequest ( DetailedOutputFileManager  oManager,
String  sChartName,
int  iChartType,
int  iTreeType,
int  iDeadCode 
)

Constructor.

Declares all the arrays.

Parameters:
oManager Parent detailed output file manager
sChartName Name of the table being drawn.
iChartType Type of graph, absolute or relative / density or basal area.
iTreeType Type of tree for which to draw this chart.
iDeadCode Dead code for trees (including NOTDEAD).


Member Function Documentation

void datavisualizer.LineGraphDataRequest.WriteChartDataToFile ( java.io.FileWriter  jOut  )  throws java.io. IOException, javawrapper.ModelException [protected, virtual]

Writes the line graph's data to tab-delimited text.

Parameters:
jOut java.io.FileWriter The file to write to.
Exceptions:
java.io.IOException if there is a problem writing the file.
ModelException passed through from called methods if the dataset doesn't make sense.

Implements datavisualizer.DataRequest.

void datavisualizer.LineGraphDataRequest.UpdateChart ( Legend  oLegend  )  throws javawrapper.ModelException [package, virtual]

This will update the chart only if the user has changed which species are visible or unless the number of timesteps is different.

Parameters:
oLegend Legend The legend for this chart.
Exceptions:
ModelException Won't be thrown.

Implements datavisualizer.DataRequest.

DefaultXYDataset datavisualizer.LineGraphDataRequest.MakeDataset ( DetailedOutputLegend  oLegend  )  throws javawrapper.ModelException [private]

Creates the chart dataset.

Parameters:
oLegend Legend The legend for this chart.
Returns:
DefaultCategoryDataset The dataset for the chart, NOT adjusted for which species are visible in the legend.
Exceptions:
ModelException if there is a problem creating the dataset.

ModelInternalFrame datavisualizer.LineGraphDataRequest.DrawChart ( Legend  oLegend,
String  sChartTitle 
) throws javawrapper.ModelException [package, virtual]

Draws the chart.

Parameters:
oLegend Legend Legend for this chart.
sChartTitle String Chart name for the window title.
Exceptions:
ModelException Passed through from other called methods - this method doesn't throw it.
Returns:
JInternalFrame The finished chart window.

Implements datavisualizer.DataRequest.

void datavisualizer.LineGraphDataRequest.ClearData (  )  throws javawrapper.ModelException [package, virtual]

Does nothing, because the charts don't operate on the detailed output file update protocol.

Exceptions:
ModelException Won't throw it.

Implements datavisualizer.DataRequest.

boolean datavisualizer.LineGraphDataRequest.WantAnyTreeFloats (  ) 

This wants diameter values for all trees.

Returns:
boolean Set to true.

Reimplemented from datavisualizer.DataRequest.

boolean datavisualizer.LineGraphDataRequest.WantAnyDeadTreeFloats (  ) 

This wants diameter values for all trees.

Returns:
boolean Set to true.

Reimplemented from datavisualizer.DataRequest.

void datavisualizer.LineGraphDataRequest.AddTreeFloatDataMemberCode ( int  iSpecies,
int  iType,
String  sLabel,
int  iCode 
)

Accepts a tree float data member code.

Parameters:
iSpecies The species for which this is a data member.
iType The tree type for which this is a data member.
sLabel The label of the data member.
iCode The data member code.

Reimplemented from datavisualizer.DataRequest.

void datavisualizer.LineGraphDataRequest.AddTreeFloatData ( int  iSpecies,
int  iType,
int  iCode,
float  fVal 
)

Accepts a tree float data member value.

If it matches our code, we'll increment either the count or the total, depending on the chart type.

Parameters:
iSpecies Species of the tree from which this value came.
iType Type of the tree from which this value came.
iCode Data member code of this value.
fVal Value.

Reimplemented from datavisualizer.DataRequest.

void datavisualizer.LineGraphDataRequest.AddDeadTreeFloatData ( int  iSpecies,
int  iType,
int  iCode,
int  iDeadCode,
float  fVal 
)

Accepts a tree float data member value.

If it matches our code, we'll increment either the count or the total, depending on the chart type.

Parameters:
iSpecies Species of the tree from which this value came.
iType Type of the tree from which this value came.
iCode Data member code of this value.
fVal Value.

Reimplemented from datavisualizer.DataRequest.

DefaultXYDataset datavisualizer.LineGraphDataRequest.AdjustVisibleSpecies ( DefaultXYDataset  oDataset,
Legend  oLegend 
) throws javawrapper.ModelException [protected]

This will take a dataset and make a copy with only series for species which are supposed to be visible.

Parameters:
oDataset The dataset.
oLegend The legend which controls which species are visible.
Returns:
The dataset copy.
Exceptions:
ModelException wrapping another exception.

void datavisualizer.LineGraphDataRequest.actionPerformed ( java.awt.event.ActionEvent  oEvent  ) 

Performs actions for the controls in the Histogram window.

Parameters:
oEvent Event triggered.

Reimplemented from datavisualizer.DataRequest.


Member Data Documentation

Chart type is relative basal area.

Chart type is relative density.

Chart type is absolute basal area.

Chart type is absolute density.

Chart type is absolute volume.

Chart type is relative volume.

Chart type is absolute biomass.

Chart type is relative biomass.

DefaultXYDataset datavisualizer.LineGraphDataRequest.m_oDataset = null [private]

The dataset with all species.

Data array.

Array indexes are #1 - species, and #2 - timestep.

Data totals for absolute chart types.

Array index is number of timestep.

Holds the data codes for the data being graphed.

For density for seedlings, this is diam10; for density or basal area, it's DBH; for volume, it's volume. Array index is # of species.

A copy of which species are being displayed, so we know if the user changed it.

Checkbox for displaying the total.

Might be null if not needed.

Area of the plot, in hectares.

The current timestep.

This helps process an entire detailed output file. It also lets this class know when to ignore offered data - whenever this value is set to -1, some other chart event triggered the parse.

Reimplemented from datavisualizer.DataRequest.

The total number of timesteps.

We keep track of this so we know if something has changed (as in real-time data visualization) so we can update appropriately.

The type of chart - absolute or relative / basal area or density.

Tree type of chart - seedling - snag.

Dead code for trees (including NOTDEAD).


The documentation for this class was generated from the following file:

Generated on Tue Apr 19 13:59:33 2011 for SORTIE Java Interface by  doxygen 1.5.6