Revision 19329

View differences:

trunk/libraries/libTopology/src/com/iver/utiles/swing/threads/TopologyValidationTask.java
52 52
import org.gvsig.topology.Topology;
53 53

  
54 54
import com.iver.cit.gvsig.fmap.MapContext;
55
import com.iver.cit.gvsig.fmap.layers.FLayer;
56
import com.iver.cit.gvsig.fmap.layers.FLayers;
55 57

  
56 58
public class TopologyValidationTask extends CancellableProgressTask {
57 59

  
......
69 71

  
70 72
	public void run() throws Exception {
71 73
		topology.validate(this);
72
		if(topology.getNumberOfErrors() > 0)
73
			mapContext.getLayers().addLayer(topology.getErrorLayer());
74
		if(topology.getNumberOfErrors() > 0){
75
			//first of all, we check for a topology error layer for the same geometry
76
			FLayers mapContextLyrs = mapContext.getLayers();
77
			for(int i = 0; i < mapContextLyrs.getLayersCount(); i++){
78
				FLayer layer = mapContextLyrs.getLayer(i);
79
				if(layer.getName().equalsIgnoreCase(topology.getName()+"_error")){
80
					mapContextLyrs.removeLayer(layer);
81
				}
82
			}
83
			mapContextLyrs.addLayer(topology.getErrorLayer());
84
		}
74 85
		finished = true;
75 86
	}
76 87
	
trunk/libraries/libTopology/src/com/iver/utiles/swing/threads/CancellableProgressTask.java
70 70
	 * Primary message that describes the logic of the task this IMonitorableTask
71 71
	 * is doing.
72 72
	 */
73
	String statusMessage;
73
	protected String statusMessage;
74 74
	
75 75
	/**
76 76
	 * Secondary message that describes the current step that
77 77
	 * the task is doing.
78 78
	 */
79
	String currentNote;
79
	protected String currentNote;
80 80
	
81 81
	/**
82 82
	 * Marks if this process is finished.
83 83
	 */
84
	boolean finished;
84
	protected boolean finished;
85 85
	
86 86
	/**
87 87
	 * String connector to link the currentStep with the total number of steps

Also available in: Unified diff