Revision 10626 trunk/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/core/fmap/AbstractGeoprocess.java

View differences:

AbstractGeoprocess.java
45 45
*
46 46
* $Id$
47 47
* $Log$
48
* Revision 1.9  2006-10-20 14:28:30  azabala
48
* Revision 1.10  2007-03-06 16:47:58  caballero
49
* Exceptions
50
*
51
* Revision 1.9  2006/10/20 14:28:30  azabala
49 52
* changed visibility of createLayerFrom method to protected
50 53
*
51 54
* Revision 1.8  2006/09/15 10:42:54  caballero
......
102 105

  
103 106
import org.cresques.cts.IProjection;
104 107

  
108
import com.hardcode.gdbms.driver.exceptions.SchemaEditionException;
105 109
import com.iver.andami.PluginServices;
106 110
import com.iver.cit.gvsig.fmap.MapContext;
107 111
import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition;
108 112
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver;
109
import com.iver.cit.gvsig.fmap.edition.EditionException;
110 113
import com.iver.cit.gvsig.fmap.edition.ISchemaManager;
111 114
import com.iver.cit.gvsig.fmap.edition.IWriter;
112 115
import com.iver.cit.gvsig.fmap.edition.writers.shp.MultiShpWriter;
......
136 139
	 * vectorial layer
137 140
	 */
138 141
	protected FLyrVect firstLayer;
139
		
142

  
140 143
	public abstract void setParameters(Map params) throws GeoprocessException;
141 144

  
142 145
	public abstract void checkPreconditions() throws GeoprocessException;
143 146

  
144 147
	public abstract void process() throws GeoprocessException;
145
	
148

  
146 149
	public  void cancel(){
147 150
		try {
148 151
			schemaManager.removeSchema("");
149
		} catch (EditionException e) {
152
		} catch (SchemaEditionException e) {
150 153
			// TODO Auto-generated catch block
151 154
			e.printStackTrace();
152 155
		}
153 156
	}
154
	
155
	
157

  
158

  
156 159
	protected FLayer createLayerFrom(IWriter writer) throws GeoprocessException{
157 160
		FLyrVect solution = null;
158 161
		//Para evitar todos estos casts, hay que meter la
......
162 165
		int fileNameStart = fileName.lastIndexOf(File.separator) + 1;
163 166
		if(fileNameStart == -1)
164 167
			fileNameStart = 0;
165
		layerName = fileName.substring(fileNameStart, fileName.length() /*-1*/);		
168
		layerName = fileName.substring(fileNameStart, fileName.length() /*-1*/);
166 169
		File file = new File(fileName);
167 170
		IProjection proj = firstLayer.getProjection();
168 171
		//TODO La proyeccion se deberia leer del WRITER
......
174 177
									driver,
175 178
									file,
176 179
									proj);
177
			return solution; 
180
			return solution;
178 181
		} catch (Exception e) {
179 182
			throw new GeoprocessException("Problemas al cargar la capa resultado", e);
180
		} 	
183
		}
181 184
	}
182
		
185

  
183 186
	/**
184 187
	 * Creates a new Layer with:
185 188
	 * a) the same projection than input layer.
186 189
	 * b) an adapter created to work with writer's persistent store
187
	 * 
190
	 *
188 191
	 * @return FLyrVect with geoprocess result
189 192
	 */
190 193
	public FLayer getResult() throws GeoprocessException {
......
203 206
				int fileNameStart = name.lastIndexOf(File.separator) + 1;
204 207
				if(fileNameStart == -1)
205 208
					fileNameStart = 0;
206
				name = name.substring(fileNameStart, name.length());		
209
				name = name.substring(fileNameStart, name.length());
207 210
				solution.setName(name);
208 211
				for(int i = 0; i < writers.length; i++){
209 212
					solution.addLayer(createLayerFrom(writers[i]));
......
212 215
			}else{
213 216
				return createLayerFrom(writers[0]);
214 217
			}
215
		}		
218
		}
216 219
	}
217 220

  
218 221
	public void setResultLayerProperties(IWriter writer,
......
220 223
		this.writer = writer;
221 224
		this.schemaManager = schemaManager;
222 225
	}
223
	
226

  
224 227
	public abstract ILayerDefinition createLayerDefinition();
225
	
228

  
226 229
}
227 230

  

Also available in: Unified diff