本文整理汇总了C++中qstringlist::iterator::toDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::toDouble方法的具体用法?C++ iterator::toDouble怎么用?C++ iterator::toDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::iterator
的用法示例。
在下文中一共展示了iterator::toDouble方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadRow
bool FormattedTouchstone::ReadRow(FormattedNetworkData &network, QTextStream &snpFile, FormattedComplexMatrix2D &dataRow, double &frequencyPoint) {
// Begin to read data values
double wordsToRead = pow(double(network.numberOfPorts()), 2) * 2 + 1;
QStringList allWords;
while (wordsToRead > 0 && !snpFile.atEnd()) {
QStringList words;
ReadLine(snpFile, words);
wordsToRead -= words.size();
allWords.append(words);
}
// Check to see if all data was read
if (wordsToRead != 0)
return false;
// Process data
frequencyPoint = allWords[0].toDouble();
QStringList::iterator wordIndex = allWords.begin() + 1;
dataRow.resize(network.numberOfPorts());
for (FormattedComplexMatrix2D::iterator rowIndex = dataRow.begin(); rowIndex != dataRow.end(); rowIndex++) {
(*rowIndex).resize(network.numberOfPorts());
FormattedComplexRowVector::iterator columnIndex = (*rowIndex).begin();
for (; columnIndex != (*rowIndex).end(); columnIndex++) {
*columnIndex = (*ReadDatum)(wordIndex->toDouble(), (wordIndex + 1)->toDouble());
wordIndex += 2;
}
}
return true;
}
示例2: if
//.........这里部分代码省略.........
QgsDebugMsg( "Found y field: " + ( *it ) );
mYFieldIndex = fieldPos;
}
QgsDebugMsg( "Adding field: " + ( *it ) );
// assume that the field could be integer or double
couldBeInt.insert( fieldPos, true );
couldBeDouble.insert( fieldPos, true );
fieldPos++;
}
}
QgsDebugMsg( "Field count for the delimited text file is " + QString::number( attributeFields.size() ) );
hasFields = true;
}
else if ( mXFieldIndex != -1 && mYFieldIndex != -1 )
{
mNumberFeatures++;
// split the line on the delimiter
QStringList parts;
if ( mDelimiterType == "regexp" )
parts = line.split( mDelimiterRegexp );
else
parts = line.split( mDelimiter );
// Skip malformed lines silently. Report line number with nextFeature()
if ( attributeFields.size() != parts.size() )
{
continue;
}
// Get the x and y values, first checking to make sure they
// aren't null.
QString sX = parts[mXFieldIndex];
QString sY = parts[mYFieldIndex];
bool xOk = true;
bool yOk = true;
double x = sX.toDouble( &xOk );
double y = sY.toDouble( &yOk );
if ( xOk && yOk )
{
if ( !firstPoint )
{
mExtent.combineExtentWith( x, y );
}
else
{ // Extent for the first point is just the first point
mExtent.set( x, y, x, y );
firstPoint = false;
}
}
int i = 0;
for ( QStringList::iterator it = parts.begin(); it != parts.end(); ++it, ++i )
{
// try to convert attribute values to integer and double
if ( couldBeInt[i] )
{
it->toInt( &couldBeInt[i] );
}
if ( couldBeDouble[i] )
{
it->toDouble( &couldBeDouble[i] );
}
}
}
}
// now it's time to decide the types for the fields
for ( QgsFieldMap::iterator it = attributeFields.begin(); it != attributeFields.end(); ++it )
{
if ( couldBeInt[it.key()] )
{
it->setType( QVariant::Int );
it->setTypeName( "integer" );
}
else if ( couldBeDouble[it.key()] )
{
it->setType( QVariant::Double );
it->setTypeName( "double" );
}
}
if ( mXFieldIndex != -1 && mYFieldIndex != -1 )
{
QgsDebugMsg( "Data store is valid" );
QgsDebugMsg( "Number of features " + QString::number( mNumberFeatures ) );
QgsDebugMsg( "Extents " + mExtent.toString() );
mValid = true;
}
else
{
QgsDebugMsg( "Data store is invalid. Specified x,y fields do not match those in the database" );
}
QgsDebugMsg( "Done checking validity" );
}