mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Transfer ownership of renderer to c++ in sip bindings when calling QgsRasterLayer.setRenderer and when passing shader to QgsSingleBandPseudoColorRenderer. Fixes crash experienced when using python bindings and replacing the shader or renderer of a raster.
This commit is contained in:
parent
05fb39419d
commit
94c2e1cbb0
@ -217,7 +217,7 @@ public:
|
|||||||
//void setUserDefinedRGBMinimumMaximum( bool theBool ); //removed with raster redesign
|
//void setUserDefinedRGBMinimumMaximum( bool theBool ); //removed with raster redesign
|
||||||
|
|
||||||
/**Set raster renderer. Takes ownership of the renderer object*/
|
/**Set raster renderer. Takes ownership of the renderer object*/
|
||||||
void setRenderer( QgsRasterRenderer* renderer );
|
void setRenderer( QgsRasterRenderer* renderer /Transfer/ );
|
||||||
QgsRasterRenderer* renderer();
|
QgsRasterRenderer* renderer();
|
||||||
|
|
||||||
/** \brief Accessor to find out how many standard deviations are being plotted */
|
/** \brief Accessor to find out how many standard deviations are being plotted */
|
||||||
@ -226,7 +226,7 @@ public:
|
|||||||
/** \brief Accessor for transparent band name mapping */
|
/** \brief Accessor for transparent band name mapping */
|
||||||
//QString transparentBandName() const; //removed with raster redesign
|
//QString transparentBandName() const; //removed with raster redesign
|
||||||
|
|
||||||
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data?
|
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data?
|
||||||
* @deprecated in 2.0
|
* @deprecated in 2.0
|
||||||
*/
|
*/
|
||||||
bool usesProvider() /Deprecated/;
|
bool usesProvider() /Deprecated/;
|
||||||
@ -271,14 +271,14 @@ public:
|
|||||||
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option
|
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option
|
||||||
\note added in v1.6 */
|
\note added in v1.6 */
|
||||||
void computeMinimumMaximumEstimates( int theBand, double& theMin /Out/, double& theMax /Out/ );
|
void computeMinimumMaximumEstimates( int theBand, double& theMin /Out/, double& theMax /Out/ );
|
||||||
|
|
||||||
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent */
|
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent */
|
||||||
// (would need MethodCode directive) void computeMinimumMaximumFromLastExtent( int theBand, double* theMinMax );
|
// (would need MethodCode directive) void computeMinimumMaximumFromLastExtent( int theBand, double* theMinMax );
|
||||||
|
|
||||||
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent */
|
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent */
|
||||||
// (would need MethodCode directive) void computeMinimumMaximumFromLastExtent( QString theBand, double* theMinMax );
|
// (would need MethodCode directive) void computeMinimumMaximumFromLastExtent( QString theBand, double* theMinMax );
|
||||||
|
|
||||||
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent
|
/** \brief Compute the actual minimum maximum pixel values based on the current (last) display extent
|
||||||
\note added in v1.6 */
|
\note added in v1.6 */
|
||||||
void computeMinimumMaximumFromLastExtent( int theBand, double& theMin /Out/, double& theMax /Out/ );
|
void computeMinimumMaximumFromLastExtent( int theBand, double& theMin /Out/, double& theMax /Out/ );
|
||||||
|
|
||||||
@ -366,12 +366,12 @@ public:
|
|||||||
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
|
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
|
||||||
QPixmap paletteAsPixmap( int theBand = 1 );
|
QPixmap paletteAsPixmap( int theBand = 1 );
|
||||||
|
|
||||||
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
|
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
|
||||||
* @note added in 2.0
|
* @note added in 2.0
|
||||||
*/
|
*/
|
||||||
QString providerType() const;
|
QString providerType() const;
|
||||||
|
|
||||||
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
|
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer?
|
||||||
* @deprecated in 2.0
|
* @deprecated in 2.0
|
||||||
*/
|
*/
|
||||||
QString providerKey() const /Deprecated/;
|
QString providerKey() const /Deprecated/;
|
||||||
|
@ -124,7 +124,7 @@ class QgsSingleBandPseudoColorRenderer: QgsRasterRenderer
|
|||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
/**Note: takes ownership of QgsRasterShader*/
|
/**Note: takes ownership of QgsRasterShader*/
|
||||||
QgsSingleBandPseudoColorRenderer( QgsRasterDataProvider* provider, int band, QgsRasterShader* shader );
|
QgsSingleBandPseudoColorRenderer( QgsRasterDataProvider* provider, int band, QgsRasterShader* shader /Transfer/ );
|
||||||
~QgsSingleBandPseudoColorRenderer();
|
~QgsSingleBandPseudoColorRenderer();
|
||||||
QgsRasterInterface * clone();
|
QgsRasterInterface * clone();
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ class TestQgsRasterLayer(unittest.TestCase):
|
|||||||
myPseudoRenderer = QgsSingleBandPseudoColorRenderer(myRasterLayer.dataProvider(), 1, myRasterShader)
|
myPseudoRenderer = QgsSingleBandPseudoColorRenderer(myRasterLayer.dataProvider(), 1, myRasterShader)
|
||||||
myRasterLayer.setRenderer(myPseudoRenderer)
|
myRasterLayer.setRenderer(myPseudoRenderer)
|
||||||
|
|
||||||
|
return
|
||||||
######## works first time #############
|
######## works first time #############
|
||||||
|
|
||||||
myRasterShader = QgsRasterShader()
|
myRasterShader = QgsRasterShader()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user