@@ -101,6 +101,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
101101 mRenderer( 0 ),
102102 mLabel( 0 ),
103103 mLabelOn( false ),
104+ mVertexMarkerOnlyForSelection(false ),
104105 mFetching( false )
105106{
106107 mActions = new QgsAttributeAction;
@@ -439,13 +440,12 @@ unsigned char* QgsVectorLayer::drawLineString(
439440 // draw vertex markers if in editing mode, but only to the main canvas
440441 if ( mEditable && drawingToEditingCanvas )
441442 {
442- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType ();
443443
444444 std::vector<double >::const_iterator xIt;
445445 std::vector<double >::const_iterator yIt;
446446 for ( xIt = x.begin (), yIt = y.begin (); xIt != x.end (); ++xIt, ++yIt )
447447 {
448- drawVertexMarker (( int )( *xIt ), ( int )( *yIt ), *p, markerType );
448+ drawVertexMarker (( int )( *xIt ), ( int )( *yIt ), *p, mCurrentVertexMarkerType );
449449 }
450450 }
451451
@@ -662,12 +662,10 @@ unsigned char *QgsVectorLayer::drawPolygon(
662662 // draw vertex markers if in editing mode, but only to the main canvas
663663 if ( mEditable && drawingToEditingCanvas )
664664 {
665- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType ();
666-
667665 for ( int i = 0 ; i < path.elementCount (); ++i )
668666 {
669667 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 );
671669 }
672670 }
673671
@@ -702,13 +700,16 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
702700 QPen pen;
703701 /* Pointer to a marker image*/
704702 QImage marker;
703+ // vertex marker type for selection
704+ QgsVectorLayer::VertexMarkerType vertexMarker;
705705
706706 if ( mEditable )
707707 {
708708 // Destroy all cached geometries and clear the references to them
709709 deleteCachedGeometries ();
710-
711710 mCachedGeometriesRect = rendererContext.extent ();
711+ vertexMarker = currentVertexMarkerType ();
712+ mVertexMarkerOnlyForSelection = settings.value ( " /qgis/digitizing/marker_only_for_selected" , false ).toBool ();
712713 }
713714
714715 updateFeatureCount ();
@@ -744,16 +745,27 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
744745 Q_UNUSED ( totalFeatures );
745746#endif // Q_WS_MAC
746747
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+
747753 if ( mEditable )
748754 {
749755 // Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
750756 mCachedGeometries [fet.id ()] = *fet.geometry ();
757+
758+ if (mVertexMarkerOnlyForSelection && !sel)
759+ {
760+ mCurrentVertexMarkerType = QgsVectorLayer::NoMarker;
761+ }
762+ else
763+ {
764+ mCurrentVertexMarkerType = vertexMarker;
765+ }
751766 }
752767
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+
757769
758770 // QgsDebugMsg(QString("markerScale before renderFeature(): %1").arg(markerScaleFactor));
759771 // markerScalerFactore reflects the wanted scaling of the marker
0 commit comments