NVS Shapefile library Version 3.2
NVision Solutions, Inc.

com.nvs.shapefile
Class ShapeObject

java.lang.Object
  |
  +--com.nvs.shapefile.ShapeObject

public class ShapeObject
extends java.lang.Object

A ShapeObject represents a shape record within a Shapefile.

Author:
Zack Watts
NVisionSolutions, Inc.

Field Summary
static int MULTIPOINT
          Shape type value of a MultiPoint shapefile type descriptor (8)
static int POINT
          Shape type value of a Point shapefile type descriptor (1)
static int POLYGON
          Shape type value of a Polygon shapefile type descriptor (5)
static int POLYLINE
          Shape type value of a PolyLine shapefile type descriptor (3)
static int UNDEFINED
          User didn't specify what sort of shape this is supposed to be
 
Constructor Summary
ShapeObject()
          Creates a new ShapeObject with an UNDEFINED type
ShapeObject(int type)
          Creates a new ShapeObject with the specified type
 
Method Summary
 void addPart(int part)
          Adds the specified part
 void addPoint(com.nvs.shapefile.Point point)
          Adds the specified point to this ShapeObject
 void computeExtents()
          Computes the minimum extents for this ShapeObject and sets its BoundingBox to them
 com.nvs.shapefile.BoundingBox getBoundingBox()
          Returns this ShapeObject's BoundingBox
 int getPart(int index)
          Returns the part at the specified index
 int getPartCount()
          Returns the number of parts in this ShapeObject
 java.util.ArrayList getParts()
          Returns this ShapeObject's parts as an ArrayList
 com.nvs.shapefile.Point getPoint(int index)
          Returns the point at the specified index
 int getPointCount()
          Returns the number of points in this ShapeObject
 java.util.ArrayList getPoints()
          Returns this ShapeObject's Points as an ArrayList
 com.nvs.shapefile.Record getRecord()
          Returns this ShapeObject's Record
 int getType()
          Returns this ShapeObject's type
 void removePart(int index)
          Removes the part at the specified index
 void removePoint(int index)
          Removes the point at the specified index
 void setBoundingBox(com.nvs.shapefile.BoundingBox box)
          Sets this ShapeObject's BoundingBox
 void setParts(java.util.Collection parts)
          Sets the parts of this ShapeObject to those in the specified Collection
 void setPoints(java.util.Collection points)
          Sets this ShapeObject's Points to those in the specified Collection
 void setRecord(com.nvs.shapefile.Record record)
          Sets this ShapeObject's Record
 void setType(int type)
          Sets the type of this ShapeObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
User didn't specify what sort of shape this is supposed to be

See Also:
Constant Field Values

POINT

public static final int POINT
Shape type value of a Point shapefile type descriptor (1)

See Also:
Constant Field Values

MULTIPOINT

public static final int MULTIPOINT
Shape type value of a MultiPoint shapefile type descriptor (8)

See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
Shape type value of a PolyLine shapefile type descriptor (3)

See Also:
Constant Field Values

POLYGON

public static final int POLYGON
Shape type value of a Polygon shapefile type descriptor (5)

See Also:
Constant Field Values
Constructor Detail

ShapeObject

public ShapeObject()
Creates a new ShapeObject with an UNDEFINED type


ShapeObject

public ShapeObject(int type)
Creates a new ShapeObject with the specified type

Parameters:
type - the desired type of the ShapeObject
legal type values are:
ShapeObject.UNDEFINED
ShapeObject.POINT
ShapeObject.MULTIPOINT
ShapeObject.POLYLINE
ShapeObject.POLYGON
Method Detail

addPoint

public void addPoint(com.nvs.shapefile.Point point)
Adds the specified point to this ShapeObject

Parameters:
point - Point to be added

removePoint

public void removePoint(int index)
                 throws java.lang.IndexOutOfBoundsException
Removes the point at the specified index

Parameters:
index - Index of point to be removed
Throws:
java.lang.IndexOutOfBoundsException - when the index is out of bounds

getPoint

public com.nvs.shapefile.Point getPoint(int index)
                                 throws java.lang.IndexOutOfBoundsException
Returns the point at the specified index

Parameters:
index - Desired index as an int
Returns:
Point Point at the specified index
Throws:
java.lang.IndexOutOfBoundsException - when the index is out of bounds

getPoints

public java.util.ArrayList getPoints()
Returns this ShapeObject's Points as an ArrayList

Returns:
ArrayList this ShapeObject's Point objects

setPoints

public void setPoints(java.util.Collection points)
Sets this ShapeObject's Points to those in the specified Collection

Parameters:
points - New Points as a Collection of Point objects

addPart

public void addPart(int part)
Adds the specified part

Parameters:
part - Part to be added as an int

removePart

public void removePart(int index)
                throws java.lang.IndexOutOfBoundsException
Removes the part at the specified index

Parameters:
index - Index of part to be removed
Throws:
java.lang.IndexOutOfBoundsException - when the index is out of bounds

getPart

public int getPart(int index)
            throws java.lang.IndexOutOfBoundsException
Returns the part at the specified index

Parameters:
index - Index of desired part as an int
Returns:
int the part as the specified index
Throws:
java.lang.IndexOutOfBoundsException - when index is out of bounds

setParts

public void setParts(java.util.Collection parts)
Sets the parts of this ShapeObject to those in the specified Collection

Parameters:
parts - New parts as a Collection of ints

getParts

public java.util.ArrayList getParts()
Returns this ShapeObject's parts as an ArrayList

Returns:
ArrayList this ShapeObject's parts as an ArrayList of ints

getType

public int getType()
Returns this ShapeObject's type

Returns:
int this ShapeObject's type legal type values are:
ShapeObject.UNDEFINED
ShapeObject.POINT
ShapeObject.MULTIPOINT
ShapeObject.POLYLINE
ShapeObject.POLYGON

setType

public void setType(int type)
Sets the type of this ShapeObject

Parameters:
type - New type as an int legal type values are:
ShapeObject.UNDEFINED
ShapeObject.POINT
ShapeObject.MULTIPOINT
ShapeObject.POLYLINE
ShapeObject.POLYGON

getRecord

public com.nvs.shapefile.Record getRecord()
Returns this ShapeObject's Record

Returns:
Record this ShapeObject's Record

setRecord

public void setRecord(com.nvs.shapefile.Record record)
Sets this ShapeObject's Record

Parameters:
record - New Record

setBoundingBox

public void setBoundingBox(com.nvs.shapefile.BoundingBox box)
Sets this ShapeObject's BoundingBox

Parameters:
box - New BoundingBox

getBoundingBox

public com.nvs.shapefile.BoundingBox getBoundingBox()
Returns this ShapeObject's BoundingBox

Returns:
BoundingBox this ShapeObject's BoundingBox

getPointCount

public int getPointCount()
Returns the number of points in this ShapeObject

Returns:
int the number of points in this ShapeObject

getPartCount

public int getPartCount()
Returns the number of parts in this ShapeObject

Returns:
int the number of parts in this ShapeObject

computeExtents

public void computeExtents()
Computes the minimum extents for this ShapeObject and sets its BoundingBox to them


NVS Shapefile library Version 3.2
NVision Solutions, Inc.