Skip to content
Permalink
Browse files
MarkerLine symbol layer: fixed usage with map units, set minimal inte…
…rval to avoid infinite loop, simpler markerline symbol handling.

Developed for Faunalia (http://www.faunalia.it) with funding from Regione Toscana - Sistema Informativo per la Gestione del Territorio e dell' Ambiente [RT-SIGTA]".
For the project: "Sviluppo di prodotti software GIS open-source basati sui prodotti QuantumGIS e Postgis (CIG 037728516E)"


git-svn-id: http://svn.osgeo.org/qgis/trunk@13421 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 4, 2010
1 parent bdc4a9c commit 7479708
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
@@ -246,20 +246,19 @@ void QgsMarkerLineSymbolLayerV2::setColor( QColor color )

void QgsMarkerLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
{
mMarker->setAlpha( context.alpha() );
mMarker->setOutputUnit( context.outputUnit() );

// if being rotated, it gets initialized with every line segment
if ( !mRotateMarker )
{
mMarker->setAlpha( context.alpha() );
mMarker->startRender( context.renderContext() );
}
if ( mRotateMarker )
mMarker->setRenderHints( QgsSymbolV2::DataDefinedRotation );

mMarker->startRender( context.renderContext() );
}

void QgsMarkerLineSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
{
if ( !mRotateMarker )
{
mMarker->stopRender( context.renderContext() );
}
mMarker->stopRender( context.renderContext() );
}

void QgsMarkerLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context )
@@ -282,7 +281,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineNoOffset( const QPolygonF& points
bool first = true;
double origAngle = mMarker->angle();

double painterUnitInterval = context.outputLineWidth( mInterval );
double painterUnitInterval = context.outputLineWidth( mInterval > 0 ? mInterval : 0.1 );

QgsRenderContext& rc = context.renderContext();

@@ -306,9 +305,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineNoOffset( const QPolygonF& points
// rotate marker (if desired)
if ( mRotateMarker )
{
mMarker->setAlpha( context.alpha() );
mMarker->setAngle( origAngle + ( l.angle() * 180 / M_PI ) );
mMarker->startRender( rc );
}

// draw first marker
@@ -329,9 +326,6 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineNoOffset( const QPolygonF& points
}

lastPt = pt;

if ( mRotateMarker )
mMarker->stopRender( rc );
}

// restore original rotation
@@ -375,6 +369,16 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::clone() const
return x;
}

void QgsMarkerLineSymbolLayerV2::setWidth( double width )
{
mMarker->setSize( width );
}

double QgsMarkerLineSymbolLayerV2::width() const
{
return mMarker->size();
}

/////////////

QgsLineDecorationSymbolLayerV2::QgsLineDecorationSymbolLayerV2( QColor color )
@@ -108,6 +108,9 @@ class CORE_EXPORT QgsMarkerLineSymbolLayerV2 : public QgsLineSymbolLayerV2
QgsSymbolV2* subSymbol();
bool setSubSymbol( QgsSymbolV2* symbol );

virtual void setWidth( double width );
virtual double width() const;

// new stuff

bool rotateMarker() const { return mRotateMarker; }
@@ -99,8 +99,8 @@ class CORE_EXPORT QgsLineSymbolLayerV2 : public QgsSymbolLayerV2
public:
virtual void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context ) = 0;

void setWidth( double width ) { mWidth = width; }
double width() const { return mWidth; }
virtual void setWidth( double width ) { mWidth = width; }
virtual double width() const { return mWidth; }

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );

0 comments on commit 7479708

Please sign in to comment.