org.wkb4j.openmap
Class OpenMapFactory

java.lang.Object
  |
  +--org.wkb4j.factories.AbstractWKBFactory
        |
        +--org.wkb4j.openmap.OpenMapFactory
All Implemented Interfaces:
WKBFactory, WKBGeometryTypes

public class OpenMapFactory
extends AbstractWKBFactory

This class has capability to transform data in the WKB format into OpenMap objects. The mapping between the WKB format and OpenMap is not perfect because OpenMap wasn't designed with WKB. To put it simply, they are many possible mappings. Here is the one I choose.

All the generated OMGraphics are stored in a single OMGraphicList. So this OMGraphicList is really a simple list of OMLines, OMPolys and OMPoints
It would perfectly possible to program a library where OMGraphics could be nested. For example, a MultiLineString could be represented by an OMGraphicList. It would contain the OMLines emulating each LineString contained in the MultiLineString. If this MultiLineString is part of a GeometryCollection, the OMGraphicList could be nested into a larger OMGraphicList.
Internally, the OMGraphicList is really an OMGeometryList, since this class is really designed to let users fetch and project OMGraphics as fast as possible.
This class can set the AppObject of generated OMGraphics to an Integer representing the SRID of each feature.
You can download the OpenMap library from http://openmap.bbn.com.

Version:
$Revision: 1.5 $ $Date: 2003/08/02 23:52:18 $
Author:
David Garnier
Creation date: 10 juil. 2002 22:05:22

Field Summary
private  float[] coordinatesBuffer
           
private  com.bbn.openmap.omGraphics.OMGraphic currentGeometry
           
private  com.bbn.openmap.omGraphics.OMGraphicList geoColl
           
private  com.bbn.openmap.omGraphics.OMGraphicList geometries
           
protected static org.apache.log4j.Logger log
           
private  int srid
           
private  boolean sridAsAppObject
           
private  java.lang.Integer sridObject
           
private  com.bbn.openmap.omGraphics.OMGraphicList tempGraphicList
           
private  com.bbn.openmap.omGraphics.OMGraphicList tempGraphicList2
           
 
Fields inherited from class org.wkb4j.factories.AbstractWKBFactory
depthPointer, geometryDepth, inUnit, inWork, typeStack, values, words
 
Fields inherited from interface org.wkb4j.engine.WKBGeometryTypes
linearRing, wkbGeometryCollection, wkbLineString, wkbMultiLineString, wkbMultiPoint, wkbMultiPolygon, wkbPoint, wkbPolygon
 
Constructor Summary
OpenMapFactory()
          The OMGraphics won't contain the SRID in the AppObject.
OpenMapFactory(boolean _sridAsAppObject)
          If _sridAsShapeObject is true, the created OMGraphics will have the SRID of the record used as the AppObject.
 
Method Summary
 void abortGeometryCollection()
          Signals a malformed GeometryCollection.
 void abortMultiPolygon()
          Signals a malformed MultiPolygon.
 void abortPoint()
          Signals a malformed Point.
 boolean addPoints(double[] points)
          points is an array of doubles reprensentings coordinates.
 boolean addPoints3D(double[] points)
          OpenMap doesn't support 3D points, so the third coordinate is just discarded.
 boolean beginGeometryCollection(int count)
          Signals the beginning of a new GeometryCollection.
 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 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.
 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.
 com.bbn.openmap.omGraphics.OMGraphicList getGeometries()
          Returns the geometries.
 int getSrid()
          Returns the srid.
 boolean newGeometryCollectionComponent()
          Signals that a new component for the geometry factory is about to processed OR that all components has been used.
 void reset()
           
private  void setSrid(int srid)
          Sets the srid.
 
Methods inherited from class org.wkb4j.factories.AbstractWKBFactory
abortLinearRing, abortLineString, abortMultiLineString, abortMultiPoint, abortPolygon, abortUnit, abortWork, beginLinearRing, beginLineString, beginPoint, beginWork, endWork, getValues, getWords, init, setValues, setWords
 
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

sridAsAppObject

private final boolean sridAsAppObject

geometries

private final com.bbn.openmap.omGraphics.OMGraphicList geometries

coordinatesBuffer

private float[] coordinatesBuffer

tempGraphicList

private com.bbn.openmap.omGraphics.OMGraphicList tempGraphicList

tempGraphicList2

private com.bbn.openmap.omGraphics.OMGraphicList tempGraphicList2

geoColl

private com.bbn.openmap.omGraphics.OMGraphicList geoColl

srid

private int srid

sridObject

private java.lang.Integer sridObject

currentGeometry

private com.bbn.openmap.omGraphics.OMGraphic currentGeometry
Constructor Detail

OpenMapFactory

public OpenMapFactory()
The OMGraphics won't contain the SRID in the AppObject.


OpenMapFactory

public OpenMapFactory(boolean _sridAsAppObject)
If _sridAsShapeObject is true, the created OMGraphics will have the SRID of the record used as the AppObject. Otherwise, the SRID is ignored.

Method Detail

beginUnit

public final 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
Overrides:
beginUnit in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginUnit()

beginUnit

public final 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
Overrides:
beginUnit in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginUnit()

beginGeometryCollection

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

Specified by:
beginGeometryCollection in interface WKBFactory
Overrides:
beginGeometryCollection in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginGeometryCollection()

endGeometryCollection

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

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

newGeometryCollectionComponent

public final 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
Overrides:
newGeometryCollectionComponent in class AbstractWKBFactory
See Also:
WKBFactory.abortGeometryCollection()

abortGeometryCollection

public final 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
Overrides:
abortGeometryCollection in class AbstractWKBFactory
See Also:
WKBFactory.abortGeometryCollection()

endLineString

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

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

beginMultiLineString

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

Specified by:
beginMultiLineString in interface WKBFactory
Overrides:
beginMultiLineString in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginMultiLineString()

endMultiLineString

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

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

endPoint

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

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

abortPoint

public final 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
Overrides:
abortPoint in class AbstractWKBFactory
See Also:
WKBFactory.abortPoint()

beginMultiPoint

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

Specified by:
beginMultiPoint in interface WKBFactory
Overrides:
beginMultiPoint in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginMultiPoint()

endMultiPoint

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

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

beginMultiPolygon

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

Specified by:
beginMultiPolygon in interface WKBFactory
Overrides:
beginMultiPolygon in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginMultiPolygon()

endMultiPolygon

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

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

abortMultiPolygon

public final 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
Overrides:
abortMultiPolygon in class AbstractWKBFactory
See Also:
WKBFactory.abortMultiPolygon()

beginPolygon

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

Specified by:
beginPolygon in interface WKBFactory
Overrides:
beginPolygon in class AbstractWKBFactory
See Also:
org.wkb4j.engine.WKBFactory#beginPolygon()

endPolygon

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

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

endLinearRing

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

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

addPoints

public final 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
Overrides:
addPoints in class AbstractWKBFactory
See Also:
WKBFactory.addPoints(double[])

addPoints3D

public final boolean addPoints3D(double[] points)
OpenMap doesn't support 3D points, so the third coordinate is just discarded. OpenMap encodes coordinates as floats, so there is a possible loss of precision when casting from double to float.

Overrides:
addPoints3D in class AbstractWKBFactory
See Also:
WKBFactory.addPoints(double[])

getGeometries

public final com.bbn.openmap.omGraphics.OMGraphicList getGeometries()
Returns the geometries.

Returns:
ArrayList

getSrid

public final int getSrid()
Returns the srid.

Returns:
int

setSrid

private void setSrid(int srid)
Sets the srid.

Parameters:
srid - The srid to set

reset

public void reset()
Specified by:
reset in class AbstractWKBFactory
See Also:
AbstractWKBFactory.reset()

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
Overrides:
endUnit in class AbstractWKBFactory
See Also:
WKBFactory.endUnit()


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