[QGIS Commit] r10889 - branches/symbology-ng-branch/src/plugins/labeling

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Jun 5 19:20:00 EDT 2009


Author: wonder
Date: 2009-06-05 19:20:00 -0400 (Fri, 05 Jun 2009)
New Revision: 10889

Modified:
   branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp
   branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui
   branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp
   branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h
Log:
Labeling: allowed to set priority for a layer and whether's it should be considered as an obstacle.


Modified: branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp	2009-06-05 22:55:30 UTC (rev 10888)
+++ branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp	2009-06-05 23:20:00 UTC (rev 10889)
@@ -49,6 +49,8 @@
     cboPlacement->setCurrentIndex( cboPlacement->findData( QVariant( (int)lyr.placement ) ) );
     cboFieldName->setCurrentIndex( cboFieldName->findText(lyr.fieldName) );
     chkEnableLabeling->setChecked( lyr.enabled );
+    sliderPriority->setValue( lyr.priority );
+    chkNoObstacle->setChecked( !lyr.obstacle );
   }
   else
   {
@@ -81,6 +83,8 @@
   lyr.textColor = btnTextColor->color();
   lyr.textFont = lblFontPreview->font();
   lyr.enabled = chkEnableLabeling->isChecked();
+  lyr.priority = sliderPriority->value();
+  lyr.obstacle = !chkNoObstacle->isChecked();
 
   return lyr;
 }

Modified: branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui	2009-06-05 22:55:30 UTC (rev 10888)
+++ branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui	2009-06-05 23:20:00 UTC (rev 10889)
@@ -183,6 +183,58 @@
     </widget>
    </item>
    <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Priority</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Low</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSlider" name="sliderPriority">
+        <property name="maximum">
+         <number>10</number>
+        </property>
+        <property name="value">
+         <number>5</number>
+        </property>
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="tickPosition">
+         <enum>QSlider::TicksBelow</enum>
+        </property>
+        <property name="tickInterval">
+         <number>1</number>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>High</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="chkNoObstacle">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="text">
+      <string>not an obstacle</string>
+     </property>
+    </widget>
+   </item>
+   <item>
     <spacer name="verticalSpacer_2">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -196,53 +248,6 @@
     </spacer>
    </item>
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="enabled">
-        <bool>false</bool>
-       </property>
-       <property name="text">
-        <string>Priority</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QDoubleSpinBox" name="spinPriority">
-       <property name="enabled">
-        <bool>false</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QCheckBox" name="chkNoObstacle">
-     <property name="enabled">
-      <bool>false</bool>
-     </property>
-     <property name="text">
-      <string>not an obstacle</string>
-     </property>
-    </widget>
-   </item>
-   <item>
     <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
       <widget class="QPushButton" name="btnEngineSettings">
@@ -270,19 +275,6 @@
     </layout>
    </item>
    <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>25</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-06-05 22:55:30 UTC (rev 10888)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-06-05 23:20:00 UTC (rev 10889)
@@ -141,7 +141,8 @@
   }
 
   // create the pal layer
-  Layer* l = pal.addLayer(lyr.layerId.toLocal8Bit().data(), -1, -1, arrangement, METER, 0, true, true, true);
+  double priority = 1 - lyr.priority/10.0; // convert 0..10 --> 1..0
+  Layer* l = pal.addLayer(lyr.layerId.toLocal8Bit().data(), -1, -1, arrangement, METER, priority, lyr.obstacle, true, true);
 
   QFontMetrics fm(lyr.textFont);
 

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-06-05 22:55:30 UTC (rev 10888)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-06-05 23:20:00 UTC (rev 10889)
@@ -36,6 +36,8 @@
       QFont textFont;
       QColor textColor;
       bool enabled;
+      int priority; // 0 = low, 10 = high
+      bool obstacle; // whether it's an obstacle
     };
 
     void doLabeling(QPainter* painter);



More information about the QGIS-commit mailing list