1   /*
2    *    WKB4J - WKB reader for geographical mapping toolkits
3    *    (C) 2002,2003, David Garnier, dgarnier@users.sourceforge.net
4    *
5    *    This library is free software; you can redistribute it and/or
6    *    modify it under the terms of the GNU Lesser General Public
7    *    License as published by the Free Software Foundation,
8    *    version 2.1 of the License.
9    * 
10   *    This library is distributed in the hope that it will be useful,
11   *    but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   *    Lesser General Public License for more details.
14   *
15   *    You should have received a copy of the GNU Lesser General Public
16   *    License along with this library; if not, write to the Free Software
17   *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18   *    or visit the web to http://www.gnu.org.
19   * 
20   */
21  
22  package org.wkb4j.engine;
23  
24  /***
25   * <code>WKBFactory</code> must be implemented by any class wishing to serve as a factory
26   *  for geometric objects. When an object implements this interface, it can be submitted
27   *  to the <code>WKBParser</code> and it will call thoses methods with the correct values.
28   * The author of each factory is completly free to implement any behavior, including ignoring some calls.<br/>
29   * 
30   * wkbByteOrders and wkbTypes values don't generate events because there is no point in doing so.
31   * Similarly, there is no way to pass a generic  Geometry. MultiPoints, WKBPoints and Points are colapsed in a double array.
32   * It is the responsability of the Factory to ensure that the stream of events actually represents a correct construction. 
33   * See AbstractWKBFactory for an implementation of a "validating" WKBFactory. 
34   * 
35   * <br/>Inspired by the SAX API.
36   * @author David Garnier
37   *
38   * <br/>Creation date: 6 juil. 2002 21:22:00
39   * @version $Revision: 1.7 $ $Date: 2003/07/28 22:21:26 $
40   */
41  public interface WKBFactory {
42  
43  	/*** Signals the beginning of the transcription process for a buffer of WKB data.*/
44  	public void beginWork();
45  	/*** Signals the end of the transcription process for a buffer of WKB data.*/
46  	public void endWork();
47  	/*** Signals the problematic stop of the transcription process for a buffer of WKB data.*/
48  	public void abortWork();
49  
50  	/*** Signals the beginning of the transcription process for a <code>Geometry</code>.
51  	 *  The submitted SRID will be assigned to all the Geometries contained in this Geometry*/
52  	public void beginUnit(int srid);
53  
54  	/*** Signals the beginning of the transcription process for a <code>Geometry</code>.
55  	*  The submitted values will be available to all the Geometries contained in this Geometry*/
56  	public void beginUnit(String[] words, int[] values);
57  
58  	/*** Signals the end of the transcription process for a <code>Geometry</code>.*/
59  	public void endUnit();
60  	/*** Signals the problematic stop of the transcription process for a <code>Geometry</code>.*/
61  	public void abortUnit();
62  
63  	/*** Signals the beginning of a new <code>GeometryCollection</code>.
64  	 * @param count the number of elements in the <code>GeometryCollection</code>.*/
65  	public boolean beginGeometryCollection(int count);
66  
67  	/*** Signals the end of a <code>GeometryCollection</code>.*/
68  	public boolean endGeometryCollection();
69  
70  	/*** Signals a malformed <code>GeometryCollection</code>. This can happen at any time, 
71  	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
72  	public void abortGeometryCollection();
73  
74  	/*** Signals the beginning of a new <code>LineString</code>.
75  	 *  * @param count the number of elements in the <code>LineString</code> */
76  	public boolean beginLineString(int count);
77  
78  	/*** Signals the end of a <code>LineString</code>. */
79  	public boolean endLineString();
80  
81  	/*** Signals a malformed <code>LineString</code>. This can happen at any time, 
82  	 * and Factories should just skip the malformed <codeGeometry</code> and maybe escalate the error.*/
83  	public void abortLineString();
84  
85  	/*** Signals the beginning of a new <code>MultiLineString</code>.
86  	   * @param count the number of elements in the <code>MultiLineString</code>.
87  	  */
88  	public boolean beginMultiLineString(int count);
89  
90  	/*** Signals the end of a <code>MultiLineString</code>. */
91  	public boolean endMultiLineString();
92  
93  	/*** Signals a malformed <code>MultiLineString</code>. This can happen at any time, 
94  	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
95  	public void abortMultiLineString();
96  
97  	/*** Signals the beginning of a new <code>Point</code>.
98  	 *  * @param count the number of elements in the <code>Point</code> */
99  	public boolean beginPoint();
100 
101 	/*** Signals the end of a <code>Point</code>. */
102 	public boolean endPoint();
103 
104 	/*** Signals a malformed <code>Point</code>. This can happen at any time, 
105 	 * and Factories should just skip the malformed <codeGeometry</code> and maybe escalate the error.*/
106 	public void abortPoint();
107 
108 	/*** Signals the beginning of a new <code>MultiPoint</code>.
109 	   * @param count the number of elements in the <code>MultiPoint</code>.
110 	  */
111 	public boolean beginMultiPoint(int count);
112 
113 	/*** Signals the end of a <code>MultiPoint</code>. */
114 	public boolean endMultiPoint();
115 
116 	/*** Signals a malformed <code>MultiPoint</code>. This can happen at any time, 
117 	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
118 	public void abortMultiPoint();
119 
120 	/*** Signals the beginning of a new <code>MultiPolygon</code>.
121 	  * @param count the number of elements in the <code>MultiPolygon</code>.*/
122 	public boolean beginMultiPolygon(int count);
123 
124 	/*** Signals the end of a <code>MultiPolygon</code>. */
125 	public boolean endMultiPolygon();
126 
127 	/*** Signals a malformed <code>MultiPolygon</code>. This can happen at any time, 
128 	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
129 	public void abortMultiPolygon();
130 
131 	/*** Signals the beginning of a new <code>Polygon</code>.
132 	  * @param count the number of elements in the <code>Polygon</code>.
133 	 * */
134 	public boolean beginPolygon(int count);
135 
136 	/*** Signals the end of a <code>Polygon</code>. */
137 	public boolean endPolygon();
138 
139 	/*** Signals a malformed <code>Polygon</code>. This can happen at any time, 
140 	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
141 	public void abortPolygon();
142 
143 	/*** points is an array of doubles reprensentings coordinates. They are in the same order as the data in the WKB format.
144 	 * addPoints() and addPoints3D() are mutually exclusive and can only be called once.*/
145 	public boolean addPoints(double[] points);
146 
147 	/*** Signals the beginning of a new <code>LinearRing</code>.
148 	 * @param count the number of elements in the <code>LinearRing</code>.
149 	  */
150 	public boolean beginLinearRing(int count);
151 
152 	/*** Signals the end of a <code>LinearRing</code>. */
153 	public boolean endLinearRing();
154 
155 	/*** Signals a malformed <code>LinearRing</code>. This can happen at any time, 
156 	 * and Factories should just skip the malformed <code>Geometry</code> and maybe escalate the error.*/
157 	public void abortLinearRing();
158 
159 	/*** Signals that a new component for the geometry factory is about to processed OR that
160 	 * all components has been used.
161 	 * and therefore that the current WKBFactory should take adequate steps. */
162 	public boolean newGeometryCollectionComponent();
163 
164 }
This page was automatically generated by Maven