Beispiel #1
0
 public void setSpeed() {
   if (fromToEnable.isSelected()) {
     int d = Math.round(to.getFloatValue() - from.getFloatValue());
     animator.speed = (int) Math.round(speed.getValue() * d / 360);
     if (animator.speed == 0) animator.speed = 1;
   }
 }
Beispiel #2
0
    public void actionPerformed(ActionEvent e) {
      if (e.getActionCommand().equals("Size ") || e.getActionCommand().equals(" x ")) {
        double dw = w.getFloatValue(), dh = h.getFloatValue();
        model3d.setScreenSize(dw, dh);
      } else if (e.getActionCommand().equals("Distance ")) {
        model3d.projScreen.clearImage();
        double d = y.getFloatValue();
        model3d.p3d.setPos(d);
        model3d.mask3d.setY(d);
      } else if (e.getActionCommand().equals("Flat")) {
        if (flat) return;
        flat = true;
        super.actionPerformed(new ActionEvent(this, 0, "horizontal"));
        w.setEnable(true);
        model3d.setFlatScreen();
        h.setValue(new Double(model3d.p3d.h));
        w.setValue(new Double(model3d.p3d.w));

        model3d.univers.scale(2);
        model3d.precessionClass.setAngle(animPane.angle.getFloatValue());
        model3d.precessionClass.setRotation(paramPane.precess.getValue());
        paramPane.precess.setEnabled(true);
        animPane.angle.setEnable(true);
        animPane.precession.setEnabled(true);
        animPane.mask.setEnabled(true);
        model3d.setMask(animPane.mask.isSelected());
      } else if (e.getActionCommand().equals("Cylindric")) {
        if (!flat) return;
        flat = false;
        super.actionPerformed(new ActionEvent(this, 0, "vertical"));
        w.setEnable(false);
        w.name.setEnabled(true);
        model3d.setCylindricScreen();
        h.setValue(new Double(model3d.p3d.h));
        w.edit.setText("");

        model3d.univers.scale(.5);
        model3d.precessionClass.setAngle(0);
        model3d.precessionClass.setRotation(0);
        paramPane.precess.setEnabled(false);
        animPane.angle.setEnable(false);
        animPane.precession.setEnabled(false);
        animPane.mask.setEnabled(false);
        model3d.setMask(false);
      } else if (e.getActionCommand().equals("Persistant")) {
        model3d.persistant = ((JCheckBox) e.getSource()).isSelected();
      } else if (e.getActionCommand().equals("Clear")) {
        model3d.projScreen.clearImage();
      } else if (e.getActionCommand().equals("Help")) {
        help.show(true);
      }
      model3d.doRays(false);
    }
Beispiel #3
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("More")) {
     HVPanel.quiet = true;
     x.setValue(new Integer(Math.round(x.getFloatValue()) + 1));
     y.setValue(new Integer(Math.round(y.getFloatValue()) + 1));
     z.setValue(new Integer(Math.round(z.getFloatValue()) + 1));
     HVPanel.quiet = false;
   } else if (e.getActionCommand().equals("Less")) {
     int a;
     HVPanel.quiet = true;
     x.setValue(new Integer((a = (int) x.getFloatValue()) == 0 ? 0 : a - 1));
     y.setValue(new Integer((a = (int) y.getFloatValue()) == 0 ? 0 : a - 1));
     z.setValue(new Integer((a = (int) z.getFloatValue()) == 0 ? 0 : a - 1));
     HVPanel.quiet = false;
   }
   model3d.net.setCrystalSize(
       (int) x.getFloatValue(), (int) y.getFloatValue(), (int) z.getFloatValue());
   model3d.doRays(false);
 }
Beispiel #4
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == fromToEnable) {
     boolean b = ((JCheckBox) e.getSource()).isSelected();
     animator.fromToEnable = b;
     from.setEnable(b);
     to.setEnable(b);
     if (!b) animator.speed = (int) Math.round(speed.getValue());
   } else if (e.getSource() == from) {
     animator.from = from.getFloatValue();
   } else if (e.getSource() == to) {
     animator.to = to.getFloatValue();
   } else if (e.getSource() == speed) {
     animator.speed = speed.getValue();
   } else if (e.getActionCommand().equals("Omega")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateSingleAngle(
           paramPane.rotX, paramPane.rotX.getValue(), (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Chi")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateSingleAngle(
           paramPane.rotY, paramPane.rotY.getValue(), (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Phi")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateSingleAngle(
           paramPane.rotZ, paramPane.rotZ.getValue(), (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Lambda")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateLambda(
           paramPane.lambda,
           paramPane.lambda.getMin(),
           paramPane.lambda.getMax(),
           (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Debye-Scherrer")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateRandom(
           paramPane.rotX, paramPane.rotY, paramPane.rotZ, (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Laue")) {
     model3d.projScreen.clearImage();
     model3d.doLaue();
   } else if (e.getActionCommand().equals("Sequential")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animateSequential(
           paramPane.rotX,
           paramPane.rotY,
           paramPane.rotZ,
           paramPane.rotX.getValue(),
           paramPane.rotY.getValue(),
           paramPane.rotZ.getValue(),
           (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   } else if (e.getActionCommand().equals("Speed")) {
     animator.speed = (int) Math.round(((SliderAndValue) e.getSource()).getValue());
     setSpeed();
   } else if (e.getActionCommand().equals(" Angle")) {
     double mu = angle.getFloatValue();
     model3d.precessionClass.setAngle(mu);
     model3d.mask3d.setR(
         Math.sin(model3d.precessionClass.mu) * (model3d.p3d.y * defaultValues.maskDistFract));
     model3d.doRays(false);
   } else if (e.getActionCommand().equals("Mask")) {
     model3d.setMask(((JCheckBox) e.getSource()).isSelected());
     model3d.doRays(false);
   } else if (e.getActionCommand().equals("Precession")) {
     if (((JToggleButton) e.getSource()).isSelected()) {
       animator.animatePrecession(
           paramPane.precess, paramPane.precess.getValue(), (JToggleButton) e.getSource());
     } else {
       animator.stopAnimation();
     }
   }
 }
Beispiel #5
0
 public void actionPerformed(ActionEvent e) {
   if (sync) {
     sync = false;
     if (this == lPane) {
       HVPanel.quiet = true;
       lattice =
           new Lattice(
               a.getFloatValue(),
               b.getFloatValue(),
               c.getFloatValue(),
               alpha.getFloatValue(),
               beta.getFloatValue(),
               gamma.getFloatValue());
       lattice.setOrientation(u, v, w);
       reciprocal = lattice.reciprocal();
       rPane.put(reciprocal);
       HVPanel.quiet = false;
     } else if (this == rPane) {
       HVPanel.quiet = true;
       reciprocal =
           new Lattice(
               a.getFloatValue(),
               b.getFloatValue(),
               c.getFloatValue(),
               alpha.getFloatValue(),
               beta.getFloatValue(),
               gamma.getFloatValue());
       Lattice l = reciprocal.reciprocal();
       lattice = new Lattice(l.a, l.b, l.c, l.alpha, l.beta, l.gamma);
       lattice.setOrientation(u, v, w);
       reciprocal = lattice.reciprocal();
       lPane.put(lattice);
       HVPanel.quiet = false;
     }
     sync = true;
   }
   model3d.net.setLattice(reciprocal);
   model3d.doRays(false);
 }