예제 #1
0
void XRFFreeRun::onRoisHaveValues()
{
	/// \note To fix my current problem with ROIs updating when they shouldn't, I might just need to disconnect ALL the signals to the detector.  Worth a try anyway.
	disconnect(xrfTable_, SIGNAL(addedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(addRegionOfInterest(XRFElement*,QString)));
	disconnect(xrfTable_, SIGNAL(removedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(removeRegionOfInterest(XRFElement*,QString)));
	disconnect(detector_, SIGNAL(externalRegionsOfInterestChanged()), this, SLOT(onExternalRegionsOfInterestChanged()));
	disconnect(xrfTable_, SIGNAL(removedAllRegionsOfInterest()), detector_, SLOT(clearRegionsOfInterest()));

	XRFElement *current = xrfTable_->currentElement();
	xrfTable_->removeAll();

	// Go through all the regions of interest PVs and if there are any regions set already, pass them on to the rest of the program.
	QString name;

	for (int i = 0; i < detector_->roiList().count(); i++){

		name = detector_->roiList().at(i)->name();

		// If the name is empty then we've reached the end of the road for preset regions of interest.
		if (name.isEmpty()){

			if (current)
				xrfTable_->setCurrentElement(current);
			else
				xrfTable_->setCurrentElement(xrfTable_->elementBySymbol("Fe"));

			connect(xrfTable_, SIGNAL(addedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(addRegionOfInterest(XRFElement*,QString)));
			connect(xrfTable_, SIGNAL(removedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(removeRegionOfInterest(XRFElement*,QString)));
			connect(detector_, SIGNAL(externalRegionsOfInterestChanged()), this, SLOT(onExternalRegionsOfInterestChanged()));
			connect(xrfTable_, SIGNAL(removedAllRegionsOfInterest()), detector_, SLOT(clearRegionsOfInterest()));

			return;
		}

		addRegionOfInterestToTable(name);
	}
}
예제 #2
0
XRFFreeRun::XRFFreeRun(XRFDetector *detector, QObject *parent)
	: QObject(parent)
{
	detector_ = detector;
	config_ = new VESPERSXRFScanConfiguration(detector_->toXRFInfo());
	xrfTable_ = new XRFPeriodicTable(AMPeriodicTable::table()->elementBySymbol("K")->Kalpha().second.toDouble(), detector_->maximumEnergy(), this);
	xrfTable_->setCurrentElement(xrfTable_->elementBySymbol("Fe"));

	connect(xrfTable_, SIGNAL(addedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(addRegionOfInterest(XRFElement*,QString)));
	connect(xrfTable_, SIGNAL(removedRegionOfInterest(XRFElement*,QString)), detector_, SLOT(removeRegionOfInterest(XRFElement*,QString)));
	// Cleans up anything that might have been missed.
	connect(xrfTable_, SIGNAL(removedAllRegionsOfInterest()), detector_, SLOT(clearRegionsOfInterest()));

	connect(detector_, SIGNAL(roisHaveValues()), this, SLOT(onRoisHaveValues()));
}
예제 #3
0
void XRFPeriodicTable::removeAll()
{
	// Don't do anything if current isn't valid.
	if (current_ == 0)
		return;

	// Save current element.
	XRFElement *current = current_;

	while (!selectedElements_.isEmpty()){

		current_ = selectedElements_.first();

		while (current_->hasLinesSelected())
			current_->removeLine(current_->linesSelected().first());

		selectedElements_.removeFirst();
	}

	// Used to notify that the old current element information may have changed.
	emit currentElementChanged(current);
	emit removedAllRegionsOfInterest();
}