[GRASS-dev] [GRASS GIS] #2175: m.nviz.image: adding transparency_value= changes raster layer stacking order

GRASS GIS trac at osgeo.org
Mon Jan 27 19:57:40 PST 2014


#2175: m.nviz.image: adding transparency_value= changes raster layer stacking
order
----------------------------------------+-----------------------------------
 Reporter:  hamish                      |       Owner:  grass-dev@…              
     Type:  defect                      |      Status:  new                      
 Priority:  normal                      |   Milestone:  6.4.4                    
Component:  Default                     |     Version:  svn-trunk                
 Keywords:  m.nviz.image, transparency  |    Platform:  Linux                    
      Cpu:  x86-64                      |  
----------------------------------------+-----------------------------------

Comment(by hamish):

 Some progress, and a workaround:

 sort_surfs_max() in lib/nviz/draw.c seems working as expected and to
 return the same result both with and without the transparency_value=
 option.

 and yet, bypassing the sort with the following patch seems to fix(bypass)
 the problem:

 {{{
 Index: lib/nviz/draw.c
 ===================================================================
 --- lib/nviz/draw.c     (revision 58790)
 +++ lib/nviz/draw.c     (working copy)
 @@ -107,7 +107,8 @@
         }

         maxvals[indices[i]] = max + 1;
 -       id_sort[i] = surf[indices[i]];
 +//     id_sort[i] = surf[indices[i]];
 +       id_sort[i] = surf[i];
      }

      return 1;
 }}}

 The sort returns layers ordered lowest to highest maximum value, and thus
 for a planar surface cutting through a DEM the DEM will always be higher,
 so the constant surface will always be rendered first, since it has a
 lower maximum (& so will be sorted to first in the list of surfaces to
 render).

 proof:
  by changing the constant surface from elevation_value=100 to 160
 (slightly more than the max of NC's elevation map), it renders correctly.
 By lowering it slightly to 150 (just below elevation's max) the semi-
 transparent constant surface gets overwritten by the DEM.


 The question then becomes do we try and come up with a better sorting
 strategy or render in the order the layers were added, and why does it
 work correctly when transparency_value= is left unset even though the
 layers are sorted with the DEM rendering last? Is there a second bug which
 was masking the first?


 cheers,
 Hamish

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2175#comment:5>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list