Esempio n. 1
0
 public void saveView(String filename) {
   BoundingSphere bs = _ipg.getBoundingSphere(true);
   Vector3 tvec = _view.getTranslate();
   try {
     FileWriter fw = new FileWriter(filename);
     PrintWriter out = new PrintWriter(fw);
     out.println(bs.getRadius());
     Point3 center = bs.getCenter();
     out.printf("%f %f %f \n", center.x, center.y, center.z);
     out.println(_view.getAzimuth());
     out.println(_view.getElevation());
     out.println(_view.getScale());
     out.printf("%f %f %f \n", tvec.x, tvec.y, tvec.z);
     Iterator<ImagePanel> itr = _ipg.getImagePanels();
     while (itr.hasNext()) {
       ImagePanel ip = itr.next();
       AxisAlignedFrame aaf = ip.getFrame();
       Point3 min = aaf.getCornerMin();
       Point3 max = aaf.getCornerMax();
       out.printf("%f %f %f %f %f %f\n", min.x, min.y, min.z, max.x, max.y, max.z);
     }
     out.println(_pmax);
     out.println(_color.getCode());
     out.close();
   } catch (Exception e) {
     System.out.println(e);
   }
 }
Esempio n. 2
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);
    }
  }