/** * \brief Find out whether a rectangle is contained in the rectangle * defined by a size ojbect. */ bool ImageSize::bounds(const ImageRectangle& rect) const { if (!bounds(rect.origin())) { debug(LOG_DEBUG, DEBUG_LOG, 0, "origin outside"); return false; } return bounds(ImagePoint(rect.origin().x() + rect.size().width() - 1, rect.origin().y() + rect.size().height() - 1)); }
void ImageRectangleTest::testAccessors() { debug(LOG_DEBUG, DEBUG_LOG, 0, "testAccessors() begin"); CPPUNIT_ASSERT(r1->size() == *s1); CPPUNIT_ASSERT(r2->size() == *s2); CPPUNIT_ASSERT(r3->size() == *s1); CPPUNIT_ASSERT(r4->size() == *s2); CPPUNIT_ASSERT(r1->origin() == *p1); CPPUNIT_ASSERT(r2->origin() == *p1); CPPUNIT_ASSERT(r3->origin() == *p2); CPPUNIT_ASSERT(r4->origin() == *p2); debug(LOG_DEBUG, DEBUG_LOG, 0, "testAccessors() end"); }
void ImageRectangleTest::testSubrectangle() { debug(LOG_DEBUG, DEBUG_LOG, 0, "testSubrectangle() begin"); ImageRectangle r(*r2, *r1); CPPUNIT_ASSERT(r.size() == r1->size()); CPPUNIT_ASSERT(r.origin() == ImagePoint(6, 10)); debug(LOG_DEBUG, DEBUG_LOG, 0, "testSubrectangle() end"); }
void ImageRectangleTest::testTranslation() { debug(LOG_DEBUG, DEBUG_LOG, 0, "testTranslation() begin"); ImageRectangle r(*r1, ImagePoint(17, 4)); CPPUNIT_ASSERT(r.size() == r1->size()); CPPUNIT_ASSERT(r.origin() == ImagePoint(20, 9)); debug(LOG_DEBUG, DEBUG_LOG, 0, "testTranslation() end"); }
/** * \brief Set the CCD */ void ExposureWidget::setCcd(CcdPtr _ccd) { debug(LOG_DEBUG, DEBUG_LOG, 0, "initializing CCD properties"); // remember the CCD (there might be some information we want to read // from it later) ccd = _ccd; // read the binning modes and add the options to the combo box const BinningSet& set = ccd->getInfo().modes(); std::set<Binning>::const_iterator bi; for (bi = set.begin(); bi != set.end(); bi++) { ui->binningComboBox->addItem(QString(bi->toString().c_str())); } // set the frame size ImageRectangle frame = ccd->getInfo().getFrame(); ui->originxField->setText(QString().setNum(frame.origin().x())); ui->originyField->setText(QString().setNum(frame.origin().y())); ui->widthField->setText(QString().setNum(frame.size().width())); ui->heightField->setText(QString().setNum(frame.size().height())); // if the ccd has no shutter, disable it ui->shutterLabel->setEnabled(ccd->hasShutter()); ui->shutterComboBox->setEnabled(ccd->hasShutter()); // if the ccd has a gain setting, configureit if (ccd->hasGain()) { debug(LOG_DEBUG, DEBUG_LOG, 0, "camera has gain control"); ui->gainLabel->setEnabled(true); ui->gainSlider->setEnabled(true); std::pair<float, float> gaininterval = ccd->gainInterval(); mingain = gaininterval.first; maxgain = gaininterval.second; debug(LOG_DEBUG, DEBUG_LOG, 0, "gain interval: [%f,%f]", mingain, maxgain); gainunit = (maxgain - mingain) / 100.; } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "camera has no gain control"); } }
ImageRectangle operator/(const ImageRectangle& rect, const Binning& binning) { return ImageRectangle(rect.origin() / binning, rect.size() / binning); }