diff --git a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java index 7a54ac05b0..d9f97242af 100644 --- a/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java +++ b/cave/com.raytheon.uf.viz.gisdatastore/src/com/raytheon/uf/viz/gisdatastore/rsc/DataStoreResource.java @@ -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() diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java index 1fb6908606..be9856a268 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java @@ -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;