72 |
72 |
this.proj = proj;
|
73 |
73 |
this.component = component;
|
74 |
74 |
colorBand = new GeoRasterFile[fnames.length];
|
75 |
|
for (int i=0; i<fnames.length; i++) {
|
|
75 |
for (int i=0; i<colorBand.length; i++) {
|
76 |
76 |
colorBand[i] = GeoRasterFile.openFile(proj, fnames[i]);//loadECW(fname);
|
77 |
77 |
colorBand[i].setUpdatable((Component) component);
|
78 |
78 |
setExtent(colorBand[i].getExtent());
|
79 |
79 |
colorBand[i].setView(colorBand[i].getExtent());
|
80 |
80 |
}
|
|
81 |
geoFile = colorBand[0];
|
81 |
82 |
extentOrig = extent;
|
82 |
83 |
if (fnames.length >= 3) {
|
83 |
|
this.setBand(GeoRasterFile.RED_BAND, 1);
|
84 |
|
this.setBand(GeoRasterFile.GREEN_BAND, 2);
|
85 |
|
this.setBand(GeoRasterFile.BLUE_BAND, 3);
|
|
84 |
this.setBand(GeoRasterFile.RED_BAND, 0);
|
|
85 |
this.setBand(GeoRasterFile.GREEN_BAND, 1);
|
|
86 |
this.setBand(GeoRasterFile.BLUE_BAND, 2);
|
86 |
87 |
} else {
|
87 |
88 |
this.setBand(GeoRasterFile.RED_BAND|GeoRasterFile.GREEN_BAND|GeoRasterFile.BLUE_BAND, 1);
|
88 |
89 |
}
|
... | ... | |
198 |
199 |
if (sz.minY() < extent.minY()) vy = extent.minY();
|
199 |
200 |
if (sz.maxX() > extent.maxX()) vx2 = extent.maxX();
|
200 |
201 |
if (sz.maxY() > extent.maxY()) vy2 = extent.maxY();
|
201 |
|
geoFile.setView(new Extent(vx, vy, vx2, vy2));
|
|
202 |
if (colorBand != null) { // multiBands
|
|
203 |
for (int i=0; i<colorBand.length; i++)
|
|
204 |
colorBand[i].setView(new Extent(vx, vy, vx2, vy2));
|
|
205 |
} else if (geoFile != null) { // Una sola banda
|
|
206 |
geoFile.setView(new Extent(vx, vy, vx2, vy2));
|
|
207 |
} else { // no cargada
|
|
208 |
System.err.println("PxRaster.calculateNewView(): Foto no cargada.");
|
|
209 |
}
|
202 |
210 |
}
|
203 |
211 |
|
204 |
212 |
/**
|
... | ... | |
233 |
241 |
System.out.println("Dibujando PxRaster: pt0 = "+pt);
|
234 |
242 |
vp.mat.transform(pt, pt);
|
235 |
243 |
System.out.println("Dibujando PxRaster: pt1 = "+pt);
|
236 |
|
if (geoFile != null) { // Una sola banda
|
237 |
|
geoImage = geoFile.updateImage(wImg, hImg, rp);
|
|
244 |
if (colorBand != null) { // multiBands
|
238 |
245 |
System.out.println("Dibujando PxRaster ...");
|
|
246 |
//if (doTransparency)
|
|
247 |
//geoImage = new BufferedImage(wImg, hImg, BufferedImage.TYPE_INT_ARGB);
|
|
248 |
//else
|
|
249 |
// geoImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
|
250 |
geoImage = colorBand[rBand].updateImage(wImg, hImg, rp); //, geoImage, GeoRasterFile.RED_BAND);
|
|
251 |
geoImage = colorBand[gBand].updateImage(wImg, hImg, rp, geoImage, GeoRasterFile.GREEN_BAND);
|
|
252 |
geoImage = colorBand[bBand].updateImage(wImg, hImg, rp, geoImage, GeoRasterFile.BLUE_BAND);
|
239 |
253 |
|
240 |
254 |
g.drawImage(geoImage, (int) Math.round(pt.getX()), (int) Math.round(pt.getY()), component);
|
241 |
255 |
t2 = new Date().getTime();
|
242 |
256 |
System.out.println("Dibujando PxRaster: "+(t2-t1)/1000D+", secs.");
|
243 |
|
} else if (colorBand != null) { // multiBands
|
|
257 |
|
|
258 |
} else if (geoFile != null) { // Una sola banda
|
|
259 |
geoImage = geoFile.updateImage(wImg, hImg, rp);
|
244 |
260 |
System.out.println("Dibujando PxRaster ...");
|
245 |
|
//if (doTransparency)
|
246 |
|
geoImage = new BufferedImage(wImg, hImg, BufferedImage.TYPE_INT_ARGB);
|
247 |
|
//else
|
248 |
|
// geoImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
249 |
|
colorBand[rBand].updateImage(wImg, hImg, rp, geoImage, GeoRasterFile.RED_BAND);
|
250 |
|
colorBand[gBand].updateImage(wImg, hImg, rp, geoImage, GeoRasterFile.GREEN_BAND);
|
251 |
|
colorBand[bBand].updateImage(wImg, hImg, rp, geoImage, GeoRasterFile.BLUE_BAND);
|
252 |
261 |
|
253 |
262 |
g.drawImage(geoImage, (int) Math.round(pt.getX()), (int) Math.round(pt.getY()), component);
|
254 |
263 |
t2 = new Date().getTime();
|
255 |
264 |
System.out.println("Dibujando PxRaster: "+(t2-t1)/1000D+", secs.");
|
256 |
|
|
257 |
265 |
} else { // no cargada
|
258 |
266 |
System.err.println("Dibujando PxRaster: Foto no cargada.");
|
259 |
267 |
}
|