Skip to content
Permalink
Browse files

code cleanup

  • Loading branch information
PeterPetrik committed May 16, 2018
1 parent aea3dcc commit 3fc99c04c1c7d212b70a6b2e32661d0f13c66f33
@@ -14,14 +14,13 @@ typedef QgsPoint QgsMeshVertex;

typedef QVector<int> QgsMeshFace;

typedef QMap<QString, QString> QgsMeshDatasetMetadata;

class QgsMeshDatasetValue
{
%Docstring

QgsMeshDatasetValue is a vector or a scalar value on vertex or face of the mesh with
support of nodata values
QgsMeshDatasetValue represents single mesh dataset value

could be scalar or vector. Nodata values are represented by NaNs.

.. note::

@@ -37,38 +36,21 @@ support of nodata values
QgsMeshDatasetValue( double x,
double y );
%Docstring
Ctor
Constructor for vector value
%End

QgsMeshDatasetValue( double scalar );
%Docstring
Ctor
Constructor for scalar value
%End

QgsMeshDatasetValue( );
QgsMeshDatasetValue();
%Docstring
Ctor
Default Ctor, initialize to NaN
%End

~QgsMeshDatasetValue();

void setNodata( bool nodata = true );
%Docstring
Sets nodata value for this dataset value
%End
bool isNodata() const;
%Docstring
Returns whether it is nodata value
%End
bool isScalar() const;
%Docstring
Returns whether it is scalar value
%End
double scalar() const;
%Docstring
Returns scalar value. Length for vectors, value for scalars
%End

void set( double scalar );
%Docstring
Sets scalar value
@@ -82,6 +64,11 @@ Sets X value
void setY( double y );
%Docstring
Sets Y value
%End

double scalar() const;
%Docstring
Returns magnitude of vector for vector data or scalar value for scalar data
%End

double x() const;
@@ -98,6 +85,60 @@ Returns y value

};



class QgsMeshDatasetMetadata
{
%Docstring

QgsMeshDatasetMetadata is a collection of mesh dataset metadata such
as if the data is vector or scalar, etc.

.. note::

The API is considered EXPERIMENTAL and can be changed without a notice

.. versionadded:: 3.2
%End

%TypeHeaderCode
#include "qgsmeshdataprovider.h"
%End
public:
QgsMeshDatasetMetadata();
QgsMeshDatasetMetadata( bool isScalar,
bool isValid,
bool isOnVertices,
const QMap<QString, QString> &extraOptions );

QMap<QString, QString> extraOptions() const;
%Docstring
Returns extra metadata options
Usually including name, description or time variable
%End

bool isVector() const;
%Docstring
Returns whether dataset has vector data
%End

bool isScalar() const;
%Docstring
Returns whether dataset has scalar data
%End

bool isOnVertices() const;
%Docstring
Returns whether dataset data is defined on vertices
%End

bool isValid() const;
%Docstring
Returns whether dataset is valid
%End

};

class QgsMeshSource /Abstract/
{
%Docstring
@@ -155,7 +196,7 @@ class QgsMeshDatasetSource /Abstract/
%Docstring
Dataset is a collection of vector or scalar values on vertices or faces of the mesh

Base on the underlying data provider/format, whole dataset is either stored in memory or
Based on the underlying data provider/format, whole dataset is either stored in memory or
read on demand

.. note::
@@ -181,29 +222,16 @@ read on demand
Returns number of datasets loaded
%End

virtual bool datasetHasScalarData( int index ) const = 0;
%Docstring
Returns whether dataset has scalar data associated
%End

virtual bool datasetIsOnVertices( int index ) const = 0;
%Docstring
Returns whether dataset is on vertices
%End

virtual QgsMeshDatasetMetadata datasetMetadata( int index ) const = 0;
virtual QgsMeshDatasetMetadata datasetMetadata( int datasetIndex ) const = 0;
%Docstring
Returns dataset metadata
%End

virtual QgsMeshDatasetValue datasetValue( int datasetIndex, int valueIndex ) const = 0;
%Docstring
Returns value associated with the index from the dataset
%End
Returns vector/scalar value associated with the index from the dataset

virtual bool datasetIsValid( int index ) const = 0;
%Docstring
Returns whether dataset is valid
See QgsMeshDatasetMetadata.isVector() to check if the returned value is vector or scalar
%End
};

@@ -10,6 +10,8 @@



const int NO_ACTIVE_MESH_DATASET;


class QgsMeshLayer : QgsMapLayer
{
@@ -121,7 +123,7 @@ Returns the provider type for this layer



QgsMeshRendererMeshSettings rendererNativeMeshSettings() const /Factory/;
QgsMeshRendererMeshSettings rendererNativeMeshSettings() const;
%Docstring
Returns rendrer settings
%End
@@ -131,7 +133,7 @@ Returns rendrer settings
Sets new rendering settings, triggers repaint
%End

QgsMeshRendererMeshSettings rendererTriangularMeshSettings() const /Factory/;
QgsMeshRendererMeshSettings rendererTriangularMeshSettings() const;
%Docstring
Returns rendrer settings
%End
@@ -141,7 +143,7 @@ Returns rendrer settings
Sets new rendering settings, triggers repaint
%End

QgsMeshRendererScalarSettings rendererScalarSettings() const /Factory/;
QgsMeshRendererScalarSettings rendererScalarSettings() const;
%Docstring
Returns rendrer settings
%End
@@ -151,7 +153,7 @@ Returns rendrer settings
Sets new rendering settings, triggers repaint
%End

QgsMeshRendererVectorSettings rendererVectorSettings() const /Factory/;
QgsMeshRendererVectorSettings rendererVectorSettings() const;
%Docstring
Returns rendrer settings
%End
@@ -161,18 +163,22 @@ Returns rendrer settings
Sets new rendering settings, triggers repaint
%End

void setActiveScalarDataset( int index = -1 );
void setActiveScalarDataset( int index = NO_ACTIVE_MESH_DATASET );
%Docstring
Sets active scalar dataset for rendering

Triggers repaint
%End
int activeScalarDataset() const;
%Docstring
Returns active scalar dataset
%End

void setActiveVectorDataset( int index = -1 );
void setActiveVectorDataset( int index = NO_ACTIVE_MESH_DATASET );
%Docstring
Sets active vector dataset for rendering. If dataset is not vector based, do nothing
Sets active vector dataset for rendering.

If dataset is not vector based, do nothing. Triggers repaint
%End
int activeVectorDataset() const;
%Docstring
@@ -140,7 +140,7 @@ Represents a mesh renderer settings for vector datasets
#include "qgsmeshrenderersettings.h"
%End
public:
enum VectorRenderingType
enum ArrowScalingMethod
{

MinMax,
@@ -198,11 +198,11 @@ Sets filter value for vector magnitudes.
.. seealso:: :py:func:`QgsMeshRendererVectorSettings.vectorFilterMax`
%End

QgsMeshRendererVectorSettings::VectorRenderingType shaftLengthMethod() const;
QgsMeshRendererVectorSettings::ArrowScalingMethod shaftLengthMethod() const;
%Docstring
Returns method used for drawing arrows
%End
void setShaftLengthMethod( const QgsMeshRendererVectorSettings::VectorRenderingType &shaftLengthMethod );
void setShaftLengthMethod( const QgsMeshRendererVectorSettings::ArrowScalingMethod &shaftLengthMethod );
%Docstring
Sets method used for drawing arrows
%End
@@ -211,46 +211,56 @@ Sets method used for drawing arrows
%Docstring
Returns mininimum shaft length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowType.MinMax
Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.MinMax
%End

void setMinShaftLength( double minShaftLength );
%Docstring
Sets mininimum shaft length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowType.MinMax
Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.MinMax
%End

double maxShaftLength() const;
%Docstring
Returns maximum shaft length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowType.MinMax
Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.MinMax
%End

void setMaxShaftLength( double maxShaftLength );
%Docstring
Sets maximum shaft length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowType.MinMax
Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.MinMax
%End

double scaleFactor() const;
%Docstring
Returns scale factor. Only for QgsMeshRendererVectorSettings.ArrowType.Scaled
Returns scale factor

Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.Scaled
%End

void setScaleFactor( double scaleFactor );
%Docstring
Sets scale factor. Only for QgsMeshRendererVectorSettings.ArrowType.Scaled
Sets scale factor

Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.Scaled
%End

double fixedShaftLength() const;
%Docstring
Returns fixed arrow length (in millimeters). Only for QgsMeshRendererVectorSettings.ArrowType.Fixed
Returns fixed arrow length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.Fixed
%End

void setFixedShaftLength( double fixedShaftLength );
%Docstring
Sets fixed length (in millimeters). Only for QgsMeshRendererVectorSettings.ArrowType.Fixed
Sets fixed length (in millimeters)

Only for QgsMeshRendererVectorSettings.ArrowScalingMethod.Fixed
%End

double arrowHeadWidthRatio() const;
@@ -1,3 +1,4 @@
// Include auto-generated SIP files
%Include auto_generated/expression/qgsexpression.sip
%Include auto_generated/expression/qgsexpressionnode.sip
%Include auto_generated/expression/qgsexpressionnodeimpl.sip

0 comments on commit 3fc99c0

Please sign in to comment.
You can’t perform that action at this time.