[QGIS Commit] r10882 - in trunk/qgis/src: app core ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Jun 5 04:11:40 EDT 2009
Author: mhugent
Date: 2009-06-05 04:11:40 -0400 (Fri, 05 Jun 2009)
New Revision: 10882
Modified:
trunk/qgis/src/app/qgsoptions.cpp
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/qgsvectorlayer.h
trunk/qgis/src/ui/qgsoptionsbase.ui
Log:
[FEATURE] Added option to show only markers of selected features in editing mode.
Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp 2009-06-03 13:34:35 UTC (rev 10881)
+++ trunk/qgis/src/app/qgsoptions.cpp 2009-06-05 08:11:40 UTC (rev 10882)
@@ -218,6 +218,8 @@
mSearchRadiusVertexEditComboBox->setCurrentIndex( settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", 0 ).toInt() );
//vertex marker
+ mMarkersOnlyForSelectedCheckBox->setChecked(settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool());
+
mMarkerStyleComboBox->addItem( tr( "Semi transparent circle" ) );
mMarkerStyleComboBox->addItem( tr( "Cross" ) );
mMarkerStyleComboBox->addItem( tr( "None" ) );
@@ -436,6 +438,7 @@
settings.setValue( "/qgis/digitizing/search_radius_vertex_edit_unit",
( mSearchRadiusVertexEditComboBox->currentIndex() == 0 ? QgsTolerance::MapUnits : QgsTolerance::Pixels ) );
+ settings.setValue( "/qgis/digitizing/marker_only_for_selected", mMarkersOnlyForSelectedCheckBox->isChecked() );
QString markerComboText = mMarkerStyleComboBox->currentText();
if ( markerComboText == tr( "Semi transparent circle" ) )
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2009-06-03 13:34:35 UTC (rev 10881)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2009-06-05 08:11:40 UTC (rev 10882)
@@ -101,6 +101,7 @@
mRenderer( 0 ),
mLabel( 0 ),
mLabelOn( false ),
+ mVertexMarkerOnlyForSelection(false),
mFetching( false )
{
mActions = new QgsAttributeAction;
@@ -439,13 +440,12 @@
// draw vertex markers if in editing mode, but only to the main canvas
if ( mEditable && drawingToEditingCanvas )
{
- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType();
std::vector<double>::const_iterator xIt;
std::vector<double>::const_iterator yIt;
for ( xIt = x.begin(), yIt = y.begin(); xIt != x.end(); ++xIt, ++yIt )
{
- drawVertexMarker(( int )( *xIt ), ( int )( *yIt ), *p, markerType );
+ drawVertexMarker(( int )( *xIt ), ( int )( *yIt ), *p, mCurrentVertexMarkerType );
}
}
@@ -662,12 +662,10 @@
// draw vertex markers if in editing mode, but only to the main canvas
if ( mEditable && drawingToEditingCanvas )
{
- QgsVectorLayer::VertexMarkerType markerType = currentVertexMarkerType();
-
for ( int i = 0; i < path.elementCount(); ++i )
{
const QPainterPath::Element & e = path.elementAt( i );
- drawVertexMarker(( int )e.x, ( int )e.y, *p, markerType );
+ drawVertexMarker(( int )e.x, ( int )e.y, *p, mCurrentVertexMarkerType );
}
}
@@ -702,13 +700,16 @@
QPen pen;
/*Pointer to a marker image*/
QImage marker;
+ //vertex marker type for selection
+ QgsVectorLayer::VertexMarkerType vertexMarker;
if ( mEditable )
{
// Destroy all cached geometries and clear the references to them
deleteCachedGeometries();
-
mCachedGeometriesRect = rendererContext.extent();
+ vertexMarker = currentVertexMarkerType();
+ mVertexMarkerOnlyForSelection = settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool();
}
updateFeatureCount();
@@ -744,17 +745,28 @@
Q_UNUSED( totalFeatures );
#endif //Q_WS_MAC
+ // check if feature is selected
+ // only show selections of the current layer
+ // TODO: create a mechanism to let layer know whether it's current layer or not [MD]
+ bool sel = mSelectedFeatureIds.contains( fet.id() );
+
if ( mEditable )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
mCachedGeometries[fet.id()] = *fet.geometry();
+
+ if(mVertexMarkerOnlyForSelection && !sel)
+ {
+ mCurrentVertexMarkerType = QgsVectorLayer::NoMarker;
+ }
+ else
+ {
+ mCurrentVertexMarkerType = vertexMarker;
+ }
}
- // check if feature is selected
- // only show selections of the current layer
- // TODO: create a mechanism to let layer know whether it's current layer or not [MD]
- bool sel = mSelectedFeatureIds.contains( fet.id() );
+
//QgsDebugMsg(QString("markerScale before renderFeature(): %1").arg(markerScaleFactor));
// markerScalerFactore reflects the wanted scaling of the marker
mRenderer->renderFeature(
Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h 2009-06-03 13:34:35 UTC (rev 10881)
+++ trunk/qgis/src/core/qgsvectorlayer.h 2009-06-05 08:11:40 UTC (rev 10882)
@@ -654,6 +654,12 @@
/** Display labels */
bool mLabelOn;
+ /**The current type of editing marker*/
+ QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType;
+
+ /**Flag if the vertex markers should be drawn only for selection (true) or for all features (false)*/
+ bool mVertexMarkerOnlyForSelection;
+
/**List of overlays. Vector overlays will be rendered on top of all maplayers*/
QList<QgsVectorOverlay*> mOverlays;
Modified: trunk/qgis/src/ui/qgsoptionsbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsoptionsbase.ui 2009-06-03 13:34:35 UTC (rev 10881)
+++ trunk/qgis/src/ui/qgsoptionsbase.ui 2009-06-05 08:11:40 UTC (rev 10882)
@@ -13,7 +13,9 @@
<string>QGIS Options</string>
</property>
<property name="windowIcon" >
- <iconset/>
+ <iconset>
+ <normaloff/>
+ </iconset>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
@@ -28,7 +30,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@@ -48,18 +50,9 @@
<string>Project files</string>
</property>
<layout class="QVBoxLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item>
<widget class="QCheckBox" name="chbAskToSaveProjectChanges" >
<property name="text" >
@@ -98,7 +91,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@@ -134,7 +127,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@@ -241,7 +234,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>577</width>
<height>21</height>
@@ -308,18 +301,9 @@
<string>Rendering quality</string>
</property>
<layout class="QVBoxLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item>
<widget class="QCheckBox" name="chkAntiAliasing" >
<property name="text" >
@@ -345,7 +329,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@@ -360,36 +344,18 @@
<string>&Map tools</string>
</attribute>
<layout class="QGridLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox_10" >
<property name="title" >
<string>Panning and zooming</string>
</property>
<layout class="QGridLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item row="0" column="1" >
<widget class="QComboBox" name="cmbWheelAction" >
<item>
@@ -450,24 +416,15 @@
<string>Measure tool</string>
</property>
<layout class="QGridLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>191</width>
<height>20</height>
@@ -520,18 +477,9 @@
<string>Search radius</string>
</property>
<layout class="QGridLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item row="1" column="0" colspan="2" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
@@ -576,7 +524,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@@ -627,7 +575,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>221</width>
<height>20</height>
@@ -643,8 +591,8 @@
<attribute name="title" >
<string>Digitizing</string>
</attribute>
- <layout class="QVBoxLayout" >
- <item>
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="0" column="0" >
<widget class="QGroupBox" name="mRubberBandGroupBox" >
<property name="title" >
<string>Rubberband</string>
@@ -696,7 +644,7 @@
</layout>
</widget>
</item>
- <item>
+ <item row="1" column="0" >
<widget class="QGroupBox" name="mSnappingGroupBox" >
<property name="title" >
<string>Snapping</string>
@@ -714,7 +662,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>311</width>
<height>20</height>
@@ -744,7 +692,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>241</width>
<height>20</height>
@@ -774,7 +722,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>61</width>
<height>20</height>
@@ -829,25 +777,32 @@
</layout>
</widget>
</item>
- <item>
+ <item row="2" column="0" >
<widget class="QGroupBox" name="mVertexMarkerGroupBox" >
<property name="title" >
<string>Vertex markers</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QCheckBox" name="mMarkersOnlyForSelectedCheckBox" >
+ <property name="text" >
+ <string>Show markers only for selected features</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
<widget class="QLabel" name="mMarkerStyleLabel" >
<property name="text" >
<string>Marker style</string>
</property>
</widget>
</item>
- <item row="0" column="1" >
+ <item row="1" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>281</width>
<height>20</height>
@@ -855,7 +810,7 @@
</property>
</spacer>
</item>
- <item row="0" column="2" >
+ <item row="1" column="2" >
<widget class="QComboBox" name="mMarkerStyleComboBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@@ -868,7 +823,7 @@
</layout>
</widget>
</item>
- <item>
+ <item row="3" column="0" >
<widget class="QGroupBox" name="mEnterAttributeValuesGroupBox" >
<property name="title" >
<string>Enter attribute values</string>
@@ -887,12 +842,12 @@
</layout>
</widget>
</item>
- <item>
+ <item row="4" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>547</width>
<height>71</height>
@@ -907,24 +862,15 @@
<string>CRS</string>
</attribute>
<layout class="QGridLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>51</width>
<height>31</height>
@@ -948,18 +894,9 @@
<string>When layer is loaded that has no coordinate reference system (CRS)</string>
</property>
<layout class="QVBoxLayout" >
- <property name="leftMargin" >
+ <property name="margin" >
<number>11</number>
</property>
- <property name="topMargin" >
- <number>11</number>
- </property>
- <property name="rightMargin" >
- <number>11</number>
- </property>
- <property name="bottomMargin" >
- <number>11</number>
- </property>
<item>
<widget class="QRadioButton" name="radPromptForProjection" >
<property name="text" >
@@ -1031,7 +968,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>501</width>
<height>51</height>
@@ -1152,7 +1089,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>241</width>
<height>20</height>
@@ -1186,7 +1123,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>391</width>
<height>20</height>
More information about the QGIS-commit
mailing list