[Qgis-developer] Re: Colormap

sergio cavalcante sergio.cavalcante at gmail.com
Wed Aug 12 10:56:06 EDT 2009


Hey guys,

I've solved the problem.

It was just use the function :


mRasterLayer->setRasterShaderFunction(myRasterShaderFunction);

at the end of the applypalette() , and and create the myRasterShaderFunction
this way:

 QgsColorRampShader* myRasterShaderFunction = new QgsColorRampShader(0,255);

instead of this way:

QgsRasterLayer * mypLayer = new
 QgsRasterLayer(myRasterFileInfo.filePath(),myRasterFileInfo.
completeBaseName());


Best Regards,
------------------------------
Sérgio Cavalcante



On Wed, Aug 12, 2009 at 11:03 AM, sergio cavalcante <
sergio.cavalcante at gmail.com> wrote:

> Hello Guys,
>
> I'm with a little problem here trying to "colormaping" a raster.
>
> Here is the code that adds a raster:
> http://pastebin.com/m3d57d2e2
>
> Where:
> - AddRasterLayer is the method that adds a layer to the canvas,
> - qgsImage is the qgsMapCanvas
> - mclLayerSet is the list of the MapLayers
> - ui.twPalette is a TreeWidget that holds the colormap
>
> In this point,
> myRasterShaderFunction->setColorRampItemList( myColorRampItems );
>
> The application exits abnormally.
>
> That's anything that I need to configure in the raster before set this
> variable?
>
> Anyone could help this desperated developer?
>
> Best Regards,
> ------------------------------
> Sérgio Cavalcante
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090812/3179b496/attachment.html


More information about the Qgis-developer mailing list