@@ -12,17 +12,8 @@ class QgsRasterBlock
1212 * @param theDataType raster data type
1313 * @param theWidth width of data matrix
1414 * @param theHeight height of data matrix
15- * @note not available in python bindings (use variant with theNoDataValue)
1615 */
17- // QgsRasterBlock( Qgis::DataType theDataType, int theWidth, int theHeight );
18-
19- /* * \brief Constructor which allocates data block in memory
20- * @param theDataType raster data type
21- * @param theWidth width of data matrix
22- * @param theHeight height of data matrix
23- * @param theNoDataValue the value representing no data (NULL)
24- */
25- QgsRasterBlock ( Qgis::DataType theDataType, int theWidth, int theHeight, double theNoDataValue );
16+ QgsRasterBlock ( Qgis::DataType theDataType, int theWidth, int theHeight );
2617
2718 virtual ~QgsRasterBlock ();
2819
@@ -31,18 +22,8 @@ class QgsRasterBlock
3122 * @param theWidth width of data matrix
3223 * @param theHeight height of data matrix
3324 * @return true on success
34- * @note not available in python bindings (use variant with theNoDataValue)
3525 */
36- // bool reset( Qgis::DataType theDataType, int theWidth, int theHeight );
37-
38- /* * \brief Reset block
39- * @param theDataType raster data type
40- * @param theWidth width of data matrix
41- * @param theHeight height of data matrix
42- * @param theNoDataValue the value representing no data (NULL)
43- * @return true on success
44- */
45- bool reset ( Qgis::DataType theDataType, int theWidth, int theHeight, double theNoDataValue );
26+ bool reset ( Qgis::DataType theDataType, int theWidth, int theHeight );
4627
4728 // TODO: consider if use isValid() at all, isEmpty() should be sufficient
4829 // and works also if block is valid but empty - difference between valid and empty?
@@ -80,7 +61,9 @@ class QgsRasterBlock
8061 static Qgis::DataType typeWithNoDataValue ( Qgis::DataType dataType, double *noDataValue );
8162
8263 /* * True if the block has no data value.
83- * @return true if the block has no data value */
64+ * @return true if the block has no data value
65+ * @see noDataValue(), setNoDataValue(), resetNoDataValue()
66+ */
8467 bool hasNoDataValue () const ;
8568
8669 /* * Returns true if the block may contain no data. It does not guarantee
@@ -89,9 +72,24 @@ class QgsRasterBlock
8972 * @return true if the block may contain no data */
9073 bool hasNoData () const ;
9174
75+ /* * Sets cell value that will be considered as "no data".
76+ * @note added in QGIS 3.0
77+ * @see noDataValue(), hasNoDataValue(), resetNoDataValue()
78+ */
79+ void setNoDataValue ( double noDataValue );
80+
81+ /* * Reset no data value: if there was a no data value previously set,
82+ * it will be discarded.
83+ * @note added in QGIS 3.0
84+ * @see noDataValue(), hasNoDataValue(), setNoDataValue()
85+ */
86+ void resetNoDataValue ();
87+
9288 /* * Return no data value. If the block does not have a no data value the
9389 * returned value is undefined.
94- * @return No data value */
90+ * @return No data value
91+ * @see hasNoDataValue(), setNoDataValue(), resetNoDataValue()
92+ */
9593 double noDataValue () const ;
9694
9795 /* * Get byte array representing a value.
@@ -197,6 +195,16 @@ class QgsRasterBlock
197195 * @note added in QGIS 2.10 */
198196 void setIsData ( qgssize index );
199197
198+ /* * Get access to raw data.
199+ * The returned QByteArray instance is not a copy of the data: it only refers to the array
200+ * owned by the QgsRasterBlock, therefore it is only valid while the QgsRasterBlock object
201+ * still exists. Writing to the returned QByteArray will not affect the original data:
202+ * a deep copy of the data will be made and only the local copy will be modified.
203+ * @note in Python the method returns ordinary bytes object as the
204+ * @note added in QGIS 3.0
205+ */
206+ QByteArray data () const ;
207+
200208 /* * \brief Get pointer to data
201209 * @param row row index
202210 * @param column column index
0 commit comments