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.layer.shape
Class ShapeUtils

    java.lang.Object
      com.bbn.openmap.layer.shape.ShapeUtils

All Implemented Interfaces:
  ShapeConstants

Direct Known Subclasses:
  ESRIPoly, ESRIRecord, ShapeFile, ShapeIndex, SpatialIndex

public class ShapeUtils
extends java.lang.Object
implements ShapeConstants

Utilities for reading and writing the components of shape files.

Version:
  $Revision: 1.3.2.1 $ $Date: 2004/10/14 18:27:17 $
Author:
  Tom Mitchell

Field Summary

Fields inherited from interface com.bbn.openmap.dataAccess.shape.ShapeConstants
`DBF_ATTRIBUTE, DBF_CHARACTER, DBF_DATE, DBF_LOGICAL, DBF_MEMO, DBF_NUMERIC, DBF_TYPE_CHARACTER, DBF_TYPE_DATE, DBF_TYPE_LOGICAL, DBF_TYPE_MEMO, DBF_TYPE_NUMERIC, PARAM_DBF, PARAM_SHP, PARAM_SHX, SHAPE_BOUNDS_ATTRIBUTE, SHAPE_DBF_DASHPATTERN, SHAPE_DBF_DASHPHASE, SHAPE_DBF_DESCRIPTION, SHAPE_DBF_FILLCOLOR, SHAPE_DBF_INFO_ATTRIBUTE, SHAPE_DBF_LINECOLOR, SHAPE_DBF_LINEWIDTH, SHAPE_DBF_SELECTCOLOR, SHAPE_FILE_HEADER_LENGTH, SHAPE_FILE_RECORD_HEADER_LENGTH, SHAPE_INDEX_ATTRIBUTE, SHAPE_MAX_MEASURE_ATTRIBUTE, SHAPE_MAX_Z_ATTRIBUTE, SHAPE_MEASURE_ATTRIBUTE, SHAPE_MIN_MEASURE_ATTRIBUTE, SHAPE_MIN_Z_ATTRIBUTE, SHAPE_TYPE_ARC, SHAPE_TYPE_MULTIPATCH, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_MULTIPOINTM, SHAPE_TYPE_MULTIPOINTZ, SHAPE_TYPE_NULL, SHAPE_TYPE_POINT, SHAPE_TYPE_POINTM, SHAPE_TYPE_POINTZ, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYGONM, SHAPE_TYPE_POLYGONZ, SHAPE_TYPE_POLYLINE, SHAPE_TYPE_POLYLINEM, SHAPE_TYPE_POLYLINEZ, SHAPE_Z_ATTRIBUTE`

Constructor Summary
`ShapeUtils()`

Method Summary
`static int` | `readBEInt(byte[] b, int off)` Reads a big endian integer.
`static ESRIBoundingBox` | `readBox(byte[] b, int off)` Reads a bounding box record.
`static double` | `readLEDouble(byte[] b, int off)` Reads a little endian double.
`static int` | `readLEInt(BinaryBufferedFile in)` Reads a little endian int from the current location of the given file.
`static int` | `readLEInt(byte[] b, int off)` Reads a little endian integer.
`static long` | `readLELong(byte[] b, int off)` Reads a little endian 8 byte integer.
`static ESRIPoint` | `readPoint(byte[] b, int off)` Reads a point record.
`static int` | `writeBEInt(byte[] b, int off, int val)` Writes the given integer to the given buffer at the given location in big endian format.
`static int` | `writeBox(byte[] b, int off, ESRIBoundingBox box)` Writes the given bounding box to the given buffer at the given location.
`static int` | `writeLEDouble(byte[] b, int off, double val)` Writes the given double to the given buffer at the given location in little endian format.
`static int` | `writeLEInt(byte[] b, int off, int val)` Writes the given integer to the given buffer at the given location in little endian format.
`static int` | `writeLELong(byte[] b, int off, long val)` Writes the given long to the given buffer at the given location in little endian format.
`static int` | `writePoint(byte[] b, int off, ESRIPoint point)` Writes the given point to the given buffer at the given location.

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

Constructor Detail

### ShapeUtils

    public ShapeUtils()

Method Detail

### readBEInt

    public static int readBEInt(byte[] b,
                                int off)

  Reads a big endian integer.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the int resides
  Returns:
    the int read from the buffer at the offset location

### readLEInt

    public static int readLEInt(byte[] b,
                                int off)

  Reads a little endian integer.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the int resides
  Returns:
    the int read from the buffer at the offset location

### readLEInt

    public static int readLEInt(BinaryBufferedFile in)
                         throws java.io.IOException

  Reads a little endian int from the current location of the given file. Synchronized for thread-safe access to leiBuffer.

  Parameters:
    `in` - an input file
  Returns:
    the int read from the file
  Throws:
    `java.io.IOException`

### readLELong

    public static long readLELong(byte[] b,
                                  int off)

  Reads a little endian 8 byte integer.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the long resides
  Returns:
    the long read from the buffer at the offset location

### readLEDouble

    public static double readLEDouble(byte[] b,
                                      int off)

  Reads a little endian double.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the double resides
  Returns:
    the double read from the buffer at the offset location

### readPoint

    public static ESRIPoint readPoint(byte[] b,
                                      int off)

  Reads a point record. A point record is a double representing the x value and a double representing a y value.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the int resides
  Returns:
    the point read from the buffer at the offset location

### readBox

    public static ESRIBoundingBox readBox(byte[] b,
                                          int off)

  Reads a bounding box record. A bounding box is four double representing, in order, xmin, ymin, xmax, ymax.

  Parameters:
    `b` - the raw data buffer
    `off` - the offset into the buffer where the int resides
  Returns:
    the point read from the buffer at the offset location

### writeBEInt

    public static int writeBEInt(byte[] b,
                                 int off,
                                 int val)

  Writes the given integer to the given buffer at the given location in big endian format.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `val` - the integer to write
  Returns:
    the number of bytes written

### writeLEInt

    public static int writeLEInt(byte[] b,
                                 int off,
                                 int val)

  Writes the given integer to the given buffer at the given location in little endian format.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `val` - the integer to write
  Returns:
    the number of bytes written

### writeLELong

    public static int writeLELong(byte[] b,
                                  int off,
                                  long val)

  Writes the given long to the given buffer at the given location in little endian format.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `val` - the long to write
  Returns:
    the number of bytes written

### writeLEDouble

    public static int writeLEDouble(byte[] b,
                                    int off,
                                    double val)

  Writes the given double to the given buffer at the given location in little endian format.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `val` - the double to write
  Returns:
    the number of bytes written

### writePoint

    public static int writePoint(byte[] b,
                                 int off,
                                 ESRIPoint point)

  Writes the given point to the given buffer at the given location. The point is written as a double representing x followed by a double representing y.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `point` - the point to write
  Returns:
    the number of bytes written

### writeBox

    public static int writeBox(byte[] b,
                               int off,
                               ESRIBoundingBox box)

  Writes the given bounding box to the given buffer at the given location. The bounding box is written as four doubles representing, in order, xmin, ymin, xmax, ymax.

  Parameters:
    `b` - the data buffer
    `off` - the offset into the buffer where writing should occur
    `box` - the bounding box to write
  Returns:
    the number of bytes written

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