//
// DiscoverableZoom.java
//

/*
VisAD system for interactive analysis and visualization of numerical
data.  Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/

package visad.bom;

import visad.*;
import visad.java3d.*;

import java.util.Vector;
import java.util.Enumeration;
import java.rmi.*;


/**
   DiscoverableZoom is the VisAD class for
   discoverable zoom of displayed data.
*/
public class DiscoverableZoom extends Object
       implements ControlListener {

  private boolean pfirst = true;

  private double base_scale = 1.0;
  private float last_cscale = 1.0f;

  private float latmul, lonmul;
  private DataRenderer[] renderers = null;
  private boolean[] enabled = null;
  private int nrenderers = -1;
  private float[] lons = null;
  private float[] lats = null;

  /** the DataRenderers in the rs array are assumed to each link to
      a Tuple data object that includes Real fields for Latitude and
      Longitude, and that Latitude and Longitude are mapped to spatial
      DisplayRealTypes; the DataRenderers in rs are enabled or disabled
      to maintain a roughly constant spacing among their visible
      depictions;
      distance is the scale for distance;
      in order to work, this DiscoverableZoom must be added as a
      Control Listener to the ProjectionControl of the DisplayImpl
      linked to the DataRenderer array rs;
      see CollectiveBarbManipulation.java for an example of use */
  public void setRenderers(DataRenderer[] rs, float distance)
         throws VisADException, RemoteException {
    renderers = rs;
    if (renderers != null) {
      nrenderers = renderers.length;
      if (nrenderers == 0) {
        nrenderers = -1;
        return;
      }
      lons = new float[nrenderers];
      lats = new float[nrenderers];
      enabled = new boolean[nrenderers];
      for (int i=0; i
                    



        
      

Ads help maintain this website.