Revision 2331 org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/bean/previewbase/RasterDataSourcePreview.java
RasterDataSourcePreview.java | ||
---|---|---|
26 | 26 |
import java.awt.geom.Rectangle2D; |
27 | 27 |
import java.awt.image.BufferedImage; |
28 | 28 |
|
29 |
import org.cresques.cts.IProjection; |
|
29 | 30 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
30 | 31 |
import org.gvsig.fmap.dal.exception.ReadException; |
32 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
31 | 33 |
import org.gvsig.fmap.geom.GeometryLocator; |
32 | 34 |
import org.gvsig.fmap.geom.GeometryManager; |
33 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
34 | 35 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
35 | 36 |
import org.gvsig.fmap.geom.primitive.Envelope; |
36 | 37 |
import org.gvsig.fmap.mapcontext.ViewPort; |
... | ... | |
45 | 46 |
* Source for a preview using a raster layer |
46 | 47 |
* @author Nacho Brodin nachobrodin@gmail.com |
47 | 48 |
*/ |
49 |
@SuppressWarnings("deprecation") |
|
48 | 50 |
public class RasterDataSourcePreview implements DataSourcePreview { |
49 | 51 |
private FLyrRaster lyr = null; |
52 |
private IProjection viewProjection = null; |
|
50 | 53 |
private static GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
51 | 54 |
private static final Logger logger = LoggerFactory.getLogger(RasterDataSourcePreview.class); |
52 | 55 |
|
53 |
public RasterDataSourcePreview(FLyrRaster lyr) { |
|
56 |
public RasterDataSourcePreview(FLyrRaster lyr, IProjection proj) {
|
|
54 | 57 |
this.lyr = lyr; |
58 |
this.viewProjection = proj; |
|
55 | 59 |
} |
56 | 60 |
|
57 | 61 |
public void closePreviewLayer() { |
... | ... | |
73 | 77 |
public DataSourcePreview cloneDataSourcePreview() { |
74 | 78 |
if(lyr != null) { |
75 | 79 |
try { |
76 |
return new RasterDataSourcePreview((FLyrRaster)lyr.cloneLayer()); |
|
80 |
IProjection viewProj = null; |
|
81 |
if(lyr.getMapContext() != null) |
|
82 |
viewProj = lyr.getMapContext().getProjection(); |
|
83 |
return new RasterDataSourcePreview((FLyrRaster)lyr.cloneLayer(), viewProj); |
|
77 | 84 |
} catch (Exception e) { |
78 | 85 |
} |
79 | 86 |
} |
... | ... | |
90 | 97 |
lyr.getRender().getFilterList().pushStatus(); |
91 | 98 |
} |
92 | 99 |
|
93 |
public void draw(BufferedImage image, Graphics2D g, double[] coords, int w, int h, Cancellable cancel, double scale) throws ImageUnavailableException { |
|
100 |
public void draw(BufferedImage image, |
|
101 |
Graphics2D g, |
|
102 |
double[] coords, |
|
103 |
int w, |
|
104 |
int h, |
|
105 |
Cancellable cancel, |
|
106 |
double scale) throws ImageUnavailableException { |
|
94 | 107 |
try { |
95 | 108 |
// Inicializo el ViewPort |
96 |
ViewPort vp = new ViewPort(null);
|
|
109 |
ViewPort vp = new ViewPort(viewProjection);
|
|
97 | 110 |
Envelope env; |
98 | 111 |
try { |
99 | 112 |
env = geomManager.createEnvelope(coords[0], coords[3], coords[2], coords[1], SUBTYPES.GEOM2D); |
Also available in: Unified diff