Issue #626 Changed downscaler so it can scale from any level to another level instead of always using full resolution level. Fixed Float.NaN reference in AbstractDataWrapper. Fixed GLMesh leak in AbstractTileSet.
Change-Id: I5e36d3a7632f54c19c81818c270b28ac60a385ac Former-commit-id:cc0a1fbca3
[formerly 0f59e9ea9e204bc49e14135249ef859903a2cbcb] Former-commit-id:f635e9c332
This commit is contained in:
parent
f7a864a2c0
commit
079a11565a
3 changed files with 22 additions and 26 deletions
|
@ -489,17 +489,17 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
|||
}
|
||||
|
||||
drawableImages.add(di);
|
||||
} else {
|
||||
rsc.issueRefresh();
|
||||
}
|
||||
|
||||
if (image == null || image.getStatus() != Status.LOADED
|
||||
|| tile.coverage.getMesh() == null) {
|
||||
if (image == null || image.getStatus() != Status.LOADED) {
|
||||
rsc.issueRefresh();
|
||||
needDrawLower = true;
|
||||
}
|
||||
|
||||
if (tile.coverage.getMesh() == null) {
|
||||
tile.coverage.setMesh(target.getExtension(
|
||||
IMapMeshExtension.class).constructMesh(
|
||||
tile.imageGeometry, mapDescriptor.getGridGeometry()));
|
||||
target.setNeedsRefresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,39 +103,33 @@ public class GridDownscaler {
|
|||
return downscaleSizes.toArray(new Rectangle[downscaleSizes.size()]);
|
||||
}
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
private GeneralGridGeometry sourceGeometry;
|
||||
private Envelope sourceEnvelope;
|
||||
|
||||
private Rectangle[] downscaleGeometries;
|
||||
|
||||
private Interpolation interpolation;
|
||||
|
||||
/**
|
||||
* Constructs a GridDownscaler for the given source geometry and data source
|
||||
* using the default interpolation method
|
||||
* Constructs a GridDownscaler for the given source geometry using the
|
||||
* default interpolation method
|
||||
*
|
||||
* @param sourceGeometry
|
||||
* @param dataSource
|
||||
*/
|
||||
public GridDownscaler(GeneralGridGeometry sourceGeometry,
|
||||
DataSource dataSource) {
|
||||
this(sourceGeometry, dataSource, new NearestNeighborInterpolation());
|
||||
public GridDownscaler(GeneralGridGeometry sourceGeometry) {
|
||||
this(sourceGeometry, new NearestNeighborInterpolation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a GridDownscaler for the given source
|
||||
* {@link GeneralGridGeometry} and {@link DataSource} using the specified
|
||||
* {@link Interpolation}
|
||||
* {@link GeneralGridGeometry} using the specified {@link Interpolation}
|
||||
*
|
||||
* @param sourceGeometry
|
||||
* @param dataSource
|
||||
* @param interpolation
|
||||
*/
|
||||
public GridDownscaler(GeneralGridGeometry sourceGeometry,
|
||||
DataSource dataSource, Interpolation interpolation) {
|
||||
this.sourceGeometry = sourceGeometry;
|
||||
this.dataSource = dataSource;
|
||||
Interpolation interpolation) {
|
||||
this.sourceEnvelope = sourceGeometry.getEnvelope();
|
||||
this.downscaleGeometries = getDownscaleSizes(sourceGeometry);
|
||||
this.interpolation = interpolation;
|
||||
}
|
||||
|
@ -176,16 +170,18 @@ public class GridDownscaler {
|
|||
* @param destination
|
||||
* @throws TransformException
|
||||
*/
|
||||
public void downscale(int downscaleLevel, DataDestination destination)
|
||||
throws TransformException {
|
||||
Rectangle destSize = getDownscaleSize(downscaleLevel);
|
||||
public void downscale(int fromLevel, int toLevel, DataSource source,
|
||||
DataDestination destination) throws TransformException {
|
||||
Rectangle sourceSize = getDownscaleSize(fromLevel);
|
||||
GeneralGridGeometry sourceGeometry = new GeneralGridGeometry(
|
||||
new GridEnvelope2D(sourceSize), sourceEnvelope);
|
||||
Rectangle destSize = getDownscaleSize(toLevel);
|
||||
GeneralGridGeometry destGeometry = new GeneralGridGeometry(
|
||||
new GridEnvelope2D(destSize), sourceGeometry.getEnvelope());
|
||||
new GridEnvelope2D(destSize), sourceEnvelope);
|
||||
GridReprojection reprojection = new GridReprojection(sourceGeometry,
|
||||
destGeometry);
|
||||
try {
|
||||
reprojection
|
||||
.reprojectedGrid(interpolation, dataSource, destination);
|
||||
reprojection.reprojectedGrid(interpolation, source, destination);
|
||||
} catch (FactoryException e) {
|
||||
throw new TransformException(
|
||||
"Error creating transforms required for downscaling", e);
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class AbstractDataWrapper implements DataSource,
|
|||
public double getDataValue(int x, int y) {
|
||||
if (y < 0 || y > ny - 1) {
|
||||
// outside y range
|
||||
return Float.NaN;
|
||||
return Double.NaN;
|
||||
} else if (x < 0 || x > nx - 1) {
|
||||
// outside x range
|
||||
if (wrapX > 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue