Merge "Omaha #3459 Ensure font is initialized before queryJob runs, Additional refactoring to someday allow ZoneSelectorResource to use more common code." into omaha_14.4.1
Former-commit-id:3efe4cf3b0
[formerlyc4333e030c
] [formerly13f1a5a8ab
[formerly 172d733902e6430de4f776eed3ad4cd6a94164a5]] Former-commit-id:13f1a5a8ab
Former-commit-id:d7a2ff8336
This commit is contained in:
commit
ce408af16d
2 changed files with 18 additions and 33 deletions
|
@ -75,7 +75,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
|
|||
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
|
@ -841,8 +840,6 @@ public class DataStoreResource extends
|
|||
|
||||
protected IWireframeShape highlightShape;
|
||||
|
||||
protected IFont font;
|
||||
|
||||
protected PixelExtent lastExtent;
|
||||
|
||||
protected PixelExtent projExtent;
|
||||
|
@ -1140,6 +1137,15 @@ public class DataStoreResource extends
|
|||
.getLabelField();
|
||||
boolean isLabeled = labelField != null;
|
||||
|
||||
double labelMagnification = getCapability(MagnificationCapability.class)
|
||||
.getMagnification();
|
||||
|
||||
if (font == null) {
|
||||
font = aTarget.initializeFont(aTarget.getDefaultFont()
|
||||
.getFontName(), (float) (10 * labelMagnification), null);
|
||||
font.setSmoothing(false);
|
||||
}
|
||||
|
||||
String shadingField = getCapability(ShadeableCapability.class)
|
||||
.getShadingField();
|
||||
boolean isShaded = isPolygonal() && (shadingField != null);
|
||||
|
@ -1217,12 +1223,8 @@ public class DataStoreResource extends
|
|||
highlightWidth, highlightStyle);
|
||||
}
|
||||
|
||||
double labelMagnification = getCapability(MagnificationCapability.class)
|
||||
.getMagnification();
|
||||
|
||||
if ((labels != null) && isLabeled && (labelMagnification != 0)) {
|
||||
drawLabels(aTarget, paintProps, labelMagnification,
|
||||
worldToScreenRatio);
|
||||
drawLabels(aTarget, paintProps, worldToScreenRatio);
|
||||
}
|
||||
|
||||
if (rubberBandExtent != null) {
|
||||
|
@ -1270,14 +1272,8 @@ public class DataStoreResource extends
|
|||
}
|
||||
|
||||
private void drawLabels(IGraphicsTarget aTarget,
|
||||
PaintProperties paintProps, double labelMagnification,
|
||||
double worldToScreenRatio) throws VizException {
|
||||
if (font == null) {
|
||||
font = aTarget.initializeFont(aTarget.getDefaultFont()
|
||||
.getFontName(), (float) (10 * labelMagnification), null);
|
||||
font.setSmoothing(false);
|
||||
}
|
||||
|
||||
PaintProperties paintProps, double worldToScreenRatio)
|
||||
throws VizException {
|
||||
double offsetX = getCapability(LabelableCapability.class).getxOffset()
|
||||
* worldToScreenRatio;
|
||||
double offsetY = getCapability(LabelableCapability.class).getyOffset()
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
|
@ -314,7 +313,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
Point point = poly.getInteriorPoint();
|
||||
if (point.getCoordinate() != null) {
|
||||
LabelNode node = new LabelNode(zoneName,
|
||||
point, req.target);
|
||||
point, req.target, req.rsc.font);
|
||||
newLabels.add(node);
|
||||
}
|
||||
}
|
||||
|
@ -698,21 +697,14 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
PaintProperties paintProps) throws VizException {
|
||||
this.target = aTarget;
|
||||
|
||||
if (font == null) {
|
||||
font = GFEFonts.getFont(aTarget, 2);
|
||||
}
|
||||
|
||||
PixelExtent screenExtent = (PixelExtent) paintProps.getView()
|
||||
.getExtent();
|
||||
|
||||
// compute an estimate of degrees per pixel
|
||||
double yc = screenExtent.getCenter()[1];
|
||||
double x1 = screenExtent.getMinX();
|
||||
double x2 = screenExtent.getMaxX();
|
||||
double[] c1 = descriptor.pixelToWorld(new double[] { x1, yc });
|
||||
double[] c2 = descriptor.pixelToWorld(new double[] { x2, yc });
|
||||
Rectangle canvasBounds = paintProps.getCanvasBounds();
|
||||
int screenWidth = canvasBounds.width;
|
||||
double dppX = Math.abs(c2[0] - c1[0]) / screenWidth;
|
||||
// System.out.println("c1:" + Arrays.toString(c1) + " c2:"
|
||||
// + Arrays.toString(c2) + " dpp:" + dppX);
|
||||
double simpLev = getSimpLev(dppX);
|
||||
double simpLev = getSimpLev(paintProps);
|
||||
|
||||
if ((simpLev < lastSimpLev)
|
||||
|| (lastExtent == null)
|
||||
|
@ -779,9 +771,6 @@ public class ZoneSelectorResource extends DbMapResource {
|
|||
}
|
||||
|
||||
if ((labels != null) && (this.labelZones || this.labelZoneGroups)) {
|
||||
if (font == null) {
|
||||
font = GFEFonts.getFont(aTarget, 2);
|
||||
}
|
||||
double worldToScreenRatio = paintProps.getView().getExtent()
|
||||
.getWidth()
|
||||
/ paintProps.getCanvasBounds().width;
|
||||
|
|
Loading…
Add table
Reference in a new issue