gvsig-raster / org.gvsig.raster.tools / trunk / templates / examples / org.gvsig.raster.roimask_v2_1 / org.gvsig.raster.roimask.swing / org.gvsig.raster.roimask.swing.impl / src / main / java / org / gvsig / raster / roimask / swing / impl / ROIMaskDataImpl.java @ 1982
History | View | Annotate | Download (1.48 KB)
1 |
package org.gvsig.raster.roimask.swing.impl; |
---|---|
2 |
|
3 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
4 |
import org.gvsig.raster.roimask.swing.ROIMaskData; |
5 |
|
6 |
public class ROIMaskDataImpl implements ROIMaskData { |
7 |
private ROIMaskPanelImpl panel = null; |
8 |
private Object inputLyr = null; |
9 |
|
10 |
public ROIMaskDataImpl(ROIMaskPanelImpl panel) {
|
11 |
this.panel = panel;
|
12 |
} |
13 |
|
14 |
public Object getInputLayer() { |
15 |
return inputLyr;
|
16 |
} |
17 |
|
18 |
public void setInputLayer(Object obj) { |
19 |
this.inputLyr = obj;
|
20 |
} |
21 |
|
22 |
public int getAlpha() { |
23 |
double controlValue = panel.getSlider().getValue();
|
24 |
return(int)(controlValue * 255 / 100); |
25 |
} |
26 |
|
27 |
public boolean isInverse() { |
28 |
return panel.getInverse().isSelected();
|
29 |
} |
30 |
|
31 |
public void setValueNoData(double value) { |
32 |
panel.setValueNoData(value); |
33 |
} |
34 |
|
35 |
public void clearROIs() throws NotInitializeException { |
36 |
panel.clearTable(); |
37 |
} |
38 |
|
39 |
public void addROI(Object[] roi) throws NotInitializeException { |
40 |
panel.addRow(roi); |
41 |
} |
42 |
|
43 |
public double getValueNoData() { |
44 |
try {
|
45 |
return new Double(panel.getValueNoData().getValue()); |
46 |
} catch (NumberFormatException e) { |
47 |
return 0; |
48 |
} |
49 |
} |
50 |
|
51 |
public boolean[] getROIsSelected() { |
52 |
try {
|
53 |
boolean[] result = new boolean[panel.getTableContainer().getRowCount()]; |
54 |
for (int i = 0; i < panel.getTableContainer().getRowCount(); i++) { |
55 |
result[i] = (Boolean)panel.getTableContainer().getModel().getValueAt(i, 0); |
56 |
} |
57 |
return result;
|
58 |
} catch (NotInitializeException e) {
|
59 |
return null; |
60 |
} |
61 |
|
62 |
} |
63 |
|
64 |
} |