[QGIS Commit] r8214 - in trunk/qgis/src: app gui ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 13 05:25:52 EDT 2008


Author: mhugent
Date: 2008-03-13 05:25:52 -0400 (Thu, 13 Mar 2008)
New Revision: 8214

Modified:
   trunk/qgis/src/app/qgsoptions.cpp
   trunk/qgis/src/gui/qgsmapcanvassnapper.cpp
   trunk/qgis/src/ui/qgsoptionsbase.ui
Log:
Added support for a default snap mode (can be to vertex, to segment, to vertex and segment)

Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp	2008-03-12 21:02:40 UTC (rev 8213)
+++ trunk/qgis/src/app/qgsoptions.cpp	2008-03-13 09:25:52 UTC (rev 8214)
@@ -163,6 +163,13 @@
   myGreen = settings.value("/qgis/digitizing/line_color_green", 0).toInt();
   myBlue = settings.value("/qgis/digitizing/line_color_blue", 0).toInt();
   mLineColourToolButton->setColor(QColor(myRed, myGreen, myBlue));
+
+  //default snap mode
+  mDefaultSnapModeComboBox->insertItem(0, tr("to vertex"));
+  mDefaultSnapModeComboBox->insertItem(1, tr("to segment"));
+  mDefaultSnapModeComboBox->insertItem(2, tr("to vertex and segment"));
+  QString defaultSnapString = settings.value("/qgis/digitizing/default_snap_mode", "to vertex").toString();
+  mDefaultSnapModeComboBox->setCurrentIndex(mDefaultSnapModeComboBox->findText(tr(defaultSnapString)));
   mDefaultSnappingToleranceSpinBox->setValue(settings.value("/qgis/digitizing/default_snapping_tolerance", 0).toDouble());
   mSearchRadiusVertexEditSpinBox->setValue(settings.value("/qgis/digitizing/search_radius_vertex_edit", 10).toDouble());
 }
@@ -287,6 +294,22 @@
   settings.setValue("/qgis/digitizing/line_color_red", digitizingColor.red());
   settings.setValue("/qgis/digitizing/line_color_green", digitizingColor.green());
   settings.setValue("/qgis/digitizing/line_color_blue", digitizingColor.blue());
+
+  //default snap mode
+  QString defaultSnapModeString;
+  if(mDefaultSnapModeComboBox->currentText() == tr("to vertex"))
+    {
+      defaultSnapModeString = "to vertex";
+    }
+  else if(mDefaultSnapModeComboBox->currentText() == tr("to segment"))
+    {
+      defaultSnapModeString = "to segment";
+    }
+  else if(mDefaultSnapModeComboBox->currentText() == tr("to vertex and segment"))
+    {
+      defaultSnapModeString = "to vertex and segment";
+    }
+  settings.setValue("/qgis/digitizing/default_snap_mode", defaultSnapModeString);
   settings.setValue("/qgis/digitizing/default_snapping_tolerance", mDefaultSnappingToleranceSpinBox->value());
   settings.setValue("/qgis/digitizing/search_radius_vertex_edit", mSearchRadiusVertexEditSpinBox->value());
   //

Modified: trunk/qgis/src/gui/qgsmapcanvassnapper.cpp
===================================================================
--- trunk/qgis/src/gui/qgsmapcanvassnapper.cpp	2008-03-12 21:02:40 UTC (rev 8213)
+++ trunk/qgis/src/gui/qgsmapcanvassnapper.cpp	2008-03-13 09:25:52 UTC (rev 8214)
@@ -227,8 +227,24 @@
 	    }
 	  
 	  vectorLayerList.push_back(currentVectorLayer);
-	  snapTo.push_back(QgsSnapper::SNAP_TO_VERTEX);
 	  QSettings settings;
+
+	  //default snap mode
+	  QString defaultSnapString = settings.value("/qgis/digitizing/default_snap_mode", "to vertex").toString();
+	  if(defaultSnapString == "to segment")
+	    {
+	      snapTo.push_back(QgsSnapper::SNAP_TO_SEGMENT);
+	    }
+	  else if(defaultSnapString == "to vertex and segment")
+	    {
+	      snapTo.push_back(QgsSnapper::SNAP_TO_VERTEX_AND_SEGMENT);
+	    }
+	  else
+	    {
+	      snapTo.push_back(QgsSnapper::SNAP_TO_VERTEX);
+	    }
+	  
+	  //default snapping tolerance
 	  toleranceDoubleList.push_back(settings.value("/qgis/digitizing/default_snapping_tolerance", 0).toDouble());
 	}
 

Modified: trunk/qgis/src/ui/qgsoptionsbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsoptionsbase.ui	2008-03-12 21:02:40 UTC (rev 8213)
+++ trunk/qgis/src/ui/qgsoptionsbase.ui	2008-03-13 09:25:52 UTC (rev 8214)
@@ -28,16 +28,6 @@
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="1" column="0" >
-    <widget class="QDialogButtonBox" name="buttonBox" >
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons" >
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
    <item row="0" column="0" >
     <widget class="QTabWidget" name="tabWidget" >
      <property name="currentIndex" >
@@ -675,10 +665,23 @@
        <property name="spacing" >
         <number>6</number>
        </property>
-       <item row="0" column="0" >
-        <widget class="QGroupBox" name="mRubberBandGroupBox" >
+       <item row="2" column="0" >
+        <spacer>
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" >
+          <size>
+           <width>20</width>
+           <height>171</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="0" >
+        <widget class="QGroupBox" name="mSnappingGroupBox" >
          <property name="title" >
-          <string>Rubberband</string>
+          <string>Snapping</string>
          </property>
          <layout class="QGridLayout" >
           <property name="margin" >
@@ -696,79 +699,77 @@
              <number>6</number>
             </property>
             <item>
-             <widget class="QLabel" name="mLineWidthTextLabel" >
+             <widget class="QLabel" name="mDefaultSnapModeLabel" >
               <property name="text" >
-               <string>Line Width:</string>
+               <string>Default Snap Mode:</string>
               </property>
-              <property name="buddy" >
-               <cstring>mLineWidthSpinBox</cstring>
-              </property>
              </widget>
             </item>
             <item>
-             <widget class="QSpinBox" name="mLineWidthSpinBox" >
-              <property name="toolTip" >
-               <string>Line width in pixels</string>
-              </property>
-              <property name="minimum" >
-               <number>1</number>
-              </property>
-             </widget>
-            </item>
-            <item>
              <spacer>
               <property name="orientation" >
                <enum>Qt::Horizontal</enum>
               </property>
               <property name="sizeHint" >
                <size>
-                <width>271</width>
+                <width>311</width>
                 <height>20</height>
                </size>
               </property>
              </spacer>
             </item>
             <item>
-             <widget class="QLabel" name="mLineColourTextLabel" >
+             <widget class="QComboBox" name="mDefaultSnapModeComboBox" >
+              <property name="sizePolicy" >
+               <sizepolicy>
+                <hsizetype>7</hsizetype>
+                <vsizetype>0</vsizetype>
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="2" column="0" >
+           <layout class="QHBoxLayout" >
+            <property name="margin" >
+             <number>0</number>
+            </property>
+            <property name="spacing" >
+             <number>6</number>
+            </property>
+            <item>
+             <widget class="QLabel" name="mVertexSearchRadiusVertexEditLabel" >
               <property name="text" >
-               <string>Line Colour:</string>
+               <string>Search radius for vertex edits (in layer units):</string>
               </property>
-              <property name="buddy" >
-               <cstring>mLineColourToolButton</cstring>
-              </property>
              </widget>
             </item>
             <item>
-             <widget class="QgsColorButton" name="mLineColourToolButton" >
-              <property name="minimumSize" >
+             <spacer>
+              <property name="orientation" >
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" >
                <size>
-                <width>100</width>
-                <height>0</height>
+                <width>61</width>
+                <height>20</height>
                </size>
               </property>
-              <property name="text" >
-               <string/>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QDoubleSpinBox" name="mSearchRadiusVertexEditSpinBox" >
+              <property name="maximum" >
+               <double>9999.989999999999782</double>
               </property>
              </widget>
             </item>
            </layout>
           </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="1" column="0" >
-        <widget class="QGroupBox" name="mSnappingGroupBox" >
-         <property name="title" >
-          <string>Snapping</string>
-         </property>
-         <layout class="QGridLayout" >
-          <property name="margin" >
-           <number>9</number>
-          </property>
-          <property name="spacing" >
-           <number>6</number>
-          </property>
-          <item row="0" column="0" >
+          <item row="1" column="0" >
            <layout class="QHBoxLayout" >
             <property name="margin" >
              <number>0</number>
@@ -805,7 +806,22 @@
             </item>
            </layout>
           </item>
-          <item row="1" column="0" >
+         </layout>
+        </widget>
+       </item>
+       <item row="0" column="0" >
+        <widget class="QGroupBox" name="mRubberBandGroupBox" >
+         <property name="title" >
+          <string>Rubberband</string>
+         </property>
+         <layout class="QGridLayout" >
+          <property name="margin" >
+           <number>9</number>
+          </property>
+          <property name="spacing" >
+           <number>6</number>
+          </property>
+          <item row="0" column="0" >
            <layout class="QHBoxLayout" >
             <property name="margin" >
              <number>0</number>
@@ -814,50 +830,66 @@
              <number>6</number>
             </property>
             <item>
-             <widget class="QLabel" name="mVertexSearchRadiusVertexEditLabel" >
+             <widget class="QLabel" name="mLineWidthTextLabel" >
               <property name="text" >
-               <string>Search radius for vertex edits (in layer units):</string>
+               <string>Line Width:</string>
               </property>
+              <property name="buddy" >
+               <cstring>mLineWidthSpinBox</cstring>
+              </property>
              </widget>
             </item>
             <item>
+             <widget class="QSpinBox" name="mLineWidthSpinBox" >
+              <property name="toolTip" >
+               <string>Line width in pixels</string>
+              </property>
+              <property name="minimum" >
+               <number>1</number>
+              </property>
+             </widget>
+            </item>
+            <item>
              <spacer>
               <property name="orientation" >
                <enum>Qt::Horizontal</enum>
               </property>
               <property name="sizeHint" >
                <size>
-                <width>61</width>
+                <width>271</width>
                 <height>20</height>
                </size>
               </property>
              </spacer>
             </item>
             <item>
-             <widget class="QDoubleSpinBox" name="mSearchRadiusVertexEditSpinBox" >
-              <property name="maximum" >
-               <double>9999.989999999999782</double>
+             <widget class="QLabel" name="mLineColourTextLabel" >
+              <property name="text" >
+               <string>Line Colour:</string>
               </property>
+              <property name="buddy" >
+               <cstring>mLineColourToolButton</cstring>
+              </property>
              </widget>
             </item>
+            <item>
+             <widget class="QgsColorButton" name="mLineColourToolButton" >
+              <property name="minimumSize" >
+               <size>
+                <width>100</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="text" >
+               <string/>
+              </property>
+             </widget>
+            </item>
            </layout>
           </item>
          </layout>
         </widget>
        </item>
-       <item row="2" column="0" >
-        <spacer>
-         <property name="orientation" >
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" >
-          <size>
-           <width>20</width>
-           <height>171</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tabProjection" >
@@ -1023,6 +1055,16 @@
      </widget>
     </widget>
    </item>
+   <item row="1" column="0" >
+    <widget class="QDialogButtonBox" name="buttonBox" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11" />



More information about the QGIS-commit mailing list