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