本文整理汇总了C++中AMDataSource类的典型用法代码示例。如果您正苦于以下问题:C++ AMDataSource类的具体用法?C++ AMDataSource怎么用?C++ AMDataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AMDataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPointF
void AM4DBinningABEditor::placeRangeRectangle()
{
AMDataSource* inputSource;
if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) {
int sumAxis = analysisBlock_->sumAxis();
double dataMin = inputSource->axisValue(sumAxis,0);
double sumMin = inputSource->axisValue(sumAxis, analysisBlock_->sumRangeMin());
double sumMax = inputSource->axisValue(sumAxis, analysisBlock_->sumRangeMax());
double dataMax = inputSource->axisValue(sumAxis, inputSource->size(sumAxis)-1);
rangeRectangle1_->setYAxisTarget(plot_->axisScaleVerticalRelative()); // note: does nothing if already correct
rangeRectangle2_->setYAxisTarget(plot_->axisScaleVerticalRelative()); // note: does nothing if already correct
rangeRectangle1_->setXAxisTarget(plot_->axisScaleBottom()); // note: does nothing if already correct
rangeRectangle2_->setXAxisTarget(plot_->axisScaleBottom()); // note: does nothing if already correct
rangeRectangle1_->setRect(QRectF(QPointF(dataMin,0), QPointF(sumMin,1)).normalized());
rangeRectangle2_->setRect(QRectF(QPointF(sumMax,0), QPointF(dataMax,1)).normalized());
rangeRectangle1_->setVisible(true);
rangeRectangle2_->setVisible(true);
}
else {
rangeRectangle1_->setVisible(false);
rangeRectangle2_->setVisible(false);
}
}
示例2: inputDataSourceAt
void AMAnalysisBlock::onInputSourceDeleted(void* deletedSource) {
// this implementation is just like calling setInputDataSources() with an empty list, except we don't want to call deregisterObserver() on the deleted input source. (In a single-threaded situation, this would be okay, but if the deleted() signal came through a queued signal-slot connection, then that object might already be deleted)
for(int i=0; i<inputDataSourceCount(); i++) {
AMDataSource* oldSource = inputDataSourceAt(i);
if(oldSource != deletedSource) {
disconnect(oldSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*)));
oldSource->deregisterObserver(this);
}
}
示例3: onDataSourceDescriptionChanged
void AMDataSourcesEditor::onDataSourceDescriptionChanged()
{
QModelIndex index = scanSetView_->currentIndex();
AMDataSource *dataSource = model_->dataSourceAt(index.parent().row(), index.row());
if (dataSource){
descriptionEdit_->setText(dataSource->description());
scanSetView_->update(index);
}
}
示例4: MPlotImageBasic
void AM2DSummingABEditor::onAnalysisBlockInputDataSourcesChanged() {
if(image_) {
delete image_;
image_ = 0;
}
AMDataSource* inputSource;
if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) {
// inputSource is a valid data source
axisSelector_->setEnabled(false);
rangeMinControl_->setEnabled(true);
rangeMaxControl_->setEnabled(true);
QList<AMAxisInfo> inputSourceAxes = inputSource->axes();
// we know (according to AM2DSummingAB's check of input source validity) that there are two axes here.
axisSelector_->setItemText(0, inputSourceAxes.at(0).name + ": " + inputSourceAxes.at(0).description);
axisSelector_->setItemText(1, inputSourceAxes.at(1).name + ": " + inputSourceAxes.at(1).description);
// set the current status of the controls to reflect the (but don't have then trigger our slots)
int sumAxis = analysisBlock_->sumAxis();
axisSelector_->blockSignals(true);
axisSelector_->setCurrentIndex(sumAxis);
axisSelector_->blockSignals(false);
rangeMinControl_->blockSignals(true);
rangeMinControl_->setMaximum(inputSourceAxes.at(sumAxis).size-1);
rangeMinControl_->setValue(analysisBlock_->sumRangeMin());
rangeMinControl_->blockSignals(false);
rangeMaxControl_->blockSignals(true);
rangeMaxControl_->setMaximum(inputSourceAxes.at(sumAxis).size-1);
rangeMaxControl_->setValue(analysisBlock_->sumRangeMax());
rangeMaxControl_->blockSignals(false);
image_ = new MPlotImageBasic();
AMDataSourceImageData *model = new AMDataSourceImageData;
model->setDataSource(inputSource);
image_->setModel(model, true);
plot_->addItem(image_);
}
else {
// no input source. Not much we can do.
axisSelector_->setEnabled(false);
rangeMinControl_->setEnabled(false);
rangeMaxControl_->setEnabled(false);
}
placeRangeRectangle();
}
示例5:
void AM4DBinningABEditor::populateComboBox()
{
AMDataSource *tempSource = 0;
for (int i = 0; i < analysisBlock_->inputDataSourceCount(); i++){
tempSource = analysisBlock_->inputDataSourceAt(i);
if (analysisBlock_->name() != tempSource->name())
names_->addItem(tempSource->description(), tempSource->name());
}
}
示例6:
void AM1DBasicIntegralABEditor::populateComboBox()
{
AMDataSource *tempSource = 0;
for (int i = 0; i < analysisBlock_->inputDataSourceCount(); i++) {
tempSource = analysisBlock_->inputDataSourceAt(i);
if (analysisBlock_->name() != tempSource->name() && !tempSource->hiddenFromUsers())
names_->addItem(tempSource->description(), tempSource->name());
}
}
示例7: QString
void AMDataSourcesEditor::onCloseButtonClicked(const QModelIndex &index) {
// handle data source-level indexes only:
if(!index.parent().isValid())
return;
int dataSourceIndex = index.row();
int scanIndex = index.parent().row();
AMScan* scan = model_->scanAt(scanIndex);
if(!scan || dataSourceIndex >= scan->dataSourceCount())
return;
if (dataSourceIndex < scan->rawDataSourceCount()){
QMessageBox::warning(this, "Can not remove raw data sources.", QString("Acquaman does not allow the deletion of raw data sources."));
return;
}
AMDataSource* dataSource = scan->dataSourceAt(dataSourceIndex);
int response = QMessageBox::question(this, "Remove Data Source?", QString("Remove this data source? \n\n'%1' (%2)\n\nThe data source will be deleted, and no longer visible in any plots. Any other data sources that depend on this data source will be reset. Raw data will NOT be deleted, and you can re-create the data source later if you need it.").arg(dataSource->description()).arg(dataSource->name()), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
if(response == QMessageBox::Ok)
scan->deleteDataSourceAt(dataSourceIndex);
}
示例8: populateComboBox
void AMOrderReductionABEditor::populateComboBox()
{
AMDataSource *source = 0;
for (int i = 0, size = analysisBlock_->inputDataSourceCount(); i < size; i++){
source = analysisBlock_->inputDataSourceAt(i);
if (analysisBlock_->name() != source->name())
sourceNames_->addItem(source->description(), source->name());
}
if (analysisBlock_->rank() != 0){
for (int i = 0, size = analysisBlock_->currentInputSource()->rank(); i < size; i++)
reducedAxisOptions_->insertItem(i, analysisBlock_->currentInputSource()->axisInfoAt(i).description, i);
}
}
示例9: switch
void AMExternalScanDataSourceAB::copyValues(int dataSourceIndex)
{
AMDataSource* ds = scan_->dataSourceAt(dataSourceIndex);
const AMnDIndex size = ds->size();
switch(ds->rank()) {
case 0:
values_.clear();
values_ << ds->value(AMnDIndex());
break;
case 1: {
values_.resize(size.i());
for(int i=0; i<size.i(); i++)
values_[i] = ds->value(i);
break;
}
case 2: {
values_.resize(size.i()*size.j());
for(int i=0; i<size.i(); i++)
for(int j=0; j<size.j(); j++)
values_[i*size.j() + j] = ds->value(AMnDIndex(i,j));
break;
}
case 3: {
values_.resize(size.i()*size.j()*size.k());
for(int i=0; i<size.i(); i++)
for(int j=0; j<size.j(); j++)
for(int k=0; k<size.k(); k++)
values_[i*size.j()*size.k() + j*size.k() + k] = ds->value(AMnDIndex(i,j,k));
break;
}
case 4: {
values_.resize(size.i()*size.j()*size.k()*size.l());
for(int i=0; i<size.i(); i++)
for(int j=0; j<size.j(); j++)
for(int k=0; k<size.k(); k++)
for(int l=0; l<size.l(); l++)
values_[i*size.j()*size.k()*size.l() + j*size.k()*size.l() + k*size.l() + l] = ds->value(AMnDIndex(i,j,k,l));
break;
}
case 5: {
values_.resize(size.i()*size.j()*size.k()*size.l()*size.m());
for(int i=0; i<size.i(); i++)
for(int j=0; j<size.j(); j++)
for(int k=0; k<size.k(); k++)
for(int l=0; l<size.l(); l++)
for(int m=0; m<size.m(); m++)
values_[i*size.j()*size.k()*size.l()*size.m() + j*size.k()*size.l()*size.m() + k*size.l()*size.m() + l*size.m() + m] = ds->value(AMnDIndex(i,j,k,l,m));
/// \todo oh god, we really need a block copy or a multi-dimensional iterator for AMDataSource::value()...
break;
}
}
}
示例10: removeDetailEditor
void AMDataSourcesEditor::onSetViewIndexChanged(const QModelIndex &selected, const QModelIndex &deselected) {
removeDetailEditor();
// Nothing selected?
////////////////////////
if(!selected.isValid()) {
nameEdit_->clear();
descriptionEdit_->clear();
descriptionEdit_->setReadOnly(true);
addDataSourceButton_->setDisabled(true);
return;
}
addDataSourceButton_->setEnabled(true);
// Scan selected? (No selected data source)
/////////////////////////
if(!selected.parent().isValid()) {
nameEdit_->clear();
descriptionEdit_->clear();
descriptionEdit_->setReadOnly(true);
return;
}
// Data source selected.
/////////////////
// Remove old connection to the data source description.
int oldSi = deselected.parent().row();
int oldDi = deselected.row();
AMDataSource *oldDataSource = model_->dataSourceAt(oldSi, oldDi);
if (oldDataSource)
disconnect(oldDataSource->signalSource(), SIGNAL(infoChanged()), this, SLOT(onDataSourceDescriptionChanged()));
// Setup new data source.
int si = selected.parent().row();
int di = selected.row();
AMDataSource* dataSource = model_->dataSourceAt(si, di);
if(!dataSource)
return;
connect(dataSource->signalSource(), SIGNAL(infoChanged()), this, SLOT(onDataSourceDescriptionChanged()));
nameEdit_->setText(dataSource->name());
descriptionEdit_->setText(dataSource->description());
descriptionEdit_->setReadOnly(false);
installDetailEditor(dataSource->createEditorWidget());
// Set the new selected data source as the exclusive view preference.
model_->setExclusiveDataSourceByName(dataSource->name());
}
示例11:
// responds to GUI events
void AM2DSummingABEditor::onSumAxisControlChanged(int newSumAxis) {
if(newSumAxis == analysisBlock_->sumAxis())
return;
// adjust the maximums for the ranges
AMDataSource* inputSource;
if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) {
int newRangeMax = inputSource->size(newSumAxis)-1;
rangeMinControl_->setMaximum(newRangeMax);
rangeMaxControl_->setMaximum(newRangeMax);
}
analysisBlock_->setSumAxis(newSumAxis);
placeRangeRectangle();
}
示例12: copyAxisValues
void AMExternalScanDataSourceAB::copyAxisValues(int dataSourceIndex)
{
AMDataSource* ds = scan_->dataSourceAt(dataSourceIndex);
const AMnDIndex size = ds->size();
axisValues_.clear();
for(int mu=0; mu<size.rank(); mu++) { // for each axis
QVector<AMNumber> av;
if(!axes_.at(mu).isUniform) {
int axisLength = size.at(mu);
for(int i=0; i<axisLength; i++) // copy all the axis values
av << axisValue(mu, i);
}
axisValues_ << av;
}
}
示例13: QString
bool AMAnalysisBlock::setInputDataSources(const QList<AMDataSource*>& dataSources) {
// if a non-empty set of data sources has been provided, and they are not acceptable, return false. (An empty list must always be acceptable)
if(!dataSources.isEmpty() && !areInputDataSourcesAcceptable(dataSources)) {
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -98, QString("There was an error connecting the input data sources to this analysis component '%1: %2'. The data sources provided weren't acceptable. This can happen if they have the wrong dimension, don't provide enough data, etc.").arg(name()).arg(description())));
return false;
}
for(int i=0; i<inputDataSourceCount(); i++) {
AMDataSource* oldSource = inputDataSourceAt(i);
disconnect(oldSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*)));
oldSource->deregisterObserver(this);
}
for(int i=0; i<dataSources.count(); i++) {
AMDataSource* newSource = dataSources.at(i);
connect(newSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*)));
dataSources.at(i)->registerObserver(this);
}
setInputDataSourcesImplementation(dataSources);
emit inputSourcesChanged();
return true;
}
示例14:
void AM3DNormalizationABEditor::populateComboBox()
{
AMDataSource *tempSource = 0;
int inputCount = analysisBlock_->inputDataSourceCount();
for (int i = 0; i < inputCount; i++){
tempSource = analysisBlock_->inputDataSourceAt(i);
if (analysisBlock_->name() != tempSource->name()){
dataNames_->addItem(tempSource->description(), tempSource->name());
normalizationNames_->addItem(tempSource->description(), tempSource->name());
}
}
}
示例15: QString
void REIXSAppController::onScanAddedToEditor(AMGenericScanEditor *editor, AMScan *scan)
{
QString exclusiveName = QString();
for (int i = 0, count = scan->analyzedDataSourceCount(); i < count && exclusiveName.isNull(); i++){
AMDataSource *source = scan->analyzedDataSources()->at(i);
if (source->name().contains("TEYNorm") && !source->hiddenFromUsers())
exclusiveName = source->name();
if (source->name().contains("xesSpectrum") && !source->hiddenFromUsers())
exclusiveName = source->name();
}
if (!exclusiveName.isNull())
editor->setExclusiveDataSourceByName(exclusiveName);
else if (editor->scanAt(0)->analyzedDataSourceCount())
editor->setExclusiveDataSourceByName(editor->scanAt(0)->analyzedDataSources()->at(editor->scanAt(0)->analyzedDataSourceCount()-1)->name());
}