[Marble-commits] KDE/kdeedu/marble/src/lib [BROKEN EMAIL]

Torsten Rahn tackat at kde.org
Sat Aug 21 12:52:44 CEST 2010


SVN commit 1166257 by rahn:

- class documentation for StackedTile class.



 M  +3 -0      StackedTile.cpp  
 M  +56 -8     StackedTile.h  


--- trunk/KDE/kdeedu/marble/src/lib/StackedTile.cpp #1166256:1166257
@@ -338,6 +338,9 @@
 
 void StackedTile::initResultTile()
 {
+    // TODO: Free all the TextureTiles once the completion status is reached 
+    // to save memory.
+    
     Q_ASSERT( !d->m_tiles.isEmpty() );
     // if there are more than one active texture layers, we have to convert the
     // result tile into QImage::Format_ARGB32_Premultiplied to make blending possible
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile.h #1166256:1166257
@@ -34,6 +34,33 @@
 class TextureTile;
 class StackedTileLoader;
 
+/*!
+    \class StackedTile
+    \brief A single tile that is composed one or more different tile layers.
+
+    The StackedTile is a tile that covers a certain area and is used 
+    for a particular zoom level. It consists of a <b>stack of several
+    individual thematic TextureTiles</b> that cover the very same area and 
+    are used for the very same zoom level: This stack of TextureTiles is
+    built up from the ground: The first TextureTile at the bottom usually 
+    represents the ground surface. Optionally there might be a range of other
+    TextureTiles stacked on top which cover e.g. relief, streets and clouds.
+    
+    For rendering the whole stack of tiles gets merged and blended into a 
+    single QImage. This merging/blending operation is usually only performed 
+    once the stack of tiles changes. As a result access to the visual 
+    composition of all TextureTile layers is very fast since it is reduced to 
+    a single QImage that also covers very little memory.
+
+    The whole mechanism is comparable to layers in applications like
+    Gimp or Photoshop (TM) which can be blended on top of each other via 
+    so called filters and can be merged into a single layer if required.
+
+    Restrictions: The TextureTiles that are part of the stack need to be of 
+    the same size and need to cover the same area at the same zoom level using 
+    the very same projection.
+*/
+
 class StackedTile : public AbstractTile
 {
     friend class StackedTileLoader;
@@ -49,22 +76,39 @@
     bool forMergedLayerDecorator() const;
     void setForMergedLayerDecorator();
 
+/*!
+    \brief Returns the stack of TextureTiles
+    \return A non-zero pointer to the container of TextureTile objects.
+*/
     QVector<QSharedPointer<TextureTile> > * tiles();
-    QImage const * resultTile() const;
+
+/*!
+    \brief Returns the QImage that describes the merged stack of TextureTiles
+    \return A non-zero pointer to the resulting QImage 
+*/
+    QImage const * resultTile() const; // Note: maybe this should be resultImage() ?
     QImage * resultTile();
 
-    // Here we retrieve the color value of the requested pixel on the tile.
-    // This needs to be done differently for grayscale ( uchar, 1 byte ).
-    // and color ( uint, 4 bytes ) images.
+/*!
+    \brief Returns the color value of the result tile at the given integer position.
+    \return The uint that describes the color value of the given pixel 
 
+    Note: for gray scale images the color value of a single pixel is described
+    via a uchar (1 byte) while for RGB(A) images uint (4 bytes) are used.
+*/
     uint pixel( int x, int y ) const;
     
-    // Here we retrieve the color value of the requested subpixel on the tile.
-    // This needs to be done differently for grayscale ( uchar, 1 byte ).
-    // and color ( uint, 4 bytes ) images.
-    // Subpixel calculation is done via bilinear interpolation.
+/*!
+    \brief Returns the color value of the result tile at a given floating point position.
+    \return The uint that describes the color value of the given pixel 
 
+    Subpixel calculation is done via bilinear interpolation.
+    
+    Note: for gray scale images the color value of a single pixel is described
+    via a uchar (1 byte) while for RGB(A) images uint (4 bytes) are used.
+*/    
     uint pixelF( qreal x, qreal y ) const;
+    // This method passes the top left pixel (if known already) for better performance
     uint pixelF( qreal x, qreal y, const QRgb& pixel ) const;
 
  private:
@@ -72,6 +116,10 @@
     Q_DISABLE_COPY( StackedTile )
 
     void initJumpTables();
+    
+/*!
+    \brief This method performs the actual merge process.
+*/    
     void initResultTile();
 
     StackedTilePrivate *d;


More information about the Marble-commits mailing list