From 90a4e44690d0b3d35cf529ba18f97126cb55e136 Mon Sep 17 00:00:00 2001 From: yuanho Date: Mon, 26 Feb 2024 12:13:12 -0700 Subject: [PATCH] when the zoom scale larger than 400 we switch the clip distance in the globe view --- .../unidata/view/geoloc/GlobeDisplay.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ucar/unidata/view/geoloc/GlobeDisplay.java b/src/ucar/unidata/view/geoloc/GlobeDisplay.java index dc4129286..732debe71 100644 --- a/src/ucar/unidata/view/geoloc/GlobeDisplay.java +++ b/src/ucar/unidata/view/geoloc/GlobeDisplay.java @@ -90,6 +90,7 @@ import java.rmi.RemoteException; +import java.util.Arrays; import java.util.Iterator; import javax.media.j3d.GraphicsConfigTemplate3D; @@ -180,6 +181,7 @@ public class GlobeDisplay extends NavigatedDisplay { /** Earth Radius (m) */ public static final double EARTH_RADIUS = 6371229.; + private double[] savedProjectionMatrix = null; /** * Constructs a new GlobeDisplay. * @@ -545,6 +547,28 @@ private void setSpatialScalarMaps() } } + /** + * Zoom in on the display + * + * @param scale x zoom factor + * + * + * ( > 1 = zoom in, 1 > zoom > 0 = zoom out). using + * 2.0 and .5 seems to work well. + */ + public void resetClipDistance(double scale) { + + //System.out.println("Current zoom = " +scale); + if(scale > 400) { + setClipDistanceFront(CLIP_FRONT_DEFAULT); + setClipDistanceBack(CLIP_BACK_DEFAULT); + } + else { + setClipDistanceFront(super.defaultClipDistanceFront); + setClipDistanceBack(super.defaultClipDistanceBack); + } + // System.out.println("Scale = " + getView().getFrameNumber() + " Front = " + getClipDistanceFront() + "Rear = " + getClipDistanceBack()); + } /** * Set the map area to be displayed in the box. Does nothing at