mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-03 00:14:12 -05:00 
			
		
		
		
	Revert "Add methods for retrieving extra parameters from symbol render"
This reverts commit fe9461be05043daf34057a85e57424f99eeae43d. The commit was originally added for a label based feature which needed to be reworked after recent labeling changes. Reverting this commit to avoid polluting the API.
This commit is contained in:
		
							parent
							
								
									abf4e12181
								
							
						
					
					
						commit
						57275cea9e
					
				@ -263,15 +263,6 @@ class QgsFeatureRendererV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setForceRasterRender( bool forceRaster );
 | 
					    void setForceRasterRender( bool forceRaster );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Returns the result of the feature rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderFeature).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 renderFeature
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderFeature return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsFeatureRendererV2( QString type );
 | 
					    QgsFeatureRendererV2( QString type );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -300,16 +291,6 @@ class QgsFeatureRendererV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void copyPaintEffect( QgsFeatureRendererV2 *destRenderer ) const;
 | 
					    void copyPaintEffect( QgsFeatureRendererV2 *destRenderer ) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Sets the result of the symbol rendering operation. Subclasses should call
 | 
					 | 
				
			||||||
     * this method after rendering a feature and update the render result to reflect
 | 
					 | 
				
			||||||
     * to actual result of the feature render.
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the renderFeature method
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    void setRenderResult( const QgsRenderResult& result );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private:
 | 
					  private:
 | 
				
			||||||
    QgsFeatureRendererV2( const QgsFeatureRendererV2 & );
 | 
					    QgsFeatureRendererV2( const QgsFeatureRendererV2 & );
 | 
				
			||||||
    QgsFeatureRendererV2 & operator=( const QgsFeatureRendererV2 & );
 | 
					    QgsFeatureRendererV2 & operator=( const QgsFeatureRendererV2 & );
 | 
				
			||||||
 | 
				
			|||||||
@ -260,15 +260,6 @@ class QgsSymbolLayerV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setPaintEffect( QgsPaintEffect* effect /Transfer/);
 | 
					    void setPaintEffect( QgsPaintEffect* effect /Transfer/);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Returns the result of the symbol rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderPoint).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
 | 
					    QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -315,16 +306,6 @@ class QgsSymbolLayerV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
 | 
					    void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Sets the result of the symbol rendering operation. Subclasses should call
 | 
					 | 
				
			||||||
     * this method after rendering a symbol and update the render result to reflect
 | 
					 | 
				
			||||||
     * to actual result of the symbol render.
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    void setRenderResult( const QgsRenderResult& result );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//////////////////////
 | 
					//////////////////////
 | 
				
			||||||
 | 
				
			|||||||
@ -1,39 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
 | 
					typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \ingroup core
 | 
					 | 
				
			||||||
 * \class QgsRenderResult
 | 
					 | 
				
			||||||
 * \brief A simple container for the results of a rendering operation
 | 
					 | 
				
			||||||
 * \note Added in version 2.12
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class QgsRenderResult
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
%TypeHeaderCode
 | 
					 | 
				
			||||||
#include <qgssymbolv2.h>
 | 
					 | 
				
			||||||
%End
 | 
					 | 
				
			||||||
  public:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Constructor for QgsRenderResult
 | 
					 | 
				
			||||||
     * @param symbolRendered initial value for symbolRendered member
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    QgsRenderResult( bool symbolRendered );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Bounds of rendered symbol shape.
 | 
					 | 
				
			||||||
     * @note only implemented for marker symbol types
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    QRectF symbolBounds;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //! True if a symbol was rendered during the render operation
 | 
					 | 
				
			||||||
    bool symbolRendered;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Unites the render result with another QgsRenderResult object
 | 
					 | 
				
			||||||
     * @param other other render result
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void unite( const QgsRenderResult& other );
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class QgsSymbolV2
 | 
					class QgsSymbolV2
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
%TypeHeaderCode
 | 
					%TypeHeaderCode
 | 
				
			||||||
@ -196,15 +163,6 @@ class QgsSymbolV2
 | 
				
			|||||||
    void setLayer( const QgsVectorLayer* layer );
 | 
					    void setLayer( const QgsVectorLayer* layer );
 | 
				
			||||||
    const QgsVectorLayer* layer() const;
 | 
					    const QgsVectorLayer* layer() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     /** Returns the result of the symbol rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderPoint).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers /Transfer/ ); // can't be instantiated
 | 
					    QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers /Transfer/ ); // can't be instantiated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -541,18 +541,15 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QgsRenderResult result( true );
 | 
					 | 
				
			||||||
  if ( mUsingCache )
 | 
					  if ( mUsingCache )
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    //QgsDebugMsg( QString("XXX using cache") );
 | 
					    //QgsDebugMsg( QString("XXX using cache") );
 | 
				
			||||||
    // we will use cached image
 | 
					    // we will use cached image
 | 
				
			||||||
    QImage &img = context.selected() ? mSelCache : mCache;
 | 
					    QImage &img = context.selected() ? mSelCache : mCache;
 | 
				
			||||||
    double s = img.width() / context.renderContext().rasterScaleFactor();
 | 
					    double s = img.width() / context.renderContext().rasterScaleFactor();
 | 
				
			||||||
    QRectF imgRect( point.x() - s / 2.0 + off.x(),
 | 
					    p->drawImage( QRectF( point.x() - s / 2.0 + off.x(),
 | 
				
			||||||
                          point.y() - s / 2.0 + off.y(),
 | 
					                          point.y() - s / 2.0 + off.y(),
 | 
				
			||||||
                    s, s );
 | 
					                          s, s ), img );
 | 
				
			||||||
    p->drawImage( imgRect, img );
 | 
					 | 
				
			||||||
    result.symbolBounds = imgRect;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -609,25 +606,11 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
 | 
				
			|||||||
    p->setBrush( context.selected() ? mSelBrush : mBrush );
 | 
					    p->setBrush( context.selected() ? mSelBrush : mBrush );
 | 
				
			||||||
    p->setPen( context.selected() ? mSelPen : mPen );
 | 
					    p->setPen( context.selected() ? mSelPen : mPen );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QRectF boundingRect;
 | 
					 | 
				
			||||||
    if ( !mPolygon.isEmpty() )
 | 
					    if ( !mPolygon.isEmpty() )
 | 
				
			||||||
    {
 | 
					      p->drawPolygon( transform.map( mPolygon ) );
 | 
				
			||||||
      QPolygonF transformed = transform.map( mPolygon );
 | 
					 | 
				
			||||||
      boundingRect = transformed.boundingRect();
 | 
					 | 
				
			||||||
      p->drawPolygon( transformed );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					      p->drawPath( transform.map( mPath ) );
 | 
				
			||||||
      QPainterPath transformed = transform.map( mPath );
 | 
					 | 
				
			||||||
      boundingRect = transformed.boundingRect();
 | 
					 | 
				
			||||||
      p->drawPath( transformed );
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    //adjust bounding rect for pen width
 | 
					 | 
				
			||||||
    result.symbolBounds = boundingRect.adjusted( -mPen.widthF() / 2.0, -mPen.widthF() / 2.0,
 | 
					 | 
				
			||||||
                          mPen.widthF() / 2.0, mPen.widthF() / 2.0 );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  setRenderResult( result );
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -218,7 +218,6 @@ QgsFeatureRendererV2::QgsFeatureRendererV2( QString type )
 | 
				
			|||||||
    , mCurrentVertexMarkerSize( 3 )
 | 
					    , mCurrentVertexMarkerSize( 3 )
 | 
				
			||||||
    , mPaintEffect( 0 )
 | 
					    , mPaintEffect( 0 )
 | 
				
			||||||
    , mForceRaster( false )
 | 
					    , mForceRaster( false )
 | 
				
			||||||
    , mRenderResult( QgsRenderResult( true ) )
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  mPaintEffect = QgsPaintEffectRegistry::defaultStack();
 | 
					  mPaintEffect = QgsPaintEffectRegistry::defaultStack();
 | 
				
			||||||
  mPaintEffect->setEnabled( false );
 | 
					  mPaintEffect->setEnabled( false );
 | 
				
			||||||
@ -271,13 +270,9 @@ bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext&
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  QgsSymbolV2* symbol = symbolForFeature( feature, context );
 | 
					  QgsSymbolV2* symbol = symbolForFeature( feature, context );
 | 
				
			||||||
  if ( symbol == NULL )
 | 
					  if ( symbol == NULL )
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    setRenderResult( QgsRenderResult( false ) );
 | 
					 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
 | 
					  renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
 | 
				
			||||||
  setRenderResult( symbol->renderResult() );
 | 
					 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -815,8 +810,3 @@ void QgsFeatureRendererV2::convertSymbolRotation( QgsSymbolV2 * symbol, const QS
 | 
				
			|||||||
    s->setDataDefinedAngle( dd );
 | 
					    s->setDataDefinedAngle( dd );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
void QgsFeatureRendererV2::setRenderResult( const QgsRenderResult& result )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  mRenderResult = result;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -311,15 +311,6 @@ class CORE_EXPORT QgsFeatureRendererV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setForceRasterRender( bool forceRaster ) { mForceRaster = forceRaster; }
 | 
					    void setForceRasterRender( bool forceRaster ) { mForceRaster = forceRaster; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Returns the result of the feature rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderFeature).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 renderFeature
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderFeature return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const { return mRenderResult; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsFeatureRendererV2( QString type );
 | 
					    QgsFeatureRendererV2( QString type );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -370,20 +361,8 @@ class CORE_EXPORT QgsFeatureRendererV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    static void convertSymbolRotation( QgsSymbolV2 * symbol, const QString & field );
 | 
					    static void convertSymbolRotation( QgsSymbolV2 * symbol, const QString & field );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Sets the result of the symbol rendering operation. Subclasses should call
 | 
					 | 
				
			||||||
     * this method after rendering a feature and update the render result to reflect
 | 
					 | 
				
			||||||
     * to actual result of the feature render.
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the renderFeature method
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    void setRenderResult( const QgsRenderResult& result );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private:
 | 
					  private:
 | 
				
			||||||
    Q_DISABLE_COPY( QgsFeatureRendererV2 )
 | 
					    Q_DISABLE_COPY( QgsFeatureRendererV2 )
 | 
				
			||||||
 | 
					 | 
				
			||||||
    QgsRenderResult mRenderResult;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// for some reason SIP compilation fails if these lines are not included:
 | 
					// for some reason SIP compilation fails if these lines are not included:
 | 
				
			||||||
 | 
				
			|||||||
@ -816,8 +816,6 @@ bool QgsRuleBasedRendererV2::renderFeature( QgsFeature& feature,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  Q_UNUSED( layer );
 | 
					  Q_UNUSED( layer );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setRenderResult( QgsRenderResult( false ) );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  int flags = ( selected ? FeatIsSelected : 0 ) | ( drawVertexMarker ? FeatDrawMarkers : 0 );
 | 
					  int flags = ( selected ? FeatIsSelected : 0 ) | ( drawVertexMarker ? FeatDrawMarkers : 0 );
 | 
				
			||||||
  mCurrentFeatures.append( FeatureToRender( feature, flags ) );
 | 
					  mCurrentFeatures.append( FeatureToRender( feature, flags ) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -876,10 +874,6 @@ void QgsRuleBasedRendererV2::stopRender( QgsRenderContext& context )
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
          int flags = job->ftr.flags;
 | 
					          int flags = job->ftr.flags;
 | 
				
			||||||
          renderFeatureWithSymbol( job->ftr.feat, job->symbol, context, i, flags & FeatIsSelected, flags & FeatDrawMarkers );
 | 
					          renderFeatureWithSymbol( job->ftr.feat, job->symbol, context, i, flags & FeatIsSelected, flags & FeatDrawMarkers );
 | 
				
			||||||
 | 
					 | 
				
			||||||
          QgsRenderResult newRenderResult = job->symbol->renderResult();
 | 
					 | 
				
			||||||
          newRenderResult.unite( renderResult() );
 | 
					 | 
				
			||||||
          setRenderResult( newRenderResult );
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -334,7 +334,6 @@ QgsSymbolLayerV2::QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked )
 | 
				
			|||||||
    , mLocked( locked )
 | 
					    , mLocked( locked )
 | 
				
			||||||
    , mRenderingPass( 0 )
 | 
					    , mRenderingPass( 0 )
 | 
				
			||||||
    , mPaintEffect( 0 )
 | 
					    , mPaintEffect( 0 )
 | 
				
			||||||
    , mRenderResult( QgsRenderResult( true ) )
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  mPaintEffect = QgsPaintEffectRegistry::defaultStack();
 | 
					  mPaintEffect = QgsPaintEffectRegistry::defaultStack();
 | 
				
			||||||
  mPaintEffect->setEnabled( false );
 | 
					  mPaintEffect->setEnabled( false );
 | 
				
			||||||
@ -483,11 +482,6 @@ void QgsSymbolLayerV2::copyPaintEffect( QgsSymbolLayerV2 *destLayer ) const
 | 
				
			|||||||
  destLayer->setPaintEffect( mPaintEffect->clone() );
 | 
					  destLayer->setPaintEffect( mPaintEffect->clone() );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QgsSymbolLayerV2::setRenderResult( const QgsRenderResult& result )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  mRenderResult = result;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
QgsMarkerSymbolLayerV2::QgsMarkerSymbolLayerV2( bool locked )
 | 
					QgsMarkerSymbolLayerV2::QgsMarkerSymbolLayerV2( bool locked )
 | 
				
			||||||
    : QgsSymbolLayerV2( QgsSymbolV2::Marker, locked )
 | 
					    : QgsSymbolLayerV2( QgsSymbolV2::Marker, locked )
 | 
				
			||||||
    , mAngle( 0 )
 | 
					    , mAngle( 0 )
 | 
				
			||||||
 | 
				
			|||||||
@ -247,15 +247,6 @@ class CORE_EXPORT QgsSymbolLayerV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void setPaintEffect( QgsPaintEffect* effect );
 | 
					    void setPaintEffect( QgsPaintEffect* effect );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Returns the result of the symbol rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderPoint).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const { return mRenderResult; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
 | 
					    QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -316,16 +307,6 @@ class CORE_EXPORT QgsSymbolLayerV2
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
 | 
					    void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Sets the result of the symbol rendering operation. Subclasses should call
 | 
					 | 
				
			||||||
     * this method after rendering a symbol and update the render result to reflect
 | 
					 | 
				
			||||||
     * to actual result of the symbol render.
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    void setRenderResult( const QgsRenderResult& result );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    static const QString EXPR_SIZE;
 | 
					    static const QString EXPR_SIZE;
 | 
				
			||||||
    static const QString EXPR_ANGLE;
 | 
					    static const QString EXPR_ANGLE;
 | 
				
			||||||
    static const QString EXPR_NAME;
 | 
					    static const QString EXPR_NAME;
 | 
				
			||||||
@ -384,10 +365,6 @@ class CORE_EXPORT QgsSymbolLayerV2
 | 
				
			|||||||
    static const QString EXPR_OFFSET_ALONG_LINE;
 | 
					    static const QString EXPR_OFFSET_ALONG_LINE;
 | 
				
			||||||
    static const QString EXPR_HORIZONTAL_ANCHOR_POINT;
 | 
					    static const QString EXPR_HORIZONTAL_ANCHOR_POINT;
 | 
				
			||||||
    static const QString EXPR_VERTICAL_ANCHOR_POINT;
 | 
					    static const QString EXPR_VERTICAL_ANCHOR_POINT;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QgsRenderResult mRenderResult;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//////////////////////
 | 
					//////////////////////
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,6 @@ QgsSymbolV2::QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers )
 | 
				
			|||||||
    , mRenderHints( 0 )
 | 
					    , mRenderHints( 0 )
 | 
				
			||||||
    , mClipFeaturesToExtent( true )
 | 
					    , mClipFeaturesToExtent( true )
 | 
				
			||||||
    , mLayer( 0 )
 | 
					    , mLayer( 0 )
 | 
				
			||||||
    , mRenderResult( QgsRenderResult( true ) )
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // check they're all correct symbol layers
 | 
					  // check they're all correct symbol layers
 | 
				
			||||||
@ -832,8 +831,6 @@ void QgsMarkerSymbolV2::renderPointUsingLayer( QgsMarkerSymbolLayerV2* layer, co
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    layer->renderPoint( point, context );
 | 
					    layer->renderPoint( point, context );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  mRenderResult = layer->renderResult();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderContext& context, int layer, bool selected )
 | 
					void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderContext& context, int layer, bool selected )
 | 
				
			||||||
@ -849,13 +846,10 @@ void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f,
 | 
				
			|||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QgsRenderResult combinedResult( false );
 | 
					 | 
				
			||||||
  for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
 | 
					  for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    renderPointUsingLayer(( QgsMarkerSymbolLayerV2* ) * it, point, symbolContext );
 | 
					    renderPointUsingLayer(( QgsMarkerSymbolLayerV2* ) * it, point, symbolContext );
 | 
				
			||||||
    combinedResult.unite(( *it )->renderResult() );
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  mRenderResult = combinedResult;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QgsSymbolV2* QgsMarkerSymbolV2::clone() const
 | 
					QgsSymbolV2* QgsMarkerSymbolV2::clone() const
 | 
				
			||||||
@ -1038,8 +1032,6 @@ void QgsLineSymbolV2::renderPolylineUsingLayer( QgsLineSymbolLayerV2 *layer, con
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    layer->renderPolyline( points, context );
 | 
					    layer->renderPolyline( points, context );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  mRenderResult = layer->renderResult();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1120,8 +1112,6 @@ void QgsFillSymbolV2::renderPolygonUsingLayer( QgsSymbolLayerV2* layer, const QP
 | 
				
			|||||||
      (( QgsLineSymbolLayerV2* )layer )->renderPolygonOutline( points, rings, context );
 | 
					      (( QgsLineSymbolLayerV2* )layer )->renderPolygonOutline( points, rings, context );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  mRenderResult = layer->renderResult();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QRectF QgsFillSymbolV2::polygonBounds( const QPolygonF& points, const QList<QPolygonF>* rings ) const
 | 
					QRectF QgsFillSymbolV2::polygonBounds( const QPolygonF& points, const QList<QPolygonF>* rings ) const
 | 
				
			||||||
 | 
				
			|||||||
@ -45,48 +45,6 @@ class QgsDataDefined;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
 | 
					typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/** \ingroup core
 | 
					 | 
				
			||||||
 * \class QgsRenderResult
 | 
					 | 
				
			||||||
 * \brief A simple container for the results of a rendering operation
 | 
					 | 
				
			||||||
 * \note Added in version 2.12
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class QgsRenderResult
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  public:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Constructor for QgsRenderResult
 | 
					 | 
				
			||||||
     * @param symbolRendered initial value for symbolRendered member
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    QgsRenderResult( bool symbolRendered )
 | 
					 | 
				
			||||||
        : symbolRendered( symbolRendered )
 | 
					 | 
				
			||||||
    { }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Bounds of rendered symbol shape.
 | 
					 | 
				
			||||||
     * @note only implemented for marker symbol types
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    QRectF symbolBounds;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //! True if a symbol was rendered during the render operation
 | 
					 | 
				
			||||||
    bool symbolRendered;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /** Unites the render result with another QgsRenderResult object
 | 
					 | 
				
			||||||
     * @param other other render result
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    void unite( const QgsRenderResult& other )
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      symbolRendered = symbolRendered || other.symbolRendered;
 | 
					 | 
				
			||||||
      if ( !symbolBounds.isValid() )
 | 
					 | 
				
			||||||
        symbolBounds = other.symbolBounds;
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        symbolBounds = symbolBounds.united( other.symbolBounds );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class CORE_EXPORT QgsSymbolV2
 | 
					class CORE_EXPORT QgsSymbolV2
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public:
 | 
					  public:
 | 
				
			||||||
@ -263,15 +221,6 @@ class CORE_EXPORT QgsSymbolV2
 | 
				
			|||||||
    void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; }
 | 
					    void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; }
 | 
				
			||||||
    const QgsVectorLayer* layer() const { return mLayer; }
 | 
					    const QgsVectorLayer* layer() const { return mLayer; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Returns the result of the symbol rendering operation. This should only be
 | 
					 | 
				
			||||||
     * called immediately after a rendering operation (eg calling renderPoint).
 | 
					 | 
				
			||||||
     * @note added in QGIS 2.12
 | 
					 | 
				
			||||||
     * @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
 | 
					 | 
				
			||||||
     * will return a QgsRenderResult object
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    // TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
 | 
					 | 
				
			||||||
    const QgsRenderResult& renderResult() const { return mRenderResult; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
    QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers ); // can't be instantiated
 | 
					    QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers ); // can't be instantiated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -292,8 +241,6 @@ class CORE_EXPORT QgsSymbolV2
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const QgsVectorLayer* mLayer; //current vectorlayer
 | 
					    const QgsVectorLayer* mLayer; //current vectorlayer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QgsRenderResult mRenderResult;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////
 | 
					///////////////////////
 | 
				
			||||||
@ -352,9 +299,11 @@ class CORE_EXPORT QgsSymbolV2RenderContext
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//////////////////////
 | 
					//////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
 | 
					class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public:
 | 
					  public:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user