root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / histogram / HistogramProcess.java @ 10981
History | View | Annotate | Download (2.27 KB)
1 |
/* 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 |
package org.gvsig.rastertools.histogram; |
20 |
|
21 |
import org.gvsig.gui.beans.incrementabletask.IIncrementable; |
22 |
import org.gvsig.raster.util.Histogram; |
23 |
import org.gvsig.raster.util.HistogramException; |
24 |
import org.gvsig.raster.util.IHistogramable; |
25 |
|
26 |
public class HistogramProcess extends Thread implements IIncrementable { |
27 |
IHistogramable iHistogramable = null;
|
28 |
long[][] histogram = null; |
29 |
int type = 0; |
30 |
|
31 |
public HistogramProcess(IHistogramable iHistogramable, int type) { |
32 |
this.iHistogramable = iHistogramable;
|
33 |
this.type = type;
|
34 |
this.start();
|
35 |
} |
36 |
|
37 |
public void run() { |
38 |
try {
|
39 |
histogram = iHistogramable.getHistogram().getHistogramByType(Histogram.getType(type)); |
40 |
} catch (HistogramException e) {
|
41 |
e.printStackTrace(); |
42 |
} |
43 |
} |
44 |
|
45 |
public long[][] getLastHistogram() { |
46 |
return histogram;
|
47 |
} |
48 |
/*
|
49 |
* (non-Javadoc)
|
50 |
* @see org.gvsig.gui.beans.IncrementableTask.IIncrementable#getLabel()
|
51 |
*/
|
52 |
public String getLabel() { |
53 |
return "Generando histograma, por favor, espere..."; |
54 |
} |
55 |
|
56 |
/*
|
57 |
* (non-Javadoc)
|
58 |
* @see org.gvsig.gui.beans.IncrementableTask.IIncrementable#getLog()
|
59 |
*/
|
60 |
public String getLog() { |
61 |
return "Calculando histograma..."; |
62 |
} |
63 |
|
64 |
/*
|
65 |
* (non-Javadoc)
|
66 |
* @see org.gvsig.gui.beans.IncrementableTask.IIncrementable#getPercent()
|
67 |
*/
|
68 |
public int getPercent() { |
69 |
return iHistogramable.getPercent();
|
70 |
} |
71 |
|
72 |
/*
|
73 |
* (non-Javadoc)
|
74 |
* @see org.gvsig.gui.beans.IncrementableTask.IIncrementable#getTitle()
|
75 |
*/
|
76 |
public String getTitle() { |
77 |
return "Calculando histograma"; |
78 |
} |
79 |
} |