Revision: 6110 http://sourceforge.net/p/jump-pilot/code/6110 Author: ma15569 Date: 2019-01-19 19:08:31 +0000 (Sat, 19 Jan 2019) Log Message: ----------- added log record
Modified Paths: -------------- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/AggregateRastersPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/CutRasterPlugin.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/PolygonsVectorizerPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterCombPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterHistogramPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterizeVectorLayerPlugIn.java plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ReclassRasterPlugin.java Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/AggregateRastersPlugin.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/AggregateRastersPlugin.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/AggregateRastersPlugin.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -15,6 +15,8 @@ import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; + import com.geomaticaeambiente.klemgui.ui.GUIUtils; import com.geomaticaeambiente.klemgui.ui.InitialDialog; import com.geomaticaeambiente.klemgui.ui.LayerablesList; @@ -37,7 +39,6 @@ import com.vividsolutions.jump.workbench.Logger; import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; import com.vividsolutions.jump.workbench.plugin.PlugInContext; -import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn; import com.vividsolutions.jump.workbench.ui.ErrorDialog; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; @@ -199,127 +200,41 @@ @Override public void rightButton() { - try { - AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() { - @Override - public String getName() { - return null; - } + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - @Override - public boolean execute(PlugInContext context) - throws Exception { - return true; - } + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - @Override - public void run(TaskMonitor monitor, - PlugInContext context) throws Exception { - monitor.report(PluginUtils.getResources() - .getString("OpenKlem.executing-process")); - // monitor.allowCancellationRequests(); - reportNothingToUndoYet(context); - try { - aggregateRastersCommand(componentsWithActions); - } catch (final Exception ex) { - Logger.error(getName(), ex); - } - } - }, context.getWorkbenchContext(), new TaskMonitorManager()) - .actionPerformed(null); + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + aggregateRastersCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); + Logger.error(PluginUtils.plugInName, ex); } - /* - try { - - //input values - final String newValuesTable = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.INPUT, 0)); //TODO: CHECK - final String[] fileNames = newValuesTable.split("_;"); - - final String aggregMethod = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "01", GUIUtils.INPUT, 1)); - final String overlayMethod = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "02", GUIUtils.INPUT, 1)); - final String cellSize = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "03", GUIUtils.INPUT, 1)); - - //get output raster name - final String outRasterName = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.OUTPUT, 1)); - - //check input and output values - checkValues(fileNames, aggregMethod, overlayMethod, - cellSize, outRasterName); - - //extract raster selected from combobox - // RasterImageLayer inputRasterSelected = PluginUtils.getRasterImageLayerSelected((RasterComboBox) componentsWithActions.getComponent("00", GUIUtils.INPUT, 1)); - // DoubleBasicGrid rasterDBG = RasterUtils.getDoubleBasicGrid(inputRasterSelected); - - super.getInitialDialog().setCursor( - new Cursor(Cursor.WAIT_CURSOR)); - - final List<DoubleBasicGrid> inputGrids_l = new ArrayList<DoubleBasicGrid>(); - for (final String fileName : fileNames) { - inputGrids_l - .add(RasterUtils - .getDoubleBasicGridFromFile(new File( - fileName))); - } - - final DoubleBasicGrid outputGrid = RasterAggregator - .aggregateRasters(inputGrids_l - .toArray(new DoubleBasicGrid[inputGrids_l - .size()]), Double - .parseDouble(cellSize), AggregationMethod - .valueOf(aggregMethod), OverlayMethod - .valueOf(overlayMethod)); - - //extract values from table - - // //exceute reclassification - // RasterReclassifier reclassifier = new RasterReclassifier(); - // DoubleBasicGrid reclassRaster = reclassifier.reclassify(rasterDBG, reclasPair); - // - // ///Create the output rasterImageLayer and display on OJ - //Save grid as tiff - RasterUtils.saveOutputRasterAsTiff(outputGrid, new File( - outRasterName)); - //Display raster on OJ from file - RasterUtils.displayRasterFileOnOJ(context - .getWorkbenchContext(), new File(outRasterName), - null); - - JOptionPane.showMessageDialog( - super.getInitialDialog(), - PluginUtils.getResources().getString( - "SetWorkspacePlugin.Done.message"), - PluginUtils.plugInName, - JOptionPane.INFORMATION_MESSAGE); - - // } catch (NoninvertibleTransformException ex) { - // JOptionPane.showMessageDialog(super.getInitialDialog(), "Error:" + ex, PluginUtils.plugInName, JOptionPane.ERROR_MESSAGE); - } catch (final Exception ex) { - ErrorDialog.show(super.getInitialDialog(), - PluginUtils.plugInName, ex.toString(), - StringUtil.stackTrace(ex)); - } finally { - super.getInitialDialog().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); - }*/ } - ; - @Override public void leftButton() { Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/CutRasterPlugin.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/CutRasterPlugin.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/CutRasterPlugin.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -8,6 +8,7 @@ import javax.swing.JTextField; import org.openjump.core.rasterimage.RasterImageLayer; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; import com.geomaticaeambiente.klemgui.ui.CustomComboBox; import com.geomaticaeambiente.klemgui.ui.GUIUtils; @@ -27,7 +28,6 @@ import com.vividsolutions.jump.workbench.Logger; import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; import com.vividsolutions.jump.workbench.plugin.PlugInContext; -import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn; import com.vividsolutions.jump.workbench.ui.ErrorDialog; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; @@ -157,103 +157,37 @@ @Override public void rightButton() { try { + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - try { - AbstractPlugIn.toActionListener( - new ThreadedBasePlugIn() { - @Override - public String getName() { - return null; - } + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - @Override - public boolean execute(PlugInContext context) - throws Exception { - return true; - } - - @Override - public void run(TaskMonitor monitor, - PlugInContext context) - throws Exception { - monitor.report(PluginUtils - .getResources() - .getString( - "OpenKlem.executing-process")); - // monitor.allowCancellationRequests(); - reportNothingToUndoYet(context); - try { - cutRasterCommand(componentsWithActions); - } catch (final Exception ex) { - Logger.error(getName(), ex); - } - } - }, context.getWorkbenchContext(), - new TaskMonitorManager()).actionPerformed(null); - } catch (final Exception ex) { - ErrorDialog.show(super.getInitialDialog(), - PluginUtils.plugInName, ex.toString(), - StringUtil.stackTrace(ex)); - } - - //get input raster names - /* final String rasterSelected1 = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.INPUT, 1)); - final String rasterSelected2 = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "01", GUIUtils.INPUT, 1)); - - //get output raster name - final String outRasterName = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.OUTPUT, 1)); - - //check input values - GUIUtils.checkStringValue(rasterSelected1, RASTER_IN); - GUIUtils.checkStringValue(rasterSelected2, RASTER_MASK); - - //check output values - GUIUtils.checkFileValue(outRasterName, RASTER_OUT); - - //get input raster as rasterImageLayer from string - final RasterImageLayer inputRasterSelected = PluginUtils - .getRasterImageLayerSelected((CustomComboBox.RasterComboBox) componentsWithActions - .getComponent("00", GUIUtils.INPUT, 1)); - final DoubleBasicGrid inputGrid = RasterUtils - .getDoubleBasicGrid(inputRasterSelected); - - //get mask raster as rasterImageLayer from string - final RasterImageLayer maskRasterSelected = PluginUtils - .getRasterImageLayerSelected((CustomComboBox.RasterComboBox) componentsWithActions - .getComponent("01", GUIUtils.INPUT, 1)); - final DoubleBasicGrid clipperGrid = RasterUtils - .getDoubleBasicGrid(maskRasterSelected); - - //Clip raster - final DoubleBasicGrid clippedRaster = RasterClipper.clip( - inputGrid, clipperGrid); - - //Create the output file and display on OJ - //Save grid as tiff - RasterUtils.saveOutputRasterAsTiff(clippedRaster, new File( - outRasterName)); - //Display raster on OJ from file - RasterUtils.displayRasterFileOnOJ(context - .getWorkbenchContext(), new File(outRasterName), - null); - - JOptionPane.showMessageDialog( - super.getInitialDialog(), - PluginUtils.getResources().getString( - "SetWorkspacePlugin.Done.message"), - PluginUtils.plugInName, - JOptionPane.INFORMATION_MESSAGE);*/ - + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + cutRasterCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); + Logger.error(PluginUtils.plugInName, ex); } } Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/PolygonsVectorizerPlugIn.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/PolygonsVectorizerPlugIn.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/PolygonsVectorizerPlugIn.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -16,6 +16,7 @@ import org.openjump.core.rasterimage.algorithms.VectorizeAlgorithm; import org.openjump.core.rasterimage.sextante.OpenJUMPSextanteRasterLayer; import org.openjump.core.rasterimage.sextante.rasterWrappers.GridWrapperNotInterpolated; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; import com.geomaticaeambiente.klemgui.exceptions.WarningException; import com.geomaticaeambiente.klemgui.ui.CustomComboBox.RasterComboBox; @@ -115,23 +116,38 @@ @Override public void rightButton() { - try { + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - polygonsVectorizerCommand(componentsWithActions); + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - } catch (final WarningException ex) { - JOptionPane - .showMessageDialog(this, ex.getMessage(), - PluginUtils.plugInName, - JOptionPane.WARNING_MESSAGE); + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + polygonsVectorizerCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); - } finally { - super.getInitialDialog().setCursor( - new Cursor(Cursor.DEFAULT_CURSOR)); + Logger.error(PluginUtils.plugInName, ex); } } Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterCombPlugIn.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterCombPlugIn.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterCombPlugIn.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -12,6 +12,7 @@ import javax.swing.JTextField; import org.openjump.core.rasterimage.RasterImageLayer; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; import com.geomaticaeambiente.klemgui.ui.GUIUtils; import com.geomaticaeambiente.klemgui.ui.InitialDialog; @@ -34,7 +35,6 @@ import com.vividsolutions.jump.workbench.Logger; import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; import com.vividsolutions.jump.workbench.plugin.PlugInContext; -import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn; import com.vividsolutions.jump.workbench.ui.ErrorDialog; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; @@ -159,37 +159,37 @@ @Override public void rightButton() { try { - AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() { - @Override - public String getName() { - return null; - } + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - @Override - public boolean execute(PlugInContext context) - throws Exception { - return true; - } + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - @Override - public void run(TaskMonitor monitor, - PlugInContext context) throws Exception { - monitor.report(PluginUtils.getResources() - .getString("OpenKlem.executing-process")); - // monitor.allowCancellationRequests(); - reportNothingToUndoYet(context); - try { - rasterCombCommand(componentsWithActions); - } catch (final Exception ex) { - Logger.error(getName(), ex); - } - } - }, context.getWorkbenchContext(), new TaskMonitorManager()) - .actionPerformed(null); + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + rasterCombCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); + Logger.error(PluginUtils.plugInName, ex); } } Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterHistogramPlugIn.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterHistogramPlugIn.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterHistogramPlugIn.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -4,6 +4,8 @@ import javax.swing.JPanel; import javax.swing.JTabbedPane; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; + import com.geomaticaeambiente.klemgui.ui.CustomComboBox; import com.geomaticaeambiente.klemgui.ui.GUIUtils; import com.geomaticaeambiente.klemgui.ui.InitialDialog; @@ -26,7 +28,6 @@ import com.vividsolutions.jump.workbench.Logger; import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; import com.vividsolutions.jump.workbench.plugin.PlugInContext; -import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn; import com.vividsolutions.jump.workbench.ui.ErrorDialog; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; @@ -79,8 +80,8 @@ private String selectedAlgo; - public void histogramCommand(final ComponentsTreeMap componentsWithActions) - throws Exception { + public void rasterHistogramCommand( + final ComponentsTreeMap componentsWithActions) throws Exception { // input values final String inRaster = GUIUtils.getStringValue(componentsWithActions @@ -149,110 +150,41 @@ @Override public void rightButton() { - try { - AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() { - @Override - public String getName() { - return null; - } + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - @Override - public boolean execute(PlugInContext context) - throws Exception { - return true; - } + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - @Override - public void run(TaskMonitor monitor, - PlugInContext context) throws Exception { - monitor.report(PluginUtils.getResources() - .getString("OpenKlem.executing-process")); - // monitor.allowCancellationRequests(); - reportNothingToUndoYet(context); - try { - histogramCommand(componentsWithActions); - } catch (final Exception ex) { - Logger.error(getName(), ex); - } - } - }, context.getWorkbenchContext(), new TaskMonitorManager()) - .actionPerformed(null); + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + rasterHistogramCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); + Logger.error(PluginUtils.plugInName, ex); } - } - /* @Override - public void rightButton() { - try { - - // input values - final String inRaster = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.INPUT, 1)); - - final JComboBox jComboBox_Algo = (JComboBox) componentsWithActions - .getComponent("01", GUIUtils.INPUT, 1); - final String selectedAlgo = jComboBox_Algo - .getSelectedItem().toString(); - - final String interval = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "02", GUIUtils.INPUT, 1)); - final String base = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "03", GUIUtils.INPUT, 1)); - - checksValues(inRaster, selectedAlgo, interval, base); - - final DoubleBasicGrid rasterGrid = RasterUtils - .getDoubleBasicGrid((CustomComboBox.RasterComboBox) componentsWithActions - .getComponent("00", GUIUtils.INPUT, 1)); - - final HistogramCalculator rasterHisto = new HistogramCalculator(); - Histogram histo = null; - - if (selectedAlgo.equalsIgnoreCase(AUTO)) { - histo = rasterHisto.calcStatsContinuous(rasterGrid, - new Autoscale(rasterGrid)); - } else if (selectedAlgo.equalsIgnoreCase(UNIQUE_VALS)) { - histo = rasterHisto.calcStatsUnique(rasterGrid); - } else if (selectedAlgo.equalsIgnoreCase(GIVEN_INTERVAL)) { - - final double intervalVal = Double.parseDouble(interval); - final double baseVal = Double.parseDouble(base); - - histo = rasterHisto.calcStatsContinuous(rasterGrid, - new GivenIntervals(rasterGrid, intervalVal, - baseVal)); - } - - if (histo == null) { - return; - } - - final JTabbedPane mainTabelPane = super.getInitialDialog() - .getTabbedPane(); - - final PersonalChartHistogram persChartHisto = new PersonalChartHistogram(); - - mainTabelPane.setComponentAt(1, persChartHisto - .buildHistogramPanel(getInitialDialog() - .getTabbedPane(), histo)); - mainTabelPane.setEnabledAt(1, true); - mainTabelPane.setSelectedIndex(1); - - } catch (final Exception ex) { - ErrorDialog.show(super.getInitialDialog(), - PluginUtils.plugInName, ex.toString(), - StringUtil.stackTrace(ex)); - } - }*/ - @Override public void leftButton() { throw new UnsupportedOperationException("Not supported yet."); // To Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterizeVectorLayerPlugIn.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterizeVectorLayerPlugIn.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/RasterizeVectorLayerPlugIn.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -1,5 +1,6 @@ package com.geomaticaeambiente.klemgui.plugin.rastertools; +import java.awt.Cursor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -18,6 +19,7 @@ import org.openjump.core.rasterimage.RasterImageLayer; +import com.geomaticaeambiente.klemgui.exceptions.WarningException; import com.geomaticaeambiente.klemgui.ui.CustomComboBox; import com.geomaticaeambiente.klemgui.ui.GUIUtils; import com.geomaticaeambiente.klemgui.ui.InitialDialog; Modified: plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ReclassRasterPlugin.java =================================================================== --- plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ReclassRasterPlugin.java 2019-01-19 19:01:46 UTC (rev 6109) +++ plug-ins/OpenKLEM/OpenKLEMOpenJUMP/trunk/src/com/geomaticaeambiente/klemgui/plugin/rastertools/ReclassRasterPlugin.java 2019-01-19 19:08:31 UTC (rev 6110) @@ -18,6 +18,7 @@ import javax.swing.table.DefaultTableModel; import org.openjump.core.rasterimage.RasterImageLayer; +import org.openjump.core.ui.plugin.AbstractThreadedUiPlugIn; import com.geomaticaeambiente.klemgui.ui.CustomComboBox; import com.geomaticaeambiente.klemgui.ui.CustomComboBox.RasterComboBox; @@ -42,7 +43,6 @@ import com.vividsolutions.jump.workbench.Logger; import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn; import com.vividsolutions.jump.workbench.plugin.PlugInContext; -import com.vividsolutions.jump.workbench.plugin.ThreadedBasePlugIn; import com.vividsolutions.jump.workbench.ui.ErrorDialog; import com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager; @@ -257,108 +257,41 @@ @Override public void rightButton() { - try { + AbstractPlugIn.toActionListener( + new AbstractThreadedUiPlugIn() { + @Override + public String getName() { + return null; + } - AbstractPlugIn.toActionListener(new ThreadedBasePlugIn() { - @Override - public String getName() { - return null; - } + @Override + public boolean execute(PlugInContext context) + throws Exception { + return true; + } - @Override - public boolean execute(PlugInContext context) - throws Exception { - return true; - } - - @Override - public void run(TaskMonitor monitor, - PlugInContext context) throws Exception { - monitor.report(PluginUtils.getResources() - .getString("OpenKlem.executing-process")); - // monitor.allowCancellationRequests(); - reportNothingToUndoYet(context); - try { - reclassRasterCommand(componentsWithActions); - } catch (final Exception ex) { - Logger.error(getName(), ex); - } - } - }, context.getWorkbenchContext(), new TaskMonitorManager()) - .actionPerformed(null); - - //input values - /* final String rasterSelected = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.INPUT, 1)); - final String methodSelected = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "01", GUIUtils.INPUT, 1)); - final String classesSelected = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "02", GUIUtils.INPUT, 1)); - final String stDevSelected = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "03", GUIUtils.INPUT, 1)); - final String intervalSelected = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "04", GUIUtils.INPUT, 1)); - - //get output raster name - final String outRasterName = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "00", GUIUtils.OUTPUT, 1)); - - //check input and output values - checkValues(rasterSelected, methodSelected, - classesSelected, stDevSelected, intervalSelected, - outRasterName); - - //extract raster selected from combobox - final RasterImageLayer inputRasterSelected = PluginUtils - .getRasterImageLayerSelected((RasterComboBox) componentsWithActions - .getComponent("00", GUIUtils.INPUT, 1)); - final DoubleBasicGrid rasterDBG = RasterUtils - .getDoubleBasicGrid(inputRasterSelected); - - //extract values from table - final String newValuesTable = GUIUtils - .getStringValue(componentsWithActions.getComponent( - "05", GUIUtils.INPUT, 0)); //TODO: CHECK - final ReclassTuple[] reclassPair = PluginUtils - .getReclassPairFromString(newValuesTable); - - //exceute reclassification - final RasterReclassifier reclassifier = new RasterReclassifier(); - final DoubleBasicGrid reclassRaster = reclassifier - .reclassify(rasterDBG, reclassPair); - - ///Create the output rasterImageLayer and display on OJ - //Save grid as tiff - RasterUtils.saveOutputRasterAsTiff(reclassRaster, new File( - outRasterName)); - //Display raster on OJ from file - RasterUtils.displayRasterFileOnOJ(context - .getWorkbenchContext(), new File(outRasterName), - null); - - JOptionPane.showMessageDialog( - super.getInitialDialog(), - PluginUtils.getResources().getString( - "SetWorkspacePlugin.Done.message"), - PluginUtils.plugInName, - JOptionPane.INFORMATION_MESSAGE);*/ - + @Override + public void run(TaskMonitor monitor, + PlugInContext context) throws Exception { + monitor.report(PluginUtils + .getResources() + .getString( + "OpenKlem.executing-process")); + reportNothingToUndoYet(context); + monitor.allowCancellationRequests(); + reclassRasterCommand(componentsWithActions); + } + }, context.getWorkbenchContext(), + new TaskMonitorManager()).actionPerformed(null); } catch (final Exception ex) { ErrorDialog.show(super.getInitialDialog(), PluginUtils.plugInName, ex.toString(), StringUtil.stackTrace(ex)); + Logger.error(PluginUtils.plugInName, ex); } } - ; - @Override public void leftButton() { _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel