QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsmeshrenderersettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshrenderersettings.h
3  -------------------------
4  begin : May 2018
5  copyright : (C) 2018 by Peter Petrik
6  email : zilolv at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMESHRENDERERSETTINGS_H
19 #define QGSMESHRENDERERSETTINGS_H
20 
21 #include <QColor>
22 #include <limits>
23 
24 #include "qgis_core.h"
25 #include "qgis.h"
26 
36 class CORE_EXPORT QgsMeshRendererMeshSettings
37 {
38  public:
40  bool isEnabled() const;
42  void setEnabled( bool enabled );
43 
45  double lineWidth() const;
47  void setLineWidth( double lineWidth );
48 
50  QColor color() const;
52  void setColor( const QColor &color );
53 
54  private:
55  bool mEnabled = false;
56  double mLineWidth = DEFAULT_LINE_WIDTH;
57  QColor mColor = Qt::black;
58 };
59 
70 {
71  public:
73  QColor maxColor() const;
75  void setMaxColor( const QColor &maxColor );
76 
78  QColor minColor() const;
80  void setMinColor( const QColor &minColor );
81 
88  double minValue() const;
89 
94  void setMinValue( double minValue );
95 
102  double maxValue() const;
103 
108  void setMaxValue( double maxValue );
109 
110  private:
111  QColor mMaxColor = QColor::fromRgb( 255, 0, 0 );
112  QColor mMinColor = QColor::fromRgb( 0, 0, 255 );
113  double mMaxValue = std::numeric_limits<double>::quiet_NaN(); //disabled
114  double mMinValue = std::numeric_limits<double>::quiet_NaN(); //disabled
115 };
116 
127 {
128  public:
131  {
132 
136  MinMax = 0,
137 
142 
146  Fixed
147  };
148 
150  double lineWidth() const;
152  void setLineWidth( double lineWidth );
153 
155  QColor color() const;
157  void setColor( const QColor &color );
158 
165  double filterMin() const;
166 
171  void setFilterMin( double filterMin );
172 
179  double filterMax() const;
180 
185  void setFilterMax( double filterMax );
186 
188  QgsMeshRendererVectorSettings::ArrowScalingMethod shaftLengthMethod() const;
190  void setShaftLengthMethod( ArrowScalingMethod shaftLengthMethod );
191 
197  double minShaftLength() const;
198 
204  void setMinShaftLength( double minShaftLength );
205 
211  double maxShaftLength() const;
212 
218  void setMaxShaftLength( double maxShaftLength );
219 
225  double scaleFactor() const;
226 
232  void setScaleFactor( double scaleFactor );
233 
239  double fixedShaftLength() const;
240 
246  void setFixedShaftLength( double fixedShaftLength );
247 
249  double arrowHeadWidthRatio() const;
251  void setArrowHeadWidthRatio( double arrowHeadWidthRatio );
252 
254  double arrowHeadLengthRatio() const;
256  void setArrowHeadLengthRatio( double arrowHeadLengthRatio );
257 
258  private:
259  double mLineWidth = DEFAULT_LINE_WIDTH; //in milimeters
260  QColor mColor = Qt::black;
261  double mFilterMin = -1; //disabled
262  double mFilterMax = -1; //disabled
263  QgsMeshRendererVectorSettings::ArrowScalingMethod mShaftLengthMethod = QgsMeshRendererVectorSettings::ArrowScalingMethod::MinMax;
264  double mMinShaftLength = 0.8; //in milimeters
265  double mMaxShaftLength = 10; //in milimeters
266  double mScaleFactor = 10;
267  double mFixedShaftLength = 20; //in milimeters
268  double mArrowHeadWidthRatio = 0.15;
269  double mArrowHeadLengthRatio = 0.40;
270 };
271 
272 #endif //QGSMESHRENDERERSETTINGS_H
Represents a mesh renderer settings for mesh object.
Represents a mesh renderer settings for scalar datasets.
Represents a mesh renderer settings for vector datasets.
Scale vector magnitude by factor scaleFactor()
const double DEFAULT_LINE_WIDTH
Definition: qgis.h:484
ArrowScalingMethod
Algorithm how to transform vector magnitude to length of arrow on the device in pixels.