/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package visad.java3d;

import java.util.ArrayList;
import javax.media.j3d.Switch;
import visad.AVHandler;

/**
 *
 * @author rink
 */
public class TrajectoryAVHandlerJ3D implements AVHandler {
    int numChildren;
    int[] whichVisible;
    int numVisible;
    int direction;
    java.util.BitSet bits;
    Switch swit;

    ArrayList allOffBelow = new ArrayList();

    ArrayList allOffAbove = new ArrayList();
   
   public TrajectoryAVHandlerJ3D(Switch swit, int numChildren, int[] whichVisible, int direction) {
     this.swit = swit;
     this.numChildren = numChildren;
     this.whichVisible = whichVisible;
     this.numVisible = whichVisible.length;
     this.direction = direction;
     this.bits = new java.util.BitSet(numChildren);
   }
   
   public void setWhichChild(int index) {
      if (index == Switch.CHILD_NONE) {
        bits.clear();
        swit.setWhichChild(Switch.CHILD_NONE);
      }
      else if (index >= 0) {
        bits.clear();
        for (int t=0; t= 0) {
            bits.set(k_set);
          }
        }

        int offBelow = 0;
        for (int k=0; k= idx) {
            offBelow = idx;
          }
        }
        if (offBelow > 0) {
          bits.clear(0, offBelow);
        }

        /* TODO: not working
        bits.set(0, numChildren-1);
        int offAbove = 0;
        for (int k=0; k 0) {
          bits.clear(offAbove, numChildren-1);
        }
        */

        swit.setChildMask(bits);
      }
   }
   
   public int getWindowSize() {
      return numVisible;
   }
   
   public void setNoneVisibleIndex(int index) {
      if (direction > 0) {
         allOffBelow.add(index);
      }
      else {
         // TODO: see above
      }
   }
   
}

 

Ads help maintain this website.