Skip to content

Commit aea3dcc

Browse files
committedMay 16, 2018
[FEATURE] Rendering of vector data on mesh layers
Rudimentary support of rendering of vector data (e.g. velocity) on mesh map layers. Rendering can be adjusted by QgsMeshRenderer*Settings. Only in Python API, no GUI widgets for styling present.
1 parent 9296528 commit aea3dcc

26 files changed

+1639
-225
lines changed
 

‎python/core/auto_generated/mesh/qgsmeshdataprovider.sip.in

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,64 @@ support of nodata values
3636
public:
3737
QgsMeshDatasetValue( double x,
3838
double y );
39+
%Docstring
40+
Ctor
41+
%End
42+
3943
QgsMeshDatasetValue( double scalar );
44+
%Docstring
45+
Ctor
46+
%End
47+
4048
QgsMeshDatasetValue( );
49+
%Docstring
50+
Ctor
51+
%End
4152

4253
~QgsMeshDatasetValue();
54+
4355
void setNodata( bool nodata = true );
56+
%Docstring
57+
Sets nodata value for this dataset value
58+
%End
4459
bool isNodata() const;
60+
%Docstring
61+
Returns whether it is nodata value
62+
%End
4563
bool isScalar() const;
46-
double scalar() const; //length for vectors, value for scalars
64+
%Docstring
65+
Returns whether it is scalar value
66+
%End
67+
double scalar() const;
68+
%Docstring
69+
Returns scalar value. Length for vectors, value for scalars
70+
%End
71+
4772
void set( double scalar );
73+
%Docstring
74+
Sets scalar value
75+
%End
76+
4877
void setX( double x );
78+
%Docstring
79+
Sets X value
80+
%End
81+
4982
void setY( double y );
83+
%Docstring
84+
Sets Y value
85+
%End
86+
5087
double x() const;
88+
%Docstring
89+
Returns x value
90+
%End
91+
5192
double y() const;
93+
%Docstring
94+
Returns y value
95+
%End
96+
5297
bool operator==( const QgsMeshDatasetValue &other ) const;
5398

5499
};
@@ -78,14 +123,14 @@ read on demand
78123

79124
virtual int vertexCount() const = 0;
80125
%Docstring
81-
Return number of vertices in the native mesh
126+
Returns number of vertices in the native mesh
82127

83128
:return: Number of vertices in the mesh
84129
%End
85130

86131
virtual int faceCount() const = 0;
87132
%Docstring
88-
Return number of faces in the native mesh
133+
Returns number of faces in the native mesh
89134

90135
:return: Number of faces in the mesh
91136
%End
@@ -94,7 +139,7 @@ read on demand
94139
%Docstring
95140
Factory for mesh vertex with index
96141

97-
:return: new mesh vertex on index
142+
:return: New mesh vertex on index
98143
%End
99144

100145
virtual QgsMeshFace face( int index ) const = 0;
@@ -133,32 +178,32 @@ read on demand
133178

134179
virtual int datasetCount() const = 0;
135180
%Docstring
136-
Return number of datasets loaded
181+
Returns number of datasets loaded
137182
%End
138183

139184
virtual bool datasetHasScalarData( int index ) const = 0;
140185
%Docstring
141-
Whether dataset has scalar data associated
186+
Returns whether dataset has scalar data associated
142187
%End
143188

144189
virtual bool datasetIsOnVertices( int index ) const = 0;
145190
%Docstring
146-
Whether dataset is on vertices
191+
Returns whether dataset is on vertices
147192
%End
148193

149194
virtual QgsMeshDatasetMetadata datasetMetadata( int index ) const = 0;
150195
%Docstring
151-
Return dataset metadata
196+
Returns dataset metadata
152197
%End
153198

154199
virtual QgsMeshDatasetValue datasetValue( int datasetIndex, int valueIndex ) const = 0;
155200
%Docstring
156-
Return value associated with the index from the dataset
201+
Returns value associated with the index from the dataset
157202
%End
158203

159204
virtual bool datasetIsValid( int index ) const = 0;
160205
%Docstring
161-
Return whether dataset is valid
206+
Returns whether dataset is valid
162207
%End
163208
};
164209

‎python/core/auto_generated/mesh/qgsmeshlayer.sip.in

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ E.g. to create mesh with one quad and one triangle
5252
);
5353
QgsMeshLayer *scratchLayer = new QgsMeshLayer(uri, "My Scratch layer", "memory_mesh");
5454

55-
Add datasets by adding them through data provider, :py:func:`QgsMeshDatasetSource.addDataset`
56-
5755
\subsection mdal MDAL data provider (mdal)
5856

5957
Accesses data using the MDAL drivers (https://github.com/lutraconsulting/MDAL). The url
@@ -118,32 +116,68 @@ QgsMeshLayer cannot be copied.
118116

119117
QString providerType() const;
120118
%Docstring
121-
Return the provider type for this layer
119+
Returns the provider type for this layer
122120
%End
123121

124122

125123

126-
QgsSymbol *nativeMeshSymbol();
124+
QgsMeshRendererMeshSettings rendererNativeMeshSettings() const /Factory/;
127125
%Docstring
128-
Returns a line symbol used for rendering native mesh.
126+
Returns rendrer settings
129127
%End
130128

131-
QgsSymbol *triangularMeshSymbol();
129+
void setRendererNativeMeshSettings( const QgsMeshRendererMeshSettings &settings );
132130
%Docstring
133-
Returns a line symbol used for rendering of triangular (derived) mesh.
131+
Sets new rendering settings, triggers repaint
132+
%End
134133

135-
.. seealso:: :py:func:`toggleTriangularMeshRendering`
134+
QgsMeshRendererMeshSettings rendererTriangularMeshSettings() const /Factory/;
135+
%Docstring
136+
Returns rendrer settings
136137
%End
137138

138-
void toggleTriangularMeshRendering( bool toggle );
139+
void setRendererTriangularMeshSettings( const QgsMeshRendererMeshSettings &settings );
139140
%Docstring
140-
Toggle rendering of triangular (derived) mesh. Off by default
141+
Sets new rendering settings, triggers repaint
141142
%End
142143

143-
void setActiveScalarDataset( int index = -1 );
144-
void setActiveVectorDataset( int index = -1 );
144+
QgsMeshRendererScalarSettings rendererScalarSettings() const /Factory/;
145+
%Docstring
146+
Returns rendrer settings
147+
%End
145148

149+
void setRendererScalarSettings( const QgsMeshRendererScalarSettings &settings );
150+
%Docstring
151+
Sets new rendering settings, triggers repaint
152+
%End
153+
154+
QgsMeshRendererVectorSettings rendererVectorSettings() const /Factory/;
155+
%Docstring
156+
Returns rendrer settings
157+
%End
158+
159+
void setRendererVectorSettings( const QgsMeshRendererVectorSettings &settings );
160+
%Docstring
161+
Sets new rendering settings, triggers repaint
162+
%End
163+
164+
void setActiveScalarDataset( int index = -1 );
165+
%Docstring
166+
Sets active scalar dataset for rendering
167+
%End
146168
int activeScalarDataset() const;
169+
%Docstring
170+
Returns active scalar dataset
171+
%End
172+
173+
void setActiveVectorDataset( int index = -1 );
174+
%Docstring
175+
Sets active vector dataset for rendering. If dataset is not vector based, do nothing
176+
%End
177+
int activeVectorDataset() const;
178+
%Docstring
179+
Returns active vector dataset
180+
%End
147181

148182
private: // Private methods
149183
QgsMeshLayer( const QgsMeshLayer &rhs );

0 commit comments

Comments
 (0)
Please sign in to comment.