ShpOutputStream (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 int` | `ESRI_RECORD_HEADER_LENGTH`
`static java.util.logging.Logger` | `logger`
`protected GeoCoordTransformation` | `transform` A GeoCoordTransform to use to convert Lat/Lon values in EsriGraphics to projected coordinates.

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
`GeoCoordTransformation` | `getTransform()` Get the transform being used on the coordinates of the EsriGraphics as they are written to the stream.
`void` | `setTransform(GeoCoordTransformation transform)` Set the GeoCoordTransform for the stream, so that the EsriGraphics will have their coordinates transformed as they are written to the stream.
`protected void` | `writeExtents(double[] 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

### ESRI_RECORD_HEADER_LENGTH

    public static final int ESRI_RECORD_HEADER_LENGTH

See Also:
  Constant Field Values

### transform

    protected GeoCoordTransformation transform

  A GeoCoordTransform to use to convert Lat/Lon values in EsriGraphics to projected coordinates.

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

### getTransform

    public GeoCoordTransformation getTransform()

  Get the transform being used on the coordinates of the EsriGraphics as they are written to the stream.

  Returns:
    GeoCoordTransform if used, may be null for no transformation.

### setTransform

    public void setTransform(GeoCoordTransformation transform)

  Set the GeoCoordTransform for the stream, so that the EsriGraphics will have their coordinates transformed as they are written to the stream. If null, the coordinates will be unchanged.

  Parameters:
    `transform` -

### 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(double[] 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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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