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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 5 07:39:47 EDT 2009


Author: wonder
Date: 2009-07-05 07:39:47 -0400 (Sun, 05 Jul 2009)
New Revision: 11027

Modified:
   branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp
   branches/symbology-ng-branch/src/plugins/labeling/labelinggui.h
   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:
reorganized labeling dialog in vision of new placement methods :)


Modified: branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp	2009-07-05 11:38:02 UTC (rev 11026)
+++ branches/symbology-ng-branch/src/plugins/labeling/labelinggui.cpp	2009-07-05 11:39:47 UTC (rev 11027)
@@ -44,19 +44,64 @@
   connect(spinBufferSize, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()) );
   connect(btnEngineSettings, SIGNAL(clicked()), this, SLOT(showEngineConfigDialog()) );
 
-  populatePlacementMethods();
+  // set placement methods page based on geometry type
+  switch (layer()->geometryType())
+  {
+    case QGis::Point:
+      stackedPlacement->setCurrentWidget(pagePoint);
+      break;
+    case QGis::Line:
+      stackedPlacement->setCurrentWidget(pageLine);
+      break;
+    case QGis::Polygon:
+      stackedPlacement->setCurrentWidget(pagePolygon);
+      break;
+    default:
+      Q_ASSERT(0 && "NOOOO!");
+  }
+
   populateFieldNames();
 
   const LayerSettings& lyr = lbl->layer(layerId);
   if (!lyr.layerId.isEmpty())
   {
     // load the labeling settings
-    cboPlacement->setCurrentIndex( cboPlacement->findData( QVariant( (int)lyr.placement ) ) );
+
+    // placement
+    switch (lyr.placement)
+    {
+      case LayerSettings::AroundPoint:
+        radAroundPoint->setChecked(true);
+        radAroundCentroid->setChecked(true);
+        spinDistPoint->setValue(lyr.dist);
+        //spinAngle->setValue(lyr.angle);
+        break;
+      case LayerSettings::AroundLine:
+      case LayerSettings::OnLine:
+        radLineParallel->setChecked(true);
+        radPolygonPerimeter->setChecked(true);
+        if ( lyr.placement == LayerSettings::AroundLine )
+        {
+          radAroundLine->setChecked(true);
+          spinDistLine->setValue(lyr.dist);
+        }
+        else
+          radOnLine->setChecked(true);
+        break;
+      case LayerSettings::Horizontal:
+        radPolygonHorizontal->setChecked(true);
+        break;
+      case LayerSettings::Free:
+        radPolygonFree->setChecked(true);
+        break;
+      default:
+        Q_ASSERT(0 && "NOOO!");
+    }
+
     cboFieldName->setCurrentIndex( cboFieldName->findText(lyr.fieldName) );
     chkEnableLabeling->setChecked( lyr.enabled );
     sliderPriority->setValue( lyr.priority );
     chkNoObstacle->setChecked( !lyr.obstacle );
-    spinDist->setValue( lyr.dist );
 
     bool scaleBased = (lyr.scaleMin != 0 && lyr.scaleMax != 0);
     chkScaleBasedVisibility->setChecked(scaleBased);
@@ -78,19 +123,24 @@
 
   }
 
-  // feature distance available only for points and lines
-  if (layer()->geometryType() == QGis::Polygon)
-  {
-    spinDist->setEnabled( false );
-  }
-
   btnTextColor->setColor( lyr.textColor );
   btnBufferColor->setColor( lyr.bufferColor );
   updateFont( lyr.textFont );
   updateUi();
 
+  updateOptions();
+
   connect(chkBuffer, SIGNAL(toggled(bool)), this, SLOT(updateUi()) );
   connect(chkScaleBasedVisibility, SIGNAL(toggled(bool)), this, SLOT(updateUi()) );
+
+  // setup connection to changes in the placement
+  QRadioButton* placementRadios[] = {
+    radAroundPoint, radOverPoint, // point
+    radLineParallel, radLineHorizontal, // line
+    radAroundCentroid, radPolygonHorizontal, radPolygonFree, radPolygonPerimeter // polygon
+  };
+  for (int i = 0; i < sizeof(placementRadios)/sizeof(QRadioButton*); i++)
+    connect( placementRadios[i], SIGNAL(toggled(bool)), this, SLOT(updateOptions()) );
 }
 
 LabelingGui::~LabelingGui()
@@ -110,13 +160,44 @@
   LayerSettings lyr;
   lyr.layerId = mLayerId;
   lyr.fieldName = cboFieldName->currentText();
-  lyr.placement = (LayerSettings::Placement) cboPlacement->itemData(cboPlacement->currentIndex()).toInt();
+
+  lyr.dist = 0;
+
+  if ( (stackedPlacement->currentWidget() == pagePoint && radAroundPoint->isChecked())
+    || (stackedPlacement->currentWidget() == pagePolygon && radAroundCentroid->isChecked()) )
+  {
+    lyr.placement = LayerSettings::AroundPoint;
+    lyr.dist = spinDistPoint->value();
+    //lyr.angle = spinAngle->value();
+  }
+  else if ( (stackedPlacement->currentWidget() == pageLine && radLineParallel->isChecked())
+    || (stackedPlacement->currentWidget() == pagePolygon && radPolygonPerimeter->isChecked()) )
+  {
+    if (radAroundLine->isChecked())
+    {
+      lyr.placement = LayerSettings::AroundLine;
+      lyr.dist = spinDistLine->value();
+    }
+    else
+      lyr.placement = LayerSettings::OnLine;
+  }
+  else
+  {
+    // this must be polygon - horizontal / free
+    if (radPolygonHorizontal->isChecked())
+      lyr.placement = LayerSettings::Horizontal;
+    else if (radPolygonFree->isChecked())
+      lyr.placement = LayerSettings::Free;
+    else
+      Q_ASSERT(0 && "NOOO!");
+  }
+
+
   lyr.textColor = btnTextColor->color();
   lyr.textFont = lblFontPreview->font();
   lyr.enabled = chkEnableLabeling->isChecked();
   lyr.priority = sliderPriority->value();
   lyr.obstacle = !chkNoObstacle->isChecked();
-  lyr.dist = spinDist->value();
   if (chkScaleBasedVisibility->isChecked())
   {
     lyr.scaleMin = spinScaleMin->value();
@@ -139,26 +220,6 @@
   return lyr;
 }
 
-void LabelingGui::populatePlacementMethods()
-{
-  switch (layer()->geometryType())
-  {
-    case QGis::Point:
-      cboPlacement->addItem(tr("Around the point"), QVariant(LayerSettings::AroundPoint));
-      break;
-    case QGis::Line:
-      cboPlacement->addItem(tr("On the line"), QVariant(LayerSettings::OnLine));
-      cboPlacement->addItem(tr("Around the line"), QVariant(LayerSettings::AroundLine));
-      break;
-    case QGis::Polygon:
-      cboPlacement->addItem(tr("Horizontal"), QVariant(LayerSettings::Horizontal));
-      cboPlacement->addItem(tr("Free"), QVariant(LayerSettings::Free));
-      cboPlacement->addItem(tr("Around the centroid"), QVariant(LayerSettings::AroundPoint));
-      cboPlacement->addItem(tr("On the perimeter"), QVariant(LayerSettings::OnLine));
-      cboPlacement->addItem(tr("Around the perimeter"), QVariant(LayerSettings::AroundLine));
-      break;
-  }
-}
 
 void LabelingGui::populateFieldNames()
 {
@@ -231,3 +292,21 @@
   btnBufferColor->setColor(color);
   updatePreview();
 }
+
+void LabelingGui::updateOptions()
+{
+  if ( (stackedPlacement->currentWidget() == pagePoint && radAroundPoint->isChecked())
+    || (stackedPlacement->currentWidget() == pagePolygon && radAroundCentroid->isChecked()) )
+  {
+    stackedOptions->setCurrentWidget(pageOptionsPoint);
+  }
+  else if ( (stackedPlacement->currentWidget() == pageLine && radLineParallel->isChecked())
+    || (stackedPlacement->currentWidget() == pagePolygon && radPolygonPerimeter->isChecked()) )
+  {
+    stackedOptions->setCurrentWidget(pageOptionsLine);
+  }
+  else
+  {
+    stackedOptions->setCurrentWidget(pageOptionsEmpty);
+  }
+}

Modified: branches/symbology-ng-branch/src/plugins/labeling/labelinggui.h
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/labelinggui.h	2009-07-05 11:38:02 UTC (rev 11026)
+++ branches/symbology-ng-branch/src/plugins/labeling/labelinggui.h	2009-07-05 11:39:47 UTC (rev 11027)
@@ -45,6 +45,7 @@
 
     void updateUi();
     void updatePreview();
+    void updateOptions();
 
   protected:
     void populatePlacementMethods();

Modified: branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui	2009-07-05 11:38:02 UTC (rev 11026)
+++ branches/symbology-ng-branch/src/plugins/labeling/labelingguibase.ui	2009-07-05 11:39:47 UTC (rev 11027)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>354</width>
-    <height>608</height>
+    <width>454</width>
+    <height>474</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -18,7 +18,7 @@
     <normaloff/>
    </iconset>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <widget class="QCheckBox" name="chkEnableLabeling">
      <property name="text">
@@ -27,34 +27,8 @@
     </widget>
    </item>
    <item>
-    <layout class="QGridLayout" name="gridLayout_2">
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-         <horstretch>1</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="text">
-        <string>Placement</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1">
-      <widget class="QComboBox" name="cboPlacement">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-         <horstretch>2</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_9">
+     <item>
       <widget class="QLabel" name="label_6">
        <property name="text">
         <string>Field with labels</string>
@@ -64,314 +38,526 @@
        </property>
       </widget>
      </item>
-     <item row="1" column="1">
+     <item>
       <widget class="QComboBox" name="cboFieldName"/>
      </item>
-     <item row="2" column="0">
-      <widget class="QLabel" name="label_8">
-       <property name="text">
-        <string>Label distance</string>
+     <item>
+      <spacer name="horizontalSpacer_4">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
        </property>
-       <property name="alignment">
-        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
        </property>
-      </widget>
+      </spacer>
      </item>
-     <item row="2" column="1">
-      <layout class="QHBoxLayout" name="horizontalLayout_3">
-       <item>
-        <widget class="QDoubleSpinBox" name="spinDist">
-         <property name="decimals">
-          <number>0</number>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QLabel" name="label_9">
-         <property name="text">
-          <string>pixels</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
     </layout>
    </item>
    <item>
-    <widget class="QGroupBox" name="groupBox">
+    <widget class="QGroupBox" name="groupBox_4">
      <property name="title">
-      <string>Text style</string>
+      <string>Placement</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_4">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
+     <layout class="QHBoxLayout" name="horizontalLayout_8">
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>4</number>
+      </property>
+      <item>
+       <widget class="QStackedWidget" name="stackedPlacement">
+        <property name="currentIndex">
+         <number>0</number>
         </property>
-        <property name="text">
-         <string>Font</string>
+        <widget class="QWidget" name="pagePoint">
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <widget class="QRadioButton" name="radAroundPoint">
+            <property name="text">
+             <string>around point</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radOverPoint">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
+            <property name="text">
+             <string>over point</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="pageLine">
+         <layout class="QVBoxLayout" name="verticalLayout_3">
+          <item>
+           <widget class="QRadioButton" name="radLineParallel">
+            <property name="text">
+             <string>parallel</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radLineHorizontal">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
+            <property name="text">
+             <string>horizontal</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="pagePolygon">
+         <layout class="QVBoxLayout" name="verticalLayout_4">
+          <item>
+           <widget class="QRadioButton" name="radAroundCentroid">
+            <property name="text">
+             <string>around centroid</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radPolygonHorizontal">
+            <property name="text">
+             <string>horizontal (slow)</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radPolygonFree">
+            <property name="text">
+             <string>free (slow)</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radPolygonPerimeter">
+            <property name="text">
+             <string>using perimeter</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="Line" name="line_2">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
         </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </widget>
+      </item>
+      <item>
+       <widget class="QStackedWidget" name="stackedOptions">
+        <property name="currentIndex">
+         <number>0</number>
         </property>
+        <widget class="QWidget" name="pageOptionsPoint">
+         <layout class="QGridLayout" name="gridLayout_2">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_8">
+            <property name="text">
+             <string>Label distance</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QDoubleSpinBox" name="spinDistPoint">
+            <property name="decimals">
+             <number>0</number>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="2">
+           <widget class="QLabel" name="label_9">
+            <property name="text">
+             <string>pixels</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_17">
+            <property name="text">
+             <string>Rotation</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QSpinBox" name="spinAngle">
+            <property name="enabled">
+             <bool>false</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <widget class="QLabel" name="label_18">
+            <property name="text">
+             <string>degrees</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="pageOptionsLine">
+         <layout class="QVBoxLayout" name="verticalLayout_5">
+          <item>
+           <widget class="QRadioButton" name="radOnLine">
+            <property name="text">
+             <string>on line</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="radAroundLine">
+            <property name="text">
+             <string>around line</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QLabel" name="label_16">
+              <property name="text">
+               <string>Label distance</string>
+              </property>
+              <property name="alignment">
+               <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QDoubleSpinBox" name="spinDistLine">
+              <property name="decimals">
+               <number>0</number>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="label_15">
+              <property name="text">
+               <string>pixels</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="pageOptionsEmpty"/>
        </widget>
       </item>
-      <item row="0" column="1">
-       <layout class="QHBoxLayout" name="horizontalLayout_5">
-        <item>
-         <widget class="QLabel" name="lblFontName">
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <layout class="QGridLayout" name="gridLayout_4">
+     <item row="0" column="0" rowspan="2">
+      <widget class="QGroupBox" name="groupBox">
+       <property name="title">
+        <string>Text style</string>
+       </property>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="label_4">
           <property name="sizePolicy">
-           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-            <horstretch>1</horstretch>
+           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+            <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
           <property name="text">
-           <string>TextLabel</string>
+           <string>Font</string>
           </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </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 row="0" column="1">
+         <layout class="QHBoxLayout" name="horizontalLayout_5">
+          <item>
+           <widget class="QLabel" name="lblFontName">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+              <horstretch>1</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>TextLabel</string>
+            </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>
+          <item>
+           <widget class="QToolButton" name="btnChangeFont">
+            <property name="text">
+             <string>...</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
         </item>
-        <item>
-         <widget class="QToolButton" name="btnChangeFont">
-          <property name="text">
-           <string>...</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item row="1" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Color</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="1">
-       <layout class="QHBoxLayout" name="horizontalLayout_6">
-        <item>
-         <widget class="QgsColorButton" name="btnTextColor">
+        <item row="1" column="0">
+         <widget class="QLabel" name="label_3">
           <property name="sizePolicy">
-           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
           <property name="text">
-           <string/>
+           <string>Color</string>
           </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
          </widget>
         </item>
-        <item>
-         <spacer name="horizontalSpacer">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
+        <item row="1" column="1">
+         <layout class="QHBoxLayout" name="horizontalLayout_6">
+          <item>
+           <widget class="QgsColorButton" name="btnTextColor">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer name="horizontalSpacer">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeType">
+             <enum>QSizePolicy::Preferred</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>142</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="label_10">
+          <property name="text">
+           <string>Buffer</string>
           </property>
-          <property name="sizeType">
-           <enum>QSizePolicy::Preferred</enum>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
           </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>142</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
+         </widget>
         </item>
-       </layout>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_10">
-        <property name="text">
-         <string>Buffer</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <layout class="QHBoxLayout" name="horizontalLayout_4">
-        <item>
-         <widget class="QCheckBox" name="chkBuffer">
+        <item row="2" column="1">
+         <layout class="QHBoxLayout" name="horizontalLayout_4">
+          <item>
+           <widget class="QCheckBox" name="chkBuffer">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="label_11">
+            <property name="text">
+             <string>Size</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QSpinBox" name="spinBufferSize">
+            <property name="minimum">
+             <number>1</number>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QLabel" name="label_12">
+            <property name="text">
+             <string>Color</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QgsColorButton" name="btnBufferColor">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>...</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item row="4" column="0">
+         <widget class="QLabel" name="label_7">
           <property name="sizePolicy">
-           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
           <property name="text">
-           <string/>
+           <string>Sample</string>
           </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
          </widget>
         </item>
-        <item>
-         <widget class="QLabel" name="label_11">
+        <item row="4" column="1">
+         <widget class="LabelPreview" name="lblFontPreview">
+          <property name="minimumSize">
+           <size>
+            <width>30</width>
+            <height>30</height>
+           </size>
+          </property>
           <property name="text">
-           <string>Size</string>
+           <string>Lorem Ipsum</string>
           </property>
           <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           <set>Qt::AlignCenter</set>
           </property>
          </widget>
         </item>
-        <item>
-         <widget class="QSpinBox" name="spinBufferSize">
-          <property name="minimum">
-           <number>1</number>
+        <item row="3" column="0" colspan="2">
+         <widget class="Line" name="line">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
           </property>
          </widget>
         </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QGroupBox" name="groupBox_2">
+       <property name="title">
+        <string>Priority</string>
+       </property>
+       <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
-         <widget class="QLabel" name="label_12">
+         <widget class="QLabel" name="label_2">
           <property name="text">
-           <string>Color</string>
+           <string>Low</string>
           </property>
-          <property name="alignment">
-           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </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="QgsColorButton" name="btnBufferColor">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
+         <widget class="QLabel" name="label_5">
+          <property name="text">
+           <string>High</string>
           </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item row="1" column="1">
+      <widget class="QGroupBox" name="groupBox_3">
+       <property name="title">
+        <string>Scale-based visibility</string>
+       </property>
+       <layout class="QGridLayout" name="gridLayout_3">
+        <item row="0" column="0" colspan="2">
+         <widget class="QCheckBox" name="chkScaleBasedVisibility">
           <property name="text">
-           <string>...</string>
+           <string>Enabled</string>
           </property>
          </widget>
         </item>
-       </layout>
-      </item>
-      <item row="4" column="0">
-       <widget class="QLabel" name="label_7">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Sample</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="1">
-       <widget class="LabelPreview" name="lblFontPreview">
-        <property name="minimumSize">
-         <size>
-          <width>30</width>
-          <height>30</height>
-         </size>
-        </property>
-        <property name="text">
-         <string>Lorem Ipsum</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0" colspan="2">
-       <widget class="Line" name="line">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </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="QGroupBox" name="groupBox_3">
-     <property name="title">
-      <string>Scale-based visibility</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QCheckBox" name="chkScaleBasedVisibility">
-        <property name="text">
-         <string>Enabled</string>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_7">
-        <item>
+        <item row="1" column="0">
          <widget class="QLabel" name="label_13">
           <property name="text">
            <string>Minimum</string>
@@ -381,7 +567,7 @@
           </property>
          </widget>
         </item>
-        <item>
+        <item row="1" column="1">
          <widget class="QSpinBox" name="spinScaleMin">
           <property name="minimum">
            <number>1</number>
@@ -391,7 +577,7 @@
           </property>
          </widget>
         </item>
-        <item>
+        <item row="2" column="0">
          <widget class="QLabel" name="label_14">
           <property name="text">
            <string>Maximum</string>
@@ -401,7 +587,7 @@
           </property>
          </widget>
         </item>
-        <item>
+        <item row="2" column="1">
          <widget class="QSpinBox" name="spinScaleMax">
           <property name="minimum">
            <number>1</number>
@@ -415,42 +601,19 @@
          </widget>
         </item>
        </layout>
-      </item>
-     </layout>
-    </widget>
+      </widget>
+     </item>
+    </layout>
    </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>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
     <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
-      <widget class="QPushButton" name="btnEngineSettings">
+      <widget class="QCheckBox" name="chkNoObstacle">
        <property name="enabled">
         <bool>true</bool>
        </property>
        <property name="text">
-        <string>Engine settings</string>
+        <string>not an obstacle</string>
        </property>
       </widget>
      </item>
@@ -467,9 +630,32 @@
        </property>
       </spacer>
      </item>
+     <item>
+      <widget class="QPushButton" name="btnEngineSettings">
+       <property name="enabled">
+        <bool>true</bool>
+       </property>
+       <property name="text">
+        <string>Engine settings</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item>
+    <spacer name="verticalSpacer_2">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
@@ -496,9 +682,19 @@
  </customwidgets>
  <tabstops>
   <tabstop>chkEnableLabeling</tabstop>
-  <tabstop>cboPlacement</tabstop>
   <tabstop>cboFieldName</tabstop>
-  <tabstop>spinDist</tabstop>
+  <tabstop>radAroundPoint</tabstop>
+  <tabstop>radOverPoint</tabstop>
+  <tabstop>radLineParallel</tabstop>
+  <tabstop>radLineHorizontal</tabstop>
+  <tabstop>radAroundCentroid</tabstop>
+  <tabstop>radPolygonHorizontal</tabstop>
+  <tabstop>radPolygonFree</tabstop>
+  <tabstop>spinDistPoint</tabstop>
+  <tabstop>spinAngle</tabstop>
+  <tabstop>radOnLine</tabstop>
+  <tabstop>radAroundLine</tabstop>
+  <tabstop>spinDistLine</tabstop>
   <tabstop>btnChangeFont</tabstop>
   <tabstop>btnTextColor</tabstop>
   <tabstop>chkBuffer</tabstop>

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-07-05 11:38:02 UTC (rev 11026)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.cpp	2009-07-05 11:39:47 UTC (rev 11027)
@@ -128,7 +128,8 @@
   geometries.append(lbl);
 
   // register feature to the layer
-  palLayer->registerFeature(lbl->strId(), lbl, labelX, labelY);
+  if (!palLayer->registerFeature(lbl->strId(), lbl, labelX, labelY))
+    return;
 
   // TODO: allow layer-wide feature dist in PAL...?
   if (dist != 0)

Modified: branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h
===================================================================
--- branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-07-05 11:38:02 UTC (rev 11026)
+++ branches/symbology-ng-branch/src/plugins/labeling/pallabeling.h	2009-07-05 11:39:47 UTC (rev 11027)
@@ -30,7 +30,7 @@
   LayerSettings();
   LayerSettings(const LayerSettings& s);
   ~LayerSettings();
-
+  
   enum Placement
   {
     AroundPoint, // Point / Polygon



More information about the QGIS-commit mailing list