com.c5corp.c5utm
Class DemMetadata

java.lang.Object
  extended by com.c5corp.c5utm.DemMetadata

public class DemMetadata
extends java.lang.Object

public class dbHelper DemMetadata.java - part of Landscape database (otherwise known as the C5UTM database). The UtmMetaData class is just a structure to hold the fields in a UTM_METADATA record. It provides a constructor to initialize the fields and accessor methods for all fields. Usually you will not create and instance of this class yourself, but will use the static methods in the C5UTMdatabaseMethods class to create a UtmMetaData from a query of some sort.

Since:
1.0
Author:
Brett Stalbaum Copyright 2002-2006 see LICENSE.txt and UCSD_LICENSE.txt

Field Summary
static int[] CARDINAL_BITS
          CARDINAL_BITS, which also include intercardinal primary directions, are arranged declared in the array in the following order: {N_BIT,NE_BIT,E_BIT,SE_BIT,S_BIT,SW_BIT,W_BIT,NW_BIT}.
static int E_BIT
          Mask to check for E bit (see CARDINAL_BITS[] below)
static int N_BIT
          Mask to check for N bit (see CARDINAL_BITS[] below)
static int NE_BIT
          Mask to check for NE bit (see CARDINAL_BITS[] below)
static int NW_BIT
          Mask to check for NW bit (see CARDINAL_BITS[] below)
static int S_BIT
          Mask to check for S bit (see CARDINAL_BITS[] below)
static int SE_BIT
          Mask to check for SE bit (see CARDINAL_BITS[] below)
static int SW_BIT
          Mask to check for SW bit (see CARDINAL_BITS[] below)
static int W_BIT
          Mask to check for W bit (see CARDINAL_BITS[] below)
 
Constructor Summary
DemMetadata(java.lang.String dem_id, int zone, int columns_x, int max_profile_length_y, double sw_easting, double sw_northing, double nw_easting, double nw_northing, double ne_easting, double ne_northing, double se_easting, double se_northing, java.sql.Date date_added, java.lang.String local_dem_file, java.lang.String file_info, int oneKgrid, int point_stats, double average_elevation)
          Constructs a DemMetadata object, which is normally constructed from data in the database, utilizing static methods as in the C5UTM class.
 
Method Summary
 int calculateSurroundingDemAvailability(java.sql.Connection connection)
          Returns an integer containing flags describing the surrounding dem availability.
 int get1kGridStatus()
          This attribute indicates the status of statistical metadata that has been generated for the areas in this dem, and stored in the tables UTM_1K_GRID_DATA and UTM_POINT_STATS, See the sql for those tables.
 DemMetadata getAdjacentDemMetadata(int cardinal_direction, java.sql.Connection connection)
          Returns the DemMetadata object for the defined cardinal direction.
 double getAverageElevation()
          gets the Average Elevation for the entire dem
 int getColumns_x()
          The number of profiles in the original DEM - think x (the max val of x in UTM coords)
 java.sql.Date getDateAdded()
          date_added is not part of the dem specification it holds the date that the DEM was placed in this database.
 java.lang.String getDemId()
          database primary key
 DemMetadata getEastDem()
          gets the DemMetadata object east of this one.
 java.lang.String getFileInfo()
          The original file information from the origin DEM, TYPE A record number 1
 java.lang.String getLocalDemFile()
          The local DEM file name.
 int getMaxProfileLength_y()
          max_profile_length is not part of the dem specification, but is important in terms imaging an entire dem.
 double getNEeasting()
          Describes the corners of the area the DEM describes
 double getNEnorthing()
          Describes the corners of the area the DEM describes
 DemMetadata getNorthDem()
          gets the DemMetadata object north of this one.
 DemMetadata getNortheastDem()
          gets the DemMetadata object northeast of this one.
 DemMetadata getNorthwestDem()
          gets the DemMetadata object northwest of this one.
 double getNWeasting()
          Describes the corners of the area the DEM describes
 double getNWnorthing()
          Describes the corners of the area the DEM describes
 int getPointStatStatus()
          This attribute indicates the status of statistical metadata that has been generated for the areas in this dem, and stored in the tables UTM_1K_GRID_DATA and UTM_POINT_STATS, See the sql for those tables.
 double getSEeasting()
          Describes the corners of the area the DEM describes
 double getSEnorthing()
          Describes the corners of the area the DEM describes
 DemMetadata getSouthDem()
          gets the DemMetadata object south of this one.
 DemMetadata getSoutheastDem()
          gets the DemMetadata object southeast of this one.
 DemMetadata getSouthwestDem()
          gets the DemMetadata object southwest of this one.
 boolean getSurroundingDemsCalculated()
          returns boolean that indicates whether or not the surround DemMetadata object references have been calculated
 double getSWeasting()
          Describes the corners of the area the DEM describes
 double getSWnorthing()
          Describes the corners of the area the DEM describes
 DemMetadata getWestDem()
          gets the DemMetadata object west of this one.
 int getX()
          returns grid X location, only meaningful after grid location has been calculated by the Grid constructor.
 int getY()
          returns grid Y location, only meaningful after grid location has been calculated by the Grid constructor.
 int getZone()
          The UTM zone
protected  void setEastDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the east of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setGridLoc(int x, int y)
          modifier function for Grid object to use.
protected  void setNorthDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the north of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setNortheastDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the northeast of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setNorthwestDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the northwest of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setSouthDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the south of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setSoutheastDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the southeast of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setSouthwestDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the southwest of this Dem given a Vector of DemMetadata objects to be put in the Grid object
protected  void setSurroundingDemsCalculated(boolean x)
          sets boolean that indicates that the references to surrounding DemMetadata objects have been made
protected  void setWestDem(java.util.Vector<DemMetadata> listDems)
          sets the reference to the Dem to the west of this Dem given a Vector of DemMetadata objects to be put in the Grid object
 void setX(int x)
          modifier function for Grid object to use.
 void setY(int y)
          modifier function for Grid object to use.
 java.lang.String toString()
          Returns a String representation of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NW_BIT

public static final int NW_BIT
Mask to check for NW bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

W_BIT

public static final int W_BIT
Mask to check for W bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

SW_BIT

public static final int SW_BIT
Mask to check for SW bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

S_BIT

public static final int S_BIT
Mask to check for S bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

SE_BIT

public static final int SE_BIT
Mask to check for SE bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

E_BIT

public static final int E_BIT
Mask to check for E bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

NE_BIT

public static final int NE_BIT
Mask to check for NE bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

N_BIT

public static final int N_BIT
Mask to check for N bit (see CARDINAL_BITS[] below)

See Also:
Constant Field Values

CARDINAL_BITS

public static final int[] CARDINAL_BITS
CARDINAL_BITS, which also include intercardinal primary directions, are arranged declared in the array in the following order: {N_BIT,NE_BIT,E_BIT,SE_BIT,S_BIT,SW_BIT,W_BIT,NW_BIT}. The array CARDINAL_BITS can be used to iterate over the values returned by int getSurroundingDemAvailability().

Constructor Detail

DemMetadata

public DemMetadata(java.lang.String dem_id,
                   int zone,
                   int columns_x,
                   int max_profile_length_y,
                   double sw_easting,
                   double sw_northing,
                   double nw_easting,
                   double nw_northing,
                   double ne_easting,
                   double ne_northing,
                   double se_easting,
                   double se_northing,
                   java.sql.Date date_added,
                   java.lang.String local_dem_file,
                   java.lang.String file_info,
                   int oneKgrid,
                   int point_stats,
                   double average_elevation)
Constructs a DemMetadata object, which is normally constructed from data in the database, utilizing static methods as in the C5UTM class.

Parameters:
dem_id - the database id of the DEM
zone - the UTM zone
columns_x - number of coulmns
max_profile_length_y - max profile length (size)
sw_easting - the SW easting
sw_northing - the SW northing
nw_easting - the NW easting
nw_northing - the NW northing
ne_easting - the NE easting
ne_northing - the NE northing
se_easting - the SE easting
se_northing - the SE northing
date_added - date added to db
local_dem_file - local DEM file name
file_info - DEM file info
oneKgrid - describes UTM_1K_GRID_DATA table status
point_stats - describes UTM_POINT_STATS table status (see /sql)
average_elevation - average elevation of DEM (see /sql)
Method Detail

calculateSurroundingDemAvailability

public int calculateSurroundingDemAvailability(java.sql.Connection connection)

Returns an integer containing flags describing the surrounding dem availability. If the bit is true, the dem in the represented direction is available in the database. See the public final static int values declared in this class. Note that the class calculates its result only when first called. The answer is cached, and can not be recalculated without getting a new DemMetadata object. Note that this method does not look in adjacent UTM zones.

Parameters:
connection - database connection
Returns:
an int containing flags describing the status of surrounding dems
See Also:
Connection, CARDINAL_BITS

getAdjacentDemMetadata

public DemMetadata getAdjacentDemMetadata(int cardinal_direction,
                                          java.sql.Connection connection)

Returns the DemMetadata object for the defined cardinal direction. See the public final static int values declared in this class for appropriate aguments. Returns 'this' object if one of the static int values defined in this class is not used as an argument, and null if the area does not exist. public int calculateSurroundingDemAvailability(Connection connection) checks for the existence of the surrounding areas. Note that this method does not look in adjacent UTM zones yet.

Parameters:
cardinal_direction - descriptor of the direction from which to retrive adjacent DemMetadata
connection - the datbase connection
Returns:
the requested DemMetadata
See Also:


setNorthDem

protected void setNorthDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the north of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setNortheastDem

protected void setNortheastDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the northeast of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setEastDem

protected void setEastDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the east of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setSoutheastDem

protected void setSoutheastDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the southeast of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setSouthDem

protected void setSouthDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the south of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setSouthwestDem

protected void setSouthwestDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the southwest of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setWestDem

protected void setWestDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the west of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

setNorthwestDem

protected void setNorthwestDem(java.util.Vector<DemMetadata> listDems)
sets the reference to the Dem to the northwest of this Dem given a Vector of DemMetadata objects to be put in the Grid object

Parameters:
listDems - the Vector of DemMetadata

getNorthDem

public DemMetadata getNorthDem()
gets the DemMetadata object north of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object north of this one

Returns:
DemMetadata to the north of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getNortheastDem

public DemMetadata getNortheastDem()
gets the DemMetadata object northeast of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object northeast of this one

Returns:
DemMetadata to the NE of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getEastDem

public DemMetadata getEastDem()
gets the DemMetadata object east of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object east of this one

Returns:
DemMetadata to the East of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getSoutheastDem

public DemMetadata getSoutheastDem()
gets the DemMetadata object southeast of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object southeast of this one

Returns:
DemMetadata to the SE of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getSouthDem

public DemMetadata getSouthDem()
gets the DemMetadata object south of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object south of this one

Returns:
DemMetadata to the South of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getSouthwestDem

public DemMetadata getSouthwestDem()
gets the DemMetadata object southwest of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object southwest of this one

Returns:
DemMetadata to the SW of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getWestDem

public DemMetadata getWestDem()
gets the DemMetadata object west of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object west of this one

Returns:
DemMetadata the West of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getNorthwestDem

public DemMetadata getNorthwestDem()
gets the DemMetadata object northwest of this one. returns null if it has not been set yet, or if there isn't a DemMetadata object northwest of this one

Returns:
DemMetadata the the NW of this
See Also:
calculateSurroundingDemAvailability(Connection connection)

getDemId

public java.lang.String getDemId()
database primary key

Returns:
the database id

getZone

public int getZone()
The UTM zone

Returns:
the UTM zone of the DEM

getColumns_x

public int getColumns_x()
The number of profiles in the original DEM - think x (the max val of x in UTM coords)

Returns:
number of profiles

getMaxProfileLength_y

public int getMaxProfileLength_y()
max_profile_length is not part of the dem specification, but is important in terms imaging an entire dem. Think max "y" or column size value - note that colums are normally different sizes because 1:24000 DEM data files use UTM, but the paper maps are squared on lat/long, so there the column (profile) lengths adjust for the resulting skew by having different sized profiles. This field counts the number of elevations in the largest profile.

Returns:
the max profile length (size)

getSWeasting

public double getSWeasting()
Describes the corners of the area the DEM describes

Returns:
the easting of the SW corner

getSWnorthing

public double getSWnorthing()
Describes the corners of the area the DEM describes

Returns:
the northing of the SW corner

getNWeasting

public double getNWeasting()
Describes the corners of the area the DEM describes

Returns:
the easting of the NW cornder

getNWnorthing

public double getNWnorthing()
Describes the corners of the area the DEM describes

Returns:
the northing of the NW corner

getNEeasting

public double getNEeasting()
Describes the corners of the area the DEM describes

Returns:
the easting of the NE corner

getNEnorthing

public double getNEnorthing()
Describes the corners of the area the DEM describes

Returns:
the northing of the NE corner

getSEeasting

public double getSEeasting()
Describes the corners of the area the DEM describes

Returns:
the easting of the SE corner

getSEnorthing

public double getSEnorthing()
Describes the corners of the area the DEM describes

Returns:
the northing of the SE corner

getDateAdded

public java.sql.Date getDateAdded()
date_added is not part of the dem specification it holds the date that the DEM was placed in this database.

Returns:
the date this DemMetadata was added

getLocalDemFile

public java.lang.String getLocalDemFile()
The local DEM file name. (Path to local DEM file - Which must be renamed for the geographic name taken from the first part of the TYPE A record number 1, (first 40 chars), spaces replaced with underscores. All files must have a .dem extension. note that these files may use *different* horizontal and vertical datums because all points in C5UTM are forcefully converted to a particular (configurable) datum.

Returns:
the local dem file

getFileInfo

public java.lang.String getFileInfo()
The original file information from the origin DEM, TYPE A record number 1

Returns:
the DEM file info

get1kGridStatus

public int get1kGridStatus()

This attribute indicates the status of statistical metadata that has been generated for the areas in this dem, and stored in the tables UTM_1K_GRID_DATA and UTM_POINT_STATS, See the sql for those tables. 0 indicates that the area needs full processing. 1 indicates that the area was processed, but there were void areas near the edges (probably because points from adjoining dems were not present in the database.) 2 indicates that every point has been processed.

The UTM_1K_GRID_DATA table simply references data records in the UTM_POINT_STATS table. This allows access to data representing a 1 kilometer grid overlaying the landscape at even multiples of 1000 meters in the grid system. Note that this is the same as the UTM grid overlaid on typical USGS maps.

Returns:
the 1K grid status
See Also:
Build1KGridStats

getPointStatStatus

public int getPointStatStatus()

This attribute indicates the status of statistical metadata that has been generated for the areas in this dem, and stored in the tables UTM_1K_GRID_DATA and UTM_POINT_STATS, See the sql for those tables. 0 indicates that the area needs full processing. 1 indicates that the area was processed, but there were void areas near the edges (probably because points from adjoining dems were not present in the database.) 2 indicates that every point has been processed.

The UTM_POINT_STATS records represent statistics about the 1K square surrounding each point in the database. This data can take an incredible amount of time to calculate

Returns:
the point grid status

getAverageElevation

public double getAverageElevation()
gets the Average Elevation for the entire dem

Returns:
the average elevation

setSurroundingDemsCalculated

protected void setSurroundingDemsCalculated(boolean x)
sets boolean that indicates that the references to surrounding DemMetadata objects have been made

Parameters:
x - flag

getSurroundingDemsCalculated

public boolean getSurroundingDemsCalculated()
returns boolean that indicates whether or not the surround DemMetadata object references have been calculated

Returns:
true if this knows its surrounding dems

getX

public int getX()
returns grid X location, only meaningful after grid location has been calculated by the Grid constructor. Otherwise it returns min integer value

Returns:
grid x location

getY

public int getY()
returns grid Y location, only meaningful after grid location has been calculated by the Grid constructor. Otherwise it returns min integer value

Returns:
grid y location

setGridLoc

protected void setGridLoc(int x,
                          int y)
modifier function for Grid object to use. sets both x and y

Parameters:
x - grid x location
y - grid y location

setX

public void setX(int x)
modifier function for Grid object to use. sets x

Parameters:
x - grid x location

setY

public void setY(int y)
modifier function for Grid object to use. sets y

Parameters:
y - grid y location

toString

public java.lang.String toString()
Returns a String representation of the object

Overrides:
toString in class java.lang.Object