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 @ 2213
History | View | Annotate | Download (2.27 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.raster.mosaic.swing.impl.main.AddFilesPanelImpl; |
11 |
import org.gvsig.raster.mosaic.swing.main.AddFilesEvent; |
12 |
import org.gvsig.raster.mosaic.swing.main.AddFilesListener; |
13 |
|
14 |
public class TestAddFilesPanel implements AddFilesListener { |
15 |
private int w = 480; |
16 |
private int h = 420; |
17 |
private JFrame frame = new JFrame(); |
18 |
private AddFilesPanelImpl desc = null; |
19 |
|
20 |
public TestAddFilesPanel() {
|
21 |
List<String> list = new ArrayList<String>(); |
22 |
list.add("tif");
|
23 |
list.add("jpg");
|
24 |
list.add("ecw");
|
25 |
desc = new AddFilesPanelImpl("file", "/tmp", list); |
26 |
desc.addListener(this);
|
27 |
double nodata = -99999.0; |
28 |
desc.addSrcFile(null, "capa 1", 3, Buffer.TYPE_BYTE, 0.5, nodata); |
29 |
desc.addSrcFile(null, "capa 2", 4, Buffer.TYPE_BYTE, 0.5, nodata); |
30 |
desc.addSrcFile(null, "capa 3", 5, Buffer.TYPE_BYTE, 0.5, nodata); |
31 |
desc.addSrcFile(null, "capa 4", 6, Buffer.TYPE_BYTE, 30, nodata); |
32 |
desc.addSrcFile(null, "capa 5", 3, Buffer.TYPE_BYTE, 15, nodata); |
33 |
desc.addSrcFile(null, "capa 6", 6, Buffer.TYPE_BYTE, 15, nodata); |
34 |
desc.addSrcFile(null, "capa 7", 12, Buffer.TYPE_SHORT, 0.5, nodata); |
35 |
desc.addSrcFile(null, "capa 8", 4, Buffer.TYPE_INT, 0.5, nodata); |
36 |
desc.addSrcFile(null, "capa 9", 6, Buffer.TYPE_SHORT, 0.5, nodata); |
37 |
desc.addSrcFile(null, "capa 10", 0, Buffer.TYPE_FLOAT, 0.5, nodata); |
38 |
frame.getContentPane().add(desc); |
39 |
frame.setSize(w, h); |
40 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
41 |
frame.setVisible(true);
|
42 |
} |
43 |
|
44 |
public static void main(String[] args) { |
45 |
new TestAddFilesPanel();
|
46 |
} |
47 |
|
48 |
public void actionAddFiles(AddFilesEvent e) { |
49 |
File[] fList = e.getFileList(); |
50 |
double nodata = -99999.0; |
51 |
for (int i = 0; i < fList.length; i++) { |
52 |
desc.addDstFile(null, fList[i].toString(), 3, Buffer.TYPE_BYTE, 0.5, nodata); |
53 |
} |
54 |
} |
55 |
|
56 |
public void actionAddFolder(AddFilesEvent e) { |
57 |
File[] folderList = e.getFileList(); |
58 |
double nodata = -99999.0; |
59 |
for (int i = 0; i < folderList.length; i++) { |
60 |
desc.addDstFile(null, folderList[i].toString(), 3, Buffer.TYPE_BYTE, 0.5, nodata); |
61 |
} |
62 |
} |
63 |
|
64 |
} |