Issue #29 Changed how TileLevel calculate pixel density to make densities more consistent between granules on display. Changed TileSetRenderable level change threshold to smaller value so displays look less pixelated with new pixel density calculation. Fixed FileTreeView from throwing errors if two definitions with same name defined which came to light from NPP build

Change-Id: I66b556b74e1a856dace5447c4b9f090d026c493c

Former-commit-id: a4dd750d4bbdaae4a548c9a296436cc783d2d71a
This commit is contained in:
Max Schenkelberg 2012-09-05 11:51:38 -05:00
parent c618ee9057
commit 28d6308444
3 changed files with 25 additions and 14 deletions

View file

@ -138,18 +138,33 @@ public class TileLevel {
DefaultGeographicCRS.WGS84));
corrector = new WorldWrapCorrector(targetGeometry);
// Calculate pixel density
// Grab the center x, 3/4 y of the map
double mapXCenter = targetGeometry.getGridRange().getSpan(0) * 0.5;
double mapYCenter = targetGeometry.getGridRange().getSpan(1) * 0.75;
Envelope levelEnv = levelGeometry.getEnvelope();
double[] in = new double[] {
levelEnv.getMinimum(0) + (levelEnv.getSpan(0) / 2),
levelEnv.getMinimum(1) + (levelEnv.getSpan(1) / 2) };
double[] out = new double[in.length];
tileCRSToTargetGrid.transform(in, 0, out, 0, 1);
double[] input = new double[] { mapXCenter, mapYCenter,
mapXCenter + 1, mapYCenter + 1 };
double mapPointX = out[0];
double mapPointY = out[1];
GridEnvelope targetEnv = targetGeometry.getGridRange();
if (targetEnv.getLow(0) > mapPointX
|| targetEnv.getHigh(0) < mapPointX
|| targetEnv.getLow(1) > mapPointY
|| targetEnv.getHigh(1) < mapPointY) {
// Center of tile level outside target grid, use something on
// target grid for calculations
mapPointX = targetEnv.getLow(0) + targetEnv.getSpan(0) * 0.5;
mapPointY = targetEnv.getLow(1)
+ targetGeometry.getGridRange().getSpan(1) * 0.75;
}
double[] input = new double[] { mapPointX, mapPointY,
mapPointX + 1, mapPointY + 1 };
double[] output = new double[input.length];
tileCRSToTargetGrid.inverse().transform(input, 0, output, 0, 2);
levelGeometry.getGridToCRS(PixelInCell.CELL_CORNER).inverse()
.transform(output, 0, input, 0, 2);
crsToGrid.transform(output, 0, input, 0, 2);
pixelDensity = 1.0 / Math.abs(new Coordinate(input[0], input[1],
0.0).distance(new Coordinate(input[2], input[3], 0.0)));
} catch (Exception e) {

View file

@ -114,7 +114,7 @@ public class TileSetRenderable implements IRenderable {
.getHandler(TileSetRenderable.class);
/** Screen pixel to image pixel threshold at which we change levels */
protected static final double LEVEL_CHANGE_THRESHOLD = 2.0;
protected static final double LEVEL_CHANGE_THRESHOLD = 1.75;
/** Job pool for tile creation */
protected static final JobPool tileCreationPool = new JobPool(

View file

@ -655,11 +655,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
String text = curItems[i].getText();
int comp = text.compareToIgnoreCase(name);
if (comp >= 0) {
if (comp == 0 && text.compareTo(name) == 0) {
idx = -1;
} else {
idx = i;
}
idx = i;
break;
}
}