#include <GridBase.h>
Public Member Functions | |
int | GetObjectVersion () |
Returns the version number of the clGridBase class. | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Reads in a grid's map, if present in a file. | |
void | ReadMapFile (xercesc::DOMDocument *p_oDoc) |
Reads a map file. | |
void | ChangePackageDataStructure (short int iNumIntVals, short int iNumFloatVals, short int iNumCharVals, short int iNumBoolVals) |
Changes the data structure for the packages, as for changing from defaults. | |
void | GetValueAtPoint (float fX, float fY, short int iCode, int *p_iValHolder) |
Retrieves the value of an integer grid data member at an (X, Y) location. | |
void | GetValueAtPoint (float fX, float fY, short int iCode, float *p_fValHolder) |
Retrieves the value of a float grid data member at an (X, Y) location. | |
void | GetValueAtPoint (float fX, float fY, short int iCode, char *p_cValHolder) |
Retrieves the value of a char grid data member at an (X, Y) location. | |
void | GetValueAtPoint (float fX, float fY, short int iCode, bool *p_bValHolder) |
Retrieves the value of a bool grid data member at an (X, Y) location. | |
void | GetValueOfCell (int iX, int iY, short int iCode, int *p_iValHolder) |
Retrieves the value of an integer data member for a particular grid cell. | |
void | GetValueOfCell (int iX, int iY, short int iCode, float *p_fValHolder) |
Retrieves the value of a float data member for a particular grid cell. | |
void | GetValueOfCell (int iX, int iY, short int iCode, char *p_cValHolder) |
Retrieves the value of a char data member for a particular grid cell. | |
void | GetValueOfCell (int iX, int iY, short int iCode, bool *p_bValHolder) |
Retrieves the value of a bool data member for a particular grid cell. | |
float | GetAverageFloatValue (float fX, float fY, short int iCode, float fRadius) |
Returns the average value of the grid cells in a circle for a float data member. | |
float | GetAverageIntValue (float fX, float fY, short int iCode, float fRadius) |
Returns the average value of the grid cells in a circle for a integer data member. | |
float | GetAverageFloatValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode) |
Returns the average value of the grid cells in a rectangle for a float data member. | |
float | GetAverageIntValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode) |
Returns the average value of the grid cells in a rectangle for an int data member. | |
float | GetOriginXOfCell (int iX) |
Gets the real X coordinate of the origin of a grid cell at a given X grid number. | |
float | GetOriginYOfCell (int iY) |
Gets the real Y coordinate of the origin of a grid cell at a given Y grid number. | |
float | GetEndXOfCell (int iX) |
Gets the real X coordinate of the end of a grid cell at a given X grid number. | |
float | GetEndYOfCell (int iY) |
Gets the real Y coordinate of the end of a grid cell at a given Y grid number. | |
clPackage * | GetFirstPackageOfCell (int iX, int iY) |
Retrieves first package in linked list for a grid cell. | |
clPackage * | GetFirstPackageAtPoint (float fX, float fY) |
Retrieves first package in linked list for a point. | |
void | GetPointOfCell (short int iCellX, short int iCellY, float *fX, float *fY) |
Gets the coordinates of a point at the center of a grid cell. | |
void | GetCellOfPoint (float fX, float fY, short int *iCellX, short int *iCellY) |
Retrieves the cell numbers for a point. | |
int | GetNumberXCells () |
Gets number of cells in the X direction. | |
int | GetNumberYCells () |
Gets number of cells in the Y direction. | |
float | GetLengthXCells () |
Gets the length of a cell in the X direction. | |
float | GetLengthYCells () |
Gets the length of a cell in the Y direction. | |
int | GetNumberIntDataMembers () |
Gets the number of int data members. | |
int | GetNumberFloatDataMembers () |
Gets the number of float data members. | |
int | GetNumberCharDataMembers () |
Gets the number of char data members. | |
int | GetNumberBoolDataMembers () |
Gets the number of bool data members. | |
int | GetNumberIntPackageDataMembers () |
Gets the number of package int data members. | |
int | GetNumberFloatPackageDataMembers () |
Gets the number of package float data members. | |
int | GetNumberCharPackageDataMembers () |
Gets the number of package char data members. | |
int | GetNumberBoolPackageDataMembers () |
Gets the number of package bool data members. | |
bool | GetPackageDataChanged () |
Gets whether or not the package data structure has changed. | |
void | SetValueAtPoint (float fX, float fY, short int iCode, float fValue) |
Sets the value of a float data member for the grid cell containing an (X, Y) location. | |
void | SetValueAtPoint (float fX, float fY, short int iCode, int iValue) |
Sets the value of an integer data member for the grid cell containing an (X, Y) location. | |
void | SetValueAtPoint (float fX, float fY, short int iCode, char *p_cValue) |
Sets the value of a char data member for the grid cell containing an (X, Y) location. | |
void | SetValueAtPoint (float fX, float fY, short int iCode, bool bValue) |
Sets the value of a bool data member for the grid cell containing an (X, Y) location. | |
void | SetValueOfCell (int iX, int iY, short int iCode, float fValue) |
Sets the value of a float data member for a particular grid cell. | |
void | SetValueOfCell (int iX, int iY, short int iCode, int iValue) |
Sets the value of an integer data member for a particular grid cell. | |
void | SetValueOfCell (int iX, int iY, short int iCode, char *p_cValue) |
Sets the value of a char data member for a particular grid cell. | |
void | SetValueOfCell (int iX, int iY, short int iCode, bool bValue) |
Sets the value of a bool data member for a particular grid cell. | |
short int | RegisterInt (char *cLabel) |
Registers an integer data member. | |
short int | RegisterFloat (char *cLabel) |
Registers a float data member. | |
short int | RegisterChar (char *cLabel) |
Registers a char data member. | |
short int | RegisterBool (char *cLabel) |
Registers a bool data member. | |
short int | RegisterPackageInt (char *cLabel) |
Registers a package integer data member. | |
short int | RegisterPackageFloat (char *cLabel) |
Registers a package float data member. | |
short int | RegisterPackageChar (char *cLabel) |
Registers a package char data member. | |
short int | RegisterPackageBool (char *cLabel) |
Registers a package bool data member. | |
clPackage * | CreatePackage (clPackage *p_oPreviousPackage) |
Creates a package. | |
clPackage * | CreatePackageOfCell (int iX, int iY) |
Creates a package. | |
clPackage * | CreatePackageAtPoint (float fX, float fY) |
Creates a package. | |
void | DeletePackage (clPackage *p_oOldPackage) |
Deletes a package. | |
short int | GetIntDataCode (char *cLabel) |
Gets the code for an integer data member. | |
short int | GetFloatDataCode (char *cLabel) |
Gets the code for a float data member. | |
short int | GetCharDataCode (char *cLabel) |
Gets the code for a char data member. | |
short int | GetBoolDataCode (char *cLabel) |
Gets the code for a bool data member. | |
short int | GetPackageIntDataCode (char *cLabel) |
Gets the code for a package integer data member. | |
short int | GetPackageFloatDataCode (char *cLabel) |
Gets the code for a package float data member. | |
short int | GetPackageCharDataCode (char *cLabel) |
Gets the code for a package char data member. | |
short int | GetPackageBoolDataCode (char *cLabel) |
Gets the code for a package bool data member. | |
char * | GetIntDataLabel (short int iCode) |
Gets the label for an integer data member. | |
char * | GetFloatDataLabel (short int iCode) |
Gets the label for a float data member. | |
char * | GetCharDataLabel (short int iCode) |
Gets the label for a char data member. | |
char * | GetBoolDataLabel (short int iCode) |
Gets the label for a bool data member. | |
char * | GetPackageIntDataLabel (short int iCode) |
Gets the label for a package integer data member. | |
char * | GetPackageFloatDataLabel (short int iCode) |
Gets the label for a package float data member. | |
char * | GetPackageCharDataLabel (short int iCode) |
Gets the label for a package char data member. | |
char * | GetPackageBoolDataLabel (short int iCode) |
Gets the label for a package bool data member. | |
Protected Member Functions | |
clGridBase (clSimManager *p_oSimManager, char *cGridName, short int iNumIntVals, short int iNumFloatVals, short int iNumCharVals, short int iNumBoolVals, float fXCellLength=0, float fYCellLength=0) | |
Constructor. | |
~clGridBase () | |
Destructor. | |
short int | RegisterDataMember (char *cLabel, short int iNumVals, char **p_cLabelList) |
Core function for registering new data members. | |
float | GetAverageValue (float fX, float fY, short int iCode, float fRadius, bool bFloat) |
This is the function that actually calculates a circle's average value. | |
float | GetAverageValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode, bool bFloat) |
This is the function that actually calculates a rectangle's average value. | |
Protected Attributes | |
stcRecords ** | mp_gridVals |
The structure holding grid cell data. | |
short int | m_iNumIntVals |
How many integer data members per grid cell. | |
short int | m_iNumFloatVals |
How many float data members per grid cell. | |
short int | m_iNumCharVals |
How many char data members per grid cell. | |
short int | m_iNumBoolVals |
How many bool data members per grid cell. | |
char ** | mp_cIntLabels |
Labels for each of the integer data members. | |
char ** | mp_cFloatLabels |
Labels for each of the float data members. | |
char ** | mp_cCharLabels |
Labels for each of the char data members. | |
char ** | mp_cBoolLabels |
Labels for each of the bool data members. | |
float | m_fXCellSize |
Length of grid cells in the X direction, in meters. | |
float | m_fYCellSize |
Length of grid cells in the Y direction, in meters. | |
float | m_fYPlotLength |
Length of plot in Y direction. | |
float | m_fXPlotLength |
Length of plot in X direction. | |
int | m_iNumXCells |
Number of grid divisions along the X axis. | |
int | m_iNumYCells |
Number of grid divisions along the Y axis. | |
char | m_cMapFileVersion [MAX_VERSION_SIZE] |
File version of map file. | |
bool | m_bPackageChangeAllowed |
Whether or not the package data structure may be changed. | |
bool | m_bPackageDataChanged |
Whether or not the packages have been set up with a different data structure from the grid. | |
short int | m_iNumPackageIntVals |
Number of package integer data members. | |
short int | m_iNumPackageFloatVals |
Number of package float data members. | |
short int | m_iNumPackageCharVals |
Number of package char data members. | |
short int | m_iNumPackageBoolVals |
Number of package bool data members. | |
char ** | mp_cPackageIntLabels |
Labels for each of the integer data members. | |
char ** | mp_cPackageFloatLabels |
Labels for each of the float data members. | |
char ** | mp_cPackageCharLabels |
Labels for each of the char data members. | |
char ** | mp_cPackageBoolLabels |
Labels for each of the bool data members. | |
Friends | |
class | clGridManager |
class | clPackage |
class | clGridTest |
For testing purposes. | |
Classes | |
struct | stcRecords |
The grid data type handles values which vary in space. It has its own grid coordinate system which may have a different resolution from the plot as a whole.
A grid is a 2D array of stcRecord structures. The size of the array is number of grid cells in the X direction by number in the Y direction (thus, one stcRecord per grid cell). The stcRecord structure has four arrays - one for ints, floats, char strings, and bools. All stcRecords for a grid have the same array size, which is set in the grid's constructor. You don't have to have variables of each type when you create a grid - the grid is happy to leave an array as NULL.
In addition, each stcRecord structure (and thus, each grid cell) has an optional linked list of clPackage objects. Each package object also has four arrays (int, float, char string, bool). All package objects for a grid are also uniform, but they can be different from the main grid. So for instance, your grid might contain space for 3 floats and 1 int in its cells within the stcRecord structures, and then 2 bools in its packages.
clBehavior objects can access and set grid values either through the grid's own coordinates (using X and Y grid numbers) or at specific point coordinates within the plot.
This class knows about the torus shape of the clPlot.
You cannot create objects of this correctly. Use the method clSimManager::CreateGrid() to create one. This ensures that created grids fall under the ownership of the clGridManager class. By the same token, do not delete grids you create. clGridManager will take care of freeing the memory.
Copyright 2003 Charles D. Canham.
clGridBase::clGridBase | ( | clSimManager * | p_oSimManager, | |
char * | cGridName, | |||
short int | iNumIntVals, | |||
short int | iNumFloatVals, | |||
short int | iNumCharVals, | |||
short int | iNumBoolVals, | |||
float | fXCellLength = 0 , |
|||
float | fYCellLength = 0 | |||
) | [protected] |
Constructor.
This will set up the value arrays for the grid cells. Values will be initialized to 0, false, or empty string, as appropriate. The grid will not be ready to use after this; the variables must be registered with labels first using the register functions below.
This will also default a package data structure which is the same as the grid's.
p_oSimManager | A pointer to the sim manager object. | |
cGridName | An identifying name string for the grid object. | |
iNumIntVals | Number of integer data members in a grid cell record. Can be 0. | |
iNumFloatVals | Number of float data members in a grid cell record. Can be 0. | |
iNumCharVals | Number of char data members in a grid cell record. Can be 0. | |
iNumBoolVals | Number of bool data members in a grid cell record. Can be 0. | |
fXCellLength | The length of a grid cell in the X direction, in meters. Not required. If ommitted this will default to the plot's grid cell length. | |
fYCellLength | The length of a grid cell in the Y direction, in meters. Not required. If this is ommitted (i.e. = 0), it is assumed the grid cells are square and the value for the X length is used. |
clGridBase::~clGridBase | ( | ) | [protected] |
Destructor.
short int clGridBase::RegisterDataMember | ( | char * | cLabel, | |
short int | iNumVals, | |||
char ** | p_cLabelList | |||
) | [inline, protected] |
Core function for registering new data members.
If successful, it will return a code for that member for the species and type combo.
cLabel | A string with the name of this variable - keep it short. | |
iNumVals | Number total allowed variables of this type | |
p_cLabelList | Pointer to the correct labels array |
If | registration is unsuccessful, a BAD_DATA or ILLEGAL_OP error will be thrown. |
float clGridBase::GetAverageValue | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
float | fRadius, | |||
bool | bFloat | |||
) | [protected] |
This is the function that actually calculates a circle's average value.
fX | X coordinate of circle center. | |
fY | Y coordinate of circle center. | |
fRadius | Radius of circle over which to average values. | |
bFloat | If true, calculate float values; if false, calculate integer vals. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
float clGridBase::GetAverageValue | ( | float | fFromX, | |
float | fFromY, | |||
float | fToX, | |||
float | fToY, | |||
short int | iCode, | |||
bool | bFloat | |||
) | [protected] |
This is the function that actually calculates a rectangle's average value.
fFromX | X coordinate of the point closest to the origin. | |
fFromY | Y coordinate of the point closest to the origin. | |
fToX | X coordinate of the point farthest from the origin. | |
fToY | Y coordinate of the point farthest from the origin. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
bFloat | If true, calculate float values; if false, calculate integer vals. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
int clGridBase::GetObjectVersion | ( | ) | [inline] |
Returns the version number of the clGridBase class.
Reimplemented from clWorkerBase.
void clGridBase::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Reads in a grid's map, if present in a file.
p_oDoc | DOM tree of parsed document. |
Implements clWorkerBase.
void clGridBase::ReadMapFile | ( | xercesc::DOMDocument * | p_oDoc | ) |
Reads a map file.
Why is this here when map file writing is in output? Because a map might need to be read as part of parameter file input, and we can't depend on output's having been loaded as a behavior.
This will read a map file into the grid object. It will search for a grid map with a grid name matching this grid's name. It will stop and load the first one it finds; any subsequent grids with this name will be ignored. If the plot info doesn't match this grid's, it will throw a BAD_DATA error. The map doesn't have to have all the same data members as the grid, but all data members in the map must be in the grid, including all package data.
The absence of a map for this grid in the document causes no changes to be made.
p_oDoc | DOM tree of parsed document. |
void clGridBase::ChangePackageDataStructure | ( | short int | iNumIntVals, | |
short int | iNumFloatVals, | |||
short int | iNumCharVals, | |||
short int | iNumBoolVals | |||
) |
Changes the data structure for the packages, as for changing from defaults.
This will wipe out all labels. This is only allowed until packages actually exist - then this will throw an ILLEGAL_OP error.
If this function is used, all variables for the package must be registered, even if they have already been registered with the grid.
iNumIntVals | Number of package integer data memebers. | |
iNumFloatVals | Number of package float data memebers. | |
iNumCharVals | Number of package char data memebers. | |
iNumBoolVals | Number of package bool data memebers. |
void clGridBase::GetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
int * | p_iValHolder | |||
) |
Retrieves the value of an integer grid data member at an (X, Y) location.
This function determines which internal grid cell this location is and places the grid value into the variable passed.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_iValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::GetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
float * | p_fValHolder | |||
) |
Retrieves the value of a float grid data member at an (X, Y) location.
This function determines which internal grid cell this location is and places the grid value into the variable passed.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_fValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::GetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
char * | p_cValHolder | |||
) |
Retrieves the value of a char grid data member at an (X, Y) location.
This function determines which internal grid cell this location is and places the grid value into the variable passed.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_cValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::GetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
bool * | p_bValHolder | |||
) |
Retrieves the value of a bool grid data member at an (X, Y) location.
This function determines which internal grid cell this location is and places the grid value into the variable passed.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_bValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::GetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
int * | p_iValHolder | |||
) |
Retrieves the value of an integer data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_iValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::GetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
float * | p_fValHolder | |||
) |
Retrieves the value of a float data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_fValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::GetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
char * | p_cValHolder | |||
) |
Retrieves the value of a char data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_cValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::GetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
bool * | p_bValHolder | |||
) |
Retrieves the value of a bool data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_bValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
float clGridBase::GetAverageFloatValue | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
float | fRadius | |||
) |
Returns the average value of the grid cells in a circle for a float data member.
The circle is defined by a point and a radius (in meters). All grid cells which are included in this circle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.
fX | X coordinate of circle center. | |
fY | Y coordinate of circle center. | |
fRadius | Radius of circle over which to average values. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
float clGridBase::GetAverageIntValue | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
float | fRadius | |||
) |
Returns the average value of the grid cells in a circle for a integer data member.
The circle is defined by a point and a radius (in meters). All grid cells which are included in this circle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.
fX | X coordinate of circle center. | |
fY | Y coordinate of circle center. | |
fRadius | Radius of circle over which to average values. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
float clGridBase::GetAverageFloatValue | ( | float | fFromX, | |
float | fFromY, | |||
float | fToX, | |||
float | fToY, | |||
short int | iCode | |||
) |
Returns the average value of the grid cells in a rectangle for a float data member.
The first point is the point of the rectangle closest to the origin. All cells which are included in this rectangle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.
fFromX | X coordinate of the point closest to the origin. | |
fFromY | Y coordinate of the point closest to the origin. | |
fToX | X coordinate of the point farthest from the origin. | |
fToY | Y coordinate of the point farthest from the origin. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
float clGridBase::GetAverageIntValue | ( | float | fFromX, | |
float | fFromY, | |||
float | fToX, | |||
float | fToY, | |||
short int | iCode | |||
) |
Returns the average value of the grid cells in a rectangle for an int data member.
The first point is the point of the rectangle closest to the origin. All cells which are included in this rectangle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.
fFromX | X coordinate of the point closest to the origin. | |
fFromY | Y coordinate of the point closest to the origin. | |
fToX | X coordinate of the point farthest from the origin. | |
fToY | Y coordinate of the point farthest from the origin. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
float clGridBase::GetOriginXOfCell | ( | int | iX | ) |
Gets the real X coordinate of the origin of a grid cell at a given X grid number.
The origin of the cell is the point closest to the origin of the plot.
iX | X grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
float clGridBase::GetOriginYOfCell | ( | int | iY | ) |
Gets the real Y coordinate of the origin of a grid cell at a given Y grid number.
The origin of the cell is the point closest to the origin of the plot.
iY | Y grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
float clGridBase::GetEndXOfCell | ( | int | iX | ) |
Gets the real X coordinate of the end of a grid cell at a given X grid number.
The end of the cell is the point farthest from the origin of the plot. Since the grid line itself would be part of the next cell over, this is the grid line minus an infinitesimal amount.
iX | X grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
float clGridBase::GetEndYOfCell | ( | int | iY | ) |
Gets the real Y coordinate of the end of a grid cell at a given Y grid number.
The end of the cell is the point farthest from the origin of the plot. Since the grid line itself would be part of the next cell over, this is the grid line minus an infinitesimal amount.
iY | Y grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
clPackage* clGridBase::GetFirstPackageOfCell | ( | int | iX, | |
int | iY | |||
) |
Retrieves first package in linked list for a grid cell.
If there are no packages for this cell, NULL is returned.
iX | Grid number in the X direction for cell for which the package is desired. | |
iY | Grid number in the Y direction for cell for which the package is desired. |
clPackage* clGridBase::GetFirstPackageAtPoint | ( | float | fX, | |
float | fY | |||
) |
Retrieves first package in linked list for a point.
If there are no packages for this point, NULL is returned.
fX | X coordinate of point. | |
fY | Y coordinate of point. |
void clGridBase::GetPointOfCell | ( | short int | iCellX, | |
short int | iCellY, | |||
float * | fX, | |||
float * | fY | |||
) |
Gets the coordinates of a point at the center of a grid cell.
iCellX | X number of grid cell | |
iCellY | Y number of grid cell | |
fX | Address of variable in which to put X coordinate | |
fY | Address of variable in which to put Y coordinate |
void clGridBase::GetCellOfPoint | ( | float | fX, | |
float | fY, | |||
short int * | iCellX, | |||
short int * | iCellY | |||
) |
Retrieves the cell numbers for a point.
fX | X coordinate of point. | |
fY | Y coordinate of point. | |
iCellX | Address of variable in which to place X grid cell number | |
iCellY | Address of variable in which to place X grid cell number |
int clGridBase::GetNumberXCells | ( | ) | [inline] |
Gets number of cells in the X direction.
int clGridBase::GetNumberYCells | ( | ) | [inline] |
Gets number of cells in the Y direction.
float clGridBase::GetLengthXCells | ( | ) | [inline] |
Gets the length of a cell in the X direction.
float clGridBase::GetLengthYCells | ( | ) | [inline] |
Gets the length of a cell in the Y direction.
int clGridBase::GetNumberIntDataMembers | ( | ) | [inline] |
Gets the number of int data members.
int clGridBase::GetNumberFloatDataMembers | ( | ) | [inline] |
Gets the number of float data members.
int clGridBase::GetNumberCharDataMembers | ( | ) | [inline] |
Gets the number of char data members.
int clGridBase::GetNumberBoolDataMembers | ( | ) | [inline] |
Gets the number of bool data members.
int clGridBase::GetNumberIntPackageDataMembers | ( | ) | [inline] |
Gets the number of package int data members.
int clGridBase::GetNumberFloatPackageDataMembers | ( | ) | [inline] |
Gets the number of package float data members.
int clGridBase::GetNumberCharPackageDataMembers | ( | ) | [inline] |
Gets the number of package char data members.
int clGridBase::GetNumberBoolPackageDataMembers | ( | ) | [inline] |
Gets the number of package bool data members.
bool clGridBase::GetPackageDataChanged | ( | ) | [inline] |
Gets whether or not the package data structure has changed.
void clGridBase::SetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
float | fValue | |||
) |
Sets the value of a float data member for the grid cell containing an (X, Y) location.
This function determines which internal grid cell this location is and assigns the grid cell for that grid.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
fValue | Value to set. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::SetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
int | iValue | |||
) |
Sets the value of an integer data member for the grid cell containing an (X, Y) location.
This function determines which internal grid cell this location is and assigns the grid cell for that grid.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
iValue | Value to set. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::SetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
char * | p_cValue | |||
) |
Sets the value of a char data member for the grid cell containing an (X, Y) location.
This function determines which internal grid cell this location is and assigns the grid cell for that grid.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
p_cValue | Value to set. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::SetValueAtPoint | ( | float | fX, | |
float | fY, | |||
short int | iCode, | |||
bool | bValue | |||
) |
Sets the value of a bool data member for the grid cell containing an (X, Y) location.
This function determines which internal grid cell this location is and assigns the grid cell for that grid.
fX | X coordinate of point for which the value is desired. | |
fY | Y coordinate of point for which the value is desired. | |
bValue | Value to set. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGridBase::SetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
float | fValue | |||
) |
Sets the value of a float data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
fValue | Value to set. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::SetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
int | iValue | |||
) |
Sets the value of an integer data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
iValue | Value to set. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::SetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
char * | p_cValue | |||
) |
Sets the value of a char data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
p_cValue | Value to set. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGridBase::SetValueOfCell | ( | int | iX, | |
int | iY, | |||
short int | iCode, | |||
bool | bValue | |||
) |
Sets the value of a bool data member for a particular grid cell.
The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.
iX | Grid number in the X direction for cell for which the value is desired. | |
iY | Grid number in the Y direction for cell for which the value is desired. | |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. | |
bValue | Value to set. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
short int clGridBase::RegisterInt | ( | char * | cLabel | ) |
Registers an integer data member.
This will not check to make sure that there is not already a variable registered with that name.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterFloat | ( | char * | cLabel | ) |
Registers a float data member.
This will not check to make sure that there is not already a variable registered with that name.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterChar | ( | char * | cLabel | ) |
Registers a char data member.
This will not check to make sure that there is not already a variable registered with that name.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterBool | ( | char * | cLabel | ) |
Registers a bool data member.
This will not check to make sure that there is not already a variable registered with that name.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterPackageInt | ( | char * | cLabel | ) |
Registers a package integer data member.
This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterPackageFloat | ( | char * | cLabel | ) |
Registers a package float data member.
This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterPackageChar | ( | char * | cLabel | ) |
Registers a package char data member.
This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGridBase::RegisterPackageBool | ( | char * | cLabel | ) |
Registers a package bool data member.
This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.
cLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
Creates a package.
The new package will be placed after a specified other package, between it and the next package on the linked list.
p_oPreviousPackage | The package after which to place the new package. |
Error | if p_oPreviousPackage is NULL. |
clPackage* clGridBase::CreatePackageOfCell | ( | int | iX, | |
int | iY | |||
) |
Creates a package.
The new package will be placed as the first package for a specific grid cell.
iX | Grid cell number in the X direction. | |
iY | Grid cell number in the Y direction. |
Error | if the grid numbers are invalid. |
clPackage* clGridBase::CreatePackageAtPoint | ( | float | fX, | |
float | fY | |||
) |
Creates a package.
The new package will be placed as the first package for the grid cell of a specific grid cell.
fX | X coordinate of point. | |
fY | Y coordinate of point. |
Error | if the point is not within the grid boundaries. |
void clGridBase::DeletePackage | ( | clPackage * | p_oOldPackage | ) |
Deletes a package.
If the package is in the middle of the package list, the gap will be closed.
p_oOldPackage | Package to delete. |
short int clGridBase::GetIntDataCode | ( | char * | cLabel | ) |
Gets the code for an integer data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetFloatDataCode | ( | char * | cLabel | ) |
Gets the code for a float data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetCharDataCode | ( | char * | cLabel | ) |
Gets the code for a char data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetBoolDataCode | ( | char * | cLabel | ) |
Gets the code for a bool data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetPackageIntDataCode | ( | char * | cLabel | ) |
Gets the code for a package integer data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetPackageFloatDataCode | ( | char * | cLabel | ) |
Gets the code for a package float data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetPackageCharDataCode | ( | char * | cLabel | ) |
Gets the code for a package char data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
short int clGridBase::GetPackageBoolDataCode | ( | char * | cLabel | ) |
Gets the code for a package bool data member.
This function will not be responsible for duplicate labels.
cLabel | The data member's label. |
char* clGridBase::GetIntDataLabel | ( | short int | iCode | ) |
Gets the label for an integer data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetFloatDataLabel | ( | short int | iCode | ) |
Gets the label for a float data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetCharDataLabel | ( | short int | iCode | ) |
Gets the label for a char data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetBoolDataLabel | ( | short int | iCode | ) |
Gets the label for a bool data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetPackageIntDataLabel | ( | short int | iCode | ) |
Gets the label for a package integer data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetPackageFloatDataLabel | ( | short int | iCode | ) |
Gets the label for a package float data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetPackageCharDataLabel | ( | short int | iCode | ) |
Gets the label for a package char data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
char* clGridBase::GetPackageBoolDataLabel | ( | short int | iCode | ) |
Gets the label for a package bool data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
friend class clGridManager [friend] |
friend class clPackage [friend] |
friend class clGridTest [friend] |
For testing purposes.
stcRecords** clGridBase::mp_gridVals [protected] |
The structure holding grid cell data.
Grid cell array. Size is # X grids by # Y grids.
short int clGridBase::m_iNumIntVals [protected] |
How many integer data members per grid cell.
short int clGridBase::m_iNumFloatVals [protected] |
How many float data members per grid cell.
short int clGridBase::m_iNumCharVals [protected] |
How many char data members per grid cell.
short int clGridBase::m_iNumBoolVals [protected] |
How many bool data members per grid cell.
char** clGridBase::mp_cIntLabels [protected] |
Labels for each of the integer data members.
char** clGridBase::mp_cFloatLabels [protected] |
Labels for each of the float data members.
char** clGridBase::mp_cCharLabels [protected] |
Labels for each of the char data members.
char** clGridBase::mp_cBoolLabels [protected] |
Labels for each of the bool data members.
float clGridBase::m_fXCellSize [protected] |
Length of grid cells in the X direction, in meters.
float clGridBase::m_fYCellSize [protected] |
Length of grid cells in the Y direction, in meters.
float clGridBase::m_fYPlotLength [protected] |
Length of plot in Y direction.
float clGridBase::m_fXPlotLength [protected] |
Length of plot in X direction.
int clGridBase::m_iNumXCells [protected] |
Number of grid divisions along the X axis.
int clGridBase::m_iNumYCells [protected] |
Number of grid divisions along the Y axis.
char clGridBase::m_cMapFileVersion[MAX_VERSION_SIZE] [protected] |
File version of map file.
bool clGridBase::m_bPackageChangeAllowed [protected] |
Whether or not the package data structure may be changed.
bool clGridBase::m_bPackageDataChanged [protected] |
Whether or not the packages have been set up with a different data structure from the grid.
short int clGridBase::m_iNumPackageIntVals [protected] |
Number of package integer data members.
short int clGridBase::m_iNumPackageFloatVals [protected] |
Number of package float data members.
short int clGridBase::m_iNumPackageCharVals [protected] |
Number of package char data members.
short int clGridBase::m_iNumPackageBoolVals [protected] |
Number of package bool data members.
char** clGridBase::mp_cPackageIntLabels [protected] |
Labels for each of the integer data members.
char** clGridBase::mp_cPackageFloatLabels [protected] |
Labels for each of the float data members.
char** clGridBase::mp_cPackageCharLabels [protected] |
Labels for each of the char data members.
char** clGridBase::mp_cPackageBoolLabels [protected] |
Labels for each of the bool data members.