Package oracle.spatial.util
Class ShapefileReaderJGeom
- java.lang.Object
-
- oracle.spatial.util.ShapefileReaderJGeom
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ShapefileReaderJGeom extends java.lang.Object implements java.lang.AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description static intAV_MULTIPOINTstatic intAV_MULTIPOINTMstatic intAV_MULTIPOINTZstatic intAV_NULLstatic intAV_POINTstatic intAV_POINTMstatic intAV_POINTZstatic intAV_POLYGONstatic intAV_POLYGONMstatic intAV_POLYGONZstatic intAV_POLYLINEstatic intAV_POLYLINEMstatic intAV_POLYLINEZprotected intbufferLenprotected intcntprotected ShapefileHdridxFileHdrprotected BufferedRandomAccessFileidxFISprotected ShapefileHdrmainFileHdrprotected BufferedRandomAccessFilemainFISprotected doublemeasureMaxprotected doublemeasureMinprotected java.lang.StringnamePrefixprotected intnRecordsprotected double[]partBufferprotected intpartBufferLenprotected byte[]recBufferstatic booleanshpMvalprotected inttypeprotected doublexMaxprotected doublexMinprotected doubleyMaxprotected doubleyMinprotected doublezMaxprotected doublezMin
-
Constructor Summary
Constructors Constructor Description ShapefileReaderJGeom(java.lang.String name)construct an object out of the specified shapefile name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseShapefile()close this shapefile.static JGeometrygetGeometry(byte[] recBuffer, int srid)protected static JGeometrygetGeometry(byte[] recBuffer, int type, int off, int srid)byte[]getGeometryBytes(int nth)retrieve nth shape record and return it as a byte array.doublegetMaxMeasure()return the maximum Measure value in file.doublegetMaxX()return the maximum X value in file.doublegetMaxY()return the maximum Y value in file.doublegetMaxZ()return the maximum Z value in file.doublegetMinMeasure()return the minimum Measure value in file.doublegetMinX()return the minimum X value in file.doublegetMinY()return the minimum Y value in file.doublegetMinZ()return the minimum Z value in file.static intgetShpDims(int type, double maxM)intgetShpFileType()return the Shape Type in the file.protected longidxRecordOffset(int nth)make an double out of the byte array starting at offset 'off'.protected booleanmainRecordOffset(int nth, oracle.spatial.util.IndexRecord idxRec)protected static doublemakeDoubleBigEndian(byte[] b, int off)protected static doublemakeDoubleLittleEndian(byte[] b, int off)protected static intmakeIntBigEndian(byte[] b, int off)protected static intmakeIntLittleEndian(byte[] b, int off)protected static JGeometrymakeMPoint(byte[] b, int off, int srid)protected static JGeometrymakeMPointZ(byte[] b, int off, int srid)protected static JGeometrymakePoint(byte[] b, int off, int srid)protected static JGeometrymakePointM(byte[] b, int off, int srid)protected static JGeometrymakePointZ(byte[] b, int off, int srid)protected static JGeometrymakePoly(byte[] b, int type, int off, int srid)protected static JGeometrymakePolyM(byte[] b, int type, int off, int srid)protected static JGeometrymakePolyZ(byte[] b, int type, int off, int srid)protected static JGeometrymakePolyZM(byte[] b, int type, int off, int srid, int[] parts, int numParts, int numPoints, int zArrayOff, int mMaxOff)intnumRecords()return the number of shape records in the file.protected voidopenShapefile(java.lang.String name)open a shapefile with the given name.static voidswapBytes(byte[] buf, int offset, int len)
-
-
-
Field Detail
-
AV_NULL
public static final int AV_NULL
- See Also:
- Constant Field Values
-
AV_POINT
public static final int AV_POINT
- See Also:
- Constant Field Values
-
AV_POLYLINE
public static final int AV_POLYLINE
- See Also:
- Constant Field Values
-
AV_POLYGON
public static final int AV_POLYGON
- See Also:
- Constant Field Values
-
AV_MULTIPOINT
public static final int AV_MULTIPOINT
- See Also:
- Constant Field Values
-
AV_POINTZ
public static final int AV_POINTZ
- See Also:
- Constant Field Values
-
AV_POLYLINEZ
public static final int AV_POLYLINEZ
- See Also:
- Constant Field Values
-
AV_POLYGONZ
public static final int AV_POLYGONZ
- See Also:
- Constant Field Values
-
AV_MULTIPOINTZ
public static final int AV_MULTIPOINTZ
- See Also:
- Constant Field Values
-
AV_POINTM
public static final int AV_POINTM
- See Also:
- Constant Field Values
-
AV_POLYLINEM
public static final int AV_POLYLINEM
- See Also:
- Constant Field Values
-
AV_POLYGONM
public static final int AV_POLYGONM
- See Also:
- Constant Field Values
-
AV_MULTIPOINTM
public static final int AV_MULTIPOINTM
- See Also:
- Constant Field Values
-
shpMval
public static boolean shpMval
-
nRecords
protected int nRecords
-
type
protected int type
-
xMax
protected double xMax
-
xMin
protected double xMin
-
yMax
protected double yMax
-
yMin
protected double yMin
-
zMax
protected double zMax
-
zMin
protected double zMin
-
measureMax
protected double measureMax
-
measureMin
protected double measureMin
-
recBuffer
protected byte[] recBuffer
-
partBuffer
protected double[] partBuffer
-
bufferLen
protected int bufferLen
-
partBufferLen
protected int partBufferLen
-
cnt
protected int cnt
-
namePrefix
protected java.lang.String namePrefix
-
mainFileHdr
protected ShapefileHdr mainFileHdr
-
idxFileHdr
protected ShapefileHdr idxFileHdr
-
mainFIS
protected BufferedRandomAccessFile mainFIS
-
idxFIS
protected BufferedRandomAccessFile idxFIS
-
-
Method Detail
-
getShpDims
public static int getShpDims(int type, double maxM) throws java.lang.Exception- Throws:
java.lang.Exception
-
getGeometry
public static JGeometry getGeometry(byte[] recBuffer, int srid) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getGeometry
protected static JGeometry getGeometry(byte[] recBuffer, int type, int off, int srid) throws java.lang.Exception
- Throws:
java.lang.Exception
-
makePoint
protected static JGeometry makePoint(byte[] b, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makePointZ
protected static JGeometry makePointZ(byte[] b, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makePointM
protected static JGeometry makePointM(byte[] b, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makeMPoint
protected static JGeometry makeMPoint(byte[] b, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makeMPointZ
protected static JGeometry makeMPointZ(byte[] b, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makePoly
protected static JGeometry makePoly(byte[] b, int type, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makePolyZ
protected static JGeometry makePolyZ(byte[] b, int type, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
makePolyZM
protected static JGeometry makePolyZM(byte[] b, int type, int off, int srid, int[] parts, int numParts, int numPoints, int zArrayOff, int mMaxOff) throws java.io.IOException
- Throws:
java.io.IOException
-
makePolyM
protected static JGeometry makePolyM(byte[] b, int type, int off, int srid) throws java.io.IOException
- Throws:
java.io.IOException
-
swapBytes
public static void swapBytes(byte[] buf, int offset, int len)
-
makeIntBigEndian
protected static int makeIntBigEndian(byte[] b, int off)
-
makeIntLittleEndian
protected static int makeIntLittleEndian(byte[] b, int off)
-
makeDoubleBigEndian
protected static double makeDoubleBigEndian(byte[] b, int off)
-
makeDoubleLittleEndian
protected static double makeDoubleLittleEndian(byte[] b, int off)
-
openShapefile
protected void openShapefile(java.lang.String name) throws java.io.IOExceptionopen a shapefile with the given name. ready to fetch individual shape records upon success return. return true if success; otherwise false- Throws:
java.io.IOException
-
closeShapefile
public void closeShapefile() throws java.io.IOExceptionclose this shapefile.- Throws:
java.io.IOException
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
getGeometryBytes
public byte[] getGeometryBytes(int nth) throws java.io.IOExceptionretrieve nth shape record and return it as a byte array.- Throws:
java.io.IOException
-
idxRecordOffset
protected long idxRecordOffset(int nth)
make an double out of the byte array starting at offset 'off'. Assumming the bytes are laid out in big-endian order.
-
mainRecordOffset
protected boolean mainRecordOffset(int nth, oracle.spatial.util.IndexRecord idxRec)
-
numRecords
public int numRecords()
return the number of shape records in the file.
-
getShpFileType
public int getShpFileType()
return the Shape Type in the file.
-
getMaxMeasure
public double getMaxMeasure()
return the maximum Measure value in file.
-
getMinMeasure
public double getMinMeasure()
return the minimum Measure value in file.
-
getMaxZ
public double getMaxZ()
return the maximum Z value in file.
-
getMinZ
public double getMinZ()
return the minimum Z value in file.
-
getMaxX
public double getMaxX()
return the maximum X value in file.
-
getMinX
public double getMinX()
return the minimum X value in file.
-
getMaxY
public double getMaxY()
return the maximum Y value in file.
-
getMinY
public double getMinY()
return the minimum Y value in file.
-
-