本文整理汇总了C++中QVector::toStdVector方法的典型用法代码示例。如果您正苦于以下问题:C++ QVector::toStdVector方法的具体用法?C++ QVector::toStdVector怎么用?C++ QVector::toStdVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVector
的用法示例。
在下文中一共展示了QVector::toStdVector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBlackBodySpec
Tjcampdx Spectrometer::getBlackBodySpec(double max, double T){
QVector<double> lambda = pixToWavelength(pixNum);
QVector<double> intens;
intens.resize(lambda.size());
for(int i=0;i<lambda.size();i++){
intens[i]=blackBodyIntensNorm(lambda[i]*1e-9,T)*max;
}
Tjcampdx spectrum;
spectrum.LoadData(lambda.toStdVector(),intens.toStdVector());
return spectrum;
}
示例2: plotGuess
void IqtFit::plotGuess(QtProperty *) {
// Do nothing if there is no sample data curve
if (!m_uiForm.ppPlot->hasCurve("Sample"))
return;
CompositeFunction_sptr function = createFunction(true);
// Create the double* array from the input workspace
const size_t binIndxLow =
m_ffInputWS->binIndexOf(m_ffRangeManager->value(m_properties["StartX"]));
const size_t binIndxHigh =
m_ffInputWS->binIndexOf(m_ffRangeManager->value(m_properties["EndX"]));
const size_t nData = binIndxHigh - binIndxLow;
std::vector<double> inputXData(nData);
const Mantid::MantidVec &XValues = m_ffInputWS->readX(0);
const bool isHistogram = m_ffInputWS->isHistogramData();
for (size_t i = 0; i < nData; i++) {
if (isHistogram)
inputXData[i] =
0.5 * (XValues[binIndxLow + i] + XValues[binIndxLow + i + 1]);
else
inputXData[i] = XValues[binIndxLow + i];
}
FunctionDomain1DVector domain(inputXData);
FunctionValues outputData(domain);
function->function(domain, outputData);
QVector<double> dataX;
QVector<double> dataY;
for (size_t i = 0; i < nData; i++) {
dataX.append(inputXData[i]);
dataY.append(outputData.getCalculated(i));
}
IAlgorithm_sptr createWsAlg =
AlgorithmManager::Instance().create("CreateWorkspace");
createWsAlg->initialize();
createWsAlg->setChild(true);
createWsAlg->setLogging(false);
createWsAlg->setProperty("OutputWorkspace", "__GuessAnon");
createWsAlg->setProperty("NSpec", 1);
createWsAlg->setProperty("DataX", dataX.toStdVector());
createWsAlg->setProperty("DataY", dataY.toStdVector());
createWsAlg->execute();
MatrixWorkspace_sptr guessWs = createWsAlg->getProperty("OutputWorkspace");
m_uiForm.ppPlot->addSpectrum("Guess", guessWs, 0, Qt::green);
}
示例3: setSegmentDefinition
void Model::setSegmentDefinition(int id, const QVector<int>& markerIds, const QVector<Pair>& links, const QVector<Triad>& faces)
{
QMap<int,Segment*>::iterator it = this->m_Segments.find(id);
if (it != this->m_Segments.end())
{
(*it)->markerIds = markerIds;
(*it)->links = links;
(*it)->faces = faces;
(*it)->mesh->SetDefinition(markerIds.toStdVector(),links.toStdVector(),faces.toStdVector());
emit segmentDefinitionChanged(id);
}
};
示例4: setAppliedIlluminant
void Viewport::setAppliedIlluminant(QVector<multi_img_base::Value> illum)
{
//bool change = (applied != illuminant_apply);
illuminantAppl = illum.toStdVector();
/* if (change) TODO: I assume this is already triggered by invalidated ROI
rebuild();*/
}
示例5: listNotebooks
bool QvernoteStorage::listNotebooks(std::vector<Notebook>& notebookList)
{
QVector<Notebook> qNotebooklist;
QNotebook::loadList(getDB(), qNotebooklist);
notebookList = qNotebooklist.toStdVector();
return true;
}
示例6: listTagsByNotebook
bool QvernoteStorage::listTagsByNotebook(std::vector<Tag>& tagList, Guid notebookGuid)
{
QVector<Tag> qTaglist;
QTag::loadForNotebook(getDB(), notebookGuid, qTaglist);
tagList = qTaglist.toStdVector();
return true;
}
示例7: locker
bool
EditableDenseThreeDimensionalModel::shouldUseLogValueScale() const
{
QReadLocker locker(&m_lock);
QVector<float> sample;
QVector<int> n;
for (int i = 0; i < 10; ++i) {
size_t index = i * 10;
if (index < m_data.size()) {
const Column &c = m_data.at(index);
while (c.size() > sample.size()) {
sample.push_back(0.f);
n.push_back(0);
}
for (int j = 0; j < c.size(); ++j) {
sample[j] += c.at(j);
++n[j];
}
}
}
if (sample.empty()) return false;
for (int j = 0; j < sample.size(); ++j) {
if (n[j]) sample[j] /= n[j];
}
return LogRange::useLogScale(sample.toStdVector());
}
示例8: getFavoriteNotes
bool QvernoteStorage::getFavoriteNotes(vector<Note>& noteList)
{
QVector<Note> qNoteList;
QNote::getFavorites(getDB(), qNoteList);
noteList = qNoteList.toStdVector();
return true;
}
示例9: actions
vector<QAction*> ToolBarImp::getItems() const
{
QList<QAction*> actionList = actions();
QVector<QAction*> actionVector = actionList.toVector();
vector<QAction*> items = actionVector.toStdVector();
return items;
}
示例10: listTags
bool QvernoteStorage::listTags(vector<Tag>& tagList)
{
QVector<Tag> qTagList;
QTag::loadList(getDB(), qTagList);
tagList = qTagList.toStdVector();
return true;
}
示例11: triangulation
// This test case is based on the example presented on page 725 of the
// paper: "Three dimensional triganulations from local transformations"
// by Barry Joe (Siam J. Sci. Stat. Comput. Vol 10, No 4, 1989).
void DelaunayTriangulationTest::joe89()
{
std::vector<chemkit::Point3> points;
points.push_back(chemkit::Point3(0.054f, 0.099f, 0.993f));
points.push_back(chemkit::Point3(0.066f, 0.756f, 0.910f));
points.push_back(chemkit::Point3(0.076f, 0.578f, 0.408f));
points.push_back(chemkit::Point3(0.081f, 0.036f, 0.954f));
points.push_back(chemkit::Point3(0.082f, 0.600f, 0.726f));
points.push_back(chemkit::Point3(0.085f, 0.327f, 0.731f));
points.push_back(chemkit::Point3(0.123f, 0.666f, 0.842f));
points.push_back(chemkit::Point3(0.161f, 0.303f, 0.975f));
chemkit::DelaunayTriangulation triangulation(points);
QCOMPARE(triangulation.vertexCount(), 8);
QCOMPARE(triangulation.tetrahedronCount(), 13);
QList<QVector<int> > expectedTetrahedra;
expectedTetrahedra.append(QVector<int>() << 0 << 1 << 2 << 4);
expectedTetrahedra.append(QVector<int>() << 0 << 1 << 4 << 5);
expectedTetrahedra.append(QVector<int>() << 0 << 1 << 5 << 7);
expectedTetrahedra.append(QVector<int>() << 0 << 2 << 3 << 5);
expectedTetrahedra.append(QVector<int>() << 0 << 2 << 4 << 5);
expectedTetrahedra.append(QVector<int>() << 0 << 3 << 5 << 7);
expectedTetrahedra.append(QVector<int>() << 1 << 2 << 4 << 6);
expectedTetrahedra.append(QVector<int>() << 1 << 4 << 5 << 7);
expectedTetrahedra.append(QVector<int>() << 1 << 4 << 6 << 7);
expectedTetrahedra.append(QVector<int>() << 2 << 3 << 5 << 7);
expectedTetrahedra.append(QVector<int>() << 2 << 4 << 5 << 6);
expectedTetrahedra.append(QVector<int>() << 2 << 5 << 6 << 7);
expectedTetrahedra.append(QVector<int>() << 4 << 5 << 6 << 7);
std::vector<std::vector<int> > tetrahedra = triangulation.tetrahedra();
QCOMPARE(tetrahedra.size(), size_t(expectedTetrahedra.size()));
for(unsigned int i = 0; i < tetrahedra.size(); i++){
std::vector<int> tetrahedron = tetrahedra[i];
std::sort(tetrahedron.begin(), tetrahedron.end());
int foundCount = 0;
for(int j = 0; j < expectedTetrahedra.size(); j++){
QVector<int> expectedTetrahedron = expectedTetrahedra[j];
if(tetrahedron == expectedTetrahedron.toStdVector()){
foundCount++;
}
}
if(foundCount != 1){
qDebug() << "tetrahedron (index " << i << ") was not found. verticies: " << QVector<int>::fromStdVector(tetrahedron);
}
QCOMPARE(foundCount, 1);
}
}
示例12: getDWT
/********************************************//**
\brief Discrete Wavelet Transform including Daubechies and Biorthogonal
\param array : input array (1D)
\param filter : name of the filter to use (from TransformationType enum)
\param dir : direction (1:forward, -1:backward)
\param transformedArray : resulting transformed array
\param stop : flag indicating if we need to stop the process or not
\param origLength : original Length useful when dir is -1 to cut result
\return boolean true if the execution is finished,
false if the process has been stopped during the execution
***********************************************/
bool FWT::getDWT(const QVector<float>& array,
const TransformationType filter,
const int dir,
QVector<float>& transformedArray,
bool* stop,
const int origLength)
{
std::vector<float> result;
if(filter == DB4_TRANSFORMATION || filter == DB6_TRANSFORMATION || filter == DB8_TRANSFORMATION)
{
if(dir == 1) return fastWaveletTransf(array.toStdVector(), filter, result, stop);
else return iFastWaveletTransf(array.toStdVector(), filter, origLength, result, stop);
}
else if(filter == BIOR_5_3_TRANSFORMATION || filter == BIOR_9_7_TRANSFORMATION)
{
return perform_wavelet_transform(array.toStdVector(), filter, dir, origLength, result, stop);
}
transformedArray.fromStdVector(result);
return true;
}
示例13: execute_line
void NScriptEngine::execute_line( const QString & line , int fragment_number, QVector<int> break_points){
if (connected){
const common::URI script_engine_path("//Tools/Python/ScriptEngine", common::URI::Scheme::CPATH);
SignalOptions options;
QString repl=QString(line);
repl.replace(QString("\t"),QString(";"));
repl.replace(QString("\n"),QString("?"));
options.add("script", repl.toStdString());
options.add("fragment",fragment_number);
options.add("breakpoints",break_points.toStdVector());
SignalFrame frame = options.create_frame("execute_script", uri(), script_engine_path);
NetworkQueue::global()->send( frame, NetworkQueue::IMMEDIATE );
}
}
示例14: setData
bool DefectsModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
if (index.isValid() && role == Qt::EditRole) {
switch (index.column()) {
case (0):
defectsList[index.row()].centre.x = value.toDouble();
break;
case (1):
defectsList[index.row()].centre.y = value.toDouble();
break;
case (2):
defectsList[index.row()].radius = value.toDouble();
break;
case (3): {
QString s = value.toString().replace("[", "").replace("]", "").trimmed();
QStringList sl = s.split(",");
QVector<double> vec;
for (int i = 0; i < sl.size(); ++i) {
vec << sl.at(i).toDouble();
}
GeneralComponentSystem g = GeneralComponentSystem(vec.toStdVector());
defectsList[index.row()].value.resize(g.components.size());
defectsList[index.row()].value = g;
break;
}
case (4):
defectsList[index.row()].boundaryCondition
= static_cast<BoundaryCondition>(value.toInt());
break;
}
emit dataChanged(index, index);
return true;
}
return false;
}
示例15: SignalSource
Aquila::SignalSource * procHighpassFilter(Aquila::SignalSource * source)
{
QVector<Aquila::SampleType> data;
const int step = 16;
int size = source->getSamplesCount();
for (int i=0; i<size; i++)
{
double res = 0.0;
for(int j=0; j<step; j++){
if(i-j < 0) res += source->sample(0);
else res += source->sample(i-j);
if(i+j >= size) res += source->sample(size-1);
else res += source->sample(i+j);
}
Aquila::SampleType val = source->sample(i) - (res / (step * 2));
if(val > 32767.0)
val = 32767.0;
if(val< -32767.0)
val =-32767.0;
data.append(val);
}
return new Aquila::SignalSource(data.toStdVector(), source->getSampleFrequency());
}