labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

CartesianCoordinateSystem Class Reference

Cartesian coordinate system for plots. More...

#include <CartesianCoordinateSystem.h>

Inheritance diagram for CartesianCoordinateSystem:
[legend]
Collaboration diagram for CartesianCoordinateSystem:
[legend]

Public Member Functions

 CartesianCoordinateSystem (CartesianPlot *)
 
 ~CartesianCoordinateSystem () override
 
QVector< QPointF > mapLogicalToScene (const QVector< QPointF > &, MappingFlags flags=MappingFlag::DefaultMapping) const override
 
void mapLogicalToScene (const QVector< QPointF > &logicalPoints, QVector< QPointF > &scenePoints, std::vector< bool > &visiblePoints, MappingFlags flags=MappingFlag::DefaultMapping) const
 
void mapLogicalToScene (int startIndex, int endIndex, const QVector< QPointF > &logicalPoints, QVector< QPointF > &scenePoints, QVector< bool > &visiblePoints, QVector< QVector< bool >> &scenePointsUsed, double minLogicalDiffX, double minLogicalDiffY, MappingFlags flags=MappingFlag::DefaultMapping) const
 
QPointF mapLogicalToScene (QPointF, MappingFlags flags=MappingFlag::DefaultMapping) const override
 
QVector< QLineF > mapLogicalToScene (const QVector< QLineF > &, MappingFlags flags=MappingFlag::DefaultMapping) const override
 
QVector< QPointF > mapSceneToLogical (const QVector< QPointF > &, MappingFlags flags=MappingFlag::DefaultMapping) const override
 
QPointF mapSceneToLogical (QPointF, MappingFlags flags=MappingFlag::DefaultMapping) const override
 
int xDirection () const
 Determine the horizontal direction relative to the page. More...
 
int yDirection () const
 Determine the vertical direction relative to the page. More...
 
bool setXScales (const QVector< CartesianScale * > &)
 
QVector< CartesianScale * > xScales () const
 
bool setYScales (const QVector< CartesianScale * > &)
 
QVector< CartesianScale * > yScales () const
 
- Public Member Functions inherited from AbstractCoordinateSystem
 AbstractCoordinateSystem (AbstractPlot *)
 
virtual ~AbstractCoordinateSystem ()
 

Private Member Functions

void init ()
 
bool rectContainsPoint (const QRectF &, QPointF) const
 

Private Attributes

CartesianCoordinateSystemPrivated
 

Additional Inherited Members

- Public Types inherited from AbstractCoordinateSystem
enum class  MappingFlag {
  DefaultMapping = 0x00 , SuppressPageClipping = 0x01 , MarkGaps = 0x02 , Limit = 0x04 ,
  SuppressPageClippingY = 0x08
}
 
- Static Public Member Functions inherited from AbstractCoordinateSystem
static bool clipLineToRect (QLineF *line, const QRectF &rect, LineClipResult *clipResult=nullptr)
 Line clipping using the Cohen-Sutherland algorithm. More...
 

Detailed Description

Cartesian coordinate system for plots.

Definition at line 73 of file CartesianCoordinateSystem.h.

Constructor & Destructor Documentation

◆ CartesianCoordinateSystem()

CartesianCoordinateSystem::CartesianCoordinateSystem ( CartesianPlot plot)
explicit

Definition at line 169 of file CartesianCoordinateSystem.cpp.

References d, and CartesianCoordinateSystemPrivate::plot.

◆ ~CartesianCoordinateSystem()

CartesianCoordinateSystem::~CartesianCoordinateSystem ( )
override

Definition at line 175 of file CartesianCoordinateSystem.cpp.

References d.

Member Function Documentation

◆ init()

void CartesianCoordinateSystem::init ( )
private

◆ mapLogicalToScene() [1/5]

◆ mapLogicalToScene() [2/5]

◆ mapLogicalToScene() [3/5]

void CartesianCoordinateSystem::mapLogicalToScene ( const QVector< QPointF > &  logicalPoints,
QVector< QPointF > &  scenePoints,
std::vector< bool > &  visiblePoints,
MappingFlags  flags = MappingFlag::DefaultMapping 
) const

Maps the points in logical coordinates from points and fills the visiblePoints with the points in logical coordinates restricted to the current intervals.

Parameters
logicalPointsList of points in logical coordinates
scenePointsList for the points in scene coordinates
visiblePointsList for the logical coordinates restricted to the current region of the coordinate system
flags

Definition at line 273 of file CartesianCoordinateSystem.cpp.

References d, CartesianPlot::dataRect(), DEBUG, AbstractCoordinateSystem::Limit, CartesianCoordinateSystemPrivate::plot, rectContainsPoint(), AbstractCoordinateSystem::SuppressPageClipping, AbstractCoordinateSystem::SuppressPageClippingY, nsl_smooth_check::x, CartesianCoordinateSystemPrivate::xScales, and CartesianCoordinateSystemPrivate::yScales.

◆ mapLogicalToScene() [4/5]

void CartesianCoordinateSystem::mapLogicalToScene ( int  startIndex,
int  endIndex,
const QVector< QPointF > &  logicalPoints,
QVector< QPointF > &  scenePoints,
QVector< bool > &  visiblePoints,
QVector< QVector< bool >> &  scenePointsUsed,
double  minLogicalDiffX,
double  minLogicalDiffY,
MappingFlags  flags = MappingFlag::DefaultMapping 
) const

Maps the points in logical coordinates from points and fills the visiblePoints with the points in logical coordinates restricted to the current intervals. If there are points, that lie on another one they will not be added a second time.

Parameters
logicalPointsList of points in logical coordinates
scenePointsList for the points in scene coordinates
visiblePointsList for the logical coordinates restricted to the current region of the coordinate system
scenePointsUsedList of bools which scene point was already used

Definition at line 325 of file CartesianCoordinateSystem.cpp.

References d, CartesianPlot::dataRect(), DEBUG, AbstractCoordinateSystem::Limit, CartesianCoordinateSystemPrivate::plot, rectContainsPoint(), AbstractCoordinateSystem::SuppressPageClipping, AbstractCoordinateSystem::SuppressPageClippingY, nsl_smooth_check::x, CartesianCoordinateSystemPrivate::xScales, and CartesianCoordinateSystemPrivate::yScales.

◆ mapLogicalToScene() [5/5]

◆ mapSceneToLogical() [1/2]

◆ mapSceneToLogical() [2/2]

◆ rectContainsPoint()

bool CartesianCoordinateSystem::rectContainsPoint ( const QRectF &  rect,
QPointF  point 
) const
private

Adjusted the function QRectF::contains(QPointF) from Qt 4.8.4 to handle the comparison of float numbers correctly. TODO: check whether the newer versions of Qt do the comparison correctly.

Definition at line 750 of file CartesianCoordinateSystem.cpp.

References nsl_math_definitely_greater_than(), nsl_math_definitely_less_than(), and nsl_math_essentially_equal().

Referenced by mapLogicalToScene().

◆ setXScales()

bool CartesianCoordinateSystem::setXScales ( const QVector< CartesianScale * > &  scales)

◆ setYScales()

bool CartesianCoordinateSystem::setYScales ( const QVector< CartesianScale * > &  scales)

◆ xDirection()

int CartesianCoordinateSystem::xDirection ( ) const

Determine the horizontal direction relative to the page.

This function is needed for untransformed lengths such as axis tick length.

Returns
1 or -1

Definition at line 700 of file CartesianCoordinateSystem.cpp.

References d, and CartesianCoordinateSystemPrivate::xScales.

Referenced by AxisPrivate::retransformTickLabelPositions(), and AxisPrivate::retransformTicks().

◆ xScales()

QVector< CartesianScale * > CartesianCoordinateSystem::xScales ( ) const

Definition at line 729 of file CartesianCoordinateSystem.cpp.

References d, and CartesianCoordinateSystemPrivate::xScales.

◆ yDirection()

int CartesianCoordinateSystem::yDirection ( ) const

Determine the vertical direction relative to the page.

This function is needed for untransformed lengths such as axis tick length.

Returns
1 or -1

Definition at line 713 of file CartesianCoordinateSystem.cpp.

References d, and CartesianCoordinateSystemPrivate::yScales.

Referenced by AxisPrivate::retransformTickLabelPositions(), and AxisPrivate::retransformTicks().

◆ yScales()

QVector< CartesianScale * > CartesianCoordinateSystem::yScales ( ) const

Definition at line 741 of file CartesianCoordinateSystem.cpp.

References d, and CartesianCoordinateSystemPrivate::yScales.

Member Data Documentation

◆ d


The documentation for this class was generated from the following files: