private void set(double omega, double chi, double phi) { HVPanel.quiet = true; rotX.setValue(omega); rotY.setValue(chi); rotZ.setValue(phi); model3d.orientationClass.setOmega(omega); model3d.orientationClass.setChi(chi); model3d.orientationClass.setPhi(phi); HVPanel.quiet = false; }
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; } }
public void actionPerformed(ActionEvent e) { boolean ajustR = false; if (e.getActionCommand().equals("Lambda")) { double l = ((SliderAndValue) e.getSource()).getValue(); model3d.s.setLambda(l); model3d.net.gonioHead.setY(model3d.s.lambdaToRadius(l)); ajustR = true; } else if (e.getActionCommand().equals("Omega")) { model3d.orientationClass.setOmega(((SliderAndValue) e.getSource()).getValue()); } else if (e.getActionCommand().equals("Chi")) { model3d.orientationClass.setChi(((SliderAndValue) e.getSource()).getValue()); } else if (e.getActionCommand().equals("Phi")) { model3d.orientationClass.setPhi(((SliderAndValue) e.getSource()).getValue()); } else if (e.getActionCommand().equals("Precession")) { model3d.precessionClass.setRotation(((SliderAndValue) e.getSource()).getValue()); } else if (e.getActionCommand().equals("Reset angles")) { rotX.setValue(0); rotY.setValue(0); rotZ.setValue(0); precess.setValue(0); // HVPanel.quiet = true; // uvw.edit.setText("0 1 0"); // HVPanel.quiet = false; model3d.projScreen.clearImage(); } else if (e.getActionCommand().equals("u v w")) { HVPanel.quiet = true; int[] ii = ((int[]) ((EditField) e.getSource()).getValue()); u = ii[0]; v = ii[1]; w = ii[2]; lattice.setOrientation(ii[0], ii[1], ii[2]); reciprocal = lattice.reciprocal(); model3d.net.setLattice(reciprocal); HVPanel.quiet = false; } model3d.doRays(ajustR); }
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(); } } }