Omaha #3459 Ensure font is initialized before queryJob runs,
Additional refactoring to someday allow ZoneSelectorResource to use more common code. Change-Id: I87e4d1a16b6086f4241e67bb1058bb096eb5e062 Former-commit-id:0bb6076cdc
[formerlyf3f2ec8843
] [formerly8583386e5f
] [formerly0bb6076cdc
[formerlyf3f2ec8843
] [formerly8583386e5f
] [formerlyde490ea582
[formerly8583386e5f
[formerly a1896437f432bcb360365d28a0ee7377cec565af]]]] Former-commit-id:de490ea582
Former-commit-id:06dbcd69d6
[formerlyae69665e50
] [formerly 39b07ee71f914fcb7284dbe4733a3b9645faf975 [formerly338672c03f
]] Former-commit-id: e0bb2a385f25bd2eb5b08e0b6f5f02ee58b77b3c [formerly3954787487
] Former-commit-id:4a821c89b7
This commit is contained in:
parent
cb4ecaae1f
commit
c317ab5eef
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.TextStyle;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||||
import com.raytheon.uf.viz.core.PixelExtent;
|
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.IShadedShape;
|
||||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
|
@ -841,8 +840,6 @@ public class DataStoreResource extends
|
||||||
|
|
||||||
protected IWireframeShape highlightShape;
|
protected IWireframeShape highlightShape;
|
||||||
|
|
||||||
protected IFont font;
|
|
||||||
|
|
||||||
protected PixelExtent lastExtent;
|
protected PixelExtent lastExtent;
|
||||||
|
|
||||||
protected PixelExtent projExtent;
|
protected PixelExtent projExtent;
|
||||||
|
@ -1140,6 +1137,15 @@ public class DataStoreResource extends
|
||||||
.getLabelField();
|
.getLabelField();
|
||||||
boolean isLabeled = labelField != null;
|
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)
|
String shadingField = getCapability(ShadeableCapability.class)
|
||||||
.getShadingField();
|
.getShadingField();
|
||||||
boolean isShaded = isPolygonal() && (shadingField != null);
|
boolean isShaded = isPolygonal() && (shadingField != null);
|
||||||
|
@ -1217,12 +1223,8 @@ public class DataStoreResource extends
|
||||||
highlightWidth, highlightStyle);
|
highlightWidth, highlightStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
double labelMagnification = getCapability(MagnificationCapability.class)
|
|
||||||
.getMagnification();
|
|
||||||
|
|
||||||
if ((labels != null) && isLabeled && (labelMagnification != 0)) {
|
if ((labels != null) && isLabeled && (labelMagnification != 0)) {
|
||||||
drawLabels(aTarget, paintProps, labelMagnification,
|
drawLabels(aTarget, paintProps, worldToScreenRatio);
|
||||||
worldToScreenRatio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rubberBandExtent != null) {
|
if (rubberBandExtent != null) {
|
||||||
|
@ -1270,14 +1272,8 @@ public class DataStoreResource extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawLabels(IGraphicsTarget aTarget,
|
private void drawLabels(IGraphicsTarget aTarget,
|
||||||
PaintProperties paintProps, double labelMagnification,
|
PaintProperties paintProps, double worldToScreenRatio)
|
||||||
double worldToScreenRatio) throws VizException {
|
throws VizException {
|
||||||
if (font == null) {
|
|
||||||
font = aTarget.initializeFont(aTarget.getDefaultFont()
|
|
||||||
.getFontName(), (float) (10 * labelMagnification), null);
|
|
||||||
font.setSmoothing(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
double offsetX = getCapability(LabelableCapability.class).getxOffset()
|
double offsetX = getCapability(LabelableCapability.class).getxOffset()
|
||||||
* worldToScreenRatio;
|
* worldToScreenRatio;
|
||||||
double offsetY = getCapability(LabelableCapability.class).getyOffset()
|
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.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
|
||||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||||
import org.geotools.coverage.grid.GridGeometry2D;
|
import org.geotools.coverage.grid.GridGeometry2D;
|
||||||
import org.geotools.geometry.GeneralEnvelope;
|
import org.geotools.geometry.GeneralEnvelope;
|
||||||
|
@ -314,7 +313,7 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
Point point = poly.getInteriorPoint();
|
Point point = poly.getInteriorPoint();
|
||||||
if (point.getCoordinate() != null) {
|
if (point.getCoordinate() != null) {
|
||||||
LabelNode node = new LabelNode(zoneName,
|
LabelNode node = new LabelNode(zoneName,
|
||||||
point, req.target);
|
point, req.target, req.rsc.font);
|
||||||
newLabels.add(node);
|
newLabels.add(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,21 +697,14 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
PaintProperties paintProps) throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
this.target = aTarget;
|
this.target = aTarget;
|
||||||
|
|
||||||
|
if (font == null) {
|
||||||
|
font = GFEFonts.getFont(aTarget, 2);
|
||||||
|
}
|
||||||
|
|
||||||
PixelExtent screenExtent = (PixelExtent) paintProps.getView()
|
PixelExtent screenExtent = (PixelExtent) paintProps.getView()
|
||||||
.getExtent();
|
.getExtent();
|
||||||
|
|
||||||
// compute an estimate of degrees per pixel
|
double simpLev = getSimpLev(paintProps);
|
||||||
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);
|
|
||||||
|
|
||||||
if ((simpLev < lastSimpLev)
|
if ((simpLev < lastSimpLev)
|
||||||
|| (lastExtent == null)
|
|| (lastExtent == null)
|
||||||
|
@ -779,9 +771,6 @@ public class ZoneSelectorResource extends DbMapResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((labels != null) && (this.labelZones || this.labelZoneGroups)) {
|
if ((labels != null) && (this.labelZones || this.labelZoneGroups)) {
|
||||||
if (font == null) {
|
|
||||||
font = GFEFonts.getFont(aTarget, 2);
|
|
||||||
}
|
|
||||||
double worldToScreenRatio = paintProps.getView().getExtent()
|
double worldToScreenRatio = paintProps.getView().getExtent()
|
||||||
.getWidth()
|
.getWidth()
|
||||||
/ paintProps.getCanvasBounds().width;
|
/ paintProps.getCanvasBounds().width;
|
||||||
|
|
Loading…
Add table
Reference in a new issue