Revision 21576 trunk/libraries/libRaster/src-test/org/gvsig/raster/dataset/io/rmf/TestRmfWrite.java
TestRmfWrite.java | ||
---|---|---|
53 | 53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
54 | 54 |
*/ |
55 | 55 |
public class TestRmfWrite extends TestCase { |
56 |
private RmfBlocksManager manager = null; |
|
57 |
private String baseDir = "." + File.separator + "test-images" + File.separator; |
|
58 |
private String path = baseDir + "miniRaster25x24.tif"; |
|
59 |
private String pathGif = baseDir + "gifTransparente.gif"; |
|
60 |
private String pathJpg = baseDir + "03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg"; |
|
61 |
private Histogram histogram = null; |
|
62 |
private ColorTable colorTable = null; |
|
63 |
private RasterDataset f = null; |
|
64 |
private RasterDataset f2 = null; |
|
56 | 65 |
|
57 |
private RmfBlocksManager manager = null; |
|
58 |
private String baseDir = "." + File.separator + "test-images" + File.separator; |
|
59 |
private String path = baseDir + "miniRaster25x24.tif"; |
|
60 |
private String pathGif = baseDir + "gifTransparente.gif"; |
|
61 |
private String pathJpg = baseDir + "03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg"; |
|
62 |
private Histogram histogram = null; |
|
63 |
private ColorTable colorTable = null; |
|
64 |
private RasterDataset f = null; |
|
65 |
private RasterDataset f2 = null; |
|
66 |
|
|
67 | 66 |
static { |
68 | 67 |
RasterLibrary.wakeUp(); |
69 | 68 |
} |
... | ... | |
106 | 105 |
} catch (InterruptedException e) { |
107 | 106 |
e.printStackTrace(); |
108 | 107 |
} |
109 |
|
|
110 | 108 |
} |
111 | 109 |
|
112 |
public void testStack(){ |
|
110 |
public void testStack() {
|
|
113 | 111 |
manager = new RmfBlocksManager(baseDir + "writetest.rmf"); |
114 | 112 |
|
115 |
//Histograma |
|
113 |
// Histograma
|
|
116 | 114 |
HistogramRmfSerializer ser = new HistogramRmfSerializer(histogram); |
117 | 115 |
manager.addClient(ser); |
118 | 116 |
|
119 |
//Tabla de color |
|
120 |
//colorTable.setName("Prueba Tabla de Color"); |
|
117 |
// Tabla de color
|
|
118 |
// colorTable.setName("Prueba Tabla de Color");
|
|
121 | 119 |
ColorTableRmfSerializer ser1 = new ColorTableRmfSerializer(colorTable); |
122 | 120 |
manager.addClient(ser1); |
123 | 121 |
|
124 |
//Estadisticas |
|
122 |
// Estadisticas
|
|
125 | 123 |
DatasetStatistics stat = f.getStatistics(); |
126 | 124 |
stat.setTailTrimValue(3.0, new Double(10.0)); |
127 | 125 |
stat.setTailTrimValue(4.0, new Double(16.0)); |
128 | 126 |
StatisticsRmfSerializer ser2 = new StatisticsRmfSerializer(stat); |
129 | 127 |
manager.addClient(ser2); |
130 | 128 |
|
131 |
//Georreferenciaci?n |
|
129 |
// Georreferenciaci?n
|
|
132 | 130 |
GeoInfoRmfSerializer ser3 = new GeoInfoRmfSerializer(f2); |
133 | 131 |
manager.addClient(ser3); |
134 | 132 |
|
135 |
//Puntos de control |
|
133 |
// Puntos de control
|
|
136 | 134 |
GeoPoint p1 = new GeoPoint(); |
137 | 135 |
p1.pixelPoint = new Point2D.Double(10, 10); |
138 | 136 |
p1.mapPoint = new Point2D.Double(34223.3, 2344.2); |
... | ... | |
153 | 151 |
p2.rightCenterPoint = new Point2D.Double(2433.3, 6244.2); |
154 | 152 |
|
155 | 153 |
p1.leftViewPort.pxSize = new Point2D.Double(32, 34); |
156 |
GeoPointRmfSerializer ser4 = new GeoPointRmfSerializer(new GeoPoint[]{p1, p2}, p1.leftViewPort);
|
|
154 |
GeoPointRmfSerializer ser4 = new GeoPointRmfSerializer(new GeoPoint[] { p1, p2 }, p1.leftViewPort);
|
|
157 | 155 |
manager.addClient(ser4); |
158 | 156 |
|
159 | 157 |
// Valor NoData |
160 | 158 |
NoDataRmfSerializer ser5 = new NoDataRmfSerializer(5450.0, 2); |
161 | 159 |
manager.addClient(ser5); |
162 |
|
|
163 |
//Interpretaci?n de color |
|
160 |
|
|
161 |
// Interpretaci?n de color
|
|
164 | 162 |
DatasetColorInterpretation ci = f.getColorInterpretation(); |
165 | 163 |
ci.setColorInterpValue(0, DatasetColorInterpretation.BLUE_BAND); |
166 | 164 |
ci.setColorInterpValue(2, DatasetColorInterpretation.RED_BAND); |
... | ... | |
175 | 173 |
e.printStackTrace(); |
176 | 174 |
} |
177 | 175 |
|
178 |
//Pasamos el test de lectura para comprobar que se ha generado bien |
|
176 |
// Pasamos el test de lectura para comprobar que se ha generado bien
|
|
179 | 177 |
TestRmfRead t = new TestRmfRead(); |
180 | 178 |
t.file = "writetest.rmf"; |
181 | 179 |
t.start(); |
182 | 180 |
} |
183 |
|
|
184 |
} |
|
181 |
} |
Also available in: Unified diff