clPlot Class Reference

PLOT CLASS - Version 1.0 This class represents the underlying plot. More...

#include <Plot.h>

Inheritance diagram for clPlot:

clWorkerBase

List of all members.

Public Member Functions

 ~clPlot ()
 Destructor.
 clPlot (clSimManager *p_oSimManager)
 Constructor.
float GetLatitude ()
 Gets the latitude.
float GetXPlotLength ()
 Gets the plot X length.
float GetYPlotLength ()
 Gets the plot Y length.
float GetXCellLength ()
 Gets the length of cells in the X direction.
float GetYCellLength ()
 Gets the length of cells in the Y direction.
float GetPlotArea ()
 Gets the plot area.
float GetMeanAnnualPrecip ()
 Gets the mean annual precipitation.
void SetMeanAnnualPrecip (float fMeanAnnualPrecip)
 Sets the mean annual precipitation.
float GetMeanAnnualTemp ()
 Gets the mean annual temperature.
void SetMeanAnnualTemp (float fMeanTemp)
 Sets the mean annual temperature.
char * GetPlotTitle ()
 Gets the plot title.
int GetNumXGrids ()
 Gets number of X grid cells.
int GetNumYGrids ()
 Gets number of Y grid cells.
float GetGridCellArea ()
 Gets the area of a grid cell.
int GetGridCellSize ()
 Gets the length of a grid cell side (cells are square).
float CorrectX (float fX)
 Translates an X coordinate to a position guaranteed to be valid.
float CorrectY (float fY)
 Translates a Y coordinate to a position guaranteed to be valid.
float GetDistance (float fFromX, float fFromY, float fToX, float fToY)
 Calculates the effective distance between two points, correcting for the torus.
float GetAzimuthAngle (float fFromX, float fFromY, float fToX, float fToY)
 Calculates the azimuth angle between two points on the plot.
int GetFastAzimuthAngle (float fFromX, float fFromY, float fToX, float fToY)
 Speedy way to do an azimuth calculation.
float GetUncorrectedX (float fFromX, float fAzimuth, float fDistance)
 Gets the X coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.
float GetUncorrectedY (float fFromY, float fAzimuth, float fDistance)
 Gets the Y coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.
float GetXDistance (float fFromX, float fToX)
 Gets the distance between two points in the X plane, corrected for torus wrapping.
float GetYDistance (float fFromY, float fToY)
 Gets the distance between two points in the Y plane, corrected for torus wrapping.

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads data from the parameter file.
void PopulateAziTans ()
 Declares and populates the tangents of the azimuth angles.

Protected Attributes

char m_cPlotTitle [MAX_PLOTTITLE_SIZE]
 Name for this plot.
int m_iNumXGrids
 Number of grid divisions along the X axis.
int m_iNumYGrids
 Number of grid divisions along the Y axis.
int m_iCellSize
 Length of one side of a grid cell, in meters.
float m_fPlotArea
 Plot area, in hectares.
float m_fPlotLenX
 Plot length along the X axis, in m.
float m_fPlotLenY
 Plot length along the Y axis, in m.
float m_fMaxX
 Max allowed X value - m_fPlotLenX minus a small value.
float m_fMaxY
 Max allowed Y value - m_fPlotLenY minus a small value.
float m_fLatitude
 Plot latitude, in decimal degrees - from the par file.
float m_fMeanAnnualPrecipMm
 Mean annual precipitation, mm.
float m_fMeanTempC
 Mean annual temperature, degrees Celsius.
float * mp_fAziTans
 Tangent of each azimuth angle.


Detailed Description

PLOT CLASS - Version 1.0 This class represents the underlying plot.

It controls for torus topology and manages the grid coordinates. It also contains geographic and climate information about the plot, for those behaviors that require it.

There are some changes in the coordinate structure. The origin is in the southwest corner of the plot (unwrapped). The Y axis is NS and values increase to the north. The X axis is EW and values increase to the east. There are no negative values. The azimuth is north zero, east positive.

The truly underlying grid cell structure is no longer in the hands of the users. The base coordinates will be structured as 8 X 8 grid cells, which is what the trees will be organized into.

This class inherits from clWorkerBase to take advantage of the XML parsing functions in that class.

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)
July 2, 2010 - Added climate info

Constructor & Destructor Documentation

clPlot::~clPlot (  ) 

Destructor.

clPlot::clPlot ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.


Member Function Documentation

float clPlot::GetLatitude (  )  [inline]

Gets the latitude.

Returns:
Latitude, in decimal degrees.

float clPlot::GetXPlotLength (  )  [inline]

Gets the plot X length.

Returns:
Length of plot in X direction in meters.

float clPlot::GetYPlotLength (  )  [inline]

Gets the plot Y length.

Returns:
Length of plot in Y direction in meters.

float clPlot::GetXCellLength (  )  [inline]

Gets the length of cells in the X direction.

Returns:
Length of cells in the X direction, in m.

float clPlot::GetYCellLength (  )  [inline]

Gets the length of cells in the Y direction.

Returns:
Length of cells in the Y direction, in m.

float clPlot::GetPlotArea (  )  [inline]

Gets the plot area.

Returns:
Plot area, in hectares.

float clPlot::GetMeanAnnualPrecip (  )  [inline]

Gets the mean annual precipitation.

Returns:
Mean annual precipitation, in mm.

void clPlot::SetMeanAnnualPrecip ( float  fMeanAnnualPrecip  )  [inline]

Sets the mean annual precipitation.

Parameters:
fMeanAnnualPrecip Mean annual precipitation, in mm.

float clPlot::GetMeanAnnualTemp (  )  [inline]

Gets the mean annual temperature.

Returns:
Mean annual precipitation, in degrees C.

void clPlot::SetMeanAnnualTemp ( float  fMeanTemp  )  [inline]

Sets the mean annual temperature.

Parameters:
fMeanTemp Mean annual precipitation, in degrees C.

char* clPlot::GetPlotTitle (  )  [inline]

Gets the plot title.

Returns:
Plot title.

int clPlot::GetNumXGrids (  )  [inline]

Gets number of X grid cells.

Returns:
Number of grid cells in the X direction.

int clPlot::GetNumYGrids (  )  [inline]

Gets number of Y grid cells.

Returns:
Number of grid cells in the Y direction.

float clPlot::GetGridCellArea (  )  [inline]

Gets the area of a grid cell.

Returns:
The area of a grid cell in square meters.

int clPlot::GetGridCellSize (  )  [inline]

Gets the length of a grid cell side (cells are square).

Returns:
Grid cell side length, in meters.

float clPlot::CorrectX ( float  fX  ) 

Translates an X coordinate to a position guaranteed to be valid.

If the number passed is already within the plot, it is left alone. If the number is outside of the plot, it is "wrapped" by adding or subtracting the appropriate plot length until it is inside the plot. Because of the torus shape of the plot, a number corrected in this way will have the same geometric relationships as the original number. This function is recursive - it will call itself until the number is correct. The edge of the plot is actually considered to be m_fMaxX; this catches numbers so close to the edge of the plot that they are likely to be rounded up and then be out of the plot.

Parameters:
fX Coordinate to correct.
Returns:
Corrected version of the coordinate.

float clPlot::CorrectY ( float  fY  ) 

Translates a Y coordinate to a position guaranteed to be valid.

If the number passed is already within the plot, it is left alone. If the number is outside of the plot, it is "wrapped" by adding or subtracting the appropriate plot length until it is inside the plot. Because of the torus shape of the plot, a number corrected in this way will have the same geometric relationships as the original number. This function is recursive - it will call itself until the number is correct. The edge of the plot is actually considered to be m_fMaxY; this catches numbers so close to the edge of the plot that they are likely to be rounded up and then be out of the plot.

Parameters:
fY Coordinate to correct.
Returns:
Corrected version of the coordinate.

float clPlot::GetDistance ( float  fFromX,
float  fFromY,
float  fToX,
float  fToY 
)

Calculates the effective distance between two points, correcting for the torus.

Note that because of the torus, there are always two possible distances to any two points. This will return the shorter.

Parameters:
fFromX X coordinate of the "from" point.
fFromY Y coordinate of the "from" point.
fToX X coordinate of the "to" point.
fToY Y coordinate of the "to" point.
Returns:
Distance between the two points in meters.
Exceptions:
BAD_DATA error if either of the points is not in the plot.

float clPlot::GetAzimuthAngle ( float  fFromX,
float  fFromY,
float  fToX,
float  fToY 
)

Calculates the azimuth angle between two points on the plot.

Parameters:
fFromX X coordinate of the "from" point.
fFromY Y coordinate of the "from" point.
fToX X coordinate of the "to" point.
fToY Y coordinate of the "to" point.
Returns:
Azimuth, in RADIANS, north = 0.

int clPlot::GetFastAzimuthAngle ( float  fFromX,
float  fFromY,
float  fToX,
float  fToY 
)

Speedy way to do an azimuth calculation.

Parameters:
fFromX X coordinate of the "from" point.
fFromY Y coordinate of the "from" point.
fToX X coordinate of the "to" point.
fToY Y coordinate of the "to" point.
Returns:
Azimuth in number of DEGREES (whole number).

float clPlot::GetUncorrectedX ( float  fFromX,
float  fAzimuth,
float  fDistance 
)

Gets the X coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.

If you want a torus-corrected point, use CorrectX() on the result of this function.

Parameters:
fFromX X coordinate of point that the desired point is defined relative to.
fAzimuth Azimuth angle from fFromX to the unknown point, in radians, north 0.
fDistance Distance from fFromX to the unknown point, in meters.
Returns:
The uncorrected X value of the point (meaning that it could be negative or greater than the plot length).
Exceptions:
modelErr if the distance is negative, the azimuth is negative, or the azimuth is greater than 2PI.

float clPlot::GetUncorrectedY ( float  fFromY,
float  fAzimuth,
float  fDistance 
)

Gets the Y coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.

If you want a torus-corrected point, use CorrectY() on the result of this function.

Parameters:
fFromY Y coordinate of point that the desired point is defined relative to.
fAzimuth Azimuth angle from fFromX to the unknown point, in radians, north 0.
fDistance Distance from fFromX to the unknown point, in meters.
Returns:
The uncorrected Y value of the point (meaning that it could be negative or greater than the plot length).
Exceptions:
modelErr if the distance is negative, the azimuth is negative, or the azimuth is greater than 2PI.

float clPlot::GetXDistance ( float  fFromX,
float  fToX 
) [inline]

Gets the distance between two points in the X plane, corrected for torus wrapping.

If the "to" point is lower than the "from", the answer will be negative.

Parameters:
fFromX X coordinate of the "from" point.
fToX X coordinate of the "to" point.
Returns:
X distance in meters.

float clPlot::GetYDistance ( float  fFromY,
float  fToY 
) [inline]

Gets the distance between two points in the Y plane, corrected for torus wrapping.

If the "to" point is lower than the "from", the answer will be negative.

Parameters:
fFromY Y coordinate of the "from" point.
fToY Y coordinate of the "to" point.
Returns:
Y distance in meters.

void clPlot::GetData ( xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]

Reads data from the parameter file.

Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

void clPlot::PopulateAziTans (  )  [protected]

Declares and populates the tangents of the azimuth angles.


Member Data Documentation

Name for this plot.

Optional.

int clPlot::m_iNumXGrids [protected]

Number of grid divisions along the X axis.

int clPlot::m_iNumYGrids [protected]

Number of grid divisions along the Y axis.

int clPlot::m_iCellSize [protected]

Length of one side of a grid cell, in meters.

Cells are square. Make this always a power of 2! The const means the compiler can optimize divisions and multiplications into bit shifts.

float clPlot::m_fPlotArea [protected]

Plot area, in hectares.

float clPlot::m_fPlotLenX [protected]

Plot length along the X axis, in m.

float clPlot::m_fPlotLenY [protected]

Plot length along the Y axis, in m.

float clPlot::m_fMaxX [protected]

Max allowed X value - m_fPlotLenX minus a small value.

float clPlot::m_fMaxY [protected]

Max allowed Y value - m_fPlotLenY minus a small value.

float clPlot::m_fLatitude [protected]

Plot latitude, in decimal degrees - from the par file.

float clPlot::m_fMeanAnnualPrecipMm [protected]

Mean annual precipitation, mm.

float clPlot::m_fMeanTempC [protected]

Mean annual temperature, degrees Celsius.

float* clPlot::mp_fAziTans [protected]

Tangent of each azimuth angle.

Array size is 360 (degrees).


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

Generated on Tue Apr 19 13:56:15 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6