Skip to content
Permalink
Browse files

[pal] Some const correctness and avoid passing large object by value

  • Loading branch information
nyalldawson committed Feb 5, 2015
1 parent 249af5f commit e4fb95fad1068f1499446c578b6fe09bf5966372
Showing with 46 additions and 46 deletions.
  1. +19 −19 python/core/qgspallabeling.sip
  2. +7 −7 src/core/qgspallabeling.cpp
  3. +20 −20 src/core/qgspallabeling.h
@@ -558,44 +558,44 @@ class QgsLabelComponent

// methods

const QString& text();
const QString& text() const;
void setText( const QString& text );

const QgsPoint& origin();
void setOrigin( QgsPoint point );
const QgsPoint& origin() const;
void setOrigin( const QgsPoint& point );

bool useOrigin() const;
void setUseOrigin( bool use );
void setUseOrigin( const bool use );

double rotation() const;
void setRotation( double rotation );
void setRotation( const double rotation );

double rotationOffset() const;
void setRotationOffset( double rotation );
void setRotationOffset( const double rotation );

bool useRotation() const;
void setUseRotation( bool use );
void setUseRotation( const bool use );

const QgsPoint& center();
void setCenter( QgsPoint point );
const QgsPoint& center() const;
void setCenter( const QgsPoint& point );

bool useCenter() const;
void setUseCenter( bool use );
void setUseCenter( const bool use );

const QgsPoint& size();
void setSize( QgsPoint point );
const QgsPoint& size() const;
void setSize( const QgsPoint& point );

const QgsPoint& offset();
void setOffset( QgsPoint point );
const QgsPoint& offset() const;
void setOffset( const QgsPoint& point );

const QPicture* picture();
const QPicture* picture() const;
void setPicture( QPicture* picture );

double pictureBuffer() const;
void setPictureBuffer( double buffer );
void setPictureBuffer( const double buffer );

double dpiRatio() const;
void setDpiRatio( double ratio );
void setDpiRatio( const double ratio );
};


@@ -721,15 +721,15 @@ class QgsPalLabeling : QgsLabelingEngineInterface
// void drawLabel( pal::LabelPosition* label, QgsRenderContext& context, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType );

static void drawLabelBuffer( QgsRenderContext& context,
QgsLabelComponent component,
const QgsLabelComponent& component,
const QgsPalLayerSettings& tmpLyr );

static void drawLabelBackground( QgsRenderContext& context,
QgsLabelComponent component,
const QgsPalLayerSettings& tmpLyr );

static void drawLabelShadow( QgsRenderContext& context,
QgsLabelComponent component,
const QgsLabelComponent& component,
const QgsPalLayerSettings& tmpLyr );

//! load/save engine settings to project file
@@ -4458,7 +4458,7 @@ void QgsPalLabeling::drawLabel( pal::LabelPosition* label, QgsRenderContext& con
}

void QgsPalLabeling::drawLabelBuffer( QgsRenderContext& context,
QgsLabelComponent component,
const QgsLabelComponent& component,
const QgsPalLayerSettings& tmpLyr )
{
QPainter* p = context.painter();
@@ -4489,11 +4489,11 @@ void QgsPalLabeling::drawLabelBuffer( QgsRenderContext& context,

if ( tmpLyr.shadowDraw && tmpLyr.shadowUnder == QgsPalLayerSettings::ShadowBuffer )
{
component.setOrigin( QgsPoint( 0.0, 0.0 ) );
component.setPicture( &buffPict );
component.setPictureBuffer( penSize / 2.0 );

drawLabelShadow( context, component, tmpLyr );
QgsLabelComponent bufferComponent = component;
bufferComponent.setOrigin( QgsPoint( 0.0, 0.0 ) );
bufferComponent.setPicture( &buffPict );
bufferComponent.setPictureBuffer( penSize / 2.0 );
drawLabelShadow( context, bufferComponent, tmpLyr );
}

p->save();
@@ -4810,7 +4810,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
}

void QgsPalLabeling::drawLabelShadow( QgsRenderContext& context,
QgsLabelComponent component,
const QgsLabelComponent& component,
const QgsPalLayerSettings& tmpLyr )
{
// incoming component sizes should be multiplied by rasterCompressFactor, as
@@ -604,44 +604,44 @@ class CORE_EXPORT QgsLabelComponent

// methods

const QString& text() { return mText; }
const QString& text() const { return mText; }
void setText( const QString& text ) { mText = text; }

const QgsPoint& origin() { return mOrigin; }
void setOrigin( QgsPoint point ) { mOrigin = point; }
const QgsPoint& origin() const { return mOrigin; }
void setOrigin( const QgsPoint& point ) { mOrigin = point; }

bool useOrigin() const { return mUseOrigin; }
void setUseOrigin( bool use ) { mUseOrigin = use; }
void setUseOrigin( const bool use ) { mUseOrigin = use; }

double rotation() const { return mRotation; }
void setRotation( double rotation ) { mRotation = rotation; }
void setRotation( const double rotation ) { mRotation = rotation; }

double rotationOffset() const { return mRotationOffset; }
void setRotationOffset( double rotation ) { mRotationOffset = rotation; }
void setRotationOffset( const double rotation ) { mRotationOffset = rotation; }

bool useRotation() const { return mUseRotation; }
void setUseRotation( bool use ) { mUseRotation = use; }
void setUseRotation( const bool use ) { mUseRotation = use; }

const QgsPoint& center() { return mCenter; }
void setCenter( QgsPoint point ) { mCenter = point; }
const QgsPoint& center() const { return mCenter; }
void setCenter( const QgsPoint& point ) { mCenter = point; }

bool useCenter() const { return mUseCenter; }
void setUseCenter( bool use ) { mUseCenter = use; }
void setUseCenter( const bool use ) { mUseCenter = use; }

const QgsPoint& size() { return mSize; }
void setSize( QgsPoint point ) { mSize = point; }
const QgsPoint& size() const { return mSize; }
void setSize( const QgsPoint& point ) { mSize = point; }

const QgsPoint& offset() { return mOffset; }
void setOffset( QgsPoint point ) { mOffset = point; }
const QgsPoint& offset() const { return mOffset; }
void setOffset( const QgsPoint& point ) { mOffset = point; }

const QPicture* picture() { return mPicture; }
const QPicture* picture() const { return mPicture; }
void setPicture( QPicture* picture ) { mPicture = picture; }

double pictureBuffer() const { return mPictureBuffer; }
void setPictureBuffer( double buffer ) { mPictureBuffer = buffer; }
void setPictureBuffer( const double buffer ) { mPictureBuffer = buffer; }

double dpiRatio() const { return mDpiRatio; }
void setDpiRatio( double ratio ) { mDpiRatio = ratio; }
void setDpiRatio( const double ratio ) { mDpiRatio = ratio; }

private:
// current label component text,
@@ -795,15 +795,15 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
virtual void drawLabel( pal::LabelPosition* label, QgsRenderContext& context, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio = 1.0 );

static void drawLabelBuffer( QgsRenderContext& context,
QgsLabelComponent component,
const QgsLabelComponent &component,
const QgsPalLayerSettings& tmpLyr );

static void drawLabelBackground( QgsRenderContext& context,
QgsLabelComponent component,
const QgsPalLayerSettings& tmpLyr );

static void drawLabelShadow( QgsRenderContext& context,
QgsLabelComponent component,
static void drawLabelShadow( QgsRenderContext &context,
const QgsLabelComponent &component,
const QgsPalLayerSettings& tmpLyr );

//! load/save engine settings to project file

0 comments on commit e4fb95f

Please sign in to comment.
You can’t perform that action at this time.