## com.bbn.openmap.dataAccess.shape.output
Class ShpOutputStream

    java.lang.Object
      com.bbn.openmap.dataAccess.shape.output.ShpOutputStream

public class ShpOutputStream
extends java.lang.Object

Writes data to a .shp file

Author:
  Doug Van Auken

Field Summary
`static java.util.logging.Logger` `logger`

Constructor Summary
`ShpOutputStream(java.io.OutputStream os)` Creates an outputstream to write to

Method Summary
`protected int[][]` `createPointIndex(OMGraphicList list)` Calculates the content length for each record, in terms of words as defined by ESRI documentation.
`protected int[][]` `createPolyIndex(EsriGraphicList list)` Creates a two dimensional array holding a list of shape content lengths and shape content length offsets, as defined in Esri shape file documentation.
`protected int[]` `getPartOffsets(OMGraphicList sublist)` Creates an array whose elements specifies at what index a parts geometry begins
`protected int` `getPointsPerShape(OMGraphicList sublist)` Iterates through a list of shapes, summing the points per part to determine the number of points per shape
`protected int[]` `getRecordOffsets(int[] contentLengths)` Creates an array whose elements specify at what index a shapes geometry begins
`protected void` `writeExtents(float[] extents)`
`int[][]` `writeGeometry(EsriGraphicList list)` Determine what type of list is given and write it out.
`int[][]` `writePointGeometry(EsriGraphicList list)` Writes point geometry to the class scope LittleEndianOutputStream.
`int[][]` `writePolyGeometry(EsriGraphicList list)` Writes polygon geometry to the class scope LittleEndianInputStream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger

    public static java.util.logging.Logger logger

Constructor Detail

### ShpOutputStream

    public ShpOutputStream(java.io.OutputStream os)

  Creates an outputstream to write to

Parameters:
  `os` - The output stream to write to

Method Detail

### writeGeometry

    public int[][] writeGeometry(EsriGraphicList list)
                          throws java.io.IOException

  Determine what type of list is given and write it out.

  Parameters:
    `list` - The EsriGraphicList to write
  Returns:
    The index data that is used to create the .shx file
  Throws:
    `java.io.IOException`

### createPointIndex

    protected int[][] createPointIndex(OMGraphicList list)

  Calculates the content length for each record, in terms of words as defined by ESRI documentation. A word is 16 bits, so a double is 4 words and an int is 2 words.

  Parameters:
    `list` - The EsriGraphicList to write
  Returns:
    The index data that is used to create the .shx file

### createPolyIndex

    protected int[][] createPolyIndex(EsriGraphicList list)

  Creates a two dimensional array holding a list of shape content lengths and shape content length offsets, as defined in Esri shape file documentation. This array is used to create the .shx file

  Parameters:
    `list` - The list from which to create the respective array
  Returns:
    The index data that is used to create the .shx file

### getRecordOffsets

    protected int[] getRecordOffsets(int[] contentLengths)

  Creates an array whose elements specify at what index a shapes geometry begins

  Parameters:
    `contentLengths` - The array for which to get offsets from
  Returns:
    An array of record offsets

### getPartOffsets

    protected int[] getPartOffsets(OMGraphicList sublist)

  Creates an array whose elements specifies at what index a parts geometry begins

  Parameters:
    `sublist` - A list of shapes
  Returns:
    An array of part offsets

### getPointsPerShape

    protected int getPointsPerShape(OMGraphicList sublist)

  Iterates through a list of shapes, summing the points per part to determine the number of points per shape

  Parameters:
    `sublist` - A list of shapes
  Returns:
    The number of points for a given shape

### writeExtents

    protected void writeExtents(float[] extents)
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### writePolyGeometry

    public int[][] writePolyGeometry(EsriGraphicList list)
                              throws java.io.IOException

  Writes polygon geometry to the class scope LittleEndianInputStream.

  Parameters:
    `list` - The list of geometry objects to save
  Returns:
    A two dimensional array containing shape offsets and content lengths
  Throws:
    `java.io.IOException`

### writePointGeometry

    public int[][] writePointGeometry(EsriGraphicList list)
                               throws java.io.IOException

  Writes point geometry to the class scope LittleEndianOutputStream.

  Parameters:
    `list` - An EsriGraphicList of points
  Returns:
    A two dimensional array containing shape offsets and content lengths
  Throws:
    `java.io.IOException`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details