Revision 24094 trunk/extensions/extGeoprocessingExtensions/src/com/iver/cit/gvsig/geoprocess/impl/topology/lineclean/fmap/LineCleanGeoprocess.java

View differences:

LineCleanGeoprocess.java
130 130
	 * flag to only clip selection of input layer
131 131
	 */
132 132
	private boolean onlyFirstLayerSelection = false;
133
	
134
	/**
135
	 * flag to mark if must create a layer with the detected
136
	 * pseudonodes
137
	 */
138
	private boolean createLyrsWithErrorGeometries = false;
133 139

  
134 140
	/**
135 141
	 * Processes features (writing them)
......
140 146
	 * Writer to save in a temporal layer intersections
141 147
	 */
142 148
	private IWriter intersectionsWriter;
149
	/**
150
	 * Processor that saves created features using the IWriter
151
	 */
143 152
	FeaturePersisterProcessor2 intersectsProcessor;
144 153

  
145 154

  
......
153 162
		if (firstLayerSelection != null)
154 163
			this.onlyFirstLayerSelection =
155 164
				firstLayerSelection.booleanValue();
165
		
166
		Boolean createLyrsWithError = (Boolean) params.get("createlayerswitherrors");
167
		if (createLyrsWithError != null)
168
			this.createLyrsWithErrorGeometries =
169
				createLyrsWithError.booleanValue();
156 170

  
157 171
	}
158 172

  
......
370 384

  
371 385

  
372 386
	public FLayer getResult() throws GeoprocessException {
373

  
374 387
		FLyrVect cleanedLayer = (FLyrVect) createLayerFrom(this.writer);
375
		FLyrVect pseudoNodes = (FLyrVect) createLayerFrom(this.intersectionsWriter);
376
		try {
377
			if(pseudoNodes.getSource().getShapeCount() == 0){
378
				return cleanedLayer;
379
			}else{
380
				MapContext map = ((View)PluginServices.
381
						getMDIManager().
382
						getActiveWindow()).
383
						getModel().
384
						getMapContext();
385
				FLayers solution = new FLayers();//(map,null);
386
				solution.setMapContext(map);
387
				solution.setName(this.firstLayer.getName()+"_cleaned");
388
				solution.addLayer(cleanedLayer);
389
				solution.addLayer(pseudoNodes);
390
				return solution;
388
		FLyrVect pseudonodes = null;
389
		
390
		if(this.createLyrsWithErrorGeometries){
391
			pseudonodes = (FLyrVect) createLayerFrom(this.intersectionsWriter);
392
			try {
393
				if(pseudonodes.getSource().getShapeCount() != 0){
394
	
395
					MapContext map = ((View)PluginServices.getMDIManager().
396
														getActiveWindow()).
397
														getModel().
398
														getMapContext();
399
					FLayers solution = new FLayers();//(map,null);
400
					solution.setMapContext(map);
401
					solution.setName(this.firstLayer.getName()+"_cleaned");
402
					solution.addLayer(cleanedLayer);
403
					solution.addLayer(pseudonodes);
404
					return solution;
405
				}
406
			} catch (ReadDriverException e) {
407
				throw new GeoprocessException("Error de lectura de datos");
391 408
			}
392
		} catch (ReadDriverException e) {
393
			throw new GeoprocessException("Error de lectura de datos");
394
		}
395

  
396

  
397

  
398

  
409
		}//if
410
		
411
		return cleanedLayer;
399 412
	}
400 413

  
401 414
}

Also available in: Unified diff