org.geotools.data.shapefile.shp
Class MultiLineHandler

java.lang.Object
  extended byorg.geotools.data.shapefile.shp.MultiLineHandler
All Implemented Interfaces:
ShapeHandler

public class MultiLineHandler
extends java.lang.Object
implements ShapeHandler

The default JTS handler for shapefile. Currently uses the default JTS GeometryFactory, since it doesn't seem to matter.


Constructor Summary
MultiLineHandler()
          Create a MultiLineHandler for ShapeType.ARC
MultiLineHandler(ShapeType type)
          Create a MultiLineHandler for one of:
ShapeType.ARC,ShapeType.ARCM,ShapeType.ARCZ
 
Method Summary
 int getLength(java.lang.Object geometry)
          Get the length of the given geometry Object in bytes not 16-bit words.
 ShapeType getShapeType()
          Get the type of shape stored (ShapeType.ARC,ShapeType.ARCM,ShapeType.ARCZ)
 java.lang.Object read(java.nio.ByteBuffer buffer, ShapeType type)
          Read a geometry from the ByteBuffer.
 java.lang.Object readOld(java.nio.ByteBuffer buffer, ShapeType type)
           
 void write(java.nio.ByteBuffer buffer, java.lang.Object geometry)
          Write the geometry into the ByteBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLineHandler

public MultiLineHandler()
Create a MultiLineHandler for ShapeType.ARC


MultiLineHandler

public MultiLineHandler(ShapeType type)
                 throws ShapefileException
Create a MultiLineHandler for one of:
ShapeType.ARC,ShapeType.ARCM,ShapeType.ARCZ

Parameters:
type - The ShapeType to use.
Throws:
ShapefileException - If the ShapeType is not correct (see constructor).
Method Detail

getShapeType

public ShapeType getShapeType()
Get the type of shape stored (ShapeType.ARC,ShapeType.ARCM,ShapeType.ARCZ)

Specified by:
getShapeType in interface ShapeHandler
Returns:
The ShapeType.

getLength

public int getLength(java.lang.Object geometry)
Description copied from interface: ShapeHandler
Get the length of the given geometry Object in bytes not 16-bit words. This is easier to keep track of, since the ByteBuffer deals with bytes. Do not include the 8 bytes of record.

Specified by:
getLength in interface ShapeHandler
Parameters:
geometry - The geometry to analyze.
Returns:
The number of bytes the shape will take up.

readOld

public java.lang.Object readOld(java.nio.ByteBuffer buffer,
                                ShapeType type)

read

public java.lang.Object read(java.nio.ByteBuffer buffer,
                             ShapeType type)
Description copied from interface: ShapeHandler
Read a geometry from the ByteBuffer. The buffer's position, byteOrder, and limit are set to that which is needed. The record has been read as well as the shape type integer. The handler need not worry about reading unused information as the ShapefileReader will correctly adjust the buffer position after this call.

Specified by:
read in interface ShapeHandler
Parameters:
buffer - The ByteBuffer to read from.
Returns:
A geometry object.

write

public void write(java.nio.ByteBuffer buffer,
                  java.lang.Object geometry)
Description copied from interface: ShapeHandler
Write the geometry into the ByteBuffer. The position, byteOrder, and limit are all set. The handler is not responsible for writing the record or shape type integer.

Specified by:
write in interface ShapeHandler
Parameters:
buffer - The ByteBuffer to write to.
geometry - The geometry to write.


Copyright © GeoTools. All Rights Reserved.