#include <PlotArea.h>
List of all members.
Constructor & Destructor Documentation
: QwtPlotItem( QwtText( "Area" ) )
{
m_type = PlotArea::Rect;
m_brush = QBrush( QColor( 255, 0, 0, 128 ) );
m_xIntervalLowerBound = 0.0;
m_xIntervalUpperBound = 0.0;
m_yIntervalLowerBound = 0.0;
m_yIntervalUpperBound = 0.0;
setZ( 1000 );
}
PlotArea::~PlotArea |
( |
|
) |
[virtual] |
Member Function Documentation
QBrush PlotArea::brush |
( |
|
) |
const [inline] |
Reimplemented from QwtPlotItem.
{
painter->setBrush( m_brush );
painter->setPen( QPen( Qt::NoPen ) );
if ( m_xIntervalLowerBound == 0.0
&& m_xIntervalUpperBound == 0.0
&& m_yIntervalLowerBound == 0.0
&& m_yIntervalUpperBound == 0.0 )
{
return;
}
if ( m_type == PlotArea::Rect )
{
int topLeftX = xMap.transform( m_rect.x() );
int topLeftY = yMap.transform( m_rect.y() );
int bottomRightX = xMap.transform( m_rect.bottomRight().x() );
int bottomRightY = yMap.transform( m_rect.bottomRight().y() );
if ( topLeftX == bottomRightX )
{
bottomRightX += 1;
}
if ( topLeftY == bottomRightY )
{
bottomRightY += 1;
}
QRect rect( topLeftX, topLeftY, bottomRightX - topLeftX, topLeftY - bottomRightY );
QwtPainter::drawRect( painter, rect );
}
else if ( m_type == PlotArea::XInterval )
{
int topLeftX = xMap.transform( m_xIntervalLowerBound );
int bottomRightX = xMap.transform( m_xIntervalUpperBound );
if ( topLeftX == bottomRightX )
{
bottomRightX += 1;
}
QRect rect( topLeftX, canvasRect.y(), bottomRightX - topLeftX, canvasRect.height() );
QwtPainter::drawRect( painter, rect );
}
else if ( m_type == PlotArea::YInterval )
{
int topLeftY = yMap.transform( m_yIntervalLowerBound );
int bottomRightY = yMap.transform( m_yIntervalUpperBound );
if ( topLeftY == bottomRightY )
{
bottomRightY += 1;
}
QRect rect( canvasRect.y(), topLeftY, canvasRect.width(), bottomRightY - topLeftY );
QwtPainter::drawRect( painter, rect );
}
}
QRectF PlotArea::rect |
( |
|
) |
const [inline] |
int PlotArea::rtti |
( |
|
) |
const [virtual] |
Reimplemented from QwtPlotItem.
{
return QwtPlotItem::Rtti_PlotUserItem + 1;
}
void PlotArea::setBrush |
( |
QBrush |
brush |
) |
[inline] |
void PlotArea::setRect |
( |
double |
xLowerBound, |
|
|
double |
yLowerBound, |
|
|
double |
xUpperBound, |
|
|
double |
yUpperBound | |
|
) |
| | |
Referenced by PlotSelector::eventFilter().
{
m_type = PlotArea::Rect;
if ( xLowerBound > xUpperBound )
{
double temp = xLowerBound;
xLowerBound = xUpperBound;
xUpperBound = temp;
}
if ( yLowerBound > yUpperBound )
{
double temp = yLowerBound;
yLowerBound = yUpperBound;
yUpperBound = temp;
}
m_rect = QRectF( xLowerBound, yUpperBound,
xUpperBound - xLowerBound, yUpperBound - yLowerBound );
}
void PlotArea::setXInterval |
( |
double |
lowerBound, |
|
|
double |
upperBound | |
|
) |
| | |
Referenced by PlotSelector::eventFilter().
{
m_type = PlotArea::XInterval;
if ( lowerBound < upperBound )
{
m_xIntervalLowerBound = lowerBound;
m_xIntervalUpperBound = upperBound;
}
else
{
m_xIntervalLowerBound = upperBound;
m_xIntervalUpperBound = lowerBound;
}
}
void PlotArea::setYInterval |
( |
double |
lowerBound, |
|
|
double |
upperBound | |
|
) |
| | |
Referenced by PlotSelector::eventFilter().
{
m_type = PlotArea::YInterval;
if ( lowerBound < upperBound )
{
m_yIntervalLowerBound = lowerBound;
m_yIntervalUpperBound = upperBound;
}
else
{
m_yIntervalLowerBound = upperBound;
m_yIntervalUpperBound = lowerBound;
}
}
Type PlotArea::type |
( |
|
) |
const [inline] |
double PlotArea::xIntervalLowerBound |
( |
|
) |
const [inline] |
double PlotArea::xIntervalUpperBound |
( |
|
) |
const [inline] |
double PlotArea::yIntervalLowerBound |
( |
|
) |
const [inline] |
double PlotArea::yIntervalUpperBound |
( |
|
) |
const [inline] |
The documentation for this class was generated from the following files: