org.deegree_impl.io.shpapi
Class MainFile

java.lang.Object
  extended byorg.deegree_impl.io.shpapi.MainFile

public class MainFile
extends java.lang.Object

Class representing an ESRI Shape File.

Uses class ByteUtils modified from the original package com.bbn.openmap.layer.shape
Copyright (C) 1998 BBN Corporation 10 Moulton St. Cambridge, MA 02138

Last changes:
14.12.1999 ap: import clauses added
14.12.1999 ap: private variable declarations
14.12.1999 ap: all public static references removed
14.12.1999 ap: constructor implemented
14.12.1999 ap: method: openFiles (String url) implemented
14.12.1999 ap: method: getFileMBR() implemented
14.12.1999 ap: method: getRecordNum() implemented
14.12.1999 ap: method: getRecordMBR(int RecNo) implemented
14.12.1999 ap: method: getByRecNo(int RecNo) implemented
14.12.1999 ap: method: getShapeTypeByRecNo(int RecNo) implemented
21.12.1999 ap: method: openfiles(String url) removed
21.12.1999 ap: all static final declarations replaced
07.01.2000 ap: return types of the methods changed from WKBxxxx and Rectangle
to SHPxxxx
07.01.2000 ap: method getRecordMBR modified - SHAPE_TYPE_MULTIPOINT added
13.01.2000 ap: method getByRecNo re-implemented
21.03.2000 ap: method getByRecNo completed; multipoint is now supported
16.08.2000 ap: method write(..) added
16.08.2000 ap: method writeHeader(..) added

Version:
16.08.2000
Author:
Andreas Poth

Field Summary
private  java.lang.String _shp
           
private  java.io.RandomAccessFile rafShp
           
protected  byte[] recHdr
           
private  FileHeader sfh
           
private  IndexFile shx
           
 
Constructor Summary
MainFile(java.lang.String url)
          Construct a MainFile from a file name.
MainFile(java.lang.String url, java.lang.String rwflag)
          Construct a MainFile from a file name.
 
Method Summary
 void close()
           
 SHPGeometry getByRecNo(int RecNo)
          method: getByRecNo (int RecNo)
retruns a ShapeRecord-Geometry by RecorcNumber
 SHPEnvelope getFileMBR()
          method: getFileMBR()
returns the minimum bounding rectangle of geometries
within the shape-file
 SHPEnvelope getRecordMBR(int RecNo)
          method: getRecordMBR(int RecNo)
returns the minimum bound rectangle of RecNo's Geometrie of the shape-file
 int getRecordNum()
          method: getRecordNum()
returns the number of record with in a shape-file
 int getShapeTypeByRecNo(int RecNo)
          method: getShapeType(int RecNo)
returns the minimum bound rectangle of RecNo's Geometrie of the shape-file
 void write(byte[] bytearray, IndexRecord record, SHPEnvelope mbr)
          method: public void write(byte[] bytearray)
appends a bytearray to the shape file
 void writeHeader(int filelength, byte shptype, SHPEnvelope mbr)
          method: public void writeHeader(int filelength, byte shptype, SHPEnvelope mbr)
writes a header to the shape and index file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recHdr

protected byte[] recHdr

sfh

private FileHeader sfh

shx

private IndexFile shx

_shp

private final java.lang.String _shp
See Also:
Constant Field Values

rafShp

private java.io.RandomAccessFile rafShp
Constructor Detail

MainFile

public MainFile(java.lang.String url)
         throws java.io.IOException
Construct a MainFile from a file name.


MainFile

public MainFile(java.lang.String url,
                java.lang.String rwflag)
         throws java.io.IOException
Construct a MainFile from a file name.

Method Detail

close

public void close()

getFileMBR

public SHPEnvelope getFileMBR()
method: getFileMBR()
returns the minimum bounding rectangle of geometries
within the shape-file


getRecordNum

public int getRecordNum()
method: getRecordNum()
returns the number of record with in a shape-file


getRecordMBR

public SHPEnvelope getRecordMBR(int RecNo)
                         throws java.io.IOException
method: getRecordMBR(int RecNo)
returns the minimum bound rectangle of RecNo's Geometrie of the shape-file

Throws:
java.io.IOException

getByRecNo

public SHPGeometry getByRecNo(int RecNo)
                       throws java.io.IOException
method: getByRecNo (int RecNo)
retruns a ShapeRecord-Geometry by RecorcNumber

Throws:
java.io.IOException

getShapeTypeByRecNo

public int getShapeTypeByRecNo(int RecNo)
                        throws java.io.IOException
method: getShapeType(int RecNo)
returns the minimum bound rectangle of RecNo's Geometrie of the shape-file

Throws:
java.io.IOException

write

public void write(byte[] bytearray,
                  IndexRecord record,
                  SHPEnvelope mbr)
           throws java.io.IOException
method: public void write(byte[] bytearray)
appends a bytearray to the shape file

Throws:
java.io.IOException

writeHeader

public void writeHeader(int filelength,
                        byte shptype,
                        SHPEnvelope mbr)
                 throws java.io.IOException
method: public void writeHeader(int filelength, byte shptype, SHPEnvelope mbr)
writes a header to the shape and index file

Throws:
java.io.IOException