Revision 11878

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/DefaultFeatureIterator.java
1
/*
2
 * Created on 11-abr-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id$
47
* $Log$
48
* Revision 1.1  2007-04-19 17:27:58  azabala
49
* first version in cvs
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.fmap.drivers;
54

  
55
import org.cresques.cts.ICoordTrans;
56
import org.cresques.cts.IProjection;
57

  
58
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
59
import com.hardcode.gdbms.engine.values.Value;
60
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
61
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
62
import com.iver.cit.gvsig.fmap.core.IFeature;
63
import com.iver.cit.gvsig.fmap.core.IGeometry;
64
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
65
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
66

  
67
/**
68
 * 
69
 * Iterator over all the features of a vectorial adapter.
70
 * It is thinked for data sources which dont have capabilities
71
 * of querying or reprojection.
72
 * 
73
 * 
74
 * @author Alvaro Zabala
75
 * */
76
public class DefaultFeatureIterator implements IFeatureIterator {
77
	
78
	/**
79
	 * Projection of the layer on which this iterator iterates.
80
	 * TODO Move projection from layer to adapter or driver
81
	 * */
82
	protected IProjection sourceProjection;
83
    /**
84
     * If its setted, all features returned by this iterator
85
     * will be previously reprojected to this target projection
86
     */
87
	protected IProjection targetProjection;
88
	/**
89
	 * If its setted, returned features only will have these alphanumeric attributes
90
	 */
91
	protected String[] fieldNames;
92
	
93
	/**
94
	 * vectorial data source. It reads geometries
95
	 * and has the recordset
96
	 */
97
	protected ReadableVectorial source;
98
	/**
99
	 * recordset, it reads alphanumeric attributes
100
	 */
101
	protected SelectableDataSource recordset;
102
	
103
	/**
104
	 * index of the next feature that will be returned by this
105
	 * iterator
106
	 */
107
	protected int currentFeature;
108
	
109
	/**
110
	 * Default constructor. 
111
	 * Creates an iterator which will return features in the data source projection
112
	 * (without reprojection) and with all the alphanumeric attributes
113
	 * @throws ReadDriverException 
114
	 *
115
	 */
116
	public DefaultFeatureIterator( ReadableVectorial source) throws ReadDriverException{
117
		this.source = source;
118
		this.recordset = source.getRecordset();
119
		currentFeature = 0;
120
	}
121
	
122
	/**
123
	 * Constructor.
124
	 * The iterator will reproject the geometry of the features to the specified target projection,
125
	 * and with the specified attribute fields.
126
	 * */
127
	public DefaultFeatureIterator(ReadableVectorial source, 
128
									IProjection sourceProj, 
129
									IProjection targetProj, 
130
									String[] fieldNames) throws ReadDriverException{
131
		this(source);
132
		this.sourceProjection = sourceProj;
133
		this.targetProjection = targetProj;
134
		this.fieldNames = fieldNames;
135
	}
136
	
137
	public boolean hasNext() throws ReadDriverException,
138
			ExpansionFileReadException {
139
		boolean bMore = (currentFeature < source.getShapeCount());
140
		return bMore;
141
	}
142

  
143
	public IFeature next() throws ReadDriverException {
144
		
145
		try {
146
			IGeometry geom = getGeometry(currentFeature);
147
			Value[] regAtt = getValues(currentFeature);
148
			IFeature feat  = new DefaultFeature(geom, regAtt, currentFeature + "");
149
			currentFeature++;
150
			return feat;
151
		} catch (ExpansionFileReadException e) {
152
			throw new ReadDriverException("",e);
153
		} 
154
	}
155

  
156
	public void closeIterator() throws ReadDriverException {
157
	}
158

  
159
	public String[] getFieldNames() {
160
		return fieldNames;
161
	}
162

  
163
	public void setFieldNames(String[] fieldNames) {
164
		this.fieldNames = fieldNames;
165
	}
166

  
167
	public IProjection getTargetProjection() {
168
		return targetProjection;
169
	}
170

  
171
	public void setTargetProjection(IProjection targetProjection) {
172
		this.targetProjection = targetProjection;
173
	}
174

  
175
	public IProjection getSourceProjection() {
176
		return sourceProjection;
177
	}
178

  
179
	public void setSourceProjection(IProjection sourceProjection) {
180
		this.sourceProjection = sourceProjection;
181
	}
182
	
183
	protected IGeometry getGeometry(int geomIdx) throws ExpansionFileReadException, 
184
																ReadDriverException{
185
		IGeometry geom = source.getShape(geomIdx); 
186
		if(this.targetProjection != null && this.sourceProjection != null){
187
			ICoordTrans trans = sourceProjection.getCT(targetProjection);
188
			geom.reProject(trans);
189
		}
190
		return geom;
191
	}
192
	
193
	protected Value[] getValues(int featureIdx) throws ReadDriverException{
194
		Value[] regAtt = null;
195
		if(fieldNames == null){
196
			regAtt = new Value[recordset.getFieldCount()];
197
			for (int fieldId = 0; fieldId < recordset.getFieldCount(); fieldId++) {
198
				regAtt[fieldId] = recordset.getFieldValue(featureIdx, fieldId);
199
			}
200
		}else{
201
			regAtt = new Value[fieldNames.length];
202
			for (int fieldId = 0; fieldId < fieldNames.length; fieldId++) {
203
				int fieldCode = recordset.getFieldIndexByName(fieldNames[fieldId]);
204
				regAtt[fieldId] = recordset.getFieldValue(featureIdx, fieldCode);
205
			}
206
		}
207
		return regAtt;
208
	}
209
	
210
}
211

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/IndexedSptQueryFeatureIterator.java
1
/*
2
 * Created on 12-abr-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id$
47
* $Log$
48
* Revision 1.1  2007-04-19 17:27:58  azabala
49
* first version in cvs
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.fmap.drivers;
54

  
55
import java.awt.geom.Rectangle2D;
56
import java.util.List;
57

  
58
import org.cresques.cts.IProjection;
59

  
60
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
61
import com.hardcode.gdbms.engine.values.Value;
62
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
63
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
64
import com.iver.cit.gvsig.fmap.core.IFeature;
65
import com.iver.cit.gvsig.fmap.core.IGeometry;
66
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
67
import com.iver.cit.gvsig.fmap.spatialindex.ISpatialIndex;
68

  
69
/**
70
 * Feature iterator for a spatial query resolved with an spatial index.
71
 * @author azabala
72
 *
73
 */
74
public class IndexedSptQueryFeatureIterator extends SpatialQueryFeatureIterator {
75

  
76
	private ISpatialIndex spatialIndex;
77
	List resultIdx;
78
	
79
	public IndexedSptQueryFeatureIterator(ReadableVectorial source, 
80
											IProjection sourceProj, 
81
											IProjection targetProj, 
82
											String[] fieldNames, 
83
											Rectangle2D spatialQuery,
84
											ISpatialIndex spatialIndex) throws ReadDriverException {
85
		super(source, sourceProj, targetProj, fieldNames, spatialQuery);
86
		this.spatialIndex = spatialIndex;
87
		this.resultIdx = this.spatialIndex.query(spatialQuery);
88
	}
89
	
90
	public boolean hasNext(){
91
		if(resultIdx != null && currentFeature < resultIdx.size())
92
			return true;
93
		else
94
			return false;
95
	}
96
	
97
	public IFeature next() throws ReadDriverException {
98
		Integer nextFeatureIdx = (Integer) resultIdx.get(currentFeature);
99
		IGeometry geom;
100
		try {
101
			geom = getGeometry(nextFeatureIdx.intValue());
102
		} catch (ExpansionFileReadException e) {
103
			throw new ReadDriverException("Error accediendo al driver", e);
104
		} 
105
		
106
		Value[] regAtt = getValues(nextFeatureIdx.intValue());
107
		DefaultFeature feat = new DefaultFeature(geom, regAtt, currentFeature + "");
108
		currentFeature++;
109
		return feat;
110
	}
111

  
112
}
113

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/AttrQueryFeatureIterator.java
1
/*
2
 * Created on 12-abr-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id$
47
* $Log$
48
* Revision 1.1  2007-04-19 17:27:58  azabala
49
* first version in cvs
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.fmap.drivers;
54

  
55
import org.cresques.cts.IProjection;
56

  
57
import com.hardcode.driverManager.DriverLoadException;
58
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
59
import com.hardcode.gdbms.engine.data.DataSource;
60
import com.hardcode.gdbms.engine.data.DataSourceFactory;
61
import com.hardcode.gdbms.engine.instruction.EvaluationException;
62
import com.hardcode.gdbms.engine.instruction.SemanticException;
63
import com.hardcode.gdbms.engine.values.Value;
64
import com.hardcode.gdbms.parser.ParseException;
65
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
66
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
67
import com.iver.cit.gvsig.fmap.core.IFeature;
68
import com.iver.cit.gvsig.fmap.core.IGeometry;
69
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
70
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
71

  
72
/**
73
 * Iterates over the features of a vectorial data source
74
 * (readablevectorial, or vectorialadapter) which verify a SQL statement.
75
 * <br>
76
 * SQL sintax is very extrict, GDBMS based.
77
 * (for example, % character is not allowed to build strings expressions,
78
 * all SQL statement must end with ;, etc)
79
 * 
80
 * 
81
 * 
82
 * 
83
 * @author azabala
84
 *
85
 */
86
public class AttrQueryFeatureIterator extends DefaultFeatureIterator {
87

  
88
	private String sqlQuery;
89
	private long[] indexes;
90
	
91
	public AttrQueryFeatureIterator(ReadableVectorial source, 
92
										IProjection sourceProj, 
93
										IProjection targetProj, 
94
										String sqlQuery) throws ReadDriverException {
95
		super(source, sourceProj, targetProj, null);
96
		this.sqlQuery = sqlQuery;
97
		
98
		try {
99
			if(hasWhere(sqlQuery)){
100
				DataSource datasource = LayerFactory.getDataSourceFactory().executeSQL(sqlQuery,
101
						DataSourceFactory.MANUAL_OPENING);
102
				indexes = datasource.getWhereFilter();
103
			}else{
104
				//TODO This is not very elegant: rethink
105
				indexes = new long[source.getShapeCount()];
106
				for(int i = 0; i < indexes.length; i++){
107
					indexes[i] = i;
108
				}
109
			}
110
		} catch (Exception e){
111
			throw new ReadDriverException("error ejecutando consulta sql para iterador", e);
112
		}
113
	}
114
	
115
	public boolean hasNext(){
116
		if(indexes != null && currentFeature < indexes.length)
117
			return true;
118
		else
119
			return false;
120
	}
121
	
122
	private boolean hasWhere(String expression) {
123
		String subExpression = expression.trim();
124
		int pos;
125

  
126
		// Remove last ';' if exists
127
		if (subExpression.charAt(subExpression.length() -1) == ';')
128
			subExpression = subExpression.substring(0, subExpression.length() -1).trim();
129

  
130
		// If there is no 'where' clause
131
		if ((pos = subExpression.indexOf("where")) == -1)
132
			return false;
133

  
134
		// If there is no subexpression in the WHERE clause -> true
135
		subExpression = subExpression.substring(pos + 5, subExpression.length()).trim(); // + 5 is the length of 'where'
136
		if ( subExpression.length() == 0 )
137
			return false;
138
		else
139
			return true;
140
	}
141
	
142
	public IFeature next() throws ReadDriverException {
143
		IGeometry geom;
144
		try {
145
			geom = getGeometry((int)indexes[currentFeature]);
146
		} catch (ExpansionFileReadException e) {
147
			throw new ReadDriverException("Error accediendo al driver", e);
148
		} 
149
		
150
		Value[] regAtt = getValues((int)indexes[currentFeature]);
151
		DefaultFeature feat = new DefaultFeature(geom, regAtt, currentFeature + "");
152
		currentFeature++;
153
		return feat;
154
	}
155

  
156

  
157
}
158

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/SpatialQueryFeatureIterator.java
1
/*
2
 * Created on 12-abr-2007
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id$
47
* $Log$
48
* Revision 1.1  2007-04-19 17:27:58  azabala
49
* first version in cvs
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.fmap.drivers;
54

  
55
import java.awt.geom.Rectangle2D;
56

  
57
import org.cresques.cts.IProjection;
58

  
59
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
60
import com.hardcode.gdbms.engine.values.Value;
61
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
62
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
63
import com.iver.cit.gvsig.fmap.core.IFeature;
64
import com.iver.cit.gvsig.fmap.core.IGeometry;
65
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
66

  
67
public class SpatialQueryFeatureIterator extends DefaultFeatureIterator {
68

  
69
	/**
70
	 * region for which features we are iterating
71
	 */
72
	protected Rectangle2D rect;
73
	
74
	/**
75
	 * Feature which will be returned the next time
76
	 */
77
	IFeature nextFeature = null;
78
	
79
	/**
80
	 * Constructor.
81
	 * @param source vectorial data source
82
	 * @param sourceProj original projection of the data (it could be null)
83
	 * @param targetProj projection of the returned features
84
	 * @param fieldNames
85
	 * @param spatialQuery
86
	 * @throws ReadDriverException
87
	 */
88
	public SpatialQueryFeatureIterator(ReadableVectorial source, 
89
									   IProjection sourceProj, 
90
									   IProjection targetProj, 
91
									   String[] fieldNames,
92
									   Rectangle2D spatialQuery) throws ReadDriverException {
93
		super(source, sourceProj, targetProj, fieldNames);
94
		setRect(spatialQuery);
95
	}
96

  
97
	public Rectangle2D getRect() {
98
		return rect;
99
	}
100

  
101
	public void setRect(Rectangle2D rect) {
102
		this.rect = rect;
103
	}
104
	
105
	public boolean hasNext() throws ReadDriverException {
106
		try {
107
			IGeometry geom = getGeometry(currentFeature);
108
			IFeature feat = null;
109
			while (!(geom.fastIntersects(rect.getMinX(), 
110
											rect.getMinY(),
111
											rect.getWidth(), 
112
											rect.getHeight()))){
113
					currentFeature++;
114
					if (currentFeature < source.getShapeCount())
115
						geom = getGeometry(currentFeature);
116
					else
117
						return false;
118
			}//while
119
			Value[] regAtt = getValues(currentFeature);
120
			feat = new DefaultFeature(geom, regAtt, currentFeature + "");
121
			currentFeature++;
122
			nextFeature = feat;
123
			return true;
124
		} catch (ExpansionFileReadException e) {
125
			throw new ReadDriverException("Error accediendo a datos del driver durante la iteracion", e);		
126
		} 
127
	}
128
	
129
	public IFeature next() throws ReadDriverException {
130
		return nextFeature;
131
	}
132

  
133
}
134

  
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/RandomAccessFeatureIterator.java
1
package com.iver.cit.gvsig.fmap.drivers;
2

  
3
import java.awt.geom.Rectangle2D;
4

  
5
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
6
import com.hardcode.gdbms.engine.values.Value;
7
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
8
import com.iver.cit.gvsig.fmap.core.IFeature;
9
import com.iver.cit.gvsig.fmap.core.IGeometry;
10
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
11

  
12
public class RandomAccessFeatureIterator implements IFeatureIterator {
13
	VectorialDriver drv;
14
	SelectableDataSource ds;
15
	Rectangle2D r = null;
16
	String epsg;
17
	int numRec = 0;
18
	public RandomAccessFeatureIterator(VectorialDriver driver, SelectableDataSource sds, Rectangle2D r, String strEPSG) {
19
		this.drv = driver;
20
		this.ds = sds;
21
		this.r = r;
22
		this.epsg = strEPSG;
23
	}
24
	public RandomAccessFeatureIterator(VectorialDriver driver, SelectableDataSource sds, String strEPSG) {
25
		this.drv = driver;
26
		this.ds = sds;
27
		this.epsg = strEPSG;
28
	}
29

  
30
	public boolean hasNext() throws ReadDriverException {
31
		boolean bMore = (numRec < drv.getShapeCount());
32
		return bMore;
33
	}
34

  
35
	public IFeature next() throws ReadDriverException {
36
		IGeometry geom;
37
		IFeature feat = null;
38
		geom = drv.getShape(numRec);
39
		// Si pedimos solo las que entran en un rect?ngulo....
40
		// ?QUE PASA SI TENEMOS UN ?NDICE ESPACIAL?
41
		if (r != null){
42
			while (!(geom.fastIntersects(r.getMinX(), r.getMinY(),
43
					r.getWidth(), r.getHeight()))){
44
				numRec++;
45
				if (numRec < drv.getShapeCount())
46
					geom = drv.getShape(numRec);
47
				else
48
					return null;
49
				}
50
		}
51
		Value[] regAtt = new Value[ds.getFieldCount()];
52
		for (int fieldId = 0; fieldId < ds.getFieldCount(); fieldId++) {
53
			regAtt[fieldId] = ds.getFieldValue(numRec, fieldId);
54
		}
55
		feat = new DefaultFeature(geom, regAtt, numRec + "");
56
		numRec++;
57
		return feat;
58
	}
59

  
60
	public void closeIterator() throws ReadDriverException {
61

  
62
	}
63

  
64

  
65
}

Also available in: Unified diff