Revision 60 org.gvsig.sextante/trunk/org.gvsig.sextante.app/org.gvsig.sextante.app.algorithm/org.gvsig.sextante.app.algorithm.spatialjoin/src/main/java/org/gvsig/sextante/app/algorithm/spatialjoin/SpatialJoinParametersPanel.java
SpatialJoinParametersPanel.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
import org.gvsig.gui.beans.table.TableContainer; |
36 | 36 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
37 |
import org.gvsig.sextante.app.extension.core.CompositeSourceOutputChannel; |
|
37 | 38 |
import org.gvsig.sextante.app.extension.gui.AlgorithmOutputPanel; |
38 | 39 |
|
39 | 40 |
import es.unex.sextante.core.GeoAlgorithm; |
40 | 41 |
import es.unex.sextante.core.ObjectAndDescription; |
42 |
import es.unex.sextante.core.OutputObjectsSet; |
|
43 |
import es.unex.sextante.core.ParametersSet; |
|
41 | 44 |
import es.unex.sextante.core.Sextante; |
42 | 45 |
import es.unex.sextante.dataObjects.IVectorLayer; |
43 | 46 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
44 | 47 |
import es.unex.sextante.gui.core.SextanteGUI; |
48 |
import es.unex.sextante.outputs.Output; |
|
45 | 49 |
|
46 | 50 |
/** |
47 | 51 |
* Panel for dissolve algorithm |
... | ... | |
261 | 265 |
|
262 | 266 |
@Override |
263 | 267 |
public boolean assignParameters() { |
264 |
/*try {
|
|
268 |
try { |
|
265 | 269 |
ParametersSet params = m_Algorithm.getParameters(); |
266 |
params.getParameter(SpatialJoinAlgorithm.LAYER).setParameterValue(getSelectedVectorLayer()); |
|
267 |
params.getParameter(SpatialJoinAlgorithm.FIELD).setParameterValue(layersJoinCombo.getSelectedIndex());
|
|
270 |
params.getParameter(SpatialJoinAlgorithm.LAYER1).setParameterValue(getSelectedVectorLayer());
|
|
271 |
params.getParameter(SpatialJoinAlgorithm.LAYER2).setParameterValue(getSelectedVectorLayer2());
|
|
268 | 272 |
params.getParameter(SpatialJoinAlgorithm.SELECTED_GEOM).setParameterValue(getSelectionCheck().isSelected()); |
269 |
params.getParameter(SpatialJoinAlgorithm.DISSOLV_ADJ).setParameterValue(getAdjacentCheck().isSelected()); |
|
270 |
|
|
273 |
params.getParameter(SpatialJoinAlgorithm.NEAREST).setParameterValue(getNearestCheck().isSelected()); |
|
271 | 274 |
params.getParameter(SpatialJoinAlgorithm.FUNCTION_LIST).setParameterValue(getValues()); |
272 | 275 |
|
273 | 276 |
OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
274 |
Output out = ooSet.getOutput(DissolveAlgorithm.RESULT);
|
|
275 |
IOutputSelection fsp = getAlgorithmOutputPanel();
|
|
277 |
Output out = ooSet.getOutput(SpatialJoinAlgorithm.RESULT);
|
|
278 |
AlgorithmOutputPanel fsp = getAlgorithmOutputPanel();
|
|
276 | 279 |
out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters())); |
280 |
|
|
277 | 281 |
return true; |
278 | 282 |
} catch (Exception e) { |
279 | 283 |
Sextante.addErrorToLog(e); |
280 | 284 |
return false; |
281 |
}*/ |
|
282 |
return true; |
|
285 |
} |
|
283 | 286 |
} |
284 |
|
|
285 |
/** |
|
286 |
* Formats the content of the table |
|
287 |
* @return |
|
288 |
*/ |
|
289 |
private String getValues() { |
|
290 |
String str = ""; |
|
291 |
try { |
|
292 |
for (int i = 0; i < getRadioButtonTable().getRowCount(); i++) { |
|
293 |
str = str + (String)getRadioButtonTable().getModel().getValueAt(i, 4) + ","; |
|
294 |
for (int j = 0; j < getRadioButtonTable().getModel().getColumnCount() - 1; j++) |
|
295 |
if(((Boolean)getRadioButtonTable().getModel().getValueAt(i, j)).booleanValue()) |
|
296 |
str = str + SpatialJoinAlgorithm.Summary[j] + ","; |
|
297 |
str = str.substring(0, str.length() - 1) + ";"; |
|
298 |
} |
|
299 |
} catch (NotInitializeException e) { |
|
300 |
Sextante.addErrorToLog(e); |
|
301 |
} |
|
302 |
return str.substring(0, str.length() - 1); |
|
303 |
} |
|
304 | 287 |
|
305 | 288 |
@Override |
306 | 289 |
public void setOutputValue(String arg0, String arg1) { |
... | ... | |
336 | 319 |
} |
337 | 320 |
|
338 | 321 |
/** |
322 |
* Gets the selected vector layer in the JComboBox |
|
323 |
* @return |
|
324 |
*/ |
|
325 |
private IVectorLayer getSelectedVectorLayer2() { |
|
326 |
if(layersJoinCombo.getSelectedItem() != null) |
|
327 |
return (IVectorLayer)((ObjectAndDescription)layersJoinCombo.getSelectedItem()).getObject(); |
|
328 |
return null; |
|
329 |
} |
|
330 |
|
|
331 |
/** |
|
339 | 332 |
* Gets the field list of the selected layer |
340 | 333 |
* @return |
341 | 334 |
*/ |
... | ... | |
346 | 339 |
data[i] = layer.getFieldName(i); |
347 | 340 |
return data; |
348 | 341 |
} |
342 |
|
|
343 |
/** |
|
344 |
* Formats the content of the table |
|
345 |
* @return |
|
346 |
*/ |
|
347 |
private String getValues() { |
|
348 |
String str = ""; |
|
349 |
try { |
|
350 |
for (int i = 0; i < getRadioButtonTable().getRowCount(); i++) { |
|
351 |
str = str + (String)getRadioButtonTable().getModel().getValueAt(i, 4) + ","; |
|
352 |
for (int j = 0; j < getRadioButtonTable().getModel().getColumnCount() - 1; j++) |
|
353 |
if(((Boolean)getRadioButtonTable().getModel().getValueAt(i, j)).booleanValue()) |
|
354 |
str = str + SpatialJoinAlgorithm.Summary[j] + ","; |
|
355 |
str = str.substring(0, str.length() - 1) + ";"; |
|
356 |
} |
|
357 |
} catch (NotInitializeException e) { |
|
358 |
Sextante.addErrorToLog(e); |
|
359 |
} |
|
360 |
return str.substring(0, str.length() - 1); |
|
361 |
} |
|
362 |
|
|
349 | 363 |
} |
Also available in: Unified diff