Class ShapeFile

All Implemented Interfaces:
PopupActivationListener, SpatialStore, Serializable, Comparable, EventListener, ListSelectionListener, TableModel

public class ShapeFile extends ShapeStore
A class to provide readonly access to ESRI shapefiles. Lines and polygons are returned as GeneralPaths, and points are returned as Point2D.Float. A method creates an iterator that will scan the entire set, or just a spatial extent. Spatial indexes are used if available.

The LERandomAccess class is not synchronized, so all methods that call it must their own synchronization methods.

Record numbers begin at 0.

See Also:
Serialized Form
  • Field Details

  • Constructor Details

  • Method Details

    • getValueAt

      public Object getValueAt(int row, int column, int period)
      Implementation of data accessor
      Specified by:
      getValueAt in class AttributeStore
      Parameters:
      row - The row containing the cell
      column - The column containing the cell
      period - The period of interest
      Returns:
      An object containing the cell value.
    • close

      public void close()
      Description copied from class: AttributeStore
      Close the table and release resources. The table should be used again after this method has been called.

      In many cases you do not need to call this method when you are finished using a table. Most tables will close automatically when they are no longer referenced.

      It is possible that this method will be deprecated or removed in a future release.

      Overrides:
      close in class AttributeStore
    • getType

      public int getType()
      Return the shapefile type.
    • getRowCount

      public int getRowCount()
      Return the number of records in the shapefile.
      Specified by:
      getRowCount in interface SpatialStore
      Specified by:
      getRowCount in interface TableModel
      Specified by:
      getRowCount in class AttributeStore
      Returns:
      the number of rows in this store
    • getPeriodCount

      public int getPeriodCount()
      Description copied from class: AttributeStore
      Get the total number of periods that this store supports
      Specified by:
      getPeriodCount in class AttributeStore
      Returns:
      The number of periods in this store
    • getYearForPeriod

      public int getYearForPeriod(int period)
      Description copied from class: AttributeStore
      Get the ending year for a given period.
      Specified by:
      getYearForPeriod in class AttributeStore
      Parameters:
      period - The period of interest
      Returns:
      the year for a given period
    • getSelection

      public BitSet getSelection(Extent2D e)
      Return a selection bitmap
      Parameters:
      e - The selection rectangle of interest
      Returns:
      A set of selected records
    • getShape

      public GeoShape getShape(int id, int period)
      Retrieve a specified shape from the shapefile. Record numbers start at 0.
      Parameters:
      id - The record of interest
      period - The period of interest
      Returns:
      A shape object
    • getCoordinates

      public double[][] getCoordinates(int id)
      Retrieve a specified shape from the shapefile. Record numbers start at 0.
      Parameters:
      id - The row of interest
      Returns:
      An array of arrays of coordinate points. Each element in the outer array contains a 'part' of the underlying shape (for example, and island or a multi-part polygon). The inner array index holds the coordinate points of that part.
    • sortRings

      public static double[][] sortRings(double[][] coords)
    • getExtent2D

      public Extent2D getExtent2D(int id, int period)
      Get the extent of a specific record
      Parameters:
      id - The record of interest
      period - The period of interest
      Returns:
      A rectangle
    • getProjectionInfo

      public String getProjectionInfo()
      Description copied from interface: SpatialStore
      Obtain projection information.
      Specified by:
      getProjectionInfo in interface SpatialStore
      Overrides:
      getProjectionInfo in class ShapeStore
    • hasSpatialIndex

      public boolean hasSpatialIndex()
      Description copied from interface: SpatialStore
      Query if this SpatialStore has a spatial index
    • canBuildSpatialIndex

      public boolean canBuildSpatialIndex()
      Description copied from interface: SpatialStore
      Query if this SpatialStore is capable of building a spatial index
    • makeSpatialIndex

      public void makeSpatialIndex() throws Exception
      Description copied from interface: SpatialStore
      Request that this SpatialStore create a spatial index
      Throws:
      Exception