org.progeeks.geo.esri
Class ShapeWriter

java.lang.Object
  extended by org.progeeks.geo.esri.ShapeWriter

public class ShapeWriter
extends java.lang.Object

Writes esri.shape meta object to an ESRI SHP file (also creates the DBF and SHX) files). Note that because the file header contains the file size and bounding box, the file will not be correct until this writer is closed. Failure to close this writer will result in an invalid shape file.

Version:
$Revision: 1.9 $
Author:
Paul Wisneskey

Field Summary
protected  BinaryDataOutputStream shpStream
           
protected  BinaryDataOutputStream shxStream
           
 
Constructor Summary
ShapeWriter(EsriShapeResource resource, int shapeType)
           
 
Method Summary
 void close()
           
protected  byte[] createShapeRecord(MetaObject shape)
           
protected  void updateBoundingAxis(MetaObject point, java.lang.String pointProperty, java.lang.String boundMinProperty, java.lang.String boundMaxProperty)
           
protected  void updateBoundingBox(MetaObject point)
           
protected  void updateHeader(java.io.RandomAccessFile raf, int length)
           
protected  void updateHeaderBoundingValue(java.io.RandomAccessFile raf, java.lang.String propertyName)
           
protected  void writeBoundingBox(MetaObject shape, BinaryDataOutputStream shapeStream)
           
 void writeDoubleLittleEndian(java.io.RandomAccessFile raf, double value)
           
protected  void writeHeader(BinaryDataOutputStream stream)
          Writes the header used for the SHP and IDX files, using place holders for information that can't be determined until all of the shapes have been written (such as file size and bounding box).
protected  void writeMeasureRange(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writeMeasures(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writeNumParts(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writeNumPoints(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writeParts(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writePartTypes(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writePoints(MetaObject shape, BinaryDataOutputStream shapeStream, boolean hasM, boolean hasZ)
           
 void writeShape(MetaObject shape)
           
protected  void writeZRange(MetaObject shape, BinaryDataOutputStream shapeStream)
           
protected  void writeZValues(MetaObject shape, BinaryDataOutputStream shapeStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shpStream

protected BinaryDataOutputStream shpStream

shxStream

protected BinaryDataOutputStream shxStream
Constructor Detail

ShapeWriter

public ShapeWriter(EsriShapeResource resource,
                   int shapeType)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

writeShape

public void writeShape(MetaObject shape)
                throws java.io.IOException
Throws:
java.io.IOException

createShapeRecord

protected byte[] createShapeRecord(MetaObject shape)
                            throws java.io.IOException
Throws:
java.io.IOException

writeNumPoints

protected void writeNumPoints(MetaObject shape,
                              BinaryDataOutputStream shapeStream)
                       throws java.io.IOException
Throws:
java.io.IOException

writePoints

protected void writePoints(MetaObject shape,
                           BinaryDataOutputStream shapeStream,
                           boolean hasM,
                           boolean hasZ)
                    throws java.io.IOException
Throws:
java.io.IOException

writeNumParts

protected void writeNumParts(MetaObject shape,
                             BinaryDataOutputStream shapeStream)
                      throws java.io.IOException
Throws:
java.io.IOException

writeParts

protected void writeParts(MetaObject shape,
                          BinaryDataOutputStream shapeStream)
                   throws java.io.IOException
Throws:
java.io.IOException

writePartTypes

protected void writePartTypes(MetaObject shape,
                              BinaryDataOutputStream shapeStream)
                       throws java.io.IOException
Throws:
java.io.IOException

writeBoundingBox

protected void writeBoundingBox(MetaObject shape,
                                BinaryDataOutputStream shapeStream)
                         throws java.io.IOException
Throws:
java.io.IOException

writeMeasureRange

protected void writeMeasureRange(MetaObject shape,
                                 BinaryDataOutputStream shapeStream)
                          throws java.io.IOException
Throws:
java.io.IOException

writeMeasures

protected void writeMeasures(MetaObject shape,
                             BinaryDataOutputStream shapeStream)
                      throws java.io.IOException
Throws:
java.io.IOException

writeZRange

protected void writeZRange(MetaObject shape,
                           BinaryDataOutputStream shapeStream)
                    throws java.io.IOException
Throws:
java.io.IOException

writeZValues

protected void writeZValues(MetaObject shape,
                            BinaryDataOutputStream shapeStream)
                     throws java.io.IOException
Throws:
java.io.IOException

updateBoundingBox

protected void updateBoundingBox(MetaObject point)

updateBoundingAxis

protected void updateBoundingAxis(MetaObject point,
                                  java.lang.String pointProperty,
                                  java.lang.String boundMinProperty,
                                  java.lang.String boundMaxProperty)

updateHeader

protected void updateHeader(java.io.RandomAccessFile raf,
                            int length)
                     throws java.io.IOException
Throws:
java.io.IOException

updateHeaderBoundingValue

protected void updateHeaderBoundingValue(java.io.RandomAccessFile raf,
                                         java.lang.String propertyName)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeDoubleLittleEndian

public void writeDoubleLittleEndian(java.io.RandomAccessFile raf,
                                    double value)
                             throws java.io.IOException
Throws:
java.io.IOException

writeHeader

protected void writeHeader(BinaryDataOutputStream stream)
                    throws java.io.IOException
Writes the header used for the SHP and IDX files, using place holders for information that can't be determined until all of the shapes have been written (such as file size and bounding box).

Throws:
java.io.IOException


Copyright © 2002-2003 Paul Speed. All Rights Reserved.