Revision 4447 trunk/extensions/extGeoProcessing/src/com/iver/gvsig/geoprocessing/gui/GeoProcessingPanel.java
GeoProcessingPanel.java | ||
---|---|---|
828 | 828 |
ShpWriter writer = new ShpWriter(); |
829 | 829 |
join.setResultLayerProperties(writer, schemaManager); |
830 | 830 |
join.setParameters(params); |
831 |
SHPLayerDefinition definition = (SHPLayerDefinition) join
|
|
832 |
.createLayerDefinition();
|
|
831 |
SHPLayerDefinition definition = |
|
832 |
(SHPLayerDefinition) join.createLayerDefinition();
|
|
833 | 833 |
definition.setFile(outputFile); |
834 |
writer.setFile(definition.getFile()); |
|
835 |
writer.initialize(definition); |
|
834 | 836 |
writer = getShpWriter(definition); |
835 | 837 |
if (writer == null) |
836 | 838 |
return; |
837 |
join.process(); |
|
838 |
layers.addLayer(join.getResult()); |
|
839 |
IMonitorableTask task1 = join.createTask(); |
|
840 |
if(task1 == null){ |
|
841 |
//mensaje de error |
|
842 |
return; |
|
843 |
} |
|
844 |
IMonitorableTask task2 = new AddResultLayerTask(join); |
|
845 |
MonitorableDecorator globalTask = new MonitorableDecorator(task1, |
|
846 |
task2); |
|
847 |
if (globalTask.preprocess()) |
|
848 |
PluginServices.cancelableBackgroundExecution(globalTask); |
|
839 | 849 |
} catch (GeoprocessException e) { |
840 | 850 |
// TODO Auto-generated catch block |
841 | 851 |
e.printStackTrace(); |
852 |
} catch (IOException e) { |
|
853 |
// TODO Auto-generated catch block |
|
854 |
e.printStackTrace(); |
|
855 |
} catch (DriverException e) { |
|
856 |
// TODO Auto-generated catch block |
|
857 |
e.printStackTrace(); |
|
842 | 858 |
} |
843 | 859 |
|
844 | 860 |
} |
... | ... | |
870 | 886 |
definition.setFile(outputFile); |
871 | 887 |
ShpSchemaManager schemaManager = new ShpSchemaManager(); |
872 | 888 |
ShpWriter writer = getShpWriter(definition); |
873 |
if (writer == null) |
|
889 |
if (writer == null){ |
|
890 |
//TODO MOSTRAR MENSAJE DE ERROR |
|
874 | 891 |
return; |
892 |
} |
|
875 | 893 |
|
876 | 894 |
clip.setResultLayerProperties(writer, schemaManager); |
877 | 895 |
HashMap params = new HashMap(); |
... | ... | |
960 | 978 |
} |
961 | 979 |
|
962 | 980 |
public void doUnion() { |
963 |
Crono crono = new Crono(); |
|
964 |
JDialog cronoDialog = new JDialog(); |
|
965 |
cronoDialog.getContentPane().setLayout(new BorderLayout()); |
|
966 |
cronoDialog.getContentPane().add(crono, BorderLayout.CENTER); |
|
967 |
cronoDialog.pack(); |
|
968 |
cronoDialog.setVisible(true); |
|
969 |
crono.start(); |
|
970 |
/* |
|
971 |
* METER TODO ESTO EN UN THREAD APARTE GESTIONADO POR EL SWINGWORKER |
|
972 |
*/ |
|
973 | 981 |
FLyrVect inputLayer = geoProcessingUnionPanel.getFirstLayer(); |
974 | 982 |
FLyrVect overlayLayer = geoProcessingUnionPanel.getSecondLayer(); |
975 | 983 |
File outputFile = geoProcessingUnionPanel.getOutputFile(); |
976 | 984 |
UnionGeoprocess union = new UnionGeoprocess(inputLayer); |
977 | 985 |
union.setSecondOperand(overlayLayer); |
978 |
/* |
|
979 |
* TODO Ahora mismo ShpWriter crea el esquema en el constructor, por lo |
|
980 |
* que no estoy llamando a SchemaManager.createOrAlter. Lo suyo es que |
|
981 |
* ShpWriter implemente SchemaManager REVISAR |
|
982 |
*/ |
|
983 | 986 |
SHPLayerDefinition definition = (SHPLayerDefinition) union |
984 | 987 |
.createLayerDefinition(); |
985 | 988 |
definition.setFile(outputFile); |
... | ... | |
1003 | 1006 |
try { |
1004 | 1007 |
union.setParameters(params); |
1005 | 1008 |
union.checkPreconditions(); |
1006 |
union.process(); |
|
1007 |
layers.addLayer(union.getResult()); |
|
1009 |
IMonitorableTask task1 = union.createTask(); |
|
1010 |
if(task1 == null){ |
|
1011 |
//mensaje de error |
|
1012 |
return; |
|
1013 |
} |
|
1014 |
IMonitorableTask task2 = new AddResultLayerTask(union); |
|
1015 |
MonitorableDecorator globalTask = new MonitorableDecorator(task1, |
|
1016 |
task2); |
|
1017 |
if (globalTask.preprocess()) |
|
1018 |
PluginServices.cancelableBackgroundExecution(globalTask); |
|
1008 | 1019 |
} catch (GeoprocessException e) { |
1009 | 1020 |
// TODO Mostrar dialogo de error |
1010 | 1021 |
e.printStackTrace(); |
1011 | 1022 |
return; |
1012 | 1023 |
} |
1013 |
crono.stop(); |
|
1014 |
|
|
1015 | 1024 |
} |
1016 | 1025 |
|
1017 |
private int getQuadrantSegments() { |
|
1018 |
return (Integer.valueOf((String) ((JComboBox) geoProcessingBufferPanel |
|
1019 |
.getComponent(11)).getSelectedItem())).intValue(); |
|
1020 |
} |
|
1021 |
|
|
1022 |
private String insertRepeatedFieldChar(String inputString) { |
|
1023 |
char[] chars = inputString.toCharArray(); |
|
1024 |
String outputString; |
|
1025 |
if (chars.length < 10) { |
|
1026 |
outputString = inputString + "_"; |
|
1027 |
} else { |
|
1028 |
chars[9] = "_".charAt(0); |
|
1029 |
outputString = new String(chars); |
|
1030 |
} |
|
1031 |
return outputString; |
|
1032 |
} |
|
1033 |
|
|
1026 |
|
|
1034 | 1027 |
public void doConvexHull() { |
1035 | 1028 |
FLyrVect inputLayer = geoProcessingConvexHullPanel.getInputLayer(); |
1036 | 1029 |
File outputFile = geoProcessingConvexHullPanel.getOutputFile(); |
... | ... | |
1090 | 1083 |
ShpWriter writer = null; |
1091 | 1084 |
try { |
1092 | 1085 |
writer = new ShpWriter(); |
1093 |
writer.initialize(outputFile, definition); |
|
1086 |
writer.setFile(outputFile); |
|
1087 |
writer.initialize(definition); |
|
1094 | 1088 |
} catch (IOException e) { |
1095 | 1089 |
// TODO PONER MENSAJE DE ERROR INTERNACIONALIZADO |
1096 | 1090 |
e.printStackTrace(); |
Also available in: Unified diff