Revision 6547 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider/src/main/java/org/gvsig/raster/gdal/provider/AbstractFileRasterGdalStoreProvider.java
AbstractFileRasterGdalStoreProvider.java | ||
---|---|---|
65 | 65 |
import org.gvsig.fmap.geom.Geometry; |
66 | 66 |
import org.gvsig.fmap.geom.Geometry.DIMENSIONS; |
67 | 67 |
import org.gvsig.fmap.geom.GeometryLocator; |
68 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
68 | 69 |
import org.gvsig.fmap.geom.primitive.Envelope; |
69 | 70 |
import org.gvsig.raster.lib.buffer.api.Buffer; |
70 | 71 |
import org.gvsig.tools.dynobject.DynClass; |
... | ... | |
73 | 74 |
import org.gvsig.tools.dynobject.DynObject; |
74 | 75 |
import org.gvsig.tools.dynobject.Tags; |
75 | 76 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
77 |
import org.gvsig.tools.locator.LocatorException; |
|
76 | 78 |
|
77 | 79 |
/** |
78 | 80 |
* Provider for Raster GDAL files |
... | ... | |
353 | 355 |
} |
354 | 356 |
|
355 | 357 |
tfw = new File(FilenameUtils.removeExtension(fileName) + extWorldFile); |
356 |
Envelope envelope=buffer.getEnvelope(); |
|
358 |
Envelope envelope; |
|
359 |
try { |
|
360 |
envelope = buffer.getEnvelope(); |
|
361 |
} catch (LocatorException | CreateEnvelopeException e) { |
|
362 |
logger.warn("Can't get the buffer envelope", e); |
|
363 |
return; |
|
364 |
} |
|
357 | 365 |
|
358 | 366 |
double pixelSizeX = buffer.getPixelSizeX();//(envelope.getMaximum(DIMENSIONS.X) - envelope.getMinimum(DIMENSIONS.X)) / (gdalDataSet.getRasterXSize()); |
359 | 367 |
double pixelSizeY = -buffer.getPixelSizeY();//(envelope.getMinimum(DIMENSIONS.Y) - envelope.getMaximum(DIMENSIONS.Y)) / (gdalDataSet.getRasterYSize()); |
... | ... | |
415 | 423 |
*/ |
416 | 424 |
protected double[] createGeoTransform(Buffer buffer){ |
417 | 425 |
double[] result=new double[6]; |
418 |
result[0]=buffer.getEnvelope().getMinimum(DIMENSIONS.X); |
|
426 |
try { |
|
427 |
result[0]=buffer.getEnvelope().getMinimum(DIMENSIONS.X); |
|
428 |
} catch (LocatorException | CreateEnvelopeException e) { |
|
429 |
result[0]=0; |
|
430 |
} |
|
419 | 431 |
result[1]=buffer.getPixelSizeX(); |
420 | 432 |
//TODO: Rotation not implemented yet |
421 | 433 |
result[2]=0; |
422 |
result[3]=buffer.getEnvelope().getMaximum(DIMENSIONS.Y); |
|
434 |
try { |
|
435 |
result[3]=buffer.getEnvelope().getMaximum(DIMENSIONS.Y); |
|
436 |
} catch (LocatorException | CreateEnvelopeException e) { |
|
437 |
result[3]=0; |
|
438 |
} |
|
423 | 439 |
//TODO: Rotation not implemented yet |
424 | 440 |
result[4]=0; |
425 | 441 |
result[5]=-buffer.getPixelSizeY(); |
Also available in: Unified diff