@@ -101,6 +101,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
101
101
mRenderer( 0 ),
102
102
mLabel( 0 ),
103
103
mLabelOn( false ),
104
+ mVertexMarkerOnlyForSelection(false ),
104
105
mFetching( false )
105
106
{
106
107
mActions = new QgsAttributeAction;
@@ -439,13 +440,12 @@ unsigned char* QgsVectorLayer::drawLineString(
439
440
// draw vertex markers if in editing mode, but only to the main canvas
440
441
if ( mEditable && drawingToEditingCanvas )
441
442
{
442
- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType ();
443
443
444
444
std::vector<double >::const_iterator xIt;
445
445
std::vector<double >::const_iterator yIt;
446
446
for ( xIt = x.begin (), yIt = y.begin (); xIt != x.end (); ++xIt, ++yIt )
447
447
{
448
- drawVertexMarker (( int )( *xIt ), ( int )( *yIt ), *p, markerType );
448
+ drawVertexMarker (( int )( *xIt ), ( int )( *yIt ), *p, mCurrentVertexMarkerType );
449
449
}
450
450
}
451
451
@@ -662,12 +662,10 @@ unsigned char *QgsVectorLayer::drawPolygon(
662
662
// draw vertex markers if in editing mode, but only to the main canvas
663
663
if ( mEditable && drawingToEditingCanvas )
664
664
{
665
- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType ();
666
-
667
665
for ( int i = 0 ; i < path.elementCount (); ++i )
668
666
{
669
667
const QPainterPath::Element & e = path.elementAt ( i );
670
- drawVertexMarker (( int )e.x , ( int )e.y , *p, markerType );
668
+ drawVertexMarker (( int )e.x , ( int )e.y , *p, mCurrentVertexMarkerType );
671
669
}
672
670
}
673
671
@@ -702,13 +700,16 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
702
700
QPen pen;
703
701
/* Pointer to a marker image*/
704
702
QImage marker;
703
+ // vertex marker type for selection
704
+ QgsVectorLayer::VertexMarkerType vertexMarker;
705
705
706
706
if ( mEditable )
707
707
{
708
708
// Destroy all cached geometries and clear the references to them
709
709
deleteCachedGeometries ();
710
-
711
710
mCachedGeometriesRect = rendererContext.extent ();
711
+ vertexMarker = currentVertexMarkerType ();
712
+ mVertexMarkerOnlyForSelection = settings.value ( " /qgis/digitizing/marker_only_for_selected" , false ).toBool ();
712
713
}
713
714
714
715
updateFeatureCount ();
@@ -744,16 +745,27 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
744
745
Q_UNUSED ( totalFeatures );
745
746
#endif // Q_WS_MAC
746
747
748
+ // check if feature is selected
749
+ // only show selections of the current layer
750
+ // TODO: create a mechanism to let layer know whether it's current layer or not [MD]
751
+ bool sel = mSelectedFeatureIds .contains ( fet.id () );
752
+
747
753
if ( mEditable )
748
754
{
749
755
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
750
756
mCachedGeometries [fet.id ()] = *fet.geometry ();
757
+
758
+ if (mVertexMarkerOnlyForSelection && !sel)
759
+ {
760
+ mCurrentVertexMarkerType = QgsVectorLayer::NoMarker;
761
+ }
762
+ else
763
+ {
764
+ mCurrentVertexMarkerType = vertexMarker;
765
+ }
751
766
}
752
767
753
- // check if feature is selected
754
- // only show selections of the current layer
755
- // TODO: create a mechanism to let layer know whether it's current layer or not [MD]
756
- bool sel = mSelectedFeatureIds .contains ( fet.id () );
768
+
757
769
758
770
// QgsDebugMsg(QString("markerScale before renderFeature(): %1").arg(markerScaleFactor));
759
771
// markerScalerFactore reflects the wanted scaling of the marker
0 commit comments