Class TSVectorReader

All Implemented Interfaces:
Iterable<Feature>, FeatureSource

@Deprecated public class TSVectorReader extends LineFeatureSource
Deprecated.
The functionality of this class has been replaced by the BinnedGSHHSLineReader class which provides better performance for reading and rendering. The problem is that the TeraScan vector files only have one resolution and so render very slowly for large areas. The actual vectors rendered will differ between the data files provided by this class and the GSHHS data files because the TeraScan data is from the Digital Chart of the World (DCW) and the GSHHS data is from the CIA World Data Bank II (WDBII).

The TeraScan vector reader class reads databases in the SeaSpace TeraScan package vector file format. The file format is as follows. Each file contains a 180x360 1 degree square index, followed by a heap filled with variable length vectors. The 1 degree squares are numbered as follows:

   square = (lower-lat + 90) * 360 + left-lon + 180
 

where -90 <= lat < 90 and -180 <= lon < 180. The index is a 180x360 long integer array, indexed by square number. The index entry for a given square is the offset to the first vector in the heap for that square. The offset to the first vector in the heap is 0. All vectors for a given square are contiguous in the heap. The index entry for a square with no vectors is 0. (-1 would have been a better choice!)

The format for a given vector in the heap is shown here:

   long integer square number
   long integer number of (lat,lon) pairs in vector
   short int lat offset #1 from lower lat in seconds
   short int lon offset #1 from left lon in seconds
   short int lat offset #2 from lower lat in seconds
   short int lon offset #2 from left lon in seconds
 

Because vector segments can cross the boundaries of squares, lat and lon offsets can fall outside the range 0 to 3600 seconds.

Since:
3.1.1
Author:
Peter Hollemans
  • Field Details

  • Constructor Details

    • TSVectorReader

      public TSVectorReader(String name) throws IOException
      Deprecated.
      Creates a new TeraScan vector reader from a predefined database name.
      Parameters:
      name - the predefined database name.
      Throws:
      IOException - if the predefined database is invalid.
    • TSVectorReader

      public TSVectorReader(File file)
      Deprecated.
      Creates a new TeraScan vector reader from the database file.
      Parameters:
      file - the database file.
  • Method Details

    • select

      protected void select() throws IOException
      Deprecated.
      Description copied from class: AbstractFeatureSource
      Selects a set of features from the data source based on the current area.
      Specified by:
      select in class AbstractFeatureSource
      Throws:
      IOException - if an error occurred accessing the data source.
    • readPolyline

      public LineFeature readPolyline(int[] square, DataInput in) throws IOException
      Deprecated.
      Reads a polyline from the specified input.
      Parameters:
      square - the grid square coordinates as [lat, lon].
      in - the data input. The polyline is constructed by reading at the current input position.
      Returns:
      a new polyline as a vector of earth locations.
      Throws:
      IOException - if an error occurred reading the data file.