Revision 41 org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.base/src/main/java/org/gvsig/sextante/app/algorithm/base/core/GeometryOperation.java
GeometryOperation.java | ||
---|---|---|
19 | 19 |
*/ |
20 | 20 |
package org.gvsig.sextante.app.algorithm.base.core; |
21 | 21 |
|
22 |
import java.util.ArrayList; |
|
22 | 23 |
import java.util.Iterator; |
23 | 24 |
import java.util.List; |
24 | 25 |
|
... | ... | |
37 | 38 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
38 | 39 |
*/ |
39 | 40 |
public abstract class GeometryOperation { |
40 |
protected DALFeaturePersister persister = null; |
|
41 |
protected FeatureStore inFeatureStore = null; |
|
42 |
protected boolean selectedGeom = false; |
|
43 |
protected int numberOfFeatures = 0; |
|
41 |
protected DALFeaturePersister persister = null; |
|
42 |
protected FeatureStore inFeatureStore = null; |
|
43 |
protected ArrayList<FeatureStore> inFeatureStoreList = null; |
|
44 |
protected boolean selectedGeom = false; |
|
45 |
protected int numberOfFeatures = 0; |
|
44 | 46 |
|
45 | 47 |
/** |
46 | 48 |
* Invokes this operation and returns an EditableFeature |
... | ... | |
94 | 96 |
FeatureSet featuresSet = null; |
95 | 97 |
featuresSet = inFeatStore.getFeatureSet(); |
96 | 98 |
|
97 |
setFeatureStore(outFeatStore, attrNames); |
|
99 |
if(outFeatStore != null) |
|
100 |
setFeatureStore(outFeatStore, attrNames); |
|
98 | 101 |
DisposableIterator it = null; |
99 | 102 |
|
100 | 103 |
if(selectedGeom) { |
... | ... | |
143 | 146 |
* If it is true only the selected geometries will be processed |
144 | 147 |
* @throws DataException |
145 | 148 |
*/ |
146 |
@SuppressWarnings("unchecked") |
|
147 | 149 |
public void computesFeatureOperation(FeatureStore inFeatStore, |
148 | 150 |
FeatureStore outFeatStore, |
149 | 151 |
String[] attrNames, |
... | ... | |
154 | 156 |
FeatureSet featuresSet = null; |
155 | 157 |
featuresSet = inFeatStore.getFeatureSet(); |
156 | 158 |
|
157 |
setFeatureStore(outFeatStore, attrNames); |
|
159 |
if(outFeatStore != null) |
|
160 |
setFeatureStore(outFeatStore, attrNames); |
|
158 | 161 |
DisposableIterator it = null; |
159 | 162 |
|
160 | 163 |
if(selectedGeom) { |
... | ... | |
174 | 177 |
} |
175 | 178 |
|
176 | 179 |
/** |
180 |
* Computes a complete operation over the input list of FeatureStore. The result of this operation |
|
181 |
* is stored in the output FeatureStore. This method will call once for each geometry. |
|
182 |
* @param inFeatStoreList |
|
183 |
* Input FeatureStore list |
|
184 |
* @param outFeatStore |
|
185 |
* Output FeatureStore |
|
186 |
* @param attrNames |
|
187 |
* List of attributes to build the output feature store |
|
188 |
* @param selectedGeom |
|
189 |
* If it is true only the selected geometries will be processed |
|
190 |
* @throws DataException |
|
191 |
*/ |
|
192 |
public void computesGeometryOperationInAList(ArrayList<FeatureStore> inFeatStoreList, |
|
193 |
FeatureStore outFeatStore, |
|
194 |
String[] attrNames, |
|
195 |
boolean selectedGeom, |
|
196 |
boolean closeOutStore) throws DataException { |
|
197 |
this.inFeatureStoreList = inFeatStoreList; |
|
198 |
for (int i = 0; i < inFeatStoreList.size(); i++) { |
|
199 |
computesGeometryOperation(inFeatStoreList.get(i), |
|
200 |
i == 0 ? outFeatStore : null, |
|
201 |
attrNames, |
|
202 |
selectedGeom, |
|
203 |
false); |
|
204 |
} |
|
205 |
if(closeOutStore && persister != null) |
|
206 |
persister.end(); |
|
207 |
} |
|
208 |
|
|
209 |
/** |
|
177 | 210 |
* Ends the edition and closes the FeatureStore |
178 | 211 |
* @deprecated |
179 | 212 |
*/ |
Also available in: Unified diff