selection_rendering_fix_revised.diff
python/core/symbology-ng-core.sip (working copy) | ||
---|---|---|
465 | 465 |
qreal alpha() const; |
466 | 466 |
void setAlpha( qreal alpha ); |
467 | 467 | |
468 |
bool selected() const; |
|
469 |
void setSelected( bool selected ) const; |
|
470 | ||
471 |
static QColor selectionColor(); |
|
472 | ||
468 | 473 |
double outputLineWidth(double width) const; |
469 | 474 |
double outputPixelSize(double size) const; |
470 | 475 |
}; |
src/core/qgsvectorlayer.cpp (working copy) | ||
---|---|---|
706 | 706 | |
707 | 707 |
mRendererV2->startRender( rendererContext, this ); |
708 | 708 | |
709 |
QgsSingleSymbolRendererV2* selRenderer = NULL; |
|
710 |
if ( !mSelectedFeatureIds.isEmpty() ) |
|
711 |
{ |
|
712 |
selRenderer = new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( geometryType() ) ); |
|
713 |
selRenderer->symbol()->setColor( QgsRenderer::selectionColor() ); |
|
714 |
selRenderer->setVertexMarkerAppearance( currentVertexMarkerType(), currentVertexMarkerSize() ); |
|
715 |
selRenderer->startRender( rendererContext, this ); |
|
716 |
} |
|
717 | ||
718 | 709 |
#ifndef Q_WS_MAC |
719 | 710 |
int totalFeatures = pendingFeatureCount(); |
720 | 711 |
int featureCount = 0; |
... | ... | |
748 | 739 |
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) ); |
749 | 740 | |
750 | 741 |
// render feature |
751 |
if ( sel ) |
|
752 |
selRenderer->renderFeature( fet, rendererContext, -1, drawMarker ); |
|
753 |
else |
|
754 |
mRendererV2->renderFeature( fet, rendererContext, -1, drawMarker ); |
|
742 |
mRendererV2->renderFeature( fet, rendererContext, -1, sel, drawMarker ); |
|
755 | 743 | |
756 | 744 |
// labeling - register feature |
757 | 745 |
if ( labeling && mRendererV2->symbolForFeature( fet ) != NULL ) |
... | ... | |
772 | 760 |
++featureCount; |
773 | 761 |
#endif //Q_WS_MAC |
774 | 762 |
} |
775 | ||
776 |
stopRendererV2( rendererContext, selRenderer ); |
|
777 | 763 |
} |
778 | 764 | |
779 | 765 |
void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bool labeling ) |
... | ... | |
886 | 872 | |
887 | 873 |
try |
888 | 874 |
{ |
889 |
if ( sel ) |
|
890 |
selRenderer->renderFeature( *fit, rendererContext, -1, drawMarker ); |
|
891 |
else |
|
892 |
mRendererV2->renderFeature( *fit, rendererContext, layer, drawMarker ); |
|
875 |
mRendererV2->renderFeature( *fit, rendererContext, layer, sel, drawMarker ); |
|
893 | 876 |
} |
894 | 877 |
catch ( const QgsCsException &cse ) |
895 | 878 |
{ |
src/core/symbology-ng/qgsfillsymbollayerv2.cpp (working copy) | ||
---|---|---|
47 | 47 |
{ |
48 | 48 |
mColor.setAlphaF( context.alpha() ); |
49 | 49 |
mBrush = QBrush( mColor, mBrushStyle ); |
50 |
QColor selColor = context.selectionColor(); |
|
51 |
// selColor.setAlphaF( context.alpha() ); |
|
52 |
mSelBrush = QBrush( selColor ); |
|
53 |
if( selectFillStyle ) mSelBrush.setStyle( mBrushStyle ); |
|
50 | 54 |
mBorderColor.setAlphaF( context.alpha() ); |
51 | 55 |
mPen = QPen( mBorderColor ); |
52 | 56 |
mPen.setStyle( mBorderStyle ); |
... | ... | |
65 | 69 |
return; |
66 | 70 |
} |
67 | 71 | |
68 |
p->setBrush( mBrush ); |
|
72 |
p->setBrush( context.selected() ? mSelBrush : mBrush );
|
|
69 | 73 |
p->setPen( mPen ); |
70 | 74 | |
71 | 75 |
_renderPolygon( p, points, rings ); |
... | ... | |
209 | 213 |
{ |
210 | 214 |
return; |
211 | 215 |
} |
216 |
p->setPen( QPen( Qt::NoPen ) ); |
|
217 |
if( context.selected()) |
|
218 |
{ |
|
219 |
QColor selColor = context.selectionColor(); |
|
220 |
if( ! selectionIsOpaque ) selColor.setAlphaF( context.alpha() ); |
|
221 |
p->setBrush( QBrush(selColor)); |
|
222 |
_renderPolygon(p,points,rings); |
|
223 |
} |
|
212 | 224 |
p->setBrush( mBrush ); |
213 |
p->setPen( QPen( Qt::NoPen ) ); |
|
214 | 225 |
_renderPolygon( p, points, rings ); |
215 | 226 |
if ( mOutline ) |
216 | 227 |
{ |
217 |
mOutline->renderPolyline( points, context.renderContext() ); |
|
228 |
mOutline->renderPolyline( points, context.renderContext(), -1, selectFillBorder && context.selected() );
|
|
218 | 229 |
if ( rings ) |
219 | 230 |
{ |
220 | 231 |
QList<QPolygonF>::const_iterator ringIt = rings->constBegin(); |
221 | 232 |
for ( ; ringIt != rings->constEnd(); ++ringIt ) |
222 | 233 |
{ |
223 |
mOutline->renderPolyline( *ringIt, context.renderContext() ); |
|
234 |
mOutline->renderPolyline( *ringIt, context.renderContext(), -1, selectFillBorder && context.selected() );
|
|
224 | 235 |
} |
225 | 236 |
} |
226 | 237 |
} |
src/core/symbology-ng/qgsfillsymbollayerv2.h (working copy) | ||
---|---|---|
54 | 54 | |
55 | 55 |
protected: |
56 | 56 |
QBrush mBrush; |
57 |
QBrush mSelBrush; |
|
57 | 58 |
Qt::BrushStyle mBrushStyle; |
58 | 59 |
QColor mBorderColor; |
59 | 60 |
Qt::PenStyle mBorderStyle; |
src/core/symbology-ng/qgslinesymbollayerv2.cpp (working copy) | ||
---|---|---|
83 | 83 |
} |
84 | 84 |
mPen.setJoinStyle( mPenJoinStyle ); |
85 | 85 |
mPen.setCapStyle( mPenCapStyle ); |
86 | ||
87 |
mSelPen = mPen; |
|
88 |
QColor selColor = context.selectionColor(); |
|
89 |
if( ! selectionIsOpaque ) selColor.setAlphaF(context.alpha()); |
|
90 |
mSelPen.setColor(selColor); |
|
86 | 91 |
} |
87 | 92 | |
88 | 93 |
void QgsSimpleLineSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context ) |
... | ... | |
97 | 102 |
return; |
98 | 103 |
} |
99 | 104 | |
100 |
p->setPen( mPen ); |
|
105 |
p->setPen( context.selected() ? mSelPen : mPen );
|
|
101 | 106 |
if ( mOffset == 0 ) |
102 | 107 |
{ |
103 | 108 |
p->drawPolyline( points ); |
... | ... | |
309 | 314 |
// draw first marker |
310 | 315 |
if ( first ) |
311 | 316 |
{ |
312 |
mMarker->renderPoint( lastPt, rc ); |
|
317 |
mMarker->renderPoint( lastPt, rc, -1, context.selected() );
|
|
313 | 318 |
first = false; |
314 | 319 |
} |
315 | 320 | |
... | ... | |
319 | 324 |
// "c" is 1 for regular point or in interval (0,1] for begin of line segment |
320 | 325 |
lastPt += c * diff; |
321 | 326 |
lengthLeft -= painterUnitInterval; |
322 |
mMarker->renderPoint( lastPt, rc ); |
|
327 |
mMarker->renderPoint( lastPt, rc, -1, context.selected() );
|
|
323 | 328 |
c = 1; // reset c (if wasn't 1 already) |
324 | 329 |
} |
325 | 330 | |
... | ... | |
401 | 406 |
QColor penColor = mColor; |
402 | 407 |
penColor.setAlphaF( context.alpha() ); |
403 | 408 |
mPen.setColor( penColor ); |
409 |
QColor selColor = context.selectionColor(); |
|
410 |
if( ! selectionIsOpaque ) selColor.setAlphaF( context.alpha() ); |
|
411 |
mSelPen.setColor(selColor); |
|
404 | 412 |
} |
405 | 413 | |
406 | 414 |
void QgsLineDecorationSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context ) |
... | ... | |
442 | 450 |
QPointF p2_1 = p2 - QPointF( size * cos( angle1 ), size * sin( angle1 ) ); |
443 | 451 |
QPointF p2_2 = p2 - QPointF( size * cos( angle2 ), size * sin( angle2 ) ); |
444 | 452 | |
445 |
p->setPen( mPen ); |
|
453 |
p->setPen( context.selected() ? mSelPen : mPen );
|
|
446 | 454 |
p->drawLine( p2, p2_1 ); |
447 | 455 |
p->drawLine( p2, p2_2 ); |
448 | 456 |
} |
src/core/symbology-ng/qgslinesymbollayerv2.h (working copy) | ||
---|---|---|
64 | 64 |
Qt::PenJoinStyle mPenJoinStyle; |
65 | 65 |
Qt::PenCapStyle mPenCapStyle; |
66 | 66 |
QPen mPen; |
67 |
QPen mSelPen; |
|
67 | 68 |
double mOffset; |
68 | 69 |
//use a custom dash dot pattern instead of the predefined ones |
69 | 70 |
bool mUseCustomDashPattern; |
... | ... | |
159 | 160 | |
160 | 161 |
protected: |
161 | 162 |
QPen mPen; |
163 |
QPen mSelPen; |
|
162 | 164 | |
163 | 165 |
}; |
164 | 166 |
src/core/symbology-ng/qgsmarkersymbollayerv2.cpp (working copy) | ||
---|---|---|
68 | 68 |
mBrush = QBrush( mColor ); |
69 | 69 |
mPen = QPen( mBorderColor ); |
70 | 70 |
mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) ); |
71 |
QColor selColor = context.selectionColor(); |
|
72 |
mSelBrush = QBrush( selColor ); |
|
73 |
mSelPen = QPen( selColor == mColor ? selColor : mBorderColor ); |
|
74 |
mSelPen.setWidthF(mPen.widthF()); |
|
71 | 75 | |
72 | 76 |
mPolygon.clear(); |
73 | 77 | |
... | ... | |
148 | 152 |
else |
149 | 153 |
{ |
150 | 154 |
// some markers can't be drawn as a polygon (circle, cross) |
155 |
// For these set the selected border color to the selected color |
|
156 | ||
157 |
if( mName != "circle" ) mSelPen.setColor(selColor); |
|
151 | 158 |
} |
152 | 159 | |
153 | 160 |
// rotate if needed |
... | ... | |
176 | 183 |
drawMarker( &p, context ); |
177 | 184 |
p.end(); |
178 | 185 | |
186 |
// Construct the selected version of the Cache |
|
187 | ||
188 |
mSelCache = QImage( QSize( imageSize, imageSize ), QImage::Format_ARGB32_Premultiplied ); |
|
189 |
mSelCache.fill( 0 ); |
|
190 | ||
191 |
p.begin( &mSelCache ); |
|
192 |
p.setRenderHint( QPainter::Antialiasing ); |
|
193 |
p.setBrush( mSelBrush ); |
|
194 |
p.setPen( mSelPen ); |
|
195 |
p.translate( QPointF( center, center ) ); |
|
196 |
drawMarker( &p, context ); |
|
197 |
p.end(); |
|
198 | ||
199 |
// Check that the selected version is different. If not, then re-render, |
|
200 |
// filling the background with the selection colour and using the normal |
|
201 |
// colours for the symbol .. could be ugly! |
|
202 | ||
203 |
if( mSelCache == mCache ) |
|
204 |
{ |
|
205 |
p.begin( &mSelCache ); |
|
206 |
p.setRenderHint( QPainter::Antialiasing ); |
|
207 |
p.fillRect(0,0,imageSize,imageSize,selColor); |
|
208 |
p.setBrush( mBrush ); |
|
209 |
p.setPen( mPen ); |
|
210 |
p.translate( QPointF( center, center ) ); |
|
211 |
drawMarker( &p, context ); |
|
212 |
p.end(); |
|
213 |
} |
|
214 | ||
179 | 215 |
//opacity |
180 | 216 |
if ( context.alpha() < 1.0 ) |
181 | 217 |
{ |
182 | 218 |
QgsSymbolLayerV2Utils::multiplyImageOpacity( &mCache, context.alpha() ); |
219 |
if( ! selectionIsOpaque ) QgsSymbolLayerV2Utils::multiplyImageOpacity( &mSelCache, context.alpha() ); |
|
183 | 220 |
} |
184 | 221 |
} |
185 | 222 | |
... | ... | |
203 | 240 |
//p->translate(point); |
204 | 241 | |
205 | 242 |
//drawMarker(p); |
206 |
//mCache.save("/home/marco/tmp/marker.png", "PNG"); |
|
207 |
double s = mCache.width() / context.renderContext().rasterScaleFactor(); |
|
243 |
//mCache.save("/home/marco/tmp/marker.png","PNG"); |
|
244 |
QImage &img = context.selected() ? mSelCache : mCache; |
|
245 |
double s = img.width() / context.renderContext().rasterScaleFactor(); |
|
208 | 246 |
p->drawImage( QRectF( point.x() - s / 2.0 + context.outputLineWidth( mOffset.x() ), |
209 | 247 |
point.y() - s / 2.0 + context.outputLineWidth( mOffset.y() ), |
210 |
s, s ), mCache );
|
|
248 |
s, s ), img );
|
|
211 | 249 |
//p->restore(); |
212 | 250 |
} |
213 | 251 | |
... | ... | |
328 | 366 |
QSvgRenderer renderer( mPath ); |
329 | 367 |
QPainter painter( &mPicture ); |
330 | 368 |
renderer.render( &painter, rect ); |
369 |
double selPictureSize = pictureSize*1.2; |
|
370 |
QPainter selPainter( &mSelPicture ); |
|
371 |
selPainter.setRenderHint( QPainter::Antialiasing ); |
|
372 |
selPainter.setBrush(QBrush(context.selectionColor())); |
|
373 |
selPainter.setPen( Qt::NoPen ); |
|
374 |
selPainter.drawEllipse(QPointF(0,0),pictureSize*0.6,pictureSize*0.6); |
|
375 |
renderer.render(&selPainter,rect); |
|
331 | 376 |
} |
332 | 377 | |
333 | 378 |
void QgsSvgMarkerSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context ) |
... | ... | |
350 | 395 |
if ( mAngle != 0 ) |
351 | 396 |
p->rotate( mAngle ); |
352 | 397 | |
353 |
p->drawPicture( 0, 0, mPicture ); |
|
398 |
QPicture &pct = context.selected() ? mSelPicture : mPicture; |
|
399 |
p->drawPicture( 0, 0, pct ); |
|
354 | 400 | |
355 | 401 |
if ( mAngle != 0 ) |
356 | 402 |
p->rotate( -mAngle ); |
... | ... | |
515 | 561 | |
516 | 562 |
void QgsFontMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context ) |
517 | 563 |
{ |
518 |
mFont = QFont( mFontFamily, MM2POINT( mSize ) ); |
|
564 |
mFont = QFont( mFontFamily, MM2POINT( mSize )/context.renderContext().rasterScaleFactor() );
|
|
519 | 565 |
QFontMetrics fm( mFont ); |
520 | 566 |
mChrOffset = QPointF( fm.width( mChr ) / 2, -fm.ascent() / 2 ); |
521 | 567 | |
... | ... | |
529 | 575 |
void QgsFontMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context ) |
530 | 576 |
{ |
531 | 577 |
QPainter* p = context.renderContext().painter(); |
532 |
QColor penColor = mColor; |
|
578 |
QColor penColor = context.selected() ? context.selectionColor() : mColor;
|
|
533 | 579 |
penColor.setAlphaF( context.alpha() ); |
534 | 580 |
p->setPen( penColor ); |
535 | 581 |
p->setFont( mFont ); |
src/core/symbology-ng/qgsmarkersymbollayerv2.h (working copy) | ||
---|---|---|
59 | 59 |
QPolygonF mPolygon; |
60 | 60 |
QString mName; |
61 | 61 |
QImage mCache; |
62 |
QPen mSelPen; |
|
63 |
QBrush mSelBrush; |
|
64 |
QImage mSelCache; |
|
62 | 65 |
}; |
63 | 66 | |
64 | 67 |
////////// |
... | ... | |
110 | 113 | |
111 | 114 |
QString mPath; |
112 | 115 |
QPicture mPicture; |
116 |
QPicture mSelPicture; |
|
113 | 117 |
}; |
114 | 118 | |
115 | 119 |
src/core/symbology-ng/qgsrendererv2.cpp (working copy) | ||
---|---|---|
151 | 151 |
} |
152 | 152 | |
153 | 153 | |
154 |
void QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool drawVertexMarker ) |
|
154 |
void QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
|
|
155 | 155 |
{ |
156 | 156 |
QgsSymbolV2* symbol = symbolForFeature( feature ); |
157 | 157 |
if ( symbol == NULL ) |
... | ... | |
172 | 172 |
} |
173 | 173 |
QPointF pt; |
174 | 174 |
_getPoint( pt, context, geom->asWkb() ); |
175 |
(( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, context, layer ); |
|
175 |
(( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, context, layer, selected );
|
|
176 | 176 | |
177 | 177 |
//if ( drawVertexMarker ) |
178 | 178 |
// renderVertexMarker( pt, context ); |
... | ... | |
189 | 189 |
} |
190 | 190 |
QPolygonF pts; |
191 | 191 |
_getLineString( pts, context, geom->asWkb() ); |
192 |
(( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer ); |
|
192 |
(( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer, selected );
|
|
193 | 193 | |
194 | 194 |
if ( drawVertexMarker ) |
195 | 195 |
renderVertexMarkerPolyline( pts, context ); |
... | ... | |
207 | 207 |
QPolygonF pts; |
208 | 208 |
QList<QPolygonF> holes; |
209 | 209 |
_getPolygon( pts, holes, context, geom->asWkb() ); |
210 |
(( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context, layer ); |
|
210 |
(( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context, layer, selected );
|
|
211 | 211 | |
212 | 212 |
if ( drawVertexMarker ) |
213 | 213 |
renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context ); |
... | ... | |
231 | 231 |
for ( unsigned int i = 0; i < num; ++i ) |
232 | 232 |
{ |
233 | 233 |
ptr = _getPoint( pt, context, ptr ); |
234 |
(( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, context, layer ); |
|
234 |
(( QgsMarkerSymbolV2* )symbol )->renderPoint( pt, context, layer, selected );
|
|
235 | 235 | |
236 | 236 |
//if ( drawVertexMarker ) |
237 | 237 |
// renderVertexMarker( pt, context ); |
... | ... | |
256 | 256 |
for ( unsigned int i = 0; i < num; ++i ) |
257 | 257 |
{ |
258 | 258 |
ptr = _getLineString( pts, context, ptr ); |
259 |
(( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer ); |
|
259 |
(( QgsLineSymbolV2* )symbol )->renderPolyline( pts, context, layer, selected );
|
|
260 | 260 | |
261 | 261 |
if ( drawVertexMarker ) |
262 | 262 |
renderVertexMarkerPolyline( pts, context ); |
... | ... | |
282 | 282 |
for ( unsigned int i = 0; i < num; ++i ) |
283 | 283 |
{ |
284 | 284 |
ptr = _getPolygon( pts, holes, context, ptr ); |
285 |
(( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context, layer );
|
|
285 |
(( QgsFillSymbolV2* )symbol )->renderPolygon( pts, ( holes.count() ? &holes : NULL ), context ); |
|
286 | 286 | |
287 | 287 |
if ( drawVertexMarker ) |
288 | 288 |
renderVertexMarkerPolygon( pts, ( holes.count() ? &holes : NULL ), context ); |
src/core/symbology-ng/qgsrendererv2.h (working copy) | ||
---|---|---|
73 | 73 | |
74 | 74 |
virtual QgsFeatureRendererV2* clone() = 0; |
75 | 75 | |
76 |
virtual void renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool drawVertexMarker = false ); |
|
76 |
virtual void renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
|
|
77 | 77 | |
78 | 78 |
//! for debugging |
79 | 79 |
virtual QString dump(); |
src/core/symbology-ng/qgssymbollayerv2.cpp (working copy) | ||
---|---|---|
1 | 1 | |
2 | 2 |
#include "qgssymbollayerv2.h" |
3 | 3 | |
4 |
#include "qgsrenderer.h" |
|
4 | 5 |
#include "qgsrendercontext.h" |
5 | 6 | |
6 | 7 |
#include <QSize> |
src/core/symbology-ng/qgssymbollayerv2.h (working copy) | ||
---|---|---|
18 | 18 |
class QgsSymbolV2; |
19 | 19 | |
20 | 20 | |
21 | ||
22 | 21 |
class CORE_EXPORT QgsSymbolLayerV2 |
23 | 22 |
{ |
24 | 23 |
public: |
... | ... | |
61 | 60 |
bool mLocked; |
62 | 61 |
QColor mColor; |
63 | 62 |
int mRenderingPass; |
63 | ||
64 |
// Configuration of selected symbology implementation |
|
65 |
static const bool selectionIsOpaque = true; // Selection ignores symbol alpha |
|
66 |
static const bool selectFillBorder = false; // Fill symbol layer also selects border symbology |
|
67 |
static const bool selectFillStyle = false; // Fill symbol uses symbol layer style.. |
|
68 | ||
64 | 69 |
}; |
65 | 70 | |
66 | 71 |
////////////////////// |
src/core/symbology-ng/qgssymbolv2.cpp (working copy) | ||
---|---|---|
1 | 1 | |
2 |
#include "qgsrenderer.h" |
|
2 | 3 |
#include "qgssymbolv2.h" |
3 | 4 |
#include "qgssymbollayerv2.h" |
4 | 5 | |
... | ... | |
244 | 245 | |
245 | 246 |
//////////////////// |
246 | 247 | |
247 |
QgsSymbolV2RenderContext::QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha ) |
|
248 |
: mRenderContext( c ), mOutputUnit( u ), mAlpha( alpha ) |
|
248 |
QgsSymbolV2RenderContext::QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha, bool selected )
|
|
249 |
: mRenderContext( c ), mOutputUnit( u ), mAlpha( alpha ), mSelected( selected )
|
|
249 | 250 |
{ |
250 | 251 | |
251 | 252 |
} |
... | ... | |
255 | 256 | |
256 | 257 |
} |
257 | 258 | |
259 |
QColor QgsSymbolV2RenderContext::selectionColor() |
|
260 |
{ |
|
261 |
return QgsRenderer::selectionColor(); |
|
262 |
} |
|
263 | ||
264 | ||
258 | 265 |
double QgsSymbolV2RenderContext::outputLineWidth( double width ) const |
259 | 266 |
{ |
260 | 267 |
return width * QgsSymbolLayerV2Utils::lineWidthScaleFactor( mRenderContext, mOutputUnit ); |
... | ... | |
338 | 345 |
return maxSize; |
339 | 346 |
} |
340 | 347 | |
341 |
void QgsMarkerSymbolV2::renderPoint( const QPointF& point, QgsRenderContext& context, int layer ) |
|
348 |
void QgsMarkerSymbolV2::renderPoint( const QPointF& point, QgsRenderContext& context, int layer, bool selected )
|
|
342 | 349 |
{ |
343 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha ); |
|
350 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha, selected );
|
|
344 | 351 |
if ( layer != -1 ) |
345 | 352 |
{ |
346 | 353 |
if ( layer >= 0 && layer < mLayers.count() ) |
... | ... | |
407 | 414 |
return maxWidth; |
408 | 415 |
} |
409 | 416 | |
410 |
void QgsLineSymbolV2::renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer ) |
|
417 |
void QgsLineSymbolV2::renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer, bool selected )
|
|
411 | 418 |
{ |
412 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha ); |
|
419 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha, selected );
|
|
413 | 420 |
if ( layer != -1 ) |
414 | 421 |
{ |
415 | 422 |
if ( layer >= 0 && layer < mLayers.count() ) |
... | ... | |
443 | 450 |
mLayers.append( new QgsSimpleFillSymbolLayerV2() ); |
444 | 451 |
} |
445 | 452 | |
446 |
void QgsFillSymbolV2::renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer ) |
|
453 |
void QgsFillSymbolV2::renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer, bool selected )
|
|
447 | 454 |
{ |
448 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha ); |
|
455 |
QgsSymbolV2RenderContext symbolContext( context, mOutputUnit, mAlpha, selected );
|
|
449 | 456 |
if ( layer != -1 ) |
450 | 457 |
{ |
451 | 458 |
if ( layer >= 0 && layer < mLayers.count() ) |
src/core/symbology-ng/qgssymbolv2.h (working copy) | ||
---|---|---|
103 | 103 |
class CORE_EXPORT QgsSymbolV2RenderContext |
104 | 104 |
{ |
105 | 105 |
public: |
106 |
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0 ); |
|
106 |
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u , qreal alpha = 1.0, bool selected = false );
|
|
107 | 107 |
~QgsSymbolV2RenderContext(); |
108 | 108 | |
109 | 109 |
QgsRenderContext& renderContext() { return mRenderContext; } |
... | ... | |
115 | 115 |
qreal alpha() const { return mAlpha; } |
116 | 116 |
void setAlpha( qreal alpha ) { mAlpha = alpha; } |
117 | 117 | |
118 |
bool selected() const { return mSelected; } |
|
119 |
void setSelected( bool selected ) { mSelected = selected; } |
|
120 | ||
121 |
// Colour used for selections |
|
122 | ||
123 |
static QColor selectionColor(); |
|
124 | ||
118 | 125 |
double outputLineWidth( double width ) const; |
119 | 126 |
double outputPixelSize( double size ) const; |
120 | 127 | |
... | ... | |
125 | 132 |
QgsRenderContext& mRenderContext; |
126 | 133 |
QgsSymbolV2::OutputUnit mOutputUnit; |
127 | 134 |
qreal mAlpha; |
135 |
bool mSelected; |
|
128 | 136 |
}; |
129 | 137 | |
130 | 138 | |
... | ... | |
144 | 152 |
void setSize( double size ); |
145 | 153 |
double size(); |
146 | 154 | |
147 |
void renderPoint( const QPointF& point, QgsRenderContext& context, int layer = -1 ); |
|
155 |
void renderPoint( const QPointF& point, QgsRenderContext& context, int layer = -1, bool selected = false );
|
|
148 | 156 | |
149 | 157 |
virtual QgsSymbolV2* clone() const; |
150 | 158 |
}; |
... | ... | |
159 | 167 |
void setWidth( double width ); |
160 | 168 |
double width(); |
161 | 169 | |
162 |
void renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer = -1 ); |
|
170 |
void renderPolyline( const QPolygonF& points, QgsRenderContext& context, int layer = -1, bool selected = false );
|
|
163 | 171 | |
164 | 172 |
virtual QgsSymbolV2* clone() const; |
165 | 173 |
}; |
... | ... | |
171 | 179 |
public: |
172 | 180 |
QgsFillSymbolV2( QgsSymbolLayerV2List layers = QgsSymbolLayerV2List() ); |
173 | 181 | |
174 |
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1 ); |
|
182 |
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer = -1, bool selected = false );
|
|
175 | 183 | |
176 | 184 |
virtual QgsSymbolV2* clone() const; |
177 | 185 |
}; |