"Fossies" - the Fresh Open Source Software Archive

Member "labplot-2.6.0/src/backend/worksheet/plots/AbstractCoordinateSystem.h" (16 Apr 2019, 3781 Bytes) of package /linux/privat/labplot-2.6.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AbstractCoordinateSystem.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.5.0_vs_2.6.0.

    1 /***************************************************************************
    2     File                 : AbstractCoordinateSystem.h
    3     Project              : LabPlot
    4     Description          : Base class of all worksheet coordinate systems.
    5     --------------------------------------------------------------------
    6     Copyright            : (C) 2009 Tilman Benkert (thzs@gmx.net)
    7     Copyright            : (C) 2012 Alexander Semke (alexander.semke@web.de)
    8 
    9  ***************************************************************************/
   10 
   11 /***************************************************************************
   12  *                                                                         *
   13  *  This program is free software; you can redistribute it and/or modify   *
   14  *  it under the terms of the GNU General Public License as published by   *
   15  *  the Free Software Foundation; either version 2 of the License, or      *
   16  *  (at your option) any later version.                                    *
   17  *                                                                         *
   18  *  This program is distributed in the hope that it will be useful,        *
   19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
   20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
   21  *  GNU General Public License for more details.                           *
   22  *                                                                         *
   23  *   You should have received a copy of the GNU General Public License     *
   24  *   along with this program; if not, write to the Free Software           *
   25  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
   26  *   Boston, MA  02110-1301  USA                                           *
   27  *                                                                         *
   28  ***************************************************************************/
   29 
   30 #ifndef ABSTRACTCOORDINATESYSTEM_H
   31 #define ABSTRACTCOORDINATESYSTEM_H
   32 
   33 #include "backend/worksheet/plots/AbstractPlot.h"
   34 #include <QVector>
   35 
   36 class QString;
   37 class QLine;
   38 class QRectF;
   39 
   40 class AbstractCoordinateSystem {
   41 public:
   42     enum MappingFlag {
   43         DefaultMapping = 0x00,
   44         SuppressPageClipping = 0x01,
   45         MarkGaps = 0x02,
   46     };
   47     Q_DECLARE_FLAGS(MappingFlags, MappingFlag)
   48 
   49     explicit AbstractCoordinateSystem(AbstractPlot*);
   50     virtual ~AbstractCoordinateSystem();
   51 
   52     virtual QVector<QPointF> mapLogicalToScene(const QVector<QPointF>&, MappingFlags flags = DefaultMapping) const = 0;
   53     virtual QPointF mapLogicalToScene(QPointF, MappingFlags flags = DefaultMapping) const = 0;
   54     virtual QVector<QLineF> mapLogicalToScene(const QVector<QLineF>&, MappingFlags flags = DefaultMapping) const = 0;
   55     virtual QVector<QPointF> mapSceneToLogical(const QVector<QPointF>&, MappingFlags flags = DefaultMapping) const = 0;
   56     virtual QPointF mapSceneToLogical(QPointF, MappingFlags flags = DefaultMapping) const = 0;
   57 
   58     class LineClipResult {
   59     public:
   60         LineClipResult() {
   61             reset();
   62         }
   63         inline void reset() {
   64             for (int i = 0; i < 2; i++) {
   65                 xClippedRight[i] = false;
   66                 xClippedLeft[i] = false;
   67                 yClippedTop[i] = false;
   68                 yClippedBottom[i] = false;
   69             }
   70         }
   71         bool xClippedRight[2];
   72         bool xClippedLeft[2];
   73         bool yClippedTop[2];
   74         bool yClippedBottom[2];
   75     };
   76 
   77     //static members
   78     static bool clipLineToRect(QLineF *line, const QRectF &rect, LineClipResult *clipResult = nullptr);
   79     static bool approximatelyEqual(float a, float b, float epsilon=0.0000001);
   80     static bool essentiallyEqual(float a, float b, float epsilon=0.0000001);
   81     static bool definitelyGreaterThan(float a, float b, float epsilon=0.0000001);
   82     static bool definitelyLessThan(float a, float b, float epsilon=0.0000001);
   83 };
   84 
   85 Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractCoordinateSystem::MappingFlags)
   86 
   87 #endif