root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / histogram / HistogramProcess.java @ 17719
History | View | Annotate | Download (2.74 KB)
1 | 10970 | bsanchez | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | */
|
||
19 | 10950 | bsanchez | package org.gvsig.rastertools.histogram; |
20 | |||
21 | 12383 | nacho | import org.gvsig.raster.datastruct.Histogram; |
22 | import org.gvsig.raster.datastruct.HistogramException; |
||
23 | import org.gvsig.raster.hierarchy.IHistogramable; |
||
24 | 17719 | bsanchez | import org.gvsig.rastertools.RasterProcess; |
25 | 10950 | bsanchez | |
26 | 11187 | bsanchez | import com.iver.andami.PluginServices; |
27 | 12502 | nacho | import com.iver.andami.messages.NotificationManager; |
28 | 11318 | bsanchez | /**
|
29 | * Clase para calcular histogramas. Esta clase implementa IIncrementable para
|
||
30 | * poder ser usado con una ventana de incremento <code>IncrementableTask</code>
|
||
31 | 12369 | bsanchez | *
|
32 | 11318 | bsanchez | * @version 23/04/2007
|
33 | 12369 | bsanchez | * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
34 | 11318 | bsanchez | */
|
35 | 17719 | bsanchez | public class HistogramProcess extends RasterProcess { |
36 | IHistogramable iHistogramable = null;
|
||
37 | 11042 | bsanchez | |
38 | 17719 | bsanchez | /*
|
39 | * (non-Javadoc)
|
||
40 | * @see org.gvsig.rastertools.RasterProcess#init()
|
||
41 | 11318 | bsanchez | */
|
42 | 17719 | bsanchez | public void init() { |
43 | iHistogramable = (IHistogramable) getParam("histogramable");
|
||
44 | 10950 | bsanchez | } |
45 | 11068 | bsanchez | |
46 | /*
|
||
47 | * (non-Javadoc)
|
||
48 | 17719 | bsanchez | * @see org.gvsig.rastertools.RasterProcess#process()
|
49 | 11068 | bsanchez | */
|
50 | 17719 | bsanchez | public void process() throws InterruptedException { |
51 | 10950 | bsanchez | try {
|
52 | 11318 | bsanchez | // Proceso duro de obtener un histograma. Puede durar bastante tiempo.
|
53 | 11042 | bsanchez | Histogram histogram = iHistogramable.getHistogram(); |
54 | 11318 | bsanchez | // Ya tenemos el histograma y lo representamos en la ventana
|
55 | 13379 | bsanchez | if (histogram != null) |
56 | 17719 | bsanchez | externalActions.end(histogram); |
57 | 10950 | bsanchez | } catch (HistogramException e) {
|
58 | 13409 | nacho | NotificationManager.addError("Error calculando el histograma.", e);
|
59 | 10950 | bsanchez | } |
60 | } |
||
61 | 12369 | bsanchez | |
62 | 10950 | bsanchez | /*
|
63 | * (non-Javadoc)
|
||
64 | 17719 | bsanchez | * @see org.gvsig.rastertools.RasterProcess#getLog()
|
65 | 10950 | bsanchez | */
|
66 | public String getLog() { |
||
67 | 17719 | bsanchez | return PluginServices.getText(this, "calculando_histograma") + "...\n"; |
68 | 10950 | bsanchez | } |
69 | |||
70 | /*
|
||
71 | * (non-Javadoc)
|
||
72 | 17719 | bsanchez | * @see org.gvsig.gui.beans.incrementabletask.IIncrementable#getPercent()
|
73 | 10950 | bsanchez | */
|
74 | public int getPercent() { |
||
75 | 17719 | bsanchez | if (iHistogramable != null) |
76 | return iHistogramable.getPercent();
|
||
77 | return 0; |
||
78 | 10950 | bsanchez | } |
79 | |||
80 | /*
|
||
81 | * (non-Javadoc)
|
||
82 | 17719 | bsanchez | * @see org.gvsig.gui.beans.incrementabletask.IIncrementable#getTitle()
|
83 | 10950 | bsanchez | */
|
84 | public String getTitle() { |
||
85 | 11187 | bsanchez | return PluginServices.getText(this, "calculando_histograma"); |
86 | 10950 | bsanchez | } |
87 | } |