[Qgis-developer] keeping layer settings tab between layers and qgis sessions can cause problems when histogram tab is the last viewed

Etienne Tourigny etourigny.dev at gmail.com
Thu May 10 06:42:38 PDT 2012


I forgot about that... so far there is grass + gdal providers which
implement populateHistogram(), we could add a hasCachedHistogram() to
the api, default returns false.

This way, it would always render the cached histogram if it exists,
but ask to compute if not.

Etienne

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


More information about the Qgis-developer mailing list