Skip to content

Commit

Permalink
when the zoom scale larger than 40 we switch the clip distance in the…
Browse files Browse the repository at this point in the history
… map view
  • Loading branch information
yuanho committed Feb 26, 2024
1 parent 9dad4b7 commit 6802985
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/ucar/unidata/view/geoloc/NavigatedDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,12 @@ public abstract class NavigatedDisplay extends DisplayMaster {
/** the back clip distance */
private double clipDistanceBack = CLIP_BACK_DEFAULT;

protected double defaultClipDistanceBack = 0;
/** the front clip distance */
private double clipDistanceFront = CLIP_FRONT_DEFAULT;

protected double defaultClipDistanceFront = 0;

/** flag for auto-rotation */
private boolean autoRotate = false;

Expand Down Expand Up @@ -2521,6 +2524,8 @@ private void rotate() throws VisADException, RemoteException {
*/
public void setClipDistanceBack(double value) {
this.clipDistanceBack = value;
if(defaultClipDistanceBack == 0)
defaultClipDistanceBack = value;
}

/**
Expand All @@ -2539,6 +2544,8 @@ public double getClipDistanceBack() {
*/
public void setClipDistanceFront(double value) {
this.clipDistanceFront = value;
if(defaultClipDistanceFront == 0)
defaultClipDistanceFront = value;
}

/**
Expand Down Expand Up @@ -2624,4 +2631,27 @@ public void setVerticalRange(double min, double max)
}
}
}

/**
* 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 > 40) {
setClipDistanceFront(CLIP_FRONT_DEFAULT);
setClipDistanceBack(CLIP_BACK_DEFAULT);
}
else {
setClipDistanceFront(defaultClipDistanceFront);
setClipDistanceBack(defaultClipDistanceBack);
}
//System.out.println("Scale = " + scale + " Front = " + getClipDistanceFront() + "Rear = " + getClipDistanceBack());

}
}

0 comments on commit 6802985

Please sign in to comment.