org.wkb4j.factories
Class AbstractWKBFactory

java.lang.Object
  |
  +--org.wkb4j.factories.AbstractWKBFactory
All Implemented Interfaces:
WKBFactory, WKBGeometryTypes
Direct Known Subclasses:
JTSFactory, LoggingWKBFactory, OpenMapFactory, PostGISFactory

public abstract class AbstractWKBFactory
extends java.lang.Object
implements WKBFactory, WKBGeometryTypes

Classes implementing WKBFactory should extend this class. In particular, this class validates the WKBFormat, making sure that things happen only when they should. Among other things, it checks that geometrical objects are correctly nested: Points can only exist in LineString and LinearRing objects, GeometryCollection can contain any type of objects... This is somehow similar to a "validating" XML parser. Creation date: 6 juil. 2002 22:07:15

Version:
$Revision: 1.9 $ $Date: 2003/08/02 23:52:18 $
Author:
David Garnier

Field Summary
protected  int depthPointer
          Points to the top of the stack.
protected  int geometryDepth
           
protected  boolean inUnit
           
protected  boolean inWork
           
protected static org.apache.log4j.Logger log
           
protected  int[] typeStack
           
protected  int[] values
           
protected  java.lang.String[] words
           
 
Fields inherited from interface org.wkb4j.engine.WKBGeometryTypes
linearRing, wkbGeometryCollection, wkbLineString, wkbMultiLineString, wkbMultiPoint, wkbMultiPolygon, wkbPoint, wkbPolygon
 
Constructor Summary
AbstractWKBFactory()
           
 
Method Summary
 void abortGeometryCollection()
          Signals a malformed GeometryCollection.
 void abortLinearRing()
          Signals a malformed LinearRing.
 void abortLineString()
          Signals a malformed LineString.
 void abortMultiLineString()
          Signals a malformed MultiLineString.
 void abortMultiPoint()
          Signals a malformed MultiPoint.
 void abortMultiPolygon()
          Signals a malformed MultiPolygon.
 void abortPoint()
          Signals a malformed Point.
 void abortPolygon()
          Signals a malformed Polygon.
 void abortUnit()
          Signals the problematic stop of the transcription process for a Geometry.
 void abortWork()
          Signals the problematic stop of the transcription process for a buffer of WKB data.
 boolean addPoints(double[] points)
          points is an array of doubles reprensentings coordinates.
 boolean addPoints3D(double[] points)
           
private  void advancePointer(int type)
           
 boolean beginGeometryCollection(int count)
          Signals the beginning of a new GeometryCollection.
 boolean beginLinearRing(int count)
          Signals the beginning of a new LinearRing.
 boolean beginLineString(int count)
          Signals the beginning of a new LineString
 boolean beginMultiLineString(int count)
          Signals the beginning of a new MultiLineString.
 boolean beginMultiPoint(int count)
          Signals the beginning of a new MultiPoint.
 boolean beginMultiPolygon(int count)
          Signals the beginning of a new MultiPolygon.
 boolean beginPoint()
          Signals the beginning of a new Point
 boolean beginPolygon(int count)
          Signals the beginning of a new Polygon.
 void beginUnit(int srid)
          Signals the beginning of the transcription process for a Geometry.
 void beginUnit(java.lang.String[] words, int[] values)
          Signals the beginning of the transcription process for a Geometry.
 void beginWork()
          Signals the beginning of the transcription process for a buffer of WKB data.
 boolean endGeometryCollection()
          Signals the end of a GeometryCollection.
 boolean endLinearRing()
          Signals the end of a LinearRing.
 boolean endLineString()
          Signals the end of a LineString.
 boolean endMultiLineString()
          Signals the end of a MultiLineString.
 boolean endMultiPoint()
          Signals the end of a MultiPoint.
 boolean endMultiPolygon()
          Signals the end of a MultiPolygon.
 boolean endPoint()
          Signals the end of a Point.
 boolean endPolygon()
          Signals the end of a Polygon.
 void endUnit()
          Signals the end of the transcription process for a Geometry.
 void endWork()
          Signals the end of the transcription process for a buffer of WKB data.
 int[] getValues()
          Returns the values.
 java.lang.String[] getWords()
          Returns the words.
protected  void init()
           
 boolean newGeometryCollectionComponent()
          Signals that a new component for the geometry factory is about to processed OR that all components has been used.
abstract  void reset()
           
private  boolean rewindPointer(int type)
           
protected  void setValues(int[] values)
          Sets the values.
protected  void setWords(java.lang.String[] words)
          Sets the words.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log

geometryDepth

protected final int geometryDepth
See Also:
Constant Field Values

depthPointer

protected int depthPointer
Points to the top of the stack.


typeStack

protected int[] typeStack

inWork

protected boolean inWork

inUnit

protected boolean inUnit

words

protected java.lang.String[] words

values

protected int[] values
Constructor Detail

AbstractWKBFactory

public AbstractWKBFactory()
Method Detail

init

protected void init()

beginWork

public void beginWork()
Description copied from interface: WKBFactory
Signals the beginning of the transcription process for a buffer of WKB data.

Specified by:
beginWork in interface WKBFactory
See Also:
WKBFactory.beginWork()

endWork

public void endWork()
Description copied from interface: WKBFactory
Signals the end of the transcription process for a buffer of WKB data.

Specified by:
endWork in interface WKBFactory
See Also:
WKBFactory.endWork()

abortWork

public void abortWork()
Description copied from interface: WKBFactory
Signals the problematic stop of the transcription process for a buffer of WKB data.

Specified by:
abortWork in interface WKBFactory
See Also:
WKBFactory.abortWork()

beginUnit

public void beginUnit(java.lang.String[] words,
                      int[] values)
Description copied from interface: WKBFactory
Signals the beginning of the transcription process for a Geometry. The submitted values will be available to all the Geometries contained in this Geometry

Specified by:
beginUnit in interface WKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginUnit()

beginUnit

public void beginUnit(int srid)
Description copied from interface: WKBFactory
Signals the beginning of the transcription process for a Geometry. The submitted SRID will be assigned to all the Geometries contained in this Geometry

Specified by:
beginUnit in interface WKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginUnit()

endUnit

public void endUnit()
Description copied from interface: WKBFactory
Signals the end of the transcription process for a Geometry.

Specified by:
endUnit in interface WKBFactory
See Also:
WKBFactory.endUnit()

abortUnit

public void abortUnit()
Description copied from interface: WKBFactory
Signals the problematic stop of the transcription process for a Geometry.

Specified by:
abortUnit in interface WKBFactory
See Also:
WKBFactory.abortUnit()

beginGeometryCollection

public boolean beginGeometryCollection(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new GeometryCollection.

Specified by:
beginGeometryCollection in interface WKBFactory
Parameters:
count - the number of elements in the GeometryCollection.
See Also:
org.wkb4j.engine.WKBFactory#beginGeometryCollection()

endGeometryCollection

public boolean endGeometryCollection()
Description copied from interface: WKBFactory
Signals the end of a GeometryCollection.

Specified by:
endGeometryCollection in interface WKBFactory
See Also:
WKBFactory.endGeometryCollection()

abortGeometryCollection

public void abortGeometryCollection()
Description copied from interface: WKBFactory
Signals a malformed GeometryCollection. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortGeometryCollection in interface WKBFactory
See Also:
WKBFactory.abortGeometryCollection()

newGeometryCollectionComponent

public boolean newGeometryCollectionComponent()
Description copied from interface: WKBFactory
Signals that a new component for the geometry factory is about to processed OR that all components has been used. and therefore that the current WKBFactory should take adequate steps.

Specified by:
newGeometryCollectionComponent in interface WKBFactory
See Also:
WKBFactory.abortGeometryCollection()

beginLineString

public boolean beginLineString(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new LineString. * @param count the number of elements in the LineString

Specified by:
beginLineString in interface WKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginLineString()

endLineString

public boolean endLineString()
Description copied from interface: WKBFactory
Signals the end of a LineString.

Specified by:
endLineString in interface WKBFactory
See Also:
WKBFactory.endLineString()

abortLineString

public void abortLineString()
Description copied from interface: WKBFactory
Signals a malformed LineString. This can happen at any time, and Factories should just skip the malformed and maybe escalate the error.

Specified by:
abortLineString in interface WKBFactory
See Also:
WKBFactory.abortLineString()

beginMultiLineString

public boolean beginMultiLineString(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new MultiLineString.

Specified by:
beginMultiLineString in interface WKBFactory
Parameters:
count - the number of elements in the MultiLineString.
See Also:
org.wkb4j.engine.WKBFactory#beginMultiLineString()

endMultiLineString

public boolean endMultiLineString()
Description copied from interface: WKBFactory
Signals the end of a MultiLineString.

Specified by:
endMultiLineString in interface WKBFactory
See Also:
WKBFactory.endMultiLineString()

abortMultiLineString

public void abortMultiLineString()
Description copied from interface: WKBFactory
Signals a malformed MultiLineString. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortMultiLineString in interface WKBFactory
See Also:
WKBFactory.abortMultiLineString()

beginMultiPolygon

public boolean beginMultiPolygon(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new MultiPolygon.

Specified by:
beginMultiPolygon in interface WKBFactory
Parameters:
count - the number of elements in the MultiPolygon.
See Also:
org.wkb4j.engine.WKBFactory#beginMultiPolygon()

endMultiPolygon

public boolean endMultiPolygon()
Description copied from interface: WKBFactory
Signals the end of a MultiPolygon.

Specified by:
endMultiPolygon in interface WKBFactory
See Also:
WKBFactory.endMultiPolygon()

abortMultiPolygon

public void abortMultiPolygon()
Description copied from interface: WKBFactory
Signals a malformed MultiPolygon. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortMultiPolygon in interface WKBFactory
See Also:
WKBFactory.abortMultiPolygon()

beginPolygon

public boolean beginPolygon(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new Polygon.

Specified by:
beginPolygon in interface WKBFactory
Parameters:
count - the number of elements in the Polygon.
See Also:
org.wkb4j.engine.WKBFactory#beginPolygon()

endPolygon

public boolean endPolygon()
Description copied from interface: WKBFactory
Signals the end of a Polygon.

Specified by:
endPolygon in interface WKBFactory
See Also:
WKBFactory.endPolygon()

abortPolygon

public void abortPolygon()
Description copied from interface: WKBFactory
Signals a malformed Polygon. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortPolygon in interface WKBFactory
See Also:
WKBFactory.abortPolygon()

beginMultiPoint

public boolean beginMultiPoint(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new MultiPoint.

Specified by:
beginMultiPoint in interface WKBFactory
Parameters:
count - the number of elements in the MultiPoint.
See Also:
org.wkb4j.engine.WKBFactory#beginMultiPoint()

endMultiPoint

public boolean endMultiPoint()
Description copied from interface: WKBFactory
Signals the end of a MultiPoint.

Specified by:
endMultiPoint in interface WKBFactory
See Also:
WKBFactory.endMultiPoint()

abortMultiPoint

public void abortMultiPoint()
Description copied from interface: WKBFactory
Signals a malformed MultiPoint. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortMultiPoint in interface WKBFactory
See Also:
WKBFactory.abortMultiPoint()

beginPoint

public boolean beginPoint()
Description copied from interface: WKBFactory
Signals the beginning of a new Point. * @param count the number of elements in the Point

Specified by:
beginPoint in interface WKBFactory
See Also:
WKBFactory.beginPoint()

endPoint

public boolean endPoint()
Description copied from interface: WKBFactory
Signals the end of a Point.

Specified by:
endPoint in interface WKBFactory
See Also:
WKBFactory.endPoint()

abortPoint

public void abortPoint()
Description copied from interface: WKBFactory
Signals a malformed Point. This can happen at any time, and Factories should just skip the malformed and maybe escalate the error.

Specified by:
abortPoint in interface WKBFactory
See Also:
WKBFactory.abortPoint()

beginLinearRing

public boolean beginLinearRing(int count)
Description copied from interface: WKBFactory
Signals the beginning of a new LinearRing.

Specified by:
beginLinearRing in interface WKBFactory
Parameters:
count - the number of elements in the LinearRing.
See Also:
org.wkb4j.engine.WKBFactory#beginLineString()

endLinearRing

public boolean endLinearRing()
Description copied from interface: WKBFactory
Signals the end of a LinearRing.

Specified by:
endLinearRing in interface WKBFactory
See Also:
WKBFactory.endLinearRing()

abortLinearRing

public void abortLinearRing()
Description copied from interface: WKBFactory
Signals a malformed LinearRing. This can happen at any time, and Factories should just skip the malformed Geometry and maybe escalate the error.

Specified by:
abortLinearRing in interface WKBFactory
See Also:
WKBFactory.abortLinearRing()

addPoints

public boolean addPoints(double[] points)
Description copied from interface: WKBFactory
points is an array of doubles reprensentings coordinates. They are in the same order as the data in the WKB format. addPoints() and addPoints3D() are mutually exclusive and can only be called once.

Specified by:
addPoints in interface WKBFactory
See Also:
WKBFactory.addPoints(double[])

addPoints3D

public boolean addPoints3D(double[] points)
See Also:
WKBFactory.addPoints(double[])

advancePointer

private final void advancePointer(int type)

rewindPointer

private final boolean rewindPointer(int type)

getValues

public int[] getValues()
Returns the values.

Returns:
int[]

getWords

public java.lang.String[] getWords()
Returns the words.

Returns:
String[]

setValues

protected void setValues(int[] values)
Sets the values.

Parameters:
values - The values to set

setWords

protected void setWords(java.lang.String[] words)
Sets the words.

Parameters:
words - The words to set

reset

public abstract void reset()


Copyright © 2002-2003 David Garnier. All Rights Reserved.