gvsig-raster / org.gvsig.raster.mosaic / trunk / org.gvsig.raster.mosaic / org.gvsig.raster.mosaic.swing / org.gvsig.raster.mosaic.swing.impl / src / test / java / org / gvsig / raster / mosaic / TestAddFilesPanel.java @ 2300
History | View | Annotate | Download (3.93 KB)
1 |
package org.gvsig.raster.mosaic; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.util.ArrayList; |
5 |
import java.util.List; |
6 |
|
7 |
import javax.swing.JFrame; |
8 |
|
9 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
10 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
11 |
import org.gvsig.raster.mosaic.swing.impl.main.AddFilesPanelImpl; |
12 |
import org.gvsig.raster.mosaic.swing.main.AddFilesEvent; |
13 |
import org.gvsig.raster.mosaic.swing.main.AddFilesListener; |
14 |
|
15 |
public class TestAddFilesPanel implements AddFilesListener { |
16 |
private int w = 480; |
17 |
private int h = 420; |
18 |
private JFrame frame = new JFrame(); |
19 |
private AddFilesPanelImpl desc = null; |
20 |
|
21 |
public TestAddFilesPanel() {
|
22 |
List<String> list = new ArrayList<String>(); |
23 |
list.add("tif");
|
24 |
list.add("jpg");
|
25 |
list.add("ecw");
|
26 |
desc = new AddFilesPanelImpl("file", "/tmp", list); |
27 |
desc.addListener(this);
|
28 |
NoData nodata = new NoDataImplement();
|
29 |
desc.addSrcFile(null, "capa 1", 3, Buffer.TYPE_BYTE, 0.5, nodata); |
30 |
desc.addSrcFile(null, "capa 2", 4, Buffer.TYPE_BYTE, 0.5, nodata); |
31 |
desc.addSrcFile(null, "capa 3", 5, Buffer.TYPE_BYTE, 0.5, nodata); |
32 |
desc.addSrcFile(null, "capa 4", 6, Buffer.TYPE_BYTE, 30, nodata); |
33 |
desc.addSrcFile(null, "capa 5", 3, Buffer.TYPE_BYTE, 15, nodata); |
34 |
desc.addSrcFile(null, "capa 6", 6, Buffer.TYPE_BYTE, 15, nodata); |
35 |
desc.addSrcFile(null, "capa 7", 12, Buffer.TYPE_SHORT, 0.5, nodata); |
36 |
desc.addSrcFile(null, "capa 8", 4, Buffer.TYPE_INT, 0.5, nodata); |
37 |
desc.addSrcFile(null, "capa 9", 6, Buffer.TYPE_SHORT, 0.5, nodata); |
38 |
desc.addSrcFile(null, "capa 10", 0, Buffer.TYPE_FLOAT, 0.5, nodata); |
39 |
frame.getContentPane().add(desc); |
40 |
frame.setSize(w, h); |
41 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
42 |
frame.setVisible(true);
|
43 |
} |
44 |
|
45 |
public static void main(String[] args) { |
46 |
new TestAddFilesPanel();
|
47 |
} |
48 |
|
49 |
public void actionAddFiles(AddFilesEvent e) { |
50 |
File[] fList = e.getFileList(); |
51 |
NoData nodata = new NoDataImplement();
|
52 |
for (int i = 0; i < fList.length; i++) { |
53 |
desc.addDstFile(null, fList[i].toString(), 3, Buffer.TYPE_BYTE, 0.5, nodata); |
54 |
} |
55 |
} |
56 |
|
57 |
public void actionAddFolder(AddFilesEvent e) { |
58 |
File[] folderList = e.getFileList(); |
59 |
NoData nodata = new NoDataImplement();
|
60 |
for (int i = 0; i < folderList.length; i++) { |
61 |
desc.addDstFile(null, folderList[i].toString(), 3, Buffer.TYPE_BYTE, 0.5, nodata); |
62 |
} |
63 |
} |
64 |
|
65 |
public class NoDataImplement implements NoData { |
66 |
|
67 |
public Number getValue() { |
68 |
return -99999.0; |
69 |
} |
70 |
|
71 |
public void setValue(Number noData) { |
72 |
// TODO Auto-generated method stub
|
73 |
|
74 |
} |
75 |
|
76 |
public boolean isDefined() { |
77 |
// TODO Auto-generated method stub
|
78 |
return false; |
79 |
} |
80 |
|
81 |
public void save() { |
82 |
// TODO Auto-generated method stub
|
83 |
|
84 |
} |
85 |
|
86 |
public void load() { |
87 |
// TODO Auto-generated method stub
|
88 |
|
89 |
} |
90 |
|
91 |
public void delete() { |
92 |
// TODO Auto-generated method stub
|
93 |
|
94 |
} |
95 |
|
96 |
public void restore() { |
97 |
// TODO Auto-generated method stub
|
98 |
|
99 |
} |
100 |
|
101 |
public Number getNativeValue() { |
102 |
// TODO Auto-generated method stub
|
103 |
return null; |
104 |
} |
105 |
|
106 |
public void setNativeValue(Number nativeNoDataValue) { |
107 |
// TODO Auto-generated method stub
|
108 |
|
109 |
} |
110 |
|
111 |
public void setFileName(String fileName) { |
112 |
// TODO Auto-generated method stub
|
113 |
|
114 |
} |
115 |
|
116 |
public boolean isNoDataTransparent() { |
117 |
// TODO Auto-generated method stub
|
118 |
return false; |
119 |
} |
120 |
|
121 |
public void setNoDataTransparent(boolean noDataAsTransparent) { |
122 |
// TODO Auto-generated method stub
|
123 |
|
124 |
} |
125 |
|
126 |
public int getDataType() { |
127 |
// TODO Auto-generated method stub
|
128 |
return 0; |
129 |
} |
130 |
|
131 |
public void setDataType(int datatype) { |
132 |
// TODO Auto-generated method stub
|
133 |
|
134 |
} |
135 |
|
136 |
public boolean compare(NoData noData) { |
137 |
return false; |
138 |
} |
139 |
|
140 |
public Number getValueByBand(int nBand) { |
141 |
return null; |
142 |
} |
143 |
|
144 |
public int getBandCount() { |
145 |
return 0; |
146 |
} |
147 |
|
148 |
public void setBandCount(int bandCount) { |
149 |
|
150 |
} |
151 |
|
152 |
public void setValueByBand(Number noDataValue, int nBand) { |
153 |
|
154 |
} |
155 |
|
156 |
public Object clone() { |
157 |
return null; |
158 |
} |
159 |
} |
160 |
|
161 |
} |