com.isti.util.gis
Class LocationPlaces

java.lang.Object
  extended by com.isti.util.gis.LocationPlaces
All Implemented Interfaces:
LocationPlacesInterface

public class LocationPlaces
extends java.lang.Object
implements LocationPlacesInterface

Class LocationNotes creates the location places.


Nested Class Summary
protected static class LocationPlaces.LocationDistHolder
          Class LocationDistHolder holds a location-distance object, a number-of-points and a maximum-distance value.
 
Field Summary
static java.lang.String DEF_PLACEFILES_DIR_NAME
          Default name of directory for places files.
protected  java.lang.String loadLocNoteErrMsgStr
          Location note error message string.
protected  LocationPlaces.LocationDistHolder[] locationDistHolderArr
          Array of location-distance-holder objects.
protected  LogFile logObj
          The log file object.
protected  java.util.List shortMsgLocDistListObj
          List of location-distance objects for "short" messages.
protected  java.util.List shortQuarryMsgLocDistListObj
          List of location-distance objects for "short" "quarry" messages.
 
Constructor Summary
LocationPlaces()
          Creates the location places with the default directory.
LocationPlaces(java.io.File placesDirectoryObj, LogFile logFileObj)
          Creates the location places.
LocationPlaces(java.lang.String placesDirName, LogFile logFileObj)
          Creates the location places.
 
Method Summary
static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr)
          Gets the name of the closest location.
static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr, java.lang.String prefixStr)
          Gets the name of the closest location.
static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr, java.lang.String prefixStr, java.lang.String defaultStr)
          Gets the name of the closest location.
 java.lang.String getErrorMessageString()
          Gets the error message string.
 LocationDistanceInformation[] getLocationDistInfo(double latVal, double lonVal, boolean quarryFlag)
          Returns an array of 'LocationDistanceInformation' objects for the nearest points to the given point.
static LocationDistanceInformation getSameNameLocationInfo(java.util.List listObj, java.lang.String nameStr)
          Returns the first 'LocationDistanceInformation' object with the given name in the given list.
 LocationDistanceInformation getShortMsgLocDistInfo(double latVal, double lonVal, boolean quarryFlag)
          Returns a "short"-message-version 'LocationDistanceInformation' object for the nearest point to the given point.
static boolean locInfocontainsSameName(java.util.List listObj, java.lang.String nameStr)
          Checks if any 'LocationDistanceInformation' objects with the given name exist in the given list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_PLACEFILES_DIR_NAME

public static final java.lang.String DEF_PLACEFILES_DIR_NAME
Default name of directory for places files.

See Also:
Constant Field Values

logObj

protected final LogFile logObj
The log file object.


locationDistHolderArr

protected final LocationPlaces.LocationDistHolder[] locationDistHolderArr
Array of location-distance-holder objects.


shortMsgLocDistListObj

protected final java.util.List shortMsgLocDistListObj
List of location-distance objects for "short" messages.


shortQuarryMsgLocDistListObj

protected final java.util.List shortQuarryMsgLocDistListObj
List of location-distance objects for "short" "quarry" messages.


loadLocNoteErrMsgStr

protected java.lang.String loadLocNoteErrMsgStr
Location note error message string.

Constructor Detail

LocationPlaces

public LocationPlaces()
Creates the location places with the default directory. If there is an error loading the location places the 'getErrorMessageString' method may be used to get the error message string.

See Also:
getLocationNoteErrorMessageString.

LocationPlaces

public LocationPlaces(java.lang.String placesDirName,
                      LogFile logFileObj)
Creates the location places. If there is an error loading the location places the 'getErrorMessageString' method may be used to get the error message string.

Parameters:
placesDirName - the name of the directory for place files.
logFileObj - the log file object.
See Also:
getLocationNoteErrorMessageString.

LocationPlaces

public LocationPlaces(java.io.File placesDirectoryObj,
                      LogFile logFileObj)
Creates the location places. If there is an error loading the location places the 'getErrorMessageString' method may be used to get the error message string.

Parameters:
placesDirectoryObj - the directory for place files.
logFileObj - the log file object.
See Also:
getLocationNoteErrorMessageString.
Method Detail

getErrorMessageString

public java.lang.String getErrorMessageString()
Gets the error message string.

Returns:
the error message string.

getClosestLocationName

public static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr)
Gets the name of the closest location.

Parameters:
infoArr - the array of 'LocationDistanceInformation' objects.
Returns:
the name of the closest location or an empty string if none.
See Also:
getLocationDistInfo.

getClosestLocationName

public static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr,
                                                      java.lang.String prefixStr)
Gets the name of the closest location.

Parameters:
infoArr - the array of 'LocationDistanceInformation' objects.
prefixStr - the prefix string to prefix the location name.
Returns:
the name of the closest location or an empty string if none.
See Also:
getLocationDistInfo.

getClosestLocationName

public static java.lang.String getClosestLocationName(LocationDistanceInformation[] infoArr,
                                                      java.lang.String prefixStr,
                                                      java.lang.String defaultStr)
Gets the name of the closest location.

Parameters:
infoArr - the array of 'LocationDistanceInformation' objects.
prefixStr - the prefix string to prefix the location name.
defaultStr - the default string to use if no location.
Returns:
the name of the closest location or default string if none.
See Also:
getLocationDistInfo.

getLocationDistInfo

public LocationDistanceInformation[] getLocationDistInfo(double latVal,
                                                         double lonVal,
                                                         boolean quarryFlag)
Returns an array of 'LocationDistanceInformation' objects for the nearest points to the given point. The spherical distance (in meters) and azimuth value (in degrees) for each point is determined and entered into the returned 'LocationDistanceInformation' objects.

Specified by:
getLocationDistInfo in interface LocationPlacesInterface
Parameters:
latVal - the latitude of the given point.
lonVal - the longitude of the given point.
quarryFlag - true if the given point references a probable quarry explosion; false if not.
Returns:
An array of 'LocationDistanceInformation' objects, or an empty array if no points within the maximum-distance limits could be found, or null if an error occurred.

locInfocontainsSameName

public static boolean locInfocontainsSameName(java.util.List listObj,
                                              java.lang.String nameStr)
Checks if any 'LocationDistanceInformation' objects with the given name exist in the given list. The names are compared with letter-case, whitespace and character "accents" ignored.

Parameters:
listObj - the list of 'LocationDistanceInformation' objects to use.
nameStr - the name string to use.
Returns:
true if a matching name was found, false if not.

getSameNameLocationInfo

public static LocationDistanceInformation getSameNameLocationInfo(java.util.List listObj,
                                                                  java.lang.String nameStr)
Returns the first 'LocationDistanceInformation' object with the given name in the given list. The names are compared with letter-case, whitespace and character "accents" ignored.

Parameters:
listObj - the list of 'LocationDistanceInformation' objects to use.
nameStr - the name string to use.
Returns:
The first 'LocationDistanceInformation' object with the given name in the given list.

getShortMsgLocDistInfo

public LocationDistanceInformation getShortMsgLocDistInfo(double latVal,
                                                          double lonVal,
                                                          boolean quarryFlag)
Returns a "short"-message-version 'LocationDistanceInformation' object for the nearest point to the given point. The spherical distance (in meters) and azimuth value (in degrees) for the point is determined and entered into the returned 'LocationDistanceInformation' object.

Specified by:
getShortMsgLocDistInfo in interface LocationPlacesInterface
Parameters:
latVal - the latitude of the given point.
lonVal - the longitude of the given point.
quarryFlag - true if the given point references a probable quarry explosion; false if not.
Returns:
A 'LocationDistanceInformation' object, or null if no point could be found or if an error occurred.