## com.bbn.openmap.layer.shape
Class ShapeFileCrop

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

public class ShapeFileCrop
extends java.lang.Object

Class that supports cropping of ESRI Shapefiles with a simple bounding box. Does not yet update the .shx or .dbf files.

## Usage:

java com.bbn.openmap.layer.shape.ShapeFileCrop -ul lat,lon -lr lat,lon -i srcShapeFile -o destShapeFile
  Crops the srcShapeFile, dumps the output into destShapeFile.
  Note that this does simple rejection of entities based on their bounding boxes.
  A better scheme (unimplemented) would be to actually crop the line segments.

Version:
  $Revision: 1.2.2.2 $ $Date: 2005/08/09 21:17:47 $
Author:
  Eliot Lebsack <elebsack@mitre.org>

Field Summary
`ShapeFile` `sfin` Input ShapeFile object.
`ShapeFile` `sfout` Output ShapeFile object.

Constructor Summary
`ShapeFileCrop(java.lang.String namein, java.lang.String nameout)` Construct a `ShapeFileCrop` object from a pair of file names.

Method Summary
`void` `cropShapeFile()` Read the input `ShapeFile` object, and apply cropping rules to the read entities.
`static void` `main(java.lang.String[] args)` The driver for the command line interface.
`static void` `usage()`

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

Field Detail

### sfin

    public ShapeFile sfin

  Input ShapeFile object.

### sfout

    public ShapeFile sfout

  Output ShapeFile object.

Constructor Detail

### ShapeFileCrop

    public ShapeFileCrop(java.lang.String namein,
                         java.lang.String nameout)
                  throws java.io.IOException

  Construct a `ShapeFileCrop` object from a pair of file names.

Throws:
  `java.io.IOException` - if something goes wrong opening or reading the file.

Method Detail

### cropShapeFile

    public void cropShapeFile()
                       throws java.io.IOException

  Read the input `ShapeFile` object, and apply cropping rules to the read entities. Writes the output `ShapeFile` object, and then invokes the `ShapeFile` .verify method to fix the output file header.

  Throws:
    `java.io.IOException` - if something goes wrong opening or reading the file.

### usage

    public static void usage()

### main

    public static void main(java.lang.String[] args)
                     throws java.io.IOException

  The driver for the command line interface. Reads the command line arguments and executes appropriate calls.

  See the file documentation for usage.

  Parameters:
    `args` - the command line arguments
  Throws:
    `java.io.IOException` - if something goes wrong reading or writing the file

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