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: e06d1dabef [formerly a14d5d4c86] [formerly c183a0e614] [formerly 28d6308444 [formerly c183a0e614 [formerly a4dd750d4bbdaae4a548c9a296436cc783d2d71a]]]
Former-commit-id: 28d6308444
Former-commit-id: b4ace038bdcc2b915892986d414af1d5d5480636 [formerly 87bcbdb4cc]
Former-commit-id: 45d6b7bcb5
This commit is contained in:
Max Schenkelberg 2012-09-05 11:51:38 -05:00
parent 49524b9109
commit e7b2f69ff3
3 changed files with 25 additions and 14 deletions

View file

@ -138,18 +138,33 @@ public class TileLevel {
DefaultGeographicCRS.WGS84)); DefaultGeographicCRS.WGS84));
corrector = new WorldWrapCorrector(targetGeometry); corrector = new WorldWrapCorrector(targetGeometry);
// Calculate pixel density Envelope levelEnv = levelGeometry.getEnvelope();
// Grab the center x, 3/4 y of the map double[] in = new double[] {
double mapXCenter = targetGeometry.getGridRange().getSpan(0) * 0.5; levelEnv.getMinimum(0) + (levelEnv.getSpan(0) / 2),
double mapYCenter = targetGeometry.getGridRange().getSpan(1) * 0.75; 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, double mapPointX = out[0];
mapXCenter + 1, mapYCenter + 1 }; 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]; double[] output = new double[input.length];
tileCRSToTargetGrid.inverse().transform(input, 0, output, 0, 2); tileCRSToTargetGrid.inverse().transform(input, 0, output, 0, 2);
levelGeometry.getGridToCRS(PixelInCell.CELL_CORNER).inverse() crsToGrid.transform(output, 0, input, 0, 2);
.transform(output, 0, input, 0, 2);
pixelDensity = 1.0 / Math.abs(new Coordinate(input[0], input[1], pixelDensity = 1.0 / Math.abs(new Coordinate(input[0], input[1],
0.0).distance(new Coordinate(input[2], input[3], 0.0))); 0.0).distance(new Coordinate(input[2], input[3], 0.0)));
} catch (Exception e) { } catch (Exception e) {

View file

@ -114,7 +114,7 @@ public class TileSetRenderable implements IRenderable {
.getHandler(TileSetRenderable.class); .getHandler(TileSetRenderable.class);
/** Screen pixel to image pixel threshold at which we change levels */ /** 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 */ /** Job pool for tile creation */
protected static final JobPool tileCreationPool = new JobPool( 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(); String text = curItems[i].getText();
int comp = text.compareToIgnoreCase(name); int comp = text.compareToIgnoreCase(name);
if (comp >= 0) { if (comp >= 0) {
if (comp == 0 && text.compareTo(name) == 0) { idx = i;
idx = -1;
} else {
idx = i;
}
break; break;
} }
} }