org.deegree.feature.persistence.shape
Class SHPReader

java.lang.Object
  extended by org.deegree.feature.persistence.shape.SHPReader

public class SHPReader
extends Object

SHPReader

Version:
$Revision: 32014 $, $Date: 2011-09-26 16:47:34 +0200 (Mon, 26 Sep 2011) $
Author:
Andreas Schmitz, last edited by: $Author: mschneider $

Field Summary
static int FILETYPE
          The file type number.
static int FIRST_RING
          First ring of a polygon part type.
static int INNER_RING
          Inner polygon ring part type.
static int MULTIPATCH
          The multipatch shape.
static int MULTIPOINT
          The normal multipoint.
static int MULTIPOINTM
          The multipoint with measures.
static int MULTIPOINTZ
          The multipoint with z coordinates.
static int NULL
          The NULL shape.
static int OUTER_RING
          Outer polygon ring part type.
static int POINT
          The normal point.
static int POINTM
          The point with measure.
static int POINTZ
          The point with z coordinates.
static int POLYGON
          The normal polygon.
static int POLYGONM
          The polygon with measures.
static int POLYGONZ
          The polygon with z coordinates.
static int POLYLINE
          The normal polyline.
static int POLYLINEM
          The polyline with measures.
static int POLYLINEZ
          The polyline with z coordinates.
static int RING
          Polygon ring part type.
static int TRIANGLE_FAN
          Triangle fan part type.
static int TRIANGLE_STRIP
          Triangle strip part type.
static int VERSION
          The shape file version.
 
Constructor Summary
SHPReader(RandomAccessFile inFile, ICRS crs, SpatialIndex<Long> rtree, boolean startsWithZero)
           
 
Method Summary
 void close()
          Closes the underlying file channel and random access file.
 Envelope getEnvelope()
           
 GeometryPropertyType.GeometryType getGeometryType()
           
 LinkedList<Pair<Integer,Geometry>> query(Envelope bbox, boolean withGeometry, boolean exact)
           
 List<Pair<Integer,Long>> query(Envelope bbox, HashSet<Integer> ids)
           
 Pair<ArrayList<Pair<float[],Long>>,Boolean> readEnvelopes()
          He Who Needs It As Double, is welcome to implement/copy it.
 Geometry readGeometry(long ptr)
          Returns the geometry entry stored at the given position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILETYPE

public static final int FILETYPE
The file type number.

See Also:
Constant Field Values

VERSION

public static final int VERSION
The shape file version.

See Also:
Constant Field Values

NULL

public static final int NULL
The NULL shape.

See Also:
Constant Field Values

POINT

public static final int POINT
The normal point.

See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
The normal polyline.

See Also:
Constant Field Values

POLYGON

public static final int POLYGON
The normal polygon.

See Also:
Constant Field Values

MULTIPOINT

public static final int MULTIPOINT
The normal multipoint.

See Also:
Constant Field Values

POINTZ

public static final int POINTZ
The point with z coordinates.

See Also:
Constant Field Values

POLYLINEZ

public static final int POLYLINEZ
The polyline with z coordinates.

See Also:
Constant Field Values

POLYGONZ

public static final int POLYGONZ
The polygon with z coordinates.

See Also:
Constant Field Values

MULTIPOINTZ

public static final int MULTIPOINTZ
The multipoint with z coordinates.

See Also:
Constant Field Values

POINTM

public static final int POINTM
The point with measure.

See Also:
Constant Field Values

POLYLINEM

public static final int POLYLINEM
The polyline with measures.

See Also:
Constant Field Values

POLYGONM

public static final int POLYGONM
The polygon with measures.

See Also:
Constant Field Values

MULTIPOINTM

public static final int MULTIPOINTM
The multipoint with measures.

See Also:
Constant Field Values

MULTIPATCH

public static final int MULTIPATCH
The multipatch shape.

See Also:
Constant Field Values

TRIANGLE_STRIP

public static final int TRIANGLE_STRIP
Triangle strip part type.

See Also:
Constant Field Values

TRIANGLE_FAN

public static final int TRIANGLE_FAN
Triangle fan part type.

See Also:
Constant Field Values

OUTER_RING

public static final int OUTER_RING
Outer polygon ring part type.

See Also:
Constant Field Values

INNER_RING

public static final int INNER_RING
Inner polygon ring part type.

See Also:
Constant Field Values

FIRST_RING

public static final int FIRST_RING
First ring of a polygon part type.

See Also:
Constant Field Values

RING

public static final int RING
Polygon ring part type.

See Also:
Constant Field Values
Constructor Detail

SHPReader

public SHPReader(RandomAccessFile inFile,
                 ICRS crs,
                 SpatialIndex<Long> rtree,
                 boolean startsWithZero)
          throws IOException
Parameters:
inFile -
crs -
rtree -
startsWithZero -
Throws:
IOException
Method Detail

getGeometryType

public GeometryPropertyType.GeometryType getGeometryType()

query

public List<Pair<Integer,Long>> query(Envelope bbox,
                                      HashSet<Integer> ids)
                               throws IOException
Parameters:
bbox -
ids - if not null, the resulting list will only contain record numbers which are also contained in this set. If null, all matching records are returned.
Returns:
the list of matching record ids
Throws:
IOException

query

public LinkedList<Pair<Integer,Geometry>> query(Envelope bbox,
                                                boolean withGeometry,
                                                boolean exact)
                                         throws IOException
Parameters:
bbox -
withGeometry -
exact -
Returns:
the list of contained geometries
Throws:
IOException

getEnvelope

public Envelope getEnvelope()
Returns:
the overall bbox of the shape file

readEnvelopes

public Pair<ArrayList<Pair<float[],Long>>,Boolean> readEnvelopes()
He Who Needs It As Double, is welcome to implement/copy it.

Returns:
a list of all envelopes (minx, miny, maxx, maxy)

readGeometry

public Geometry readGeometry(long ptr)
Returns the geometry entry stored at the given position.

Parameters:
ptr - position of the entry
Returns:
geometry object, may be null

close

public void close()
           throws IOException
Closes the underlying file channel and random access file.

Throws:
IOException


Copyright © 2011. All Rights Reserved.