kwave
18.07.70
|
#include <Curve.h>
Public Types | |
typedef QListIterator< QPointF > | ConstIterator |
typedef QMutableListIterator< QPointF > | Iterator |
typedef QPointF | Point |
Public Member Functions | |
Curve () | |
Curve (const QString &command) | |
virtual | ~Curve () |
void | firstHalf () |
void | secondHalf () |
void | deletePoint (Point p, bool check) |
void | deleteSecondPoint () |
void | HFlip () |
void | VFlip () |
void | scaleFit (unsigned int range=1024) |
void | insert (double x, double y) |
Point | findPoint (double x, double y, double tol=.05) |
void | fromCommand (const QString &command) |
QString | getCommand () |
Kwave::interpolation_t | interpolationType () |
void | setInterpolationType (Kwave::interpolation_t type) |
Kwave::Interpolation & | interpolation () |
QVector< double > | interpolation (unsigned int points) |
Static Public Attributes | |
static QPointF | NoPoint |
Protected Member Functions | |
void | sort () |
Private Attributes | |
Kwave::Interpolation | m_interpolation |
typedef QListIterator<QPointF> Kwave::Curve::ConstIterator |
typedef QMutableListIterator<QPointF> Kwave::Curve::Iterator |
typedef QPointF Kwave::Curve::Point |
Kwave::Curve::Curve | ( | ) |
Default constructor, creates an empty curve.
Definition at line 36 of file Curve.cpp.
|
explicit |
Constructor, creates a curve from a command string.
command | string with parameters |
Definition at line 42 of file Curve.cpp.
References fromCommand().
|
virtual |
void Kwave::Curve::deletePoint | ( | Point | p, |
bool | check | ||
) |
Removes and deletes a point from the curve. Note that after this call the passed point is no longer valid!
p | point to be deleted |
check | if true, the last or first point will not be deleted |
Definition at line 112 of file Curve.cpp.
Referenced by Kwave::CurveWidget::deleteLast(), and Kwave::CurveWidget::mouseMoveEvent().
void Kwave::Curve::deleteSecondPoint | ( | ) |
Deletes every second point.
Definition at line 135 of file Curve.cpp.
Referenced by Kwave::CurveWidget::deleteSecond().
Kwave::Curve::Point Kwave::Curve::findPoint | ( | double | x, |
double | y, | ||
double | tol = .05 |
||
) |
Searches for a point at given coordinates with a definable tolerance.
x | coordinate on the x axis |
y | coordinate on the y axis |
tol | tolerance for x and y direction, absolute value |
Definition at line 226 of file Curve.cpp.
References NoPoint.
Referenced by Kwave::CurveWidget::findPoint(), and Kwave::CurveWidget::mouseMoveEvent().
void Kwave::Curve::firstHalf | ( | ) |
Moves all current points into the left half
Definition at line 159 of file Curve.cpp.
Referenced by Kwave::CurveWidget::firstHalf().
void Kwave::Curve::fromCommand | ( | const QString & | command | ) |
Sets a curve from a command string. Opposite of getCommand().
command | a string that contains the interpolation type and pairs of x/y coordinates. |
Definition at line 55 of file Curve.cpp.
References Kwave::Interpolation::find(), Kwave::Parser::firstParam(), Kwave::Parser::isDone(), m_interpolation, setInterpolationType(), and Kwave::Parser::toDouble().
Referenced by Curve(), Kwave::CurveWidget::CurveWidget(), Kwave::AmplifyFreePlugin::interpreteParameters(), Kwave::CurveWidget::loadPreset(), and Kwave::CurveWidget::setCurve().
QString Kwave::Curve::getCommand | ( | ) |
Returns a command string out of the curve points and interpolation type.
Definition at line 72 of file Curve.cpp.
References _, m_interpolation, Kwave::Interpolation::name(), and Kwave::Interpolation::type().
Referenced by Kwave::CurveWidget::getCommand(), and Kwave::CurveWidget::savePreset().
void Kwave::Curve::HFlip | ( | ) |
Flips/mirrors the curve horizontally (x-axis).
Definition at line 184 of file Curve.cpp.
References sort().
Referenced by Kwave::CurveWidget::HFlip().
void Kwave::Curve::insert | ( | double | x, |
double | y | ||
) |
Creates a new point and inserts it into the curve. The new point will be sorted in by it's x coordinate.
x | coordinate on the x axis, should be [0...+1.0] |
y | coordinate on the y axis, should be [0...+1.0] |
Definition at line 147 of file Curve.cpp.
References sort().
Referenced by Kwave::CurveWidget::addPoint(), Kwave::CurveWidget::mouseMoveEvent(), Kwave::PlayBackPlugin::run(), and secondHalf().
Kwave::Interpolation & Kwave::Curve::interpolation | ( | ) |
Returns a reference to the Interpolation object itself
Definition at line 86 of file Curve.cpp.
References m_interpolation, and Kwave::Interpolation::prepareInterpolation().
Referenced by Kwave::CurveWidget::paintEvent(), and scaleFit().
QVector< double > Kwave::Curve::interpolation | ( | unsigned int | points | ) |
Returns an array of points, calculated out of the current interpolation parameters.
points | number of points |
Definition at line 93 of file Curve.cpp.
References Kwave::Interpolation::interpolation(), m_interpolation, and Kwave::Interpolation::prepareInterpolation().
Kwave::interpolation_t Kwave::Curve::interpolationType | ( | ) |
Returns the interpolation type.
Definition at line 106 of file Curve.cpp.
References m_interpolation, and Kwave::Interpolation::type().
void Kwave::Curve::scaleFit | ( | unsigned int | range = 1024 | ) |
Scales the curve vertically to fit into a range of (+/- range/2) on the y-axis.
range | the size range to use for scaling |
Definition at line 200 of file Curve.cpp.
References Kwave::Interpolation::interpolation(), interpolation(), m_interpolation, and Kwave::Interpolation::type().
Referenced by Kwave::CurveWidget::scaleFit().
void Kwave::Curve::secondHalf | ( | ) |
Moves all current points into the right half
Definition at line 121 of file Curve.cpp.
References insert().
Referenced by Kwave::CurveWidget::secondHalf().
void Kwave::Curve::setInterpolationType | ( | Kwave::interpolation_t | type | ) |
Sets a new interpolation type.
type | the new interpolation type |
Definition at line 100 of file Curve.cpp.
References m_interpolation, and Kwave::Interpolation::setType().
Referenced by fromCommand(), and Kwave::CurveWidget::selectInterpolationType().
|
protected |
sorts the list by ascending x coordinate
Definition at line 251 of file Curve.cpp.
References cmp().
Referenced by HFlip(), and insert().
void Kwave::Curve::VFlip | ( | ) |
Flips/mirrors the curve vertically (y-axis).
Definition at line 172 of file Curve.cpp.
Referenced by Kwave::CurveWidget::VFlip().
|
private |
interpolation object
Definition at line 165 of file Curve.h.
Referenced by fromCommand(), getCommand(), interpolation(), interpolationType(), scaleFit(), and setInterpolationType().
|
static |
used for the "invalid" point
Definition at line 51 of file Curve.h.
Referenced by Kwave::CurveWidget::addPoint(), Kwave::CurveWidget::deleteLast(), Kwave::CurveWidget::deleteSecond(), Kwave::CurveWidget::findPoint(), findPoint(), Kwave::CurveWidget::firstHalf(), Kwave::CurveWidget::loadPreset(), Kwave::CurveWidget::mouseMoveEvent(), Kwave::CurveWidget::mousePressEvent(), Kwave::CurveWidget::mouseReleaseEvent(), and Kwave::CurveWidget::secondHalf().