<div class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">As I am new baby, I may be sauciness or wise guy or inexperience, but or I am. I also do not know whether these adjectives are appropriate for me. :-)&nbsp;But I wondered to ask... just commenting...
<br><br>Backward compatibility is cared, isn&#39;t? I mean there is obvious reason to add setColorShadingAlgorithm and setContrastEnhancementAlgorithm in 0.9.2.<br><br>Isn't it possible to keep setColorRampingType and setColorScalingAlgorithm also in 
0.9.2? They exist in 0.9.1 that is released. Version 0.9.1 and 0.9.2 is so close. <br><br>I know the reason is that "Tradeoff between backward compatibility and architectural quality." howver, the change of code is so fast. Is it normal case for Linux? Or is QGIS fast growing and developing environment? Thanks for your efforts.
<br>&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><br>With my best regard,<br>Volkan Kepoglu<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 1/24/08, <b class="gmail_sendername">Peter Ersts</b> &lt;<a href="mailto:ersts@amnh.org">ersts@amnh.org</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Martin,<br><br>QgsRasterLayer::setDrawingStyle()&nbsp;&nbsp;[Same in 0.9.1]<br>QgsRasterLayer-&gt;setColorShadingAlgorithm() [was setColorRampingType in 
0.91]<br>QgsRasterLayer-&gt;setContrastEnhancementAlgorithm() [was<br>setColorScalingAlgorithm in 0.9.1]<br>***Each of these sets a corresponding get method. And these are the only<br>three things that must be understood to draw a raster layer
<br><br>in 0.9.2, the abstracted draw process per pixel is:<br>For gray scale or RGB images<br>Read data from band -&gt; Check NoDataValue -&gt; Get transparency level -&gt;<br>Stretch -&gt; Invert (if necessary) -&gt; Display
<br>For paletted, pseudo color, for custom color maps<br>Read data from band -&gt; Check NoDataValue -&gt; Get transparency level -&gt;<br>Shade(color) -&gt; Invert (if necessary) -&gt; Display<br><br>There are now a couple of new classes:
<br>QgsContrastEnhancement - This class is responsible for implementing the<br>contrast enhancement. QgsRasterLayer calls<br>QgsContrastEnhancement::stretch(pixel value) and is returned a stretched<br>value(int). The actual stretching is done by what ever the current
<br>QgsContrastEnhancementFunction [virtual base class] does. This is a per<br>pixel operation at the moment, because it is close to a direct port of<br>what was previously being done in the draw loop in QgsRasterLayer. For 8
<br>and 16 bit data a lookup table is generated to speed things up, 32-bit<br>data are computed each call to stretch().<br><br>QgsRasterShader - Is similar in idea to QgsContrastEnhancement, but no<br>lookup table at the moment. QgsRasterShader::generateShadedValue(pixel
<br>value, &amp;returnRed, &amp;returnGreen, &amp;returnBlue) computes a RGB value for<br>the provided pixel value. The actual computation is done by a<br>QgsRasterShaderFunction[virtual base class].<br><br>Programatically, you could create your own shader or contrast
<br>enhancement function by inheriting the base QgsRasterShaderFunction or<br>QgsConstrastEnhancementFunction then calling,<br>QgsRasterLayer::setContrastEnhancementFunction(new<br>MyContrastEnhancementFunction())<br>QgsRasterLater::setSetRasterShaderFunction(new MyRasterShaderFunction())
<br><br>Hope that helps a little....<br><br>-pete<br><br>Martin Dobias wrote:<br>&gt; Hi Tim,<br>&gt;<br>&gt; thanks for the snippet. I&#39;ve updated the examples accordingly, I&#39;ve<br>&gt; also kept the older version for those interested.
<br>&gt; <a href="http://blog.qgis.org/?q=node/59">http://blog.qgis.org/?q=node/59</a><br>&gt;<br>&gt; Beware - you need most recent SVN trunk since it now contains fixes to<br>&gt; bindings which got broken by the recent merges.
<br>&gt;<br>&gt; Is there any source of information how does the raster<br>&gt; rendering/handling work now? I was unable to find anything and some of<br>&gt; the terms are quite new to me...<br>&gt;<br>&gt; Bye<br>&gt; Martin
<br>&gt;<br>&gt; 2008/1/24 Tim Sutton &lt;<a href="mailto:tim@linfiniti.com">tim@linfiniti.com</a>&gt;:<br>&gt;<br>&gt;&gt; Hi<br>&gt;&gt;<br>&gt;&gt; Yes the raster API is changed. I dont know the python stuff so well<br>
&gt;&gt; but in the case of C++&nbsp;&nbsp;you would do something like this:<br>&gt;&gt;<br>&gt;&gt; 117&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mpRasterLayer-&gt;setDrawingStyle(QgsRasterLayer::SINGLE_BAND_PSEUDO_COLOR);<br>&gt;&gt; 118&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mpRasterLayer-&gt;setColorShadingAlgorithm(QgsRasterLayer::PSEUDO_COLOR);
<br>&gt;&gt; 119&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mpRasterLayer-&gt;setContrastEnhancementAlgorithm(<br>&gt;&gt; 120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QgsContrastEnhancement::STRETCH_TO_MINMAX, false);<br>&gt;&gt;<br>&gt;&gt; You will need to translate that to python api but it should be quite
<br>&gt;&gt; similar. Take a look at<br>&gt;&gt; <a href="http://svn.qgis.org/trac/browser/trunk/qgis/src/core/raster/qgsrasterlayer.h">http://svn.qgis.org/trac/browser/trunk/qgis/src/core/raster/qgsrasterlayer.h</a><br>&gt;&gt; for the different drawing styles and shading algorithms you can use.
<br>&gt;&gt;<br>&gt;&gt; Regards<br>&gt;&gt;<br>&gt;&gt; Tim<br>&gt;&gt;<br>&gt;&gt; 2008/1/23, Martin Dobias &lt;<a href="mailto:wonder.sk@gmail.com">wonder.sk@gmail.com</a>&gt;:<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;&gt; 2008/1/23 volkan kepoglu &lt;
<a href="mailto:vkepoglu@gmail.com">vkepoglu@gmail.com</a>&gt;:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; downloaded QGIS tutorials in python, changed qgis_prefix and runned<br>&gt;&gt;&gt;&gt; 2_basic_main_window and 3_basic_labelling successfully,
<br>&gt;&gt;&gt;&gt; but 4_adding_rasters_to_canvas gives the following error;<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; vkepoglu@vkepoglu:~/qgis/tutorials/4_adding_rasters_to_canvas$ python<br>&gt;&gt;&gt;&gt; mainwindow.py
<br>&gt;&gt;&gt;&gt; Traceback (most recent call last):<br>&gt;&gt;&gt;&gt;&nbsp;&nbsp; File &quot; mainwindow.py&quot;, line 76, in addLayer<br>&gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; layer.setColorRampingType(QgsRasterLayer.BLUE_GREEN_RED)<br>&gt;&gt;&gt;&gt; AttributeError: setColorRampingType
<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt; Ah, that will be caused by the recent refactoring of the raster classes.<br>&gt;&gt;&gt; Peter / Tim - can you suggest how to change the code to make it working again?<br>&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; how can ý fix?<br>&gt;&gt;&gt;&gt; or the most important than to fix this,<br>&gt;&gt;&gt;&gt; how can ý learn to qgis bindings to python.<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; where should ý look for reference of python bindings
<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; <a href="http://wiki.qgis.org/qgiswiki/PythonBindings">http://wiki.qgis.org/qgiswiki/PythonBindings</a>, is there any other references?<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt; Today I&#39;ve updated PythonBindings wiki page with some resources
<br>&gt;&gt;&gt; (listed in top part in Using PyQGIS section). Basically it&#39;s good to<br>&gt;&gt;&gt; look at QGIS C++ API reference, QGIS blog, tutorials ported to Python<br>&gt;&gt;&gt; and QGIS plugins that have been done already. (all links listed there)
<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Martin<br>&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt; Qgis-developer mailing list<br>&gt;&gt;&gt; <a href="mailto:Qgis-developer@lists.qgis.org">Qgis-developer@lists.qgis.org
</a><br>&gt;&gt;&gt; <a href="http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer">http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt; --<br>&gt;&gt; Tim Sutton
<br>&gt;&gt; QGIS Project Steering Committee Member - Release&nbsp;&nbsp;Manager<br>&gt;&gt; Visit <a href="http://qgis.org">http://qgis.org</a> for a great open source GIS<br>&gt;&gt; openModeller Desktop Developer<br>&gt;&gt; Visit 
<a href="http://openModeller.sf.net">http://openModeller.sf.net</a> for a great open source ecological<br>&gt;&gt; niche modelling tool<br>&gt;&gt; Home Page: <a href="http://tim.linfiniti.com">http://tim.linfiniti.com</a>
<br>&gt;&gt; Skype: timlinux<br>&gt;&gt; Irc: timlinux on #qgis at <a href="http://freenode.net">freenode.net</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt; _______________________________________________<br>&gt; Qgis-developer mailing list
<br>&gt; <a href="mailto:Qgis-developer@lists.qgis.org">Qgis-developer@lists.qgis.org</a><br>&gt; <a href="http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer">http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
</a><br>&gt;<br>&gt;<br><br><br>--<br>====================================<br>Peter J. Ersts, Project Specialist<br>American Museum of Natural History<br>Center for Biodiversity and Conservation<br>Central Park West at 79th Street
<br>New York, New York 10024<br>Tel: Home Office (518)-632-4745 or NYC Office (212)-496-3488<br>Web: <a href="http://biodiversityinformatics.amnh.org">http://biodiversityinformatics.amnh.org</a><br>Web: <a href="http://cbc.amnh.org">
http://cbc.amnh.org</a><br><br>Quantum GIS Raster Development Team. Visit <a href="http://www.qgis.org">http://www.qgis.org</a><br>to learn more about QGIS, a free and open source desktop GIS<br><br>Open Source,<br>...evolving through community cooperation to change the world bit by bit
<br><br></blockquote></div><br>