~GridTransformerCalibrationPanel() { endCalibration(); transformer->getSource()->sourceDataUpdated.disconnect( boost::bind(&GridTransformerCalibrationPanel::handleSourceDataUpdate, this, _1)); }
void ECCalibrateScreen::updateLowWaitScreen() { iSeconds = iSeconds - 3; String thisString = String(iSeconds); myUTFT.clrScr(); myUTFT.print("Calibration in Progress", CENTER, 30); myUTFT.print("Seconds left until ready " + thisString, CENTER, 42); switch(iCounter){ case 0: Serial.println("PRINT 0"); myUTFT.print("************************************", CENTER, 114); iCounter = 1; break; case 1: Serial.println("PRINT 1"); myUTFT.print("******************", CENTER, 114); iCounter = 2; break; case 2: Serial.println("PRINT 2"); myUTFT.print("*****", CENTER, 114); iCounter = 0; break; } if(iSeconds == 0){ iSeconds = max_seconds_for_calibration; //Move to next stage. endCalibration(); } }
void objectRemoved(Object* object) { if (currentStepObject && *currentStepObject == *object) { if (currentStepRecorded) { LOG4CPLUS_INFO(logger, "Step " << currentStep + 1 << " of " << getTotalPoints() << " completed"); currentStep += 1; currentStepRecorded = false; if (isCalibrationDone()) { transformer->updatePoints(rows, columns, inputPoints, objects.getBounds(), outputPoints, convert(gluit::Rectangle(getSize()))); LOG4CPLUS_INFO( logger, "Updated GridTransformer with calibration data: " << rows << " rows by " << columns << " columns, " << inputPoints.size() << " points, mapping from " << objects.getBounds() << " to " << convert(gluit::Rectangle(getSize()))); endCalibration(); } } currentStepObject.reset(); } }
void handleKeyPressed(const gluit::KeyEvent& e) { Objects::Mutex::scoped_lock lock(objects.mutex); if (calibrating) { switch (e.key) { case gluit::KeyEvent::KEY_C: endCalibration(); break; case gluit::KeyEvent::KEY_P: showPattern = !showPattern; break; case gluit::KeyEvent::KEY_R: if (currentStep > 0) { currentStep -= 1; currentStepObject.reset(); inputPoints.pop_back(); outputPoints.pop_back(); if (currentStepRecorded) { currentStepRecorded = false; inputPoints.pop_back(); outputPoints.pop_back(); } } break; } } else { switch (e.key) { case gluit::KeyEvent::KEY_C: beginCalibration(); break; case gluit::KeyEvent::KEY_P: showPattern = !showPattern; break; case gluit::KeyEvent::KEY_RIGHT: if (e.hasAltModifier()) { columns += 1; } else { if (e.hasShiftModifier()) { patternBounds.translateMaxThis(Vector2D(0.005, 0.0)).clipThis(PATTERN_BOUNDS_CLIP); } else { patternBounds.translateMinThis(Vector2D(0.005, 0.0)).clipThis(PATTERN_BOUNDS_CLIP); } } break; case gluit::KeyEvent::KEY_LEFT: if (e.hasAltModifier()) { if (columns > 0) { columns -= 1; } } else { if (e.hasShiftModifier()) { patternBounds.translateMaxThis(Vector2D(-0.005, 0.0)).clipThis(PATTERN_BOUNDS_CLIP); } else { patternBounds.translateMinThis(Vector2D(-0.005, 0.0)).clipThis(PATTERN_BOUNDS_CLIP); } } break; case gluit::KeyEvent::KEY_DOWN: if (e.hasAltModifier()) { if (rows > 0) { rows -= 1; } } else { if (e.hasShiftModifier()) { patternBounds.translateMaxThis(Vector2D(0.0, 0.005)).clipThis(PATTERN_BOUNDS_CLIP); } else { patternBounds.translateMinThis(Vector2D(0.0, 0.005)).clipThis(PATTERN_BOUNDS_CLIP); } } break; case gluit::KeyEvent::KEY_UP: if (e.hasAltModifier()) { rows += 1; } else { if (e.hasShiftModifier()) { patternBounds.translateMaxThis(Vector2D(0.0, -0.005)).clipThis(PATTERN_BOUNDS_CLIP); } else { patternBounds.translateMinThis(Vector2D(0.0, -0.005)).clipThis(PATTERN_BOUNDS_CLIP); } } break; } } repaint(); }