本文整理汇总了C++中AMDataSource::values方法的典型用法代码示例。如果您正苦于以下问题:C++ AMDataSource::values方法的具体用法?C++ AMDataSource::values怎么用?C++ AMDataSource::values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMDataSource
的用法示例。
在下文中一共展示了AMDataSource::values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out
bool AMExporter2DAscii::writeSeparateFiles(const QString &destinationFolderPath)
{
if (option_->higherDimensionsInRows()){
for (int s = 0, sSize = separateFileDataSources_.size(); s < sSize; s++) {
setCurrentDataSource(separateFileDataSources_.at(s)); // sets currentDataSourceIndex_
AMDataSource* source = currentScan_->dataSourceAt(currentDataSourceIndex_);
QFile output;
QString separateFileName = parseKeywordString( destinationFolderPath % "/" % option_->separateSectionFileName() );
separateFileName = removeNonPrintableCharacters(separateFileName);
if(!openFile(&output, separateFileName)) {
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -4, "Export failed (partially): You selected to create separate files for certain data sets. Could not open the file '" % separateFileName % "' for writing. Check that you have permission to save files there, and that a file with that name doesn't already exists."));
return false;
}
int spectraSize = source->size(2);
QString columnDelimiter = option_->columnDelimiter();
QString newLineDelimiter = option_->newlineDelimiter();
QTextStream out(&output);
int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1);
int xRange = currentScan_->scanSize(0);
for (int y = 0; y < yRange; y++){
for (int x = 0; x < xRange; x++){
QVector<double> data(spectraSize);
source->values(AMnDIndex(x, y, 0), AMnDIndex(x, y, spectraSize-1), data.data());
for (int i = 0; i < spectraSize; i++)
out << data.at(i) << columnDelimiter;
out << newLineDelimiter;
}
}
if (yRange_ != -1 && xIndex_ != -1){
for (int i = 0; i < xIndex_; i++){
QVector<double> data(spectraSize);
source->values(AMnDIndex(i, yRange_-1, 0), AMnDIndex(i, yRange_-1, spectraSize-1), data.data());
for (int i = 0; i < spectraSize; i++)
out << data.at(i) << columnDelimiter;
out << newLineDelimiter;
}
out << newLineDelimiter;
}
output.close();
}
}
else{
for (int s = 0, sSize = separateFileDataSources_.size(); s < sSize; s++) {
setCurrentDataSource(separateFileDataSources_.at(s)); // sets currentDataSourceIndex_
AMDataSource* source = currentScan_->dataSourceAt(currentDataSourceIndex_);
QFile output;
QString separateFileName = parseKeywordString( destinationFolderPath % "/" % option_->separateSectionFileName() );
separateFileName = removeNonPrintableCharacters(separateFileName);
if(!openFile(&output, separateFileName)) {
AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -4, "Export failed (partially): You selected to create separate files for certain data sets. Could not open the file '" % separateFileName % "' for writing. Check that you have permission to save files there, and that a file with that name doesn't already exists."));
return false;
}
int spectraSize = source->size(2);
QString columnDelimiter = option_->columnDelimiter();
QString newLineDelimiter = option_->newlineDelimiter();
QTextStream out(&output);
int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1);
int xRange = currentScan_->scanSize(0);
for (int i = 0; i < spectraSize; i++){
for (int y = 0; y < yRange; y++)
for (int x = 0; x < xRange; x++)
out << double(source->value(AMnDIndex(x, y, i))) << columnDelimiter;
if (yRange_ != -1 && xIndex_ != -1){
for (int x = 0; x < xIndex_; x++)
out << double(source->value(AMnDIndex(x, yRange_-1, i))) << columnDelimiter;
}
out << newLineDelimiter;
}
output.close();
}
}
//.........这里部分代码省略.........
示例2: xAxis
void AM4DBinningABEditor::updateSeriesData()
{
AMDataSource *source = analysisBlock_->inputDataSourceAt(0);
if (source){
int sumAxis = analysisBlock_->sumAxis();
int sumAxisSize = source->size(sumAxis);
QVector<double> xAxis(sumAxisSize);
QVector<double> yAxis(sumAxisSize, 0);
for (int i = 0; i < sumAxisSize; i++)
xAxis[i] = double(source->axisValue(sumAxis, i));
switch (sumAxis){
case 0:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(0, i, j, k), AMnDIndex(sumAxisSize-1, i, j, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 1:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, 0, j, k), AMnDIndex(i, sumAxisSize-1, j, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 2:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, j, 0, k), AMnDIndex(i, j, sumAxisSize-1, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 3:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, j, k, 0), AMnDIndex(i, j, k, sumAxisSize-1), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
}
seriesData_->setValues(xAxis, yAxis);
}
}