jwo.landserf.structure
Class SpatialObject

java.lang.Object
  extended byjwo.landserf.structure.SpatialObject
All Implemented Interfaces:
Serializable, SpatialModel
Direct Known Subclasses:
GISVector, RasterMap, VectorMap

public abstract class SpatialObject
extends Object
implements SpatialModel, Serializable

Class for defining spatial objects. All such spatial objects have some geographical footprint and can compare themselves with other geographical footprints. The also have a colour table associated with them for display.

Version:
2.0, 5th February, 2004.
Author:
Jo Wood
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface jwo.landserf.structure.SpatialModel
ADJACENT, AREA, CONTOUR, ENCLOSES, INTERSECTION, LINE, MATCHES, MSN, NO_VALUE, OUT_OF_BOUNDS, OVERLAPS, POINT, RASTER_2D, RASTER_3D, SEPARATE, TIN, UNDEFINED, UNION, UNKNOWN_MODEL, VECTOR_2D, VECTOR_3D, VOLUME, WITHIN
 
Constructor Summary
SpatialObject()
          Creates a spatial object with a default spatial footprint.
SpatialObject(Footprint footprint)
          Creates an spatial object with the given spatial footprint.
SpatialObject(Footprint footprint, Header header)
          Creates an spatial object with the given spatial footprint and header.
SpatialObject(SpatialObject oldSpatialObject)
          Creates a spatial object based on the attributes of the given one.
 
Method Summary
 int compare(SpatialModel other)
          Makes a spatial comparison between this object and another.
 AttributeTable getAttributeTable()
          Returns optional attribute table associated with this object or null if one has not been created.
 Footprint getBounds()
          Returns the 2d bounding rectangle of the object.
 ColourTable getColourTable()
          Returns colour table associated with this object.
static String getComparisonText(int comparison)
          Reports a textual representation of the given comparison type.
 Header getHeader()
          Reports the header information associated with this object.
 Footprint getIntersectionMER(Footprint otherFp)
          Calculates the the intersection of the given footprint with this MER.
abstract  float getMaxAttribute()
          Reports the maximum attribute value of the object.
abstract  float getMinAttribute()
          Reports the minimum attribute value of the object.
 int getType()
          Reports the type of spatial object.
 Footprint getUnionMER(Footprint otherFp)
          Calculates the MER of the union of the given footprint with this MER.
 void move(float xOffset, float yOffset)
          Moves the spatial object relatively by the given x,y coordinates.
 void setAttributeTable(AttributeTable aTable)
          Sets the attribute table assocaited with this object.
 void setBounds(Footprint footprint)
          Sets the bounding rectangle of this object.
 void setColourTable(ColourTable cTable)
          Sets the colour table assocaited with this object.
 void setHeader(Header newHeader)
          Sets a new the header to be associated with this object.
 String toString()
          Reports the details of this spatial object.
abstract  void updateBounds()
          Forces the object to find its new spatial and attribute bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jwo.landserf.structure.SpatialModel
getAttribute, getImage, subset
 

Constructor Detail

SpatialObject

public SpatialObject()
Creates a spatial object with a default spatial footprint.


SpatialObject

public SpatialObject(Footprint footprint)
Creates an spatial object with the given spatial footprint.

Parameters:
footprint - Spatial footprint of this object.

SpatialObject

public SpatialObject(Footprint footprint,
                     Header header)
Creates an spatial object with the given spatial footprint and header.

Parameters:
footprint - Spatial footprint of this object.
header - Header associated with this spatial object.

SpatialObject

public SpatialObject(SpatialObject oldSpatialObject)
Creates a spatial object based on the attributes of the given one.

Parameters:
oldSpatialObject - Spatial object map to copy.
Method Detail

compare

public int compare(SpatialModel other)
Makes a spatial comparison between this object and another. Assumes that both objects are rectangular.

Specified by:
compare in interface SpatialModel
Parameters:
other - Spatial model with which to make a comparison.
Returns:
One of five topologic relations (WITHIN, MATCHES, OVERLAPS, ENCLOSES, or SEPARATE).

getUnionMER

public Footprint getUnionMER(Footprint otherFp)
Calculates the MER of the union of the given footprint with this MER.

Parameters:
otherFp - Footprint of object to union with this MER.

getIntersectionMER

public Footprint getIntersectionMER(Footprint otherFp)
Calculates the the intersection of the given footprint with this MER.

Parameters:
otherFp - Footprint of object to intersect with this MER.

move

public void move(float xOffset,
                 float yOffset)
Moves the spatial object relatively by the given x,y coordinates.

Parameters:
xOffset - Offset in the x direction.
yOffset - Offset in the y direction.

toString

public String toString()
Reports the details of this spatial object.

Returns:
Summary of this spatial object.

getType

public int getType()
Reports the type of spatial object.

Specified by:
getType in interface SpatialModel
Returns:
Type of spatial object (e.g. SpatialModel.LINE, SpatialModel.AREA etc.).

getMinAttribute

public abstract float getMinAttribute()
Reports the minimum attribute value of the object.

Returns:
Minimum attribute value.

getMaxAttribute

public abstract float getMaxAttribute()
Reports the maximum attribute value of the object.

Returns:
Maximum attribute value.

updateBounds

public abstract void updateBounds()
Forces the object to find its new spatial and attribute bounds.


getHeader

public Header getHeader()
Reports the header information associated with this object.

Specified by:
getHeader in interface SpatialModel
Returns:
Header information (title, copyright etc).

setHeader

public void setHeader(Header newHeader)
Sets a new the header to be associated with this object.

Parameters:
newHeader - New header information (title, copyright etc).

setBounds

public void setBounds(Footprint footprint)
Sets the bounding rectangle of this object.

Specified by:
setBounds in interface SpatialModel
Parameters:
footprint - Spatial footprint to assign to this object.

getBounds

public Footprint getBounds()
Returns the 2d bounding rectangle of the object.

Specified by:
getBounds in interface SpatialModel
Returns:
Minimum enclosing rectangle of object.

getColourTable

public ColourTable getColourTable()
Returns colour table associated with this object.

Returns:
Object's colour table.

setColourTable

public void setColourTable(ColourTable cTable)
Sets the colour table assocaited with this object.

Parameters:
cTable - New colour table to associate with this object

getAttributeTable

public AttributeTable getAttributeTable()
Returns optional attribute table associated with this object or null if one has not been created. Attribute tables are only needed if each item that makes up a spatial object has more than one value, or if that value is non-numeric.

Returns:
Object's attribute table or null if it does not exist.

setAttributeTable

public void setAttributeTable(AttributeTable aTable)
Sets the attribute table assocaited with this object. Attribute tables are only needed if each item that makes up a spatial object has more than one value, or if that value is non-numeric.

Parameters:
aTable - New attribute table to associate with this object

getComparisonText

public static String getComparisonText(int comparison)
Reports a textual representation of the given comparison type.

Parameters:
comparison - Type of comparison to query.
Returns:
Text representation of the given comparison.


Copyright Jo Wood, 1996-2004, last modified, 19th March, 2004