com.partnersoft.v3x.io.formats.shapefile
Class ShapeLib

java.lang.Object
  extended by com.partnersoft.v3x.io.formats.shapefile.ShapeLib
All Implemented Interfaces:
ShapefileConstants

public class ShapeLib
extends java.lang.Object
implements ShapefileConstants

Handy library routines for ESRI shapes.


Field Summary
 
Fields inherited from interface com.partnersoft.v3x.io.formats.shapefile.ShapefileConstants
ARCINFO_ARC, ARCINFO_ARCMAYBE, ARCINFO_ARCMAYBE2, ARCINFO_ARCMAYBE3, MULTIPATCH, MULTIPOINT, MULTIPOINTM, MULTIPOINTZ, NULLSHAPE, POINT, POINTM, POINTZ, POLYGON, POLYGONM, POLYGONZ, POLYLINE, POLYLINEM, POLYLINEZ, shapeNames, WHATZIT10, WHATZIT4, WHATZIT9
 
Constructor Summary
ShapeLib()
           
 
Method Summary
static ShapefileRecord readShape(byte[] shapeBytes)
          Converts a byte array to a ShapefileRecord of the appropriate type.
static ShapefileRecord readShape(byte[] shapeBytes, int start)
          Converts a byte array to a ShapefileRecord of the appropriate type.
static int readShapePoints(ByteBuffer buffer, PolylineArray results)
          Reads through a ByteBuffer and converts it to one or more polylines in the given PolylineArray.
static void writePoint(double x, double y, ByteBuffer output)
           
static void writePolyline(DoubleBuffer coords, ByteBuffer output)
          Make sure to change writePolyline(FloatBuffer, ByteBuffer) to match this exactly!
static void writePolyline(FloatBuffer coords, ByteBuffer output)
          Make sure to change writePolyline(DoubleBuffer, ByteBuffer) to match this exactly!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeLib

public ShapeLib()
Method Detail

readShapePoints

public static int readShapePoints(ByteBuffer buffer,
                                  PolylineArray results)
Reads through a ByteBuffer and converts it to one or more polylines in the given PolylineArray. From there you can decide how to process it - as a point, polygon, etc. This does not necessarily faithfully reproduce the original shape - arcs are plotted as lines at 10 degree intervals, for example.


readShape

public static ShapefileRecord readShape(byte[] shapeBytes)
Converts a byte array to a ShapefileRecord of the appropriate type. May modify the bytes in the array!


readShape

public static ShapefileRecord readShape(byte[] shapeBytes,
                                        int start)
Converts a byte array to a ShapefileRecord of the appropriate type. May modify the bytes in the array!


writePolyline

public static final void writePolyline(FloatBuffer coords,
                                       ByteBuffer output)
Make sure to change writePolyline(DoubleBuffer, ByteBuffer) to match this exactly!


writePolyline

public static final void writePolyline(DoubleBuffer coords,
                                       ByteBuffer output)
Make sure to change writePolyline(FloatBuffer, ByteBuffer) to match this exactly!


writePoint

public static final void writePoint(double x,
                                    double y,
                                    ByteBuffer output)