Revision 12950 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/impl/difference/fmap/DifferenceGeoprocess.java
DifferenceGeoprocess.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.4 2007-05-15 07:24:19 cesar |
|
48 |
* Revision 1.5 2007-08-07 15:42:19 azabala |
|
49 |
* centrilizing JTS in JTSFacade |
|
50 |
* |
|
51 |
* Revision 1.4 2007/05/15 07:24:19 cesar |
|
49 | 52 |
* Add the finished method for execution from Event Dispatch Thread |
50 | 53 |
* |
51 | 54 |
* Revision 1.3 2007/03/06 16:47:58 caballero |
... | ... | |
105 | 108 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
106 | 109 |
import com.iver.cit.gvsig.exceptions.visitors.ProcessVisitorException; |
107 | 110 |
import com.iver.cit.gvsig.exceptions.visitors.VisitorException; |
111 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
108 | 112 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
109 | 113 |
import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition; |
110 | 114 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
... | ... | |
116 | 120 |
import com.iver.cit.gvsig.geoprocess.core.fmap.FeaturePersisterProcessor2; |
117 | 121 |
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException; |
118 | 122 |
import com.iver.cit.gvsig.geoprocess.core.fmap.IOverlayGeoprocess; |
119 |
import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes; |
|
120 | 123 |
import com.iver.utiles.swing.threads.CancellableMonitorable; |
121 | 124 |
import com.iver.utiles.swing.threads.DefaultCancellableMonitorable; |
122 | 125 |
import com.iver.utiles.swing.threads.IMonitorableTask; |
... | ... | |
190 | 193 |
throw new GeoprocessException( |
191 | 194 |
"Operacion de interseccion sin especificar capa de resultados"); |
192 | 195 |
} |
196 |
/*AZABALA: PERMITIMOS CAPAS DE PUNTOS, LINEAS Y DE POLIGONOS |
|
193 | 197 |
try { |
194 | 198 |
if (firstLayer.getShapeType() != XTypes.POLYGON |
195 | 199 |
&& firstLayer.getShapeType() != XTypes.MULTI) { |
... | ... | |
205 | 209 |
throw new GeoprocessException( |
206 | 210 |
"Error al tratar de chequear si las capas a intersectar son de pol?gonos"); |
207 | 211 |
} |
212 |
*/ |
|
208 | 213 |
|
209 | 214 |
} |
210 | 215 |
|
... | ... | |
213 | 218 |
//es que usa visitors distintos |
214 | 219 |
//REDISE?AR TODOS LOS OVERLAYGEOPROCESS |
215 | 220 |
public void process() throws GeoprocessException { |
216 |
|
|
217 | 221 |
try { |
218 |
//FIXME Sacar esto de aqu? y ponerlo fuera. Marcaremos como precondicion |
|
219 |
//que el esquema del geoproceso haya sido creado |
|
220 |
// Prepare the result |
|
221 |
this.schemaManager.createSchema(createLayerDefinition()); |
|
222 |
writer.preProcess(); |
|
223 |
Strategy strategy = |
|
224 |
StrategyManager.getStrategy(firstLayer); |
|
225 |
FeaturePersisterProcessor2 featureProcessor = new FeaturePersisterProcessor2( |
|
226 |
writer); |
|
227 |
Strategy overlayStrategy = |
|
228 |
StrategyManager.getStrategy(overlayLayer); |
|
229 |
DifferenceVisitor visitor = new DifferenceVisitor(overlayLayer, |
|
230 |
featureProcessor, overlayStrategy, onlyClipLayerSelection); |
|
231 |
visitor.setLayerDefinition(resultLayerDefinition); |
|
232 |
if (this.onlyFirstLayerSelection) { |
|
233 |
strategy.process(visitor, this.firstLayer.getRecordset() |
|
234 |
.getSelection()); |
|
235 |
} else { |
|
236 |
strategy.process(visitor); |
|
237 |
} |
|
238 |
|
|
239 |
} catch (ProcessVisitorException e) { |
|
240 |
throw new GeoprocessException( |
|
241 |
"Error al procesar el feature de una capa durante el geoproceso interseccion"); |
|
242 |
} catch (ReadDriverException e) { |
|
243 |
throw new GeoprocessException( |
|
244 |
"Error de driver al calcular el geoproceso interseccion"); |
|
245 |
} catch (SchemaEditionException e) { |
|
246 |
throw new GeoprocessException( |
|
247 |
"Error en el esquema de la nueva capa"); |
|
248 |
} catch (ExpansionFileReadException e) { |
|
249 |
throw new GeoprocessException( |
|
250 |
"Error de driver al calcular el geoproceso interseccion"); |
|
251 |
} catch (VisitorException e) { |
|
252 |
throw new GeoprocessException( |
|
253 |
"Error de driver al calcular el geoproceso interseccion"); |
|
222 |
new DifferenceMonitorableTask().run(); |
|
223 |
}catch (DriverIOException e) { |
|
224 |
throw new GeoprocessException("Error de lectura de driver durante geoproceso diferencia"); |
|
254 | 225 |
} |
255 | 226 |
} |
256 | 227 |
|
... | ... | |
266 | 237 |
public ILayerDefinition createLayerDefinition() { |
267 | 238 |
if (resultLayerDefinition == null) { |
268 | 239 |
try { |
269 |
// resultLayerDefinition = DefinitionUtils.mergeLayerDefinitions( |
|
270 |
// firstLayer, overlayLayer); |
|
271 | 240 |
resultLayerDefinition = DefinitionUtils.createLayerDefinition(firstLayer); |
241 |
//All overlay geoprocesses could generate various kind of geometry types |
|
242 |
resultLayerDefinition.setShapeType(FShape.MULTI); |
|
272 | 243 |
} catch (Exception e) { |
273 | 244 |
// TODO Quizas createLayerDefinition deberia lanzar |
274 | 245 |
// una excepcion |
Also available in: Unified diff