Revision 20005
trunk/extensions/extGeoreferencing/src/org/gvsig/georeferencing/process/GeoreferencingProcess.java | ||
---|---|---|
155 | 155 |
|
156 | 156 |
// Obtenida la transformacion la aplicamos a los puntos extremos de la imagen |
157 | 157 |
double p1[]=transformData.getCoordMap(0,0); |
158 |
double p2[]=transformData.getCoordMap(0,imageGrid.getNY()); |
|
159 |
double p3[]=transformData.getCoordMap(imageGrid.getNX(),imageGrid.getNY()); |
|
160 |
double p4[]=transformData.getCoordMap(imageGrid.getNX(),0); |
|
158 |
double p2[]=transformData.getCoordMap(0,imageGrid.getNY()); |
|
159 |
double p3[]=transformData.getCoordMap(imageGrid.getNX(),0); |
|
160 |
double p4[]=transformData.getCoordMap(imageGrid.getNX(),imageGrid.getNY()); |
|
161 |
|
|
161 | 162 |
|
162 | 163 |
double xmin=Math.min( Math.min(p1[0],p2[0]),Math.min(p3[0],p4[0])); |
163 | 164 |
double ymin=Math.min( Math.min(p1[1],p2[1]),Math.min(p3[1],p4[1])); |
164 | 165 |
double xmax=Math.max( Math.max(p1[0],p2[0]),Math.max(p3[0],p4[0])); |
165 | 166 |
double ymax=Math.max( Math.max(p1[1],p2[1]),Math.max(p3[1],p4[1])); |
166 | 167 |
|
168 |
|
|
167 | 169 |
// OJO CON EL TAMA?O DE CELDA: CONSULTAR PARA EJEMPLO DE JOSE ES 25 |
168 | 170 |
if(xCellSize <= 1) |
169 | 171 |
xCellSize = (xmax - xmin) / (double)rasterSE.getPxWidth(); |
... | ... | |
202 | 204 |
{ |
203 | 205 |
byte values[]=new byte[bands.length]; |
204 | 206 |
int progress=0; |
207 |
// OPTIMIZACION. Se esta recorriendo secuencialmente cada banda. |
|
205 | 208 |
for(int band=0; band<bands.length;band++){ |
206 | 209 |
gridResult.setBandToOperate(band); |
207 | 210 |
gridInterpolated.setBandToOperate(band); |
208 |
for(int col=0; col<gridResult.getLayerNX(); col++){
|
|
211 |
for(int row=0; row<gridResult.getLayerNY(); row++){
|
|
209 | 212 |
progress++; |
210 |
for(int row=0; row<gridResult.getLayerNY();row++)
|
|
213 |
for(int col=0; col<gridResult.getLayerNX();col++)
|
|
211 | 214 |
{ |
212 | 215 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
213 | 216 |
values[band] = (byte)gridInterpolated._getValueAt(coord[0],coord[1]); |
214 | 217 |
gridResult.setCellValue(col,row,(byte)values[band]); |
215 | 218 |
} |
216 |
percent=(int)( progress*100/(gridResult.getLayerNX()*bands.length));
|
|
219 |
percent=(int)( progress*100/(gridResult.getLayerNY()*bands.length));
|
|
217 | 220 |
} |
218 | 221 |
} |
219 | 222 |
} |
... | ... | |
222 | 225 |
{ |
223 | 226 |
short values[]=new short[bands.length]; |
224 | 227 |
int progress=0; |
228 |
// OPTIMIZACION. Se esta recorriendo secuencialmente cada banda. |
|
225 | 229 |
for(int band=0; band<bands.length;band++){ |
226 | 230 |
gridResult.setBandToOperate(band); |
227 | 231 |
gridInterpolated.setBandToOperate(band); |
228 |
for(int col=0; col<gridResult.getLayerNX(); col++){
|
|
232 |
for(int row=0; row<gridResult.getLayerNY(); row++){
|
|
229 | 233 |
progress++; |
230 |
for(int row=0; row<gridResult.getLayerNY();row++)
|
|
231 |
{ |
|
232 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
|
233 |
values[band] = (short)gridInterpolated._getValueAt(coord[0],coord[1]); |
|
234 |
gridResult.setCellValue(col,row,(short)values[band]); |
|
235 |
} |
|
236 |
percent=(int)( progress*100/(gridResult.getLayerNX()*bands.length));
|
|
234 |
for(int col=0; col<gridResult.getLayerNX();col++)
|
|
235 |
{
|
|
236 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize);
|
|
237 |
values[band] = (short)gridInterpolated._getValueAt(coord[0],coord[1]);
|
|
238 |
gridResult.setCellValue(col,row,(short)values[band]);
|
|
239 |
}
|
|
240 |
percent=(int)( progress*100/(gridResult.getLayerNY()*bands.length));
|
|
237 | 241 |
} |
238 |
} |
|
242 |
}
|
|
239 | 243 |
} |
240 | 244 |
|
241 | 245 |
if(datatype==IBuffer.TYPE_INT) |
242 | 246 |
{ |
243 | 247 |
int values[]=new int[bands.length]; |
244 | 248 |
int progress=0; |
249 |
// OPTIMIZACION. Se esta recorriendo secuencialmente cada banda. |
|
245 | 250 |
for(int band=0; band<bands.length;band++){ |
246 | 251 |
gridResult.setBandToOperate(band); |
247 | 252 |
gridInterpolated.setBandToOperate(band); |
248 |
for(int col=0; col<gridResult.getLayerNX(); col++){
|
|
253 |
for(int row=0; row<gridResult.getLayerNY(); row++){
|
|
249 | 254 |
progress++; |
250 |
for(int row=0; row<gridResult.getLayerNY();row++) |
|
251 |
{ |
|
252 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
|
253 |
values[band] = (int)gridInterpolated._getValueAt(coord[0],coord[1]); |
|
254 |
gridResult.setCellValue(col,row,(int)values[band]); |
|
255 |
} |
|
256 |
percent=(int)( progress*100/(gridResult.getLayerNX()*bands.length)); |
|
257 |
|
|
255 |
for(int col=0; col<gridResult.getLayerNX();col++) |
|
256 |
{ |
|
257 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
|
258 |
values[band] = (int)gridInterpolated._getValueAt(coord[0],coord[1]); |
|
259 |
gridResult.setCellValue(col,row,(int)values[band]); |
|
260 |
} |
|
261 |
percent=(int)( progress*100/(gridResult.getLayerNY()*bands.length)); |
|
258 | 262 |
} |
259 |
} |
|
263 |
}
|
|
260 | 264 |
} |
261 | 265 |
|
262 | 266 |
if(datatype==IBuffer.TYPE_FLOAT) |
263 | 267 |
{ |
264 | 268 |
float values[]=new float[bands.length]; |
265 | 269 |
int progress=0; |
270 |
// OPTIMIZACION. Se esta recorriendo secuencialmente cada banda. |
|
266 | 271 |
for(int band=0; band<bands.length;band++){ |
267 | 272 |
gridResult.setBandToOperate(band); |
268 | 273 |
gridInterpolated.setBandToOperate(band); |
269 |
for(int col=0; col<gridResult.getLayerNX(); col++){
|
|
274 |
for(int row=0; row<gridResult.getLayerNY(); row++){
|
|
270 | 275 |
progress++; |
271 |
for(int row=0; row<gridResult.getLayerNY();row++)
|
|
272 |
{ |
|
273 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
|
274 |
values[band] = (float)gridInterpolated._getValueAt(coord[0],coord[1]); |
|
275 |
gridResult.setCellValue(col,row,(float)values[band]); |
|
276 |
} |
|
277 |
percent=(int)( progress*100/(gridResult.getLayerNX()*bands.length));
|
|
276 |
for(int col=0; col<gridResult.getLayerNX();col++)
|
|
277 |
{
|
|
278 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize);
|
|
279 |
values[band] = (float)gridInterpolated._getValueAt(coord[0],coord[1]);
|
|
280 |
gridResult.setCellValue(col,row,(float)values[band]);
|
|
281 |
}
|
|
282 |
percent=(int)( progress*100/(gridResult.getLayerNY()*bands.length));
|
|
278 | 283 |
} |
279 |
} |
|
284 |
}
|
|
280 | 285 |
} |
281 | 286 |
|
282 | 287 |
if(datatype==IBuffer.TYPE_DOUBLE) |
283 | 288 |
{ |
284 | 289 |
double values[]=new double[bands.length]; |
285 | 290 |
int progress=0; |
291 |
// OPTIMIZACION. Se esta recorriendo secuencialmente cada banda. |
|
286 | 292 |
for(int band=0; band<bands.length;band++){ |
287 | 293 |
gridResult.setBandToOperate(band); |
288 | 294 |
gridInterpolated.setBandToOperate(band); |
289 |
for(int col=0; col<gridResult.getLayerNX(); col++){
|
|
295 |
for(int row=0; row<gridResult.getLayerNY(); row++){
|
|
290 | 296 |
progress++; |
291 |
for(int row=0; row<gridResult.getLayerNY();row++)
|
|
292 |
{ |
|
293 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize); |
|
294 |
values[band] = (double)gridInterpolated._getValueAt(coord[0],coord[1]); |
|
295 |
gridResult.setCellValue(col,row,(double)values[band]); |
|
296 |
} |
|
297 |
percent=(int)( progress*100/(gridResult.getLayerNX()*bands.length));
|
|
297 |
for(int col=0; col<gridResult.getLayerNX();col++)
|
|
298 |
{
|
|
299 |
coord=transform.getCoordPixel(col*cellsize+minPointX, maxPointY-row*cellsize);
|
|
300 |
values[band] = (double)gridInterpolated._getValueAt(coord[0],coord[1]);
|
|
301 |
gridResult.setCellValue(col,row,(double)values[band]);
|
|
302 |
}
|
|
303 |
percent=(int)( progress*100/(gridResult.getLayerNY()*bands.length));
|
|
298 | 304 |
} |
299 |
} |
|
305 |
}
|
|
300 | 306 |
} |
301 | 307 |
|
302 | 308 |
} catch (OutOfGridException e) { |
303 | 309 |
e.printStackTrace(); |
304 | 310 |
} catch (RasterBufferInvalidAccessException e) { |
305 |
// TODO Auto-generated catch block |
|
306 | 311 |
e.printStackTrace(); |
307 | 312 |
} catch (RasterBufferInvalidException e) { |
308 |
// TODO Auto-generated catch block |
|
309 | 313 |
e.printStackTrace(); |
310 | 314 |
} |
311 | 315 |
|
Also available in: Unified diff