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)  

DatapickerImage.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : DatapickerImage.h
3  Project : LabPlot
4  Description : Worksheet for Datapicker
5  --------------------------------------------------------------------
6  Copyright : (C) 2015 by Ankit Wagadre (wagadre.ankit@gmail.com)
7  Copyright : (C) 2015-2016 by Alexander Semke (alexander.semke@web.de)
8 
9 ***************************************************************************/
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  * This program is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public License *
23  * along with this program; if not, write to the Free Software *
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25  * Boston, MA 02110-1301 USA *
26  * *
27  ***************************************************************************/
28 
29 #ifndef DATAPICKERIMAGE_H
30 #define DATAPICKERIMAGE_H
31 
33 #include "backend/lib/macros.h"
35 
36 #include <QVector3D>
37 #include <QPen>
38 
39 class QImage;
40 class QBrush;
43 class ImageEditor;
44 class Segments;
45 
46 class QGraphicsScene;
47 class QGraphicsPixmapItem;
48 
49 class DatapickerImage : public AbstractPart {
50  Q_OBJECT
51 
52 public:
53  explicit DatapickerImage(const QString& name, bool loading = false);
54  ~DatapickerImage() override;
55 
60 
61  struct ReferencePoints {
63  QPointF scenePos[3];
64  QVector3D logicalPos[3];
65  double ternaryScale{1.0};
66  };
67 
68  struct EditorSettings {
74  int hueThresholdHigh{360};
79  };
80 
81  QIcon icon() const override;
82  QMenu* createContextMenu() override;
83  void createContextMenu(QMenu*);
84  QWidget* view() const override;
85 
86  bool exportView() const override;
87  bool printView() override;
88  bool printPreview() const override;
89 
90  void save(QXmlStreamWriter*) const override;
91  bool load(XmlStreamReader*, bool preview) override;
92 
93  QRectF pageRect() const;
94  void setPageRect(const QRectF&);
95  QGraphicsScene *scene() const;
96  void setPrinting(bool) const;
97  void setSelectedInView(const bool);
98  void setSegmentsHoverEvent(const bool);
99 
102 
103  bool isLoaded{false};
106  QColor background;
108  int *hueBins;
110  int *valueBins;
112 
113  QGraphicsPixmapItem* m_magnificationWindow{nullptr};
114 
115  CLASS_D_ACCESSOR_DECL(QString, fileName, FileName)
118  BASIC_D_ACCESSOR_DECL(float, rotationAngle, RotationAngle)
119  BASIC_D_ACCESSOR_DECL(PointsType, plotPointsType, PlotPointsType)
120  BASIC_D_ACCESSOR_DECL(int, pointSeparation, PointSeparation)
121  BASIC_D_ACCESSOR_DECL(int, minSegmentLength, minSegmentLength)
122 
123  BASIC_D_ACCESSOR_DECL(Symbol::Style, pointStyle, PointStyle)
124  BASIC_D_ACCESSOR_DECL(qreal, pointOpacity, PointOpacity)
125  BASIC_D_ACCESSOR_DECL(qreal, pointRotationAngle, PointRotationAngle)
126  BASIC_D_ACCESSOR_DECL(qreal, pointSize, PointSize)
127  CLASS_D_ACCESSOR_DECL(QBrush, pointBrush, PointBrush)
128  CLASS_D_ACCESSOR_DECL(QPen, pointPen, PointPen)
129  BASIC_D_ACCESSOR_DECL(bool, pointVisibility, PointVisibility)
130 
132 
133 private:
134  void init();
135 
137  mutable DatapickerImageView* m_view{nullptr};
140 
141 signals:
145 
146  void fileNameChanged(const QString&);
147  void rotationAngleChanged(float);
150  void minSegmentLengthChanged(const int);
152  void pointSizeChanged(qreal);
154  void pointOpacityChanged(qreal);
155  void pointBrushChanged(QBrush);
156  void pointPenChanged(const QPen&);
158 };
159 #endif
QString name() const
Base class of Aspects with MDI windows as views (AspectParts).
Definition: AbstractPart.h:36
Datapicker/DatapickerImage view.
container to open image/plot.
QWidget * view() const override
Construct a primary view on me.
void requestUpdate()
bool printPreview() const override
void pointVisibilityChanged(bool)
void pointPenChanged(const QPen &)
void setSelectedInView(const bool)
void pointOpacityChanged(qreal)
void setPageRect(const QRectF &)
bool load(XmlStreamReader *, bool preview) override
Load from XML.
DatapickerImage::PlotImageType plotImageType()
void minSegmentLengthChanged(const int)
DatapickerImagePrivate *const d
void requestProjectContextMenu(QMenu *)
void rotationAngleChanged(float)
bool printView() override
void pointBrushChanged(QBrush)
Segments * m_segments
QIcon icon() const override
DatapickerImageView * m_view
void pointRotationAngleChanged(qreal)
void setPlotImageType(const DatapickerImage::PlotImageType)
void setSegmentsHoverEvent(const bool)
void save(QXmlStreamWriter *) const override
Save as XML.
void pointSizeChanged(qreal)
QGraphicsPixmapItem * m_magnificationWindow
void requestUpdateActions()
QGraphicsScene * scene() const
~DatapickerImage() override
void pointStyleChanged(Symbol::Style)
bool exportView() const override
DatapickerImage(const QString &name, bool loading=false)
QRectF pageRect() const
void fileNameChanged(const QString &)
void setPrinting(bool) const
void settingsChanged(const DatapickerImage::EditorSettings &)
void axisPointsChanged(const DatapickerImage::ReferencePoints &)
QMenu * createContextMenu() override
container to open image/plot.
Definition: Segments.h:36
Style
Definition: Symbol.h:38
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...
#define CLASS_D_ACCESSOR_DECL(type, method, Method)
Definition: macros.h:134
#define BASIC_D_ACCESSOR_DECL(type, method, Method)
Definition: macros.h:107