本文整理汇总了C++中QwtDoubleInterval::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleInterval::contains方法的具体用法?C++ QwtDoubleInterval::contains怎么用?C++ QwtDoubleInterval::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleInterval
的用法示例。
在下文中一共展示了QwtDoubleInterval::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateLevel
void ColorMapEditor::validateLevel(int row, int col)
{
if (col)
return;
if (row == 0 || row == table->rowCount() - 1)
{
QMessageBox::critical(this, tr("Input Error"), tr("Sorry, you cannot edit this value!"));
table->blockSignals(true);
if (!row)
table->item(0, 0)->setText(QString::number(min_val));
else
table->item(row, 0)->setText(QString::number(max_val));
table->blockSignals(false);
return;
}
bool user_input_error = false;
QString s = table->item(row, 0)->text().remove("-").remove(".").remove(",").remove("+");
if (s.isEmpty() || s.contains(QRegExp("\\D")))
{
QMessageBox::critical(this, tr("Input Error"), tr("Please enter a valid color level value!"));
user_input_error = true;
}
QwtDoubleInterval range = QwtDoubleInterval(min_val, max_val);
double val = table->item(row, 0)->text().replace(",", ".").toDouble();
if (!range.contains (val) || user_input_error)
{
QwtArray<double> colors = color_map.colorStops();
val = min_val + colors[row] * range.width();
table->blockSignals(true);
table->item(row, 0)->setText(QString::number(val));
table->blockSignals(false);
}
}
示例2: contourLines
const QList<double> &levels, int flags) const
#else
QwtRasterData::ContourLines QwtRasterData::contourLines(
const QwtDoubleRect &rect, const QSize &raster,
const QValueList<double> &levels, int flags) const
#endif
{
ContourLines contourLines;
if ( levels.size() == 0 || !rect.isValid() || !raster.isValid() )
return contourLines;
const double dx = rect.width() / raster.width();
const double dy = rect.height() / raster.height();
const bool ignoreOnPlane =
flags & QwtRasterData::IgnoreAllVerticesOnLevel;
const QwtDoubleInterval range = this->range();
bool ignoreOutOfRange = false;
if ( range.isValid() )
ignoreOutOfRange = flags & IgnoreOutOfRange;
((QwtRasterData*)this)->initRaster(rect, raster);
for ( int y = 0; y < raster.height() - 1; y++ )
{
enum Position
{
Center,
TopLeft,
TopRight,
BottomRight,
BottomLeft,
NumPositions
};
Contour3DPoint xy[NumPositions];
for ( int x = 0; x < raster.width() - 1; x++ )
{
const QwtDoublePoint pos(rect.x() + x * dx, rect.y() + y * dy);
if ( x == 0 )
{
xy[TopRight].setPos(pos.x(), pos.y());
xy[TopRight].setZ(
value( xy[TopRight].x(), xy[TopRight].y())
);
xy[BottomRight].setPos(pos.x(), pos.y() + dy);
xy[BottomRight].setZ(
value(xy[BottomRight].x(), xy[BottomRight].y())
);
}
xy[TopLeft] = xy[TopRight];
xy[BottomLeft] = xy[BottomRight];
xy[TopRight].setPos(pos.x() + dx, pos.y());
xy[BottomRight].setPos(pos.x() + dx, pos.y() + dy);
xy[TopRight].setZ(
value(xy[TopRight].x(), xy[TopRight].y())
);
xy[BottomRight].setZ(
value(xy[BottomRight].x(), xy[BottomRight].y())
);
double zMin = xy[TopLeft].z();
double zMax = zMin;
double zSum = zMin;
for ( int i = TopRight; i <= BottomLeft; i++ )
{
const double z = xy[i].z();
zSum += z;
if ( z < zMin )
zMin = z;
if ( z > zMax )
zMax = z;
}
if ( ignoreOutOfRange )
{
if ( !range.contains(zMin) || !range.contains(zMax) )
continue;
}
if ( zMax < levels[0] ||
zMin > levels[levels.size() - 1] )
{
continue;
}
xy[Center].setPos(pos.x() + 0.5 * dx, pos.y() + 0.5 * dy);
xy[Center].setZ(0.25 * zSum);
//.........这里部分代码省略.........