예제 #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;
   }
 }
  /**
   * restoreUIFieldsFromCitation - populate the UI fields from those currently stored in the
   * citation record
   */
  private void restoreUIFieldsFromCitation() {
    boolean accidentStatus = c.Violation.getElement(CViolation.ACCIDENT).equals("true");
    boolean radarStatus = c.Violation.getElement(CViolation.RADAR).equals("true");
    boolean jailStatus = c.Violation.getElement(CViolation.JAIL_BOOKING).equals("true");
    boolean pacedStatus = c.Violation.getElement(CViolation.PACED).equals("true");
    boolean alcoholStatus = c.Violation.getElement(CViolation.ALCOHOL).equals("true");

    field_accident.setChecked(accidentStatus);
    field_radar.setChecked(radarStatus);
    field_jail_booking.setChecked(jailStatus);
    field_paced.setChecked(pacedStatus);
    field_alcohol.setChecked(alcoholStatus);

    field_vbfi.setText(c.Violation.getElement(CViolation.VBFI));
    field_speed_limit.setSelectedIndex(c.Violation.getElement(CViolation.SPEED_LIMIT));
    field_alleged_speed.setText(c.Violation.getElement(CViolation.ALLEGED_SPEED));
  }
예제 #3
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);
    }
  /** storeUIFieldsToCitation - transfer the UI field values to the citation record */
  private void storeUIFieldsToCitation() {
    String accidentStatus = field_accident.getChecked() ? "true" : "false";
    String radarStatus = field_radar.getChecked() ? "true" : "false";
    String jailStatus = field_jail_booking.getChecked() ? "true" : "false";
    String pacedStatus = field_paced.getChecked() ? "true" : "false";
    String schoolStatus = field_school_zone.getChecked() ? "true" : "false";
    String alcoholStatus = field_alcohol.getChecked() ? "true" : "false";

    c.Violation.setElement(CViolation.ACCIDENT, accidentStatus);
    c.Violation.setElement(CViolation.RADAR, radarStatus);
    c.Violation.setElement(CViolation.JAIL_BOOKING, jailStatus);
    c.Violation.setElement(CViolation.PACED, pacedStatus);
    c.Violation.setElement(CViolation.SCHOOL_ZONE, schoolStatus);
    c.Violation.setElement(CViolation.ALCOHOL, alcoholStatus);

    c.Violation.setElement(CViolation.VBFI, field_vbfi.getText());
    c.Violation.setElement(CViolation.SPEED_LIMIT, field_speed_limit.toString());
    c.Violation.setElement(CViolation.ALLEGED_SPEED, field_alleged_speed.getText());
  }
예제 #5
0
 public void put(Lattice l) {
   a.setValue(new Float(l.a));
   b.setValue(new Float(l.b));
   c.setValue(new Float(l.c));
   alpha.setValue(new Float(l.alpha));
   beta.setValue(new Float(l.beta));
   gamma.setValue(new Float(l.gamma));
 }
예제 #6
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();
     }
   }
 }
예제 #7
0
    public Animation() {
      setBorder(new TitledBorder("Animation"));
      HVPanel.v p1 = new HVPanel.v();

      HVPanel p2 = new HVPanel.h();
      p2.addButton(new JToggleButton("Omega"));
      p2.addButton(new JToggleButton("Chi"));
      p2.addButton(new JToggleButton("Phi"));
      p1.addSubPane(p2);

      HVPanel p3 = new HVPanel.h();
      p3.addButton(new JToggleButton("Sequential"));
      p3.addButton(new JToggleButton("Debye-Scherrer"));
      p1.addSubPane(p3);

      HVPanel.h p5 = new HVPanel.h();
      p5.left();
      p5.addButton(fromToEnable = new JCheckBox(""));
      HVPanel.v p61 = new HVPanel.v();
      p61.expand(false);
      from = p61.addIntField("", "°", 2, defaultValues.startAngle);
      p5.addSubPane(p61);
      HVPanel.v p62 = new HVPanel.v();
      p62.expand(false);
      to = p62.addIntField("-", "°", 2, defaultValues.stopAngle);
      p5.addSubPane(p62);
      p5.putExtraSpace();
      p1.addSubPane(p5);
      p5.expand(true);
      speed = p5.addSliderAndValueH("Speed", null, 1, 20, defaultValues.speed, 0, 80);

      HVPanel p7 = new HVPanel.h();
      p7.addButton(new JToggleButton("Lambda"));
      p7.addButton(laue = new JButton("Laue"));
      p1.addSubPane(p7);
      // p1.putExtraSpace();

      HVPanel.h p8 = new HVPanel.h();
      p8.expand(true);
      p8.addButton(precession = new JToggleButton("Precession"));
      HVPanel.v p9 = new HVPanel.v();
      p9.expand(false);
      angle = p9.addIntFieldSpinner(" Angle", "°", 2, defaultValues.mu);
      model3d.precessionClass.setAngle(defaultValues.mu);
      model3d.mask3d.setR(
          Math.sin(model3d.precessionClass.mu) * (model3d.p3d.y * defaultValues.maskDistFract));

      p8.addSubPane(p9);
      p8.addButton(mask = new JCheckBox("Mask"));
      p1.addSubPane(p8);

      addSubPane(p1);
      laue.setForeground(Color.blue);
      animator = new Animator();
      animator.from = defaultValues.startAngle;
      animator.to = defaultValues.stopAngle;
      animator.fromToEnable = false;
      animator.speed = 1;

      setSpeed();

      fromToEnable.setSelected(false);
      from.setEnable(false);
      to.setEnable(false);
    }
예제 #8
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);
 }
예제 #9
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);
 }