OpenMS
|
Manipulates X or Y component of points in the X-Y plane, by assuming one axis (either X or Y axis) has gravity acting upon it. More...
#include <OpenMS/VISUAL/Plot1DCanvas.h>
Public Types | |
using | AreaXYType = PlotCanvas::GenericArea::AreaXYType |
Public Member Functions | |
Gravitator (DIM axis) | |
C'tor to apply gravity on any axis. More... | |
Gravitator (const DimMapper< 2 > &unit_mapper) | |
Convenience c'tor, which picks the Intensity dimension from a DimMapper as gravity axis. More... | |
void | setGravityAxis (DIM axis) |
void | setIntensityAsGravity (const DimMapper< 2 > &unit_mapper) |
Convenience function, which picks the Intensity dimension from a DimMapper as gravity axis. More... | |
DIM | getGravityAxis () const |
Which axis is affected by gravity? More... | |
Gravitator | swap () const |
Swap gravity axis (from X to Y, or vice versa) More... | |
QPoint | gravitateMin (QPoint p, const AreaXYType &area) const |
QPoint | gravitateWith (QPoint p, const QPoint &delta) const |
template<UInt D> | |
DPosition< D > | gravitateWith (DPosition< D > p, const DPosition< D > &delta) const |
Same as gravitateWith() More... | |
QPoint | gravitateTo (QPoint p, const QPoint &target) const |
template<UInt D> | |
DPosition< D > | gravitateTo (DPosition< D > p, const DPosition< D > &target) const |
Same as gravitateTo() More... | |
QPoint | gravitateMax (QPoint p, const AreaXYType &area) const |
Opposite of gravitateMin() More... | |
QPoint | gravitateZero (QPoint p) const |
template<UInt D> | |
DPosition< D > | gravitateZero (DPosition< D > p) const |
template<UInt D> | |
DPosition< D > | gravitateNAN (DPosition< D > p) const |
int | gravityValue (const QPoint &p) const |
template<UInt D> | |
int | gravityValue (const DPosition< D > &p) const |
template<UInt D> | |
auto | gravityDiff (const DPosition< D > &start, const DPosition< D > &end) const |
Private Attributes | |
DIM | gravity_axis_ |
Where are points in the X-Y plane projected onto when drawing lines? More... | |
Manipulates X or Y component of points in the X-Y plane, by assuming one axis (either X or Y axis) has gravity acting upon it.
Example: Assume there is a X-Y plane with RT(on X axis) and Intensity(on Y axis). Given a point on the plane, you can make it 'drop down', to a minimum intensity, by applying a gravity on the Y axis. You can also make the point 'fly up'.
|
inline |
C'tor to apply gravity on any axis.
axis | Which axis |
References Gravitator::setGravityAxis().
|
inline |
Convenience c'tor, which picks the Intensity dimension from a DimMapper as gravity axis.
unit_mapper | Pick the Intensity axis from this mapper (or throw exception). See setGravityAxis(). |
References Gravitator::setIntensityAsGravity().
|
inline |
Which axis is affected by gravity?
References Gravitator::gravity_axis_.
|
inline |
Opposite of gravitateMin()
References Gravitator::gravity_axis_, DIntervalBase< D >::maxX(), DIntervalBase< D >::maxY(), OpenMS::X, and OpenMS::Y.
|
inline |
Pull the point p
to the current gravity axis, i.e. the lowest point on the Area
p | A X-Y data point |
area | An area which contains the min/max range of X and Y axis |
p
, but with its gravity-axis value changed to the minimum given in area
References Gravitator::gravity_axis_, DIntervalBase< D >::minX(), DIntervalBase< D >::minY(), OpenMS::X, and OpenMS::Y.
Pull the point p
to NAN on the current gravity axis.
p | A X-Y data point |
References Gravitator::gravity_axis_.
Same as gravitateTo()
References Gravitator::gravity_axis_.
|
inline |
Change the value of p's
gravity dimension to the value of targets'
. Other dimensions remain untouched.
p | A X-Y data point |
target | A target value, of which we only use the gravity dimension's part. |
p
, but with its gravity-axis value changed by target's value. References Gravitator::gravity_axis_, OpenMS::X, and OpenMS::Y.
Same as gravitateWith()
References Gravitator::gravity_axis_.
|
inline |
Add value of delta's
gravity dimension to the gravity dimension of point p
. Other dimensions remain untouched.
p | A X-Y data point |
delta | A distance, of which we only use the gravity dimension's part. |
p
, but with its gravity-axis value changed by adding delta. References Gravitator::gravity_axis_, OpenMS::X, and OpenMS::Y.
Pull the point p
to zero (0) on the current gravity axis.
p | A X-Y data point |
References Gravitator::gravity_axis_.
|
inline |
Pull the point p
to zero (0) on the current gravity axis.
p | A X-Y data point |
References Gravitator::gravity_axis_, OpenMS::X, and OpenMS::Y.
Referenced by Annotation1DPeakItem< DataPoint >::draw().
Get the difference of values in the gravity dimension
start | The start point in XY coordinates |
end | The end point in XY coordinates |
References Gravitator::gravity_axis_.
|
inline |
Get the value of the gravity dimension
p | A X-Y data point |
References Gravitator::gravity_axis_.
|
inline |
Get the value of the gravity dimension
p | A X-Y data point |
References Gravitator::gravity_axis_, OpenMS::X, and OpenMS::Y.
|
inline |
Which axis is pulling a point downwards (e.g. when plotting sticks) Note that pulling (see gravitateDown()) will only change the value for the gravity axis. E.g. with gravity on Y, a Point(X=10, Y=10), will be pulled to Point(X=10, Y=min)
axis | Either X, or Y |
Exception::InvalidValue | if axis is not X or Y |
References Gravitator::gravity_axis_, OpenMS::X, and OpenMS::Y.
Referenced by Gravitator::Gravitator(), Gravitator::setIntensityAsGravity(), and Gravitator::swap().
|
inline |
Convenience function, which picks the Intensity dimension from a DimMapper as gravity axis.
unit_mapper |
Exception::NotImplemented | if unit_mapper does not have an Intensity dimension |
if 1D view has no intensity dimension, go think about what dimension should be gravitational...
References DimMapper< N_DIM >::getDim(), DimBase::getUnit(), OpenMS::INT, Gravitator::setGravityAxis(), OpenMS::X, and OpenMS::Y.
Referenced by Gravitator::Gravitator().
|
inline |
Swap gravity axis (from X to Y, or vice versa)
References Gravitator::setGravityAxis(), OpenMS::X, and OpenMS::Y.
Referenced by Annotation1DPeakItem< DataPoint >::draw().
|
private |
Where are points in the X-Y plane projected onto when drawing lines?
Referenced by Gravitator::getGravityAxis(), Gravitator::gravitateMax(), Gravitator::gravitateMin(), Gravitator::gravitateNAN(), Gravitator::gravitateTo(), Gravitator::gravitateWith(), Gravitator::gravitateZero(), Gravitator::gravityDiff(), Gravitator::gravityValue(), and Gravitator::setGravityAxis().