SORTIE Java Interface
1
|
This class represents grids in the core model. More...
Public Member Functions | |
Grid (String sGridName, DataMember[] p_oMembers, DataMember[] p_oPackageMembers, float fXCellLength, float fYCellLength) | |
Constructor. More... | |
boolean | getIsEdited () |
Get whether or not the grid has been edited. More... | |
int | getFloatCode (String sCodeName) |
Gets the code for a float data member. More... | |
int | getIntCode (String sCodeName) |
Gets the code for an int data member. More... | |
int | getBoolCode (String sCodeName) |
Gets the code for a bool data member. More... | |
int | getCharCode (String sCodeName) |
Gets the code for a char data member. More... | |
int | getFloatPackageCode (String sCodeName) |
Gets the code for a float package data member. More... | |
int | getIntPackageCode (String sCodeName) |
Gets the code for an int package data member. More... | |
int | getBoolPackageCode (String sCodeName) |
Gets the code for a bool package data member. More... | |
int | getCharPackageCode (String sCodeName) |
Gets the code for a char package data member. More... | |
void | setGridFloatCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a float data member. More... | |
void | setGridIntCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for an int data member. More... | |
void | setGridCharCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a char data member. More... | |
void | setGridBoolCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a bool data member. More... | |
void | setGridPackageFloatCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a package float data member. More... | |
void | setGridPackageIntCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a package integer data member. More... | |
void | setGridPackageCharCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a package char data member. More... | |
void | setGridPackageBoolCode (String sDataMember, int iIndex) throws ModelException |
Sets the XML grid map code for a package bool data member. More... | |
void | setGridValue (int iX, int iY, int iCode, Integer iValue, Plot oPlot) throws ModelException |
Sets a grid map integer value. More... | |
void | setGridValue (int iX, int iY, int iCode, Float fValue, Plot oPlot) throws ModelException |
Sets a grid map float value. More... | |
void | setGridValue (int iX, int iY, int iCode, String sValue, Plot oPlot) throws ModelException |
Sets a grid map char value. More... | |
void | setGridValue (int iX, int iY, int iCode, Boolean bValue, Plot oPlot) throws ModelException |
Sets a grid map bool value. More... | |
void | setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Integer iValue, Plot oPlot) throws ModelException |
Sets a grid map package integer value. More... | |
void | setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Float fValue, Plot oPlot) throws ModelException |
Sets a grid map package float value. More... | |
void | setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, String sValue, Plot oPlot) throws ModelException |
Sets a grid map package char value. More... | |
void | setGridPackageValue (int iX, int iY, int iPackageIndex, int iCode, Boolean bValue, Plot oPlot) throws ModelException |
Sets a grid map package bool value. More... | |
String | getName () |
Gets the grid's name. More... | |
void | setGridName (String sGridName) |
Sets the grid's name. More... | |
float | getXCellLength () |
Gets the X cell length for this grid. More... | |
float | getYCellLength () |
Gets the Y cell length for this grid. More... | |
void | setXCellLength (float fXCellLength) throws ModelException |
Sets the length of cells in the X direction. More... | |
void | setYCellLength (float fYCellLength) throws ModelException |
Sets the length of cells in the Y direction. More... | |
void | clearMapValues () |
Erases all current grid map values without touching any other settings. More... | |
DataMember [] | getDataMembers () |
Gets the list of data members. More... | |
void | setDataMembers (DataMember[] p_oMembers, DataMember[] p_oPackageMembers) throws ModelException |
Sets the list of data members. More... | |
DataMember [] | getPackageDataMembers () |
Gets the list of package data members. More... | |
void | writeXML (BufferedWriter oOut, Plot oPlot) throws ModelException |
Writes the grid's XML grid map to a file. More... | |
boolean | isEdited () |
Whether this grid has been edited. More... | |
Public Attributes | |
DataMember [] | mp_oDataMembers |
This is a list of the data members in a grid and thus available for saving in detailed output files etc. More... | |
String [] | mp_sIntDataMembers |
Code names of int data members. More... | |
ArrayList< GridValue > | mp_oGridVals = new ArrayList<GridValue>(0) |
Holds GridValue objects to be written to a grid map. More... | |
Protected Member Functions | |
PackageGridValue | getPackageGridValue (GridValue oCell, int iPackageIndex) throws ModelException |
Finds a requested package for a grid cell, or creates a new one if it does not already exist. More... | |
GridValue | getGridValue (int iX, int iY, Plot oPlot) throws ModelException |
Finds a requested grid cell, or creates a new one if it does not already exist. More... | |
Protected Attributes | |
String | m_sGridName |
This is the grid's name - it should match the one in the code. More... | |
float | m_fLengthXCells |
Length of cells in the X direction - optional. More... | |
boolean | m_bEdited = false |
Whether or not this grid has been edited. More... | |
ArrayList< Integer > | mp_iGridIntTransforms |
Index position for integer data members. More... | |
Private Member Functions | |
void | organizeDataMembers (DataMember[] p_oMembers, DataMember[] p_oPackageMembers) |
This function takes arrays of data members and assigns them into the data member name list arrays. More... | |
This class represents grids in the core model.
Objects of this class control data saving for grids.
This will keep track of a custom cell length in the X and Y directions. It is possible to change this at any time, but results could be disastrous if there is existing grid map data; it will not be updated to reflect the change.
Copyright: Copyright (c) Charles D. Canham 2003
Company: Cary Institute of Ecosystem Studies
Edit history:
---------------—
April 28, 2004: Submitted in beta version (LEM)
February 4, 2008: Updated to conform to Java 6 compliance (LEM)
August 11, 2011: made a notification of changes to the parent object (LEM)
sortie.data.funcgroups.Grid.Grid | ( | String | sGridName, |
DataMember [] | p_oMembers, | ||
DataMember [] | p_oPackageMembers, | ||
float | fXCellLength, | ||
float | fYCellLength | ||
) |
Constructor.
p_oMembers | The data members for this grid. |
p_oPackageMembers | The package data members for this grid, or NULL if there are no package data members. |
sGridName | The name of the grid. This should match the name of the grid in the code. |
fXCellLength | Length of cells in the X direction, in m |
fYCellLength | Length of cells in the Y direction, in m |
void sortie.data.funcgroups.Grid.clearMapValues | ( | ) |
Erases all current grid map values without touching any other settings.
int sortie.data.funcgroups.Grid.getBoolCode | ( | String | sCodeName | ) |
Gets the code for a bool data member.
sCodeName | String Code name (NOT display name) of data member. |
int sortie.data.funcgroups.Grid.getBoolPackageCode | ( | String | sCodeName | ) |
Gets the code for a bool package data member.
sCodeName | String Code name (NOT display name) of data member. |
int sortie.data.funcgroups.Grid.getCharCode | ( | String | sCodeName | ) |
Gets the code for a char data member.
sCodeName | String Code name (NOT display name) of data member. |
int sortie.data.funcgroups.Grid.getCharPackageCode | ( | String | sCodeName | ) |
Gets the code for a char package data member.
sCodeName | String Code name (NOT display name) of data member. |
DataMember [] sortie.data.funcgroups.Grid.getDataMembers | ( | ) |
Gets the list of data members.
int sortie.data.funcgroups.Grid.getFloatCode | ( | String | sCodeName | ) |
Gets the code for a float data member.
sCodeName | String Code name (NOT display name) of data member. |
int sortie.data.funcgroups.Grid.getFloatPackageCode | ( | String | sCodeName | ) |
Gets the code for a float package data member.
sCodeName | String Code name (NOT display name) of data member. |
|
protected |
int sortie.data.funcgroups.Grid.getIntCode | ( | String | sCodeName | ) |
Gets the code for an int data member.
sCodeName | String Code name (NOT display name) of data member. |
int sortie.data.funcgroups.Grid.getIntPackageCode | ( | String | sCodeName | ) |
Gets the code for an int package data member.
sCodeName | String Code name (NOT display name) of data member. |
boolean sortie.data.funcgroups.Grid.getIsEdited | ( | ) |
Get whether or not the grid has been edited.
String sortie.data.funcgroups.Grid.getName | ( | ) |
Gets the grid's name.
DataMember [] sortie.data.funcgroups.Grid.getPackageDataMembers | ( | ) |
Gets the list of package data members.
|
protected |
Finds a requested package for a grid cell, or creates a new one if it does not already exist.
oCell | Cell for which to get the package. |
iPackageIndex | Index of the package to get in the package list of the cell, starting at 0. |
ModelException | if the coordinates are invalid, or if the package index is higher than 1 + the number of packages already in the cell. |
float sortie.data.funcgroups.Grid.getXCellLength | ( | ) |
Gets the X cell length for this grid.
float sortie.data.funcgroups.Grid.getYCellLength | ( | ) |
Gets the Y cell length for this grid.
boolean sortie.data.funcgroups.Grid.isEdited | ( | ) |
Whether this grid has been edited.
|
private |
This function takes arrays of data members and assigns them into the data member name list arrays.
p_oMembers | The data members for this grid. |
p_oPackageMembers | The package data members for this grid, or NULL if there are no package data members. |
void sortie.data.funcgroups.Grid.setDataMembers | ( | DataMember [] | p_oMembers, |
DataMember [] | p_oPackageMembers | ||
) | throws ModelException |
Sets the list of data members.
This ensures that maps are updated appropriately.
p_oMembers | The list of data members to set. Can be null. |
p_oPackageMembers | The list of package members to set. Can be null. |
void sortie.data.funcgroups.Grid.setGridBoolCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a bool data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridCharCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a char data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridFloatCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a float data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridIntCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for an int data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridName | ( | String | sGridName | ) |
Sets the grid's name.
sGridName | The name. |
void sortie.data.funcgroups.Grid.setGridPackageBoolCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a package bool data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridPackageCharCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a package char data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridPackageFloatCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a package float data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridPackageIntCode | ( | String | sDataMember, |
int | iIndex | ||
) | throws ModelException |
Sets the XML grid map code for a package integer data member.
sDataMember | Data member code name. |
iIndex | Code number. |
ModelException | if the data member isn't recognized. |
void sortie.data.funcgroups.Grid.setGridPackageValue | ( | int | iX, |
int | iY, | ||
int | iPackageIndex, | ||
int | iCode, | ||
Integer | iValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map package integer value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iPackageIndex | Package index number. |
iCode | Index at which to set the value. |
iValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridPackageValue | ( | int | iX, |
int | iY, | ||
int | iPackageIndex, | ||
int | iCode, | ||
Float | fValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map package float value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iPackageIndex | Package index number. |
iCode | Index at which to set the value. |
fValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridPackageValue | ( | int | iX, |
int | iY, | ||
int | iPackageIndex, | ||
int | iCode, | ||
String | sValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map package char value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iPackageIndex | Package index number. |
iCode | Index at which to set the value. |
sValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridPackageValue | ( | int | iX, |
int | iY, | ||
int | iPackageIndex, | ||
int | iCode, | ||
Boolean | bValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map package bool value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iPackageIndex | Package index number. |
iCode | Index at which to set the value. |
bValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridValue | ( | int | iX, |
int | iY, | ||
int | iCode, | ||
Integer | iValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map integer value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iCode | Index at which to set the value. |
iValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridValue | ( | int | iX, |
int | iY, | ||
int | iCode, | ||
Float | fValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map float value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iCode | Index at which to set the value. |
fValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridValue | ( | int | iX, |
int | iY, | ||
int | iCode, | ||
String | sValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map char value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iCode | Index at which to set the value. |
sValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setGridValue | ( | int | iX, |
int | iY, | ||
int | iCode, | ||
Boolean | bValue, | ||
Plot | oPlot | ||
) | throws ModelException |
Sets a grid map bool value.
This will assume that the code needs to go through the transform array - i.e. it needs translating from the local grid map reference point.
iX | X grid cell coordinate. |
iY | Y grid cell coordinate. |
iCode | Index at which to set the value. |
bValue | Value to set. |
oPlot | Plot object. |
ModelException |
void sortie.data.funcgroups.Grid.setXCellLength | ( | float | fXCellLength | ) | throws ModelException |
Sets the length of cells in the X direction.
If the length of Y is 0, it will be set to the same value.
fXCellLength | Length of cells in the X direction, in meters. |
ModelException | If the value is negative. |
void sortie.data.funcgroups.Grid.setYCellLength | ( | float | fYCellLength | ) | throws ModelException |
Sets the length of cells in the Y direction.
If the length of X is 0, it will be set to the same value.
fYCellLength | Length of cells in the Y direction, in meters. |
ModelException | If the value is negative. |
void sortie.data.funcgroups.Grid.writeXML | ( | BufferedWriter | oOut, |
Plot | oPlot | ||
) | throws ModelException |
Writes the grid's XML grid map to a file.
If there are no grid map values, this will not write anything.
oOut | File stream to write to. |
oPlot | Plot object. |
ModelException | if there is something wrong with the file. |
|
protected |
Whether or not this grid has been edited.
|
protected |
Length of cells in the X direction - optional.
|
protected |
This is the grid's name - it should match the one in the code.
|
protected |
Index position for integer data members.
Vector position equals the data member position in the map being read, and vector value is the index for GridValue.
DataMember [] sortie.data.funcgroups.Grid.mp_oDataMembers |
This is a list of the data members in a grid and thus available for saving in detailed output files etc.
Holds GridValue objects to be written to a grid map.
String [] sortie.data.funcgroups.Grid.mp_sIntDataMembers |
Code names of int data members.