File indexing completed on 2025-01-26 03:34:06
0001 /* 0002 File : CartesianCoordinateSystem.h 0003 Project : LabPlot 0004 Description : Cartesian coordinate system for plots. 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2012-2016 Alexander Semke <alexander.semke@web.de> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef CARTESIANCOORDINATESYSTEM_H 0011 #define CARTESIANCOORDINATESYSTEM_H 0012 0013 #include "CartesianScale.h" 0014 #include "backend/worksheet/plots/AbstractCoordinateSystem.h" 0015 0016 class CartesianCoordinateSystemPrivate; 0017 class CartesianCoordinateSystemSetScalePropertiesCmd; 0018 class CartesianPlot; 0019 0020 class CartesianCoordinateSystem : public AbstractCoordinateSystem { 0021 Q_ENUMS(Dimension) 0022 public: 0023 enum class Dimension { X, Y }; 0024 0025 explicit CartesianCoordinateSystem(CartesianPlot*); 0026 ~CartesianCoordinateSystem() override; 0027 0028 static QString dimensionToString(Dimension); 0029 0030 // TODO: document the 5 versions 0031 Points mapLogicalToScene(const Points&, MappingFlags flags = MappingFlag::DefaultMapping) const override; 0032 void mapLogicalToScene(const Points& logicalPoints, 0033 Points& scenePoints, 0034 std::vector<bool>& visiblePoints, 0035 MappingFlags flags = MappingFlag::DefaultMapping) const; 0036 void mapLogicalToScene(int startIndex, 0037 int endIndex, 0038 const Points& logicalPoints, 0039 Points& scenePoints, 0040 std::vector<bool>& visiblePoints, 0041 MappingFlags flags = MappingFlag::DefaultMapping) const; 0042 QPointF mapLogicalToScene(QPointF, bool& visible, MappingFlags flags = MappingFlag::DefaultMapping) const override; 0043 Lines mapLogicalToScene(const Lines&, MappingFlags flags = MappingFlag::DefaultMapping) const override; 0044 Points mapSceneToLogical(const Points&, MappingFlags flags = MappingFlag::DefaultMapping) const override; 0045 QPointF mapSceneToLogical(QPointF, MappingFlags flags = MappingFlag::DefaultMapping) const override; 0046 virtual bool isValid() const override; 0047 0048 int direction(const Dimension) const; 0049 bool setScales(const Dimension, const QVector<CartesianScale*>&); 0050 QVector<CartesianScale*> scales(const Dimension) const; 0051 int index(const Dimension) const; 0052 void setIndex(const Dimension, const int); 0053 0054 QString info() const override; 0055 0056 private: 0057 void init(); 0058 bool rectContainsPoint(const QRectF&, QPointF) const; 0059 CartesianCoordinateSystemPrivate* d; 0060 }; 0061 0062 #endif