#include <qwt_double_rect.h>
Public Member Functions | |
QwtDoubleSize () | |
Constructs an invalid size. | |
QwtDoubleSize (double width, double height) | |
Constructs a size with width width and height height. | |
QwtDoubleSize (const QSize &) | |
Constructs a size with floating point accuracy from the given size. | |
bool | isNull () const |
bool | isEmpty () const |
bool | isValid () const |
double | width () const |
Returns the width. | |
double | height () const |
Returns the height. | |
void | setWidth (double w) |
Sets the width to width. | |
void | setHeight (double h) |
Sets the height to height. | |
void | transpose () |
Swaps the width and height values. | |
QwtDoubleSize | expandedTo (const QwtDoubleSize &) const |
QwtDoubleSize | boundedTo (const QwtDoubleSize &) const |
bool | operator== (const QwtDoubleSize &) const |
Returns true if s1 and s2 are equal; otherwise returns false. | |
bool | operator!= (const QwtDoubleSize &) const |
Returns true if s1 and s2 are different; otherwise returns false. | |
const QwtDoubleSize | operator+ (const QwtDoubleSize &) const |
const QwtDoubleSize | operator- (const QwtDoubleSize &) const |
const QwtDoubleSize | operator* (double) const |
Returns the size formed by multiplying both components by c. | |
const QwtDoubleSize | operator/ (double) const |
Returns the size formed by dividing both components by c. | |
QwtDoubleSize & | operator+= (const QwtDoubleSize &) |
Adds size other to this size and returns a reference to this size. | |
QwtDoubleSize & | operator-= (const QwtDoubleSize &) |
Subtracts size other from this size and returns a reference to this size. | |
QwtDoubleSize & | operator*= (double c) |
QwtDoubleSize & | operator/= (double c) |
The QwtDoubleSize class defines a size in double coordinates
Definition at line 100 of file qwt_double_rect.h.
QwtDoubleSize::QwtDoubleSize | ( | ) |
Constructs an invalid size.
Definition at line 163 of file qwt_double_rect.cpp.
Referenced by boundedTo(), expandedTo(), operator*(), operator+(), operator-(), and operator/().
: d_width(-1.0), d_height(-1.0) { }
QwtDoubleSize::QwtDoubleSize | ( | double | width, |
double | height | ||
) |
Constructs a size with width width and height height.
Definition at line 170 of file qwt_double_rect.cpp.
QwtDoubleSize::QwtDoubleSize | ( | const QSize & | sz ) |
Constructs a size with floating point accuracy from the given size.
Definition at line 177 of file qwt_double_rect.cpp.
: d_width(double(sz.width())), d_height(double(sz.height())) { }
QwtDoubleSize QwtDoubleSize::boundedTo | ( | const QwtDoubleSize & | other ) | const |
Returns a size with the minimum width and height of this size and other.
Definition at line 207 of file qwt_double_rect.cpp.
References QwtDoubleSize(), and qwtMin.
{ return QwtDoubleSize( qwtMin(d_width, other.d_width), qwtMin(d_height, other.d_height) ); }
QwtDoubleSize QwtDoubleSize::expandedTo | ( | const QwtDoubleSize & | other ) | const |
Returns a size with the maximum width and height of this size and other.
Definition at line 195 of file qwt_double_rect.cpp.
References QwtDoubleSize(), and qwtMax.
Referenced by QwtPlotZoomer::end().
{ return QwtDoubleSize( qwtMax(d_width, other.d_width), qwtMax(d_height, other.d_height) ); }
double QwtDoubleSize::height | ( | ) | const [inline] |
Returns the height.
Definition at line 313 of file qwt_double_rect.h.
Referenced by QwtPlotZoomer::begin(), setHeight(), and QwtDoubleRect::setSize().
{
return d_height;
}
bool QwtDoubleSize::isEmpty | ( | ) | const [inline] |
Returns true if the width is <= 0.0 or the height is <= 0.0, otherwise false.
Definition at line 292 of file qwt_double_rect.h.
{
return d_width <= 0.0 || d_height <= 0.0;
}
bool QwtDoubleSize::isNull | ( | ) | const [inline] |
Returns true if the width is 0 and the height is 0; otherwise returns false.
Definition at line 283 of file qwt_double_rect.h.
{
return d_width == 0.0 && d_height == 0.0;
}
bool QwtDoubleSize::isValid | ( | ) | const [inline] |
Returns true if the width is equal to or greater than 0.0 and the height is equal to or greater than 0.0; otherwise returns false.
Definition at line 301 of file qwt_double_rect.h.
Referenced by QwtPlotZoomer::begin().
{
return d_width >= 0.0 && d_height >= 0.0;
}
bool QwtDoubleSize::operator!= | ( | const QwtDoubleSize & | other ) | const |
Returns true if s1 and s2 are different; otherwise returns false.
Definition at line 223 of file qwt_double_rect.cpp.
References operator==().
{ return !operator==(other); }
const QwtDoubleSize QwtDoubleSize::operator* | ( | double | c ) | const |
Returns the size formed by multiplying both components by c.
Definition at line 251 of file qwt_double_rect.cpp.
References QwtDoubleSize().
{ return QwtDoubleSize(d_width * c, d_height * c); }
QwtDoubleSize & QwtDoubleSize::operator*= | ( | double | c ) |
Definition at line 282 of file qwt_double_rect.cpp.
{ d_width *= c; d_height *= c; return *this; }
const QwtDoubleSize QwtDoubleSize::operator+ | ( | const QwtDoubleSize & | other ) | const |
Returns the size formed by adding both components by the components of other. Each component is added separately.
Definition at line 232 of file qwt_double_rect.cpp.
References QwtDoubleSize().
{ return QwtDoubleSize(d_width + other.d_width, d_height + other.d_height); }
QwtDoubleSize & QwtDoubleSize::operator+= | ( | const QwtDoubleSize & | other ) |
Adds size other to this size and returns a reference to this size.
Definition at line 263 of file qwt_double_rect.cpp.
{ d_width += other.d_width; d_height += other.d_height; return *this; }
const QwtDoubleSize QwtDoubleSize::operator- | ( | const QwtDoubleSize & | other ) | const |
Returns the size formed by subtracting both components by the components of other. Each component is subtracted separately.
Definition at line 243 of file qwt_double_rect.cpp.
References QwtDoubleSize().
{ return QwtDoubleSize(d_width - other.d_width, d_height - other.d_height); }
QwtDoubleSize & QwtDoubleSize::operator-= | ( | const QwtDoubleSize & | other ) |
Subtracts size other from this size and returns a reference to this size.
Definition at line 271 of file qwt_double_rect.cpp.
{ d_width -= other.d_width; d_height -= other.d_height; return *this; }
const QwtDoubleSize QwtDoubleSize::operator/ | ( | double | c ) | const |
Returns the size formed by dividing both components by c.
Definition at line 257 of file qwt_double_rect.cpp.
References QwtDoubleSize().
{ return QwtDoubleSize(d_width / c, d_height / c); }
QwtDoubleSize & QwtDoubleSize::operator/= | ( | double | c ) |
Definition at line 293 of file qwt_double_rect.cpp.
{ d_width /= c; d_height /= c; return *this; }
bool QwtDoubleSize::operator== | ( | const QwtDoubleSize & | other ) | const |
Returns true if s1 and s2 are equal; otherwise returns false.
Definition at line 217 of file qwt_double_rect.cpp.
Referenced by operator!=().
{
return d_width == other.d_width && d_height == other.d_height;
}
void QwtDoubleSize::setHeight | ( | double | h ) | [inline] |
Sets the height to height.
Definition at line 325 of file qwt_double_rect.h.
References height().
{ d_height = height; }
void QwtDoubleSize::setWidth | ( | double | w ) | [inline] |
Sets the width to width.
Definition at line 319 of file qwt_double_rect.h.
References width().
{ d_width = width; }
void QwtDoubleSize::transpose | ( | ) |
Swaps the width and height values.
Definition at line 184 of file qwt_double_rect.cpp.
{
double tmp = d_width;
d_width = d_height;
d_height = tmp;
}
double QwtDoubleSize::width | ( | ) | const [inline] |
Returns the width.
Definition at line 307 of file qwt_double_rect.h.
Referenced by QwtPlotZoomer::begin(), QwtDoubleRect::setSize(), and setWidth().
{
return d_width;
}