Exemplo n.º 1
0
  public void loadView(String filename) {
    Point3 point;
    Vector3 tvec;
    double radius;
    double azimuth;
    double elevation;
    double scale;
    double x, y, z;
    double vx, vy, vz;

    try {
      if (_ipg == null) throw new Exception("Must load a cube first!");
      Scanner s = new Scanner(new File(filename));
      radius = s.nextDouble();
      x = s.nextDouble();
      y = s.nextDouble();
      z = s.nextDouble();
      point = new Point3(x, y, z);
      azimuth = s.nextDouble();
      elevation = s.nextDouble();
      scale = s.nextDouble();
      vx = s.nextDouble();
      vy = s.nextDouble();
      vz = s.nextDouble();
      tvec = new Vector3(vx, vy, vz);
      Iterator<ImagePanel> itr = _ipg.getImagePanels();
      while (itr.hasNext()) {
        ImagePanel ip = itr.next();
        AxisAlignedFrame aaf = ip.getFrame();
        double lx = s.nextDouble();
        double ly = s.nextDouble();
        double lz = s.nextDouble();
        double mx = s.nextDouble();
        double my = s.nextDouble();
        double mz = s.nextDouble();

        Point3 min = new Point3(lx, ly, lz);
        Point3 max = new Point3(mx, my, mz);
        aaf.setCorners(min, max);
      }
      _pmax = s.nextFloat();
      int code = s.nextInt();
      _color = ColorList.getMatch(code);
      setColorMap();
      _view.setWorldSphere(new BoundingSphere(point, radius));
      _view.setTranslate(tvec);
      _view.setAzimuth(azimuth);
      _view.setElevation(elevation);
      _view.setScale(scale);
      _ipg.setPercentiles(_pmin, _pmax);

    } catch (Exception e) {
      System.out.println("Failed to load view point!");
      System.out.println(e);
    }
  }
Exemplo n.º 2
0
 public static ColorList getMatch(int c) {
   for (ColorList color : ColorList.values()) {
     if (color.getCode() == c) return color;
   }
   return GRAY;
 }