A raster provider is not said it is a GDAL provider, so such functionalitites must not be fitted to GDAL only...<div><br></div><div>giovanni<br><br><div class="gmail_quote">2012/5/10 Etienne Tourigny <span dir="ltr"><<a href="mailto:etourigny.dev@gmail.com" target="_blank">etourigny.dev@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, May 10, 2012 at 10:03 AM, Etienne Tourigny<br>
<<a href="mailto:etourigny.dev@gmail.com">etourigny.dev@gmail.com</a>> wrote:<br>
> You are right, that is the best approach. However, it might be best<br>
> to auto-load when the user actually switches to the tab.<br>
><br>
> A pain gdal does not have an API to query if the histogram is already<br>
> computed - this would require adding PAM-aware code to the gdal<br>
> provider.<br>
><br>
<br>
I need to correct myself - PamFindMatchingHistogram() is available in<br>
gdal_pam.h and could be used to test if a cached histogram exists -<br>
provided the raster is a pam raster.<br>
<br>
However, it seems the raster provider uses the C GDAL API - rather<br>
than the C++ API , could this be changed easily?<br>
<br>
Etienne<br>
<br>
> Etienne<br>
><br>
> On Wed, May 9, 2012 at 9:53 PM, Nathan Woodrow <<a href="mailto:madmanwoo@gmail.com">madmanwoo@gmail.com</a>> wrote:<br>
>> Generally it is good practice that the UI remembers where the user left it<br>
>> last time. In this case this has a bad user experience because of the slow<br>
>> loading. My suggestion would be to just add a "Load histogram" button in<br>
>> the histogram tab that loads the histogram rather then when the tab is<br>
>> switched to. This way even if the histogram tab is remembered as the<br>
>> current tab it will load like normal and user has to click "Load histogram"<br>
>> to show it.<br>
>><br>
>> - Nathan<br>
>><br>
>><br>
>> On Thu, May 10, 2012 at 10:49 AM, Etienne Tourigny <<a href="mailto:etourigny.dev@gmail.com">etourigny.dev@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> I agree that this should not happen, should the default be always open<br>
>>> the first tab, or only when the histogram tab was previously selected?<br>
>>><br>
>>> Unfortunately there is no function in the provider API to know if<br>
>>> there is a cached histogram, so it would be better to never allow the<br>
>>> properties window to start on the histogram tab.<br>
>>><br>
>>> I have implemented this in a branch of mine to improve the histogram<br>
>>> tab, here is a snippet:<br>
>>><br>
>>> - tabBar->setCurrentIndex( settings.value(<br>
>>> "/Windows/RasterLayerProperties/row" ).toInt() );<br>
>>> + int currentTabIndex = settings.value(<br>
>>> "/Windows/RasterLayerProperties/row" ).toInt();<br>
>>> + // if current tab is disabled, use first tab<br>
>>> + if ( ! tabBar->widget( currentTabIndex )->isEnabled() )<br>
>>> + currentTabIndex = 0;<br>
>>> + // if current tab is histogram, use first tab (to avoid long<br>
>>> histogram queries)<br>
>>> + // there is currently no way to know if there ia a cached histogram<br>
>>> int myHistogramTab = 6;<br>
>>> - if ( tabBar->currentIndex() == myHistogramTab )<br>
>>> - {<br>
>>> - refreshHistogram();<br>
>>> - }<br>
>>> + if ( currentTabIndex == myHistogramTab )<br>
>>> + currentTabIndex = 0;<br>
>>> + tabBar->setCurrentIndex( currentTabIndex );<br>
>>><br>
>>><br>
>>> Etienne<br>
>>><br>
>>> On Mon, May 7, 2012 at 10:15 AM, G. Allegri <<a href="mailto:giohappy@gmail.com">giohappy@gmail.com</a>> wrote:<br>
>>> > A complex object to say something simple :(<br>
>>> > When a user opens a layer settings window and hits a tab, the same tab<br>
>>> > index<br>
>>> > is kept when opening another layer settings, or in a new qgis sessions.<br>
>>> > I had a small raster layer, and I opened the histogram tab.<br>
>>> > The today I've opened a big raster layer, and opening the layer settings<br>
>>> > caused my pc running and running, till a complete qgis crash.<br>
>>> > I supposed it was something with the settings, so I opened the smalle<br>
>>> > raster, changed the tab to Style, then I was able to open the large<br>
>>> > raster<br>
>>> > settings<br>
>>> > It's corner case probably, and qgis shouldn't crash with huge raster<br>
>>> > histograms. Anyway, opening the layer settings to the frist tab would<br>
>>> > avoid<br>
>>> > heartbreaks :)<br>
>>> ><br>
>>> > giovanni<br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Qgis-developer mailing list<br>
>>> > <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>>> > <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>>> ><br>
>>> _______________________________________________<br>
>>> Qgis-developer mailing list<br>
>>> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
>>> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>><br>
>><br>
</blockquote></div><br></div>