29 QPointF line[2],
bool ignoreOnPlane )
const;
31 inline double z()
const {
return d_z; }
34 inline int compare(
double z )
const;
43 bool ignoreOnPlane )
const 48 const int eq1 =
compare( vertex[0].
z() );
49 const int eq2 =
compare( vertex[1].
z() );
50 const int eq3 =
compare( vertex[2].
z() );
65 static const int tab[3][3][3] =
68 { { 0, 0, 8 }, { 0, 2, 5 }, { 7, 6, 9 } },
69 { { 0, 3, 4 }, { 1, 10, 1 }, { 4, 3, 0 } },
70 { { 9, 6, 7 }, { 5, 2, 0 }, { 8, 0, 0 } }
73 const int edgeType = tab[eq1+1][eq2+1][eq3+1];
155 const double h1 = p1.
z() -
d_z;
156 const double h2 = p2.
z() -
d_z;
158 const double x = ( h2 * p1.
x() - h1 * p2.
x() ) / ( h2 - h1 );
159 const double y = ( h2 * p1.
y() - h1 * p2.
y() ) / ( h2 - h1 );
161 return QPointF( x, y );
287 const QRectF &rect,
const QSize &raster,
292 if ( levels.size() == 0 || !rect.isValid() || !raster.isValid() )
295 const double dx = rect.width() / raster.width();
296 const double dy = rect.height() / raster.height();
298 const bool ignoreOnPlane =
302 bool ignoreOutOfRange =
false;
309 for (
int y = 0; y < raster.height() - 1; y++ )
325 for (
int x = 0; x < raster.width() - 1; x++ )
327 const QPointF pos( rect.x() + x * dx, rect.y() + y * dy );
331 xy[TopRight].
setX( pos.x() );
332 xy[TopRight].
setY( pos.y() );
334 value( xy[TopRight].x(), xy[TopRight].y() )
337 xy[BottomRight].
setX( pos.x() );
338 xy[BottomRight].
setY( pos.y() + dy );
339 xy[BottomRight].
setZ(
340 value( xy[BottomRight].x(), xy[BottomRight].y() )
344 xy[TopLeft] = xy[TopRight];
345 xy[BottomLeft] = xy[BottomRight];
347 xy[TopRight].
setX( pos.x() + dx );
348 xy[TopRight].
setY( pos.y() );
349 xy[BottomRight].
setX( pos.x() + dx );
350 xy[BottomRight].
setY( pos.y() + dy );
353 value( xy[TopRight].x(), xy[TopRight].y() )
355 xy[BottomRight].
setZ(
356 value( xy[BottomRight].x(), xy[BottomRight].y() )
359 double zMin = xy[TopLeft].
z();
363 for (
int i = TopRight; i <= BottomLeft; i++ )
365 const double z = xy[i].
z();
374 if ( qIsNaN( zSum ) )
380 if ( ignoreOutOfRange )
386 if ( zMax < levels[0] ||
387 zMin > levels[levels.size() - 1] )
392 xy[Center].
setX( pos.x() + 0.5 * dx );
393 xy[Center].
setY( pos.y() + 0.5 * dy );
394 xy[Center].
setZ( 0.25 * zSum );
396 const int numLevels = levels.size();
397 for (
int l = 0; l < numLevels; l++ )
399 const double level = levels[l];
400 if ( level < zMin || level > zMax )
402 QPolygonF &lines = contourLines[level];
408 for (
int m = TopLeft; m < NumPositions; m++ )
412 vertex[2] = xy[m != BottomLeft ? m + 1 : TopLeft];
414 const bool intersects =
415 plane.
intersect( vertex, line, ignoreOnPlane );
virtual void discardRaster()
Discard a raster.
void setY(double y)
Sets the y-coordinate of the point to the value specified by y.
virtual ~QwtRasterData()
Destructor.
virtual QRectF pixelHint(const QRectF &) const
Pixel hint.
int compare(double z) const
bool contains(double value) const
A class representing an interval.
Attribute
Raster data attributes.
void setAttribute(Attribute, bool on=true)
QwtRasterData::Attributes attributes
virtual void initRaster(const QRectF &, const QSize &raster)
Initialize a raster.
Ignore all vertices on the same level.
virtual QwtInterval interval(Qt::Axis) const =0
virtual ContourLines contourLines(const QRectF &rect, const QSize &raster, const QList< double > &levels, ConrecFlags) const
QwtPoint3D class defines a 3D point in double coordinates.
Ignore all values, that are out of range.
void setZ(double y)
Sets the z-coordinate of the point to the value specified by z.
virtual double value(double x, double y) const =0
bool intersect(const QwtPoint3D vertex[3], QPointF line[2], bool ignoreOnPlane) const
QFlags< ConrecFlag > ConrecFlags
Flags to modify the contour algorithm.
bool testAttribute(Attribute) const
QwtRasterData defines an interface to any type of raster data.
QwtRasterData()
Constructor.
void setX(double x)
Sets the x-coordinate of the point to the value specified by x.
QPointF intersection(const QwtPoint3D &p1, const QwtPoint3D &p2) const
QFlags< Attribute > Attributes
Raster data Attributes.