Beispiel #1
0
 /**
  * Returns the current position of the specified stage, or 0 if the stage wasn't found. Updates
  * the cache with the value as well.
  *
  * @param devKey
  * @param dir
  * @return
  */
 public double getUpdatedPosition(Devices.Keys devKey, Joystick.Directions dir) {
   String mmDevice = devices_.getMMDevice(devKey);
   if (mmDevice == null) {
     return 0;
   }
   try {
     if (devices_.is1DStage(devKey)) {
       double pt = core_.getPosition(mmDevice);
       oneAxisDrivePositions_.put(devKey, pt);
       return pt;
     }
     Point2D.Double pt;
     if (devices_.isXYStage(devKey)) {
       pt = core_.getXYStagePosition(mmDevice);
     } else if (devices_.isGalvo(devKey)) {
       pt = core_.getGalvoPosition(mmDevice);
     } else {
       pt = new Point2D.Double();
     }
     twoAxisDrivePositions_.put(devKey, pt);
     if (dir == Joystick.Directions.X) {
       return pt.x;
     } else if (dir == Joystick.Directions.Y) {
       return pt.y;
     }
   } catch (Exception ex) {
     MyDialogUtils.showError(ex);
   }
   return 0;
 }
Beispiel #2
0
 private void refreshOneAxisStagePositions() {
   for (Devices.Keys devKey : Devices.STAGES1D) {
     String mmDevice = devices_.getMMDevice(devKey);
     if (mmDevice == null) { // skip devices not set in devices tab
       oneAxisDrivePositions_.put(devKey, null);
       continue;
     }
     try {
       if (devices_.is1DStage(devKey)) {
         double pt = core_.getPosition(mmDevice);
         oneAxisDrivePositions_.put(devKey, pt);
       }
     } catch (Exception ex) {
       ReportingUtils.logMessage("Problem getting position of " + mmDevice);
     }
   }
 }