public class FireChartSVG
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AnnoteMode |
annotemode |
private static int |
chart_counter |
private static java.util.Map<java.lang.Integer,FireChartSVG> |
chart_map |
private int |
chart_num |
private int |
chart_width |
private int |
chartXOffset |
org.w3c.dom.Document |
doc |
private EventTypeToProcess |
fire_event_type |
private java.lang.String |
fontFamily |
private org.w3c.dom.DOMImplementation |
impl |
private static int |
line_gensym |
private AbstractFireHistoryReader |
reader |
private java.util.ArrayList<SeriesSVG> |
series_list |
private int |
seriesHeight |
private boolean |
showBark |
private boolean |
showFires |
private boolean |
showInjuries |
private boolean |
showInnerRing |
private boolean |
showOuterRing |
private boolean |
showPith |
private java.lang.String |
svgNS |
private int |
tickHeight |
private int |
totalHeight |
boolean |
traditionalData |
private int |
widestChronologyLabelSize |
Constructor and Description |
---|
FireChartSVG(AbstractFireHistoryReader f)
The constructor builds the DOM of the SVG.
|
Modifier and Type | Method and Description |
---|---|
void |
buildElements()
Clear out the groupers and build the chart components.
|
private org.w3c.dom.Element |
buildSingleSeries(SeriesSVG s)
TODO
|
private java.util.ArrayList<SeriesSVG> |
convertFHSeriesToSeriesSVGList(java.util.ArrayList<FHSeries> list)
TODO
|
private org.w3c.dom.Element |
createDescription(java.lang.String text,
int xLoc,
int yLoc)
Aids in the creation of descriptions for the legend.
|
private void |
deleteAllChildren(org.w3c.dom.Element e)
Helper function that deletes all child tags of the specified element.
|
boolean |
deleteAnnoteLine(java.lang.String id)
TODO
|
java.lang.String |
drawAnnoteLine(int x)
TODO
|
org.w3c.dom.Element |
getAnnoteCanvas()
TODO
|
static FireChartSVG |
getChart(java.lang.Integer id)
Get the FireChartSVG with the specified ID.
|
int |
getChartNum()
TODO
|
private org.w3c.dom.Element |
getChronologyPlot()
TODO
|
static java.lang.String |
getColorAsHex(java.awt.Color color)
Convert a java.awt.Color to a hex string.
|
private org.w3c.dom.Element |
getCompositePlot()
Get the composite plot.
|
java.util.ArrayList<SeriesSVG> |
getCurrentSeriesList()
This function returns the up-to-date list of series.
|
private org.w3c.dom.Element |
getFireYearMarker(int height,
java.awt.Color color)
TODO
|
int |
getFirstChartYear()
Get the first year in the chart.
|
private org.w3c.dom.Element |
getIndexPlot()
Get the index plot.
|
private org.w3c.dom.Element |
getInjuryYearMarker(int width,
int height,
java.awt.Color color)
TODO
|
private org.w3c.dom.Element |
getInnerYearPithMarker(boolean hasPith,
int height,
java.awt.Color color)
TODO
|
int |
getLastChartYear()
Get the last year in the chart.
|
org.w3c.dom.Element |
getLegend()
This function creates a legend dynamically, based on the current event(s) displayed on the canvas (Fire, Injury, or Fire and Injury).
|
java.lang.String |
getName()
Get the name of the file being read.
|
private org.w3c.dom.Element |
getNonRecorderLine()
Returns a non-recorder line that is pre-configured.
|
private org.w3c.dom.Element |
getOuterYearBarkMarker(boolean hasBark,
int height,
java.awt.Color color)
TODO
|
org.w3c.dom.Element |
getPercentScarredPlot()
Get the percent scarred plot including bounding box and y2 axis.
|
AbstractFireHistoryReader |
getReader()
TODO
|
private org.w3c.dom.Element |
getRecorderLine()
Returns a recorder line that is pre-configured.
|
private org.w3c.dom.Element |
getSampleOrRecorderDepthsPlot(boolean plotSampleNorRecordingDepth)
Get the sample or recorder depth plot.
|
private java.lang.Integer |
getStringHeight(java.lang.String fontFamily,
int fontStyle,
int fontSize,
java.lang.String text)
Get an approximate height for a string with the specified font.
|
private java.lang.Integer |
getStringWidth(java.lang.String fontFamily,
int fontStyle,
int fontSize,
java.lang.String text)
Get an approximate width for a string with the specified font.
|
private org.w3c.dom.Element |
getTimeAxis(int height)
Get the time axis including the guide and highlight lines.
|
int |
getTotalHeight()
TODO
|
int |
getTotalWidth()
TODO
|
void |
moveSeriesDown(java.lang.String series_name)
This method swaps the selected series with the series below it.
|
void |
moveSeriesUp(java.lang.String series_name)
This method swaps the selected series with the series above it.
|
void |
positionChartGroupersAndDrawTimeAxis()
Positions the various parts of the fire chart.
|
private void |
positionSeriesLines()
TODO
|
static void |
printDocument(org.w3c.dom.Document doc,
java.io.OutputStream out)
TODO
|
double |
pxToYears()
Convenience function to get the scaling factor.
|
double |
pxToYears(double dim)
Performs the inverse of yearsToPx.
|
void |
saveSVGToDisk(java.io.File f)
Save the current SVG to the specified file.
|
void |
setAnnoteMode(AnnoteMode m)
TODO
|
void |
setChronologyPlotVisibility()
Set the visibility of the chronology plot based on the preferences.
|
void |
setCompositePlotVisibility()
TODO
|
protected void |
setIndexPlotVisibility()
Set the visibility of the index plot based on the preferences.
|
void |
setLegendVisibility()
TODO
|
void |
setSeriesLabelsVisibility()
TODO
|
void |
setVisibilityOfNoExportElements(boolean isVisible)
TODO
|
void |
sortByFirstFireYear()
Sort the series by first fire year.
|
void |
sortByName()
Sort the series by name.
|
void |
sortBySampleEndYear()
Sort the series by end year.
|
void |
sortBySampleStartYear()
Sort the series by start year.
|
java.lang.Double |
standardChartUnits(int prop)
Returns a dimension in years (time coordinate system) for the specified proportion of the chart width.
|
void |
toggleVisibilityOfSeries(int index)
This function toggles the visibility of the series at the given location.
|
private void |
updateFontFamily()
Update the font family used in the plot.
|
double |
yearsToPx()
Convenience function to get the scaling factor.
|
double |
yearsToPx(double dim)
Converts dim from years to pixels based off of the chart_width and how many years are in the reader.
|
public org.w3c.dom.Document doc
private java.lang.String svgNS
private org.w3c.dom.DOMImplementation impl
private AbstractFireHistoryReader reader
private int seriesHeight
private int tickHeight
private int chartXOffset
private int chart_width
private int widestChronologyLabelSize
private boolean showFires
private boolean showInjuries
private boolean showPith
private boolean showBark
private boolean showInnerRing
private boolean showOuterRing
private java.lang.String fontFamily
private EventTypeToProcess fire_event_type
private AnnoteMode annotemode
public boolean traditionalData
private java.util.ArrayList<SeriesSVG> series_list
private static int chart_counter
private static int line_gensym
private static java.util.Map<java.lang.Integer,FireChartSVG> chart_map
private int totalHeight
private int chart_num
public FireChartSVG(AbstractFireHistoryReader f)
f
- public AbstractFireHistoryReader getReader()
public int getChartNum()
public java.lang.Double standardChartUnits(int prop)
prop
- public static void printDocument(org.w3c.dom.Document doc, java.io.OutputStream out)
doc
- out
- public void saveSVGToDisk(java.io.File f)
f
- public double yearsToPx(double dim)
dim
- public int getFirstChartYear()
public int getLastChartYear()
public double yearsToPx()
private void updateFontFamily()
public double pxToYears(double dim)
dim
- public double pxToYears()
public java.lang.String getName()
public static FireChartSVG getChart(java.lang.Integer id)
id
- private void deleteAllChildren(org.w3c.dom.Element e)
e
- public void buildElements()
public void positionChartGroupersAndDrawTimeAxis()
public int getTotalWidth()
public int getTotalHeight()
private org.w3c.dom.Element getTimeAxis(int height)
height
- private org.w3c.dom.Element getIndexPlot()
private org.w3c.dom.Element getSampleOrRecorderDepthsPlot(boolean plotSampleNorRecordingDepth)
plotSampleNorRecordingDepth
- public org.w3c.dom.Element getPercentScarredPlot()
protected void setIndexPlotVisibility()
public void setChronologyPlotVisibility()
public void toggleVisibilityOfSeries(int index)
index
- of the series to hidepublic java.util.ArrayList<SeriesSVG> getCurrentSeriesList()
public void sortBySampleStartYear()
public void sortBySampleEndYear()
public void sortByFirstFireYear()
public void sortByName()
public void moveSeriesUp(java.lang.String series_name)
series_name:
- Name of the series to move uppublic void moveSeriesDown(java.lang.String series_name)
series_name:
- Name of the series to move downprivate java.lang.Integer getStringWidth(java.lang.String fontFamily, int fontStyle, int fontSize, java.lang.String text)
fontFamily
- fontSize
- fontStyle
- text
- private java.lang.Integer getStringHeight(java.lang.String fontFamily, int fontStyle, int fontSize, java.lang.String text)
fontFamily
- fontSize
- fontStyle
- text
- private java.util.ArrayList<SeriesSVG> convertFHSeriesToSeriesSVGList(java.util.ArrayList<FHSeries> list)
list
- private org.w3c.dom.Element getChronologyPlot()
private void positionSeriesLines()
private org.w3c.dom.Element buildSingleSeries(SeriesSVG s)
s
- private org.w3c.dom.Element getRecorderLine()
private org.w3c.dom.Element getNonRecorderLine()
private org.w3c.dom.Element getFireYearMarker(int height, java.awt.Color color)
height
- private org.w3c.dom.Element getInjuryYearMarker(int width, int height, java.awt.Color color)
width
- height
- private org.w3c.dom.Element getInnerYearPithMarker(boolean hasPith, int height, java.awt.Color color)
hasPith
- height
- private org.w3c.dom.Element getOuterYearBarkMarker(boolean hasBark, int height, java.awt.Color color)
hasBark
- height
- private org.w3c.dom.Element getCompositePlot()
public org.w3c.dom.Element getLegend()
private org.w3c.dom.Element createDescription(java.lang.String text, int xLoc, int yLoc)
text
- The description to be enteredxLoc
- The x-location of the textyLoc
- The y-location of the textpublic void setLegendVisibility()
public void setSeriesLabelsVisibility()
public void setCompositePlotVisibility()
public void setVisibilityOfNoExportElements(boolean isVisible)
isVisible
- public org.w3c.dom.Element getAnnoteCanvas()
public java.lang.String drawAnnoteLine(int x)
x
- public boolean deleteAnnoteLine(java.lang.String id)
id
- public void setAnnoteMode(AnnoteMode m)
m
- public static java.lang.String getColorAsHex(java.awt.Color color)
color
-