org.geotools.data.shapefile.shp
Class ShapeType

java.lang.Object
  extended byorg.geotools.data.shapefile.shp.ShapeType

public final class ShapeType
extends java.lang.Object

Not much but a type safe enumeration of file types as ints and names. The descriptions can easily be tied to a ResourceBundle if someone wants to do that.

Author:
Ian Schneider

Field Summary
static ShapeType ARC
          Represents an Arc shape (id = 3).
static ShapeType ARCM
          Represents an ArcM shape (id = 23).
static ShapeType ARCZ
          Represents an ArcZ shape (id = 13).
 int id
          The integer id of this ShapeType.
static ShapeType MULTIPOINT
          Represents a MultiPoint shape (id = 8).
static ShapeType MULTIPOINTM
          Represents a MultiPointZ shape (id = 28).
static ShapeType MULTIPOINTZ
          Represents a MultiPointZ shape (id = 18).
 java.lang.String name
          The human-readable name for this ShapeType.
static ShapeType NULL
          Represents a Null shape (id = 0).
static ShapeType POINT
          Represents a Point shape (id = 1).
static ShapeType POINTM
          Represents a PointM shape (id = 21).
static ShapeType POINTZ
          Represents a PointZ shape (id = 11).
static ShapeType POLYGON
          Represents a Polygon shape (id = 5).
static ShapeType POLYGONM
          Represents a PolygonM shape (id = 25).
static ShapeType POLYGONZ
          Represents a PolygonZ shape (id = 15).
static ShapeType UNDEFINED
          Represents an Undefined shape (id = -1).
 
Constructor Summary
protected ShapeType(int id, java.lang.String name)
          Creates a new instance of ShapeType.
 
Method Summary
static ShapeType forID(int id)
          Determine the ShapeType for the id.
 ShapeHandler getShapeHandler()
          Each ShapeType corresponds to a handler.
 boolean isLineType()
           
 boolean isMultiPoint()
          Is this a multipoint shape?
 boolean isMultiPointType()
           
 boolean isPointType()
           
 boolean isPolygonType()
           
 java.lang.String toString()
          Get the name of this ShapeType.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final ShapeType NULL
Represents a Null shape (id = 0).


POINT

public static final ShapeType POINT
Represents a Point shape (id = 1).


POINTZ

public static final ShapeType POINTZ
Represents a PointZ shape (id = 11).


POINTM

public static final ShapeType POINTM
Represents a PointM shape (id = 21).


ARC

public static final ShapeType ARC
Represents an Arc shape (id = 3).


ARCZ

public static final ShapeType ARCZ
Represents an ArcZ shape (id = 13).


ARCM

public static final ShapeType ARCM
Represents an ArcM shape (id = 23).


POLYGON

public static final ShapeType POLYGON
Represents a Polygon shape (id = 5).


POLYGONZ

public static final ShapeType POLYGONZ
Represents a PolygonZ shape (id = 15).


POLYGONM

public static final ShapeType POLYGONM
Represents a PolygonM shape (id = 25).


MULTIPOINT

public static final ShapeType MULTIPOINT
Represents a MultiPoint shape (id = 8).


MULTIPOINTZ

public static final ShapeType MULTIPOINTZ
Represents a MultiPointZ shape (id = 18).


MULTIPOINTM

public static final ShapeType MULTIPOINTM
Represents a MultiPointZ shape (id = 28).


UNDEFINED

public static final ShapeType UNDEFINED
Represents an Undefined shape (id = -1).


id

public final int id
The integer id of this ShapeType.


name

public final java.lang.String name
The human-readable name for this ShapeType.
Could easily use ResourceBundle for internationialization.

Constructor Detail

ShapeType

protected ShapeType(int id,
                    java.lang.String name)
Creates a new instance of ShapeType. Hidden on purpose.

Parameters:
id - The id.
name - The name.
Method Detail

toString

public java.lang.String toString()
Get the name of this ShapeType.

Returns:
The name.

isMultiPoint

public boolean isMultiPoint()
Is this a multipoint shape? Hint- all shapes are multipoint except NULL, UNDEFINED, and the POINTs.

Returns:
true if multipoint, false otherwise.

isPointType

public boolean isPointType()

isLineType

public boolean isLineType()

isPolygonType

public boolean isPolygonType()

isMultiPointType

public boolean isMultiPointType()

forID

public static ShapeType forID(int id)
Determine the ShapeType for the id.

Parameters:
id - The id to search for.
Returns:
The ShapeType for the id.

getShapeHandler

public ShapeHandler getShapeHandler()
                             throws ShapefileException
Each ShapeType corresponds to a handler. In the future this should probably go else where to allow different handlers, or something...

Returns:
The correct handler for this ShapeType. Returns a new one.
Throws:
ShapefileException - If the ShapeType is bogus.


Copyright © GeoTools. All Rights Reserved.