[QGIS Commit] r9717 - branches/vector_overlay_branch/src/plugins/diagram_overlay

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Nov 29 08:57:02 EST 2008


Author: mhugent
Date: 2008-11-29 08:57:02 -0500 (Sat, 29 Nov 2008)
New Revision: 9717

Modified:
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramdialog.cpp
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramrendererwidget.h
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.cpp
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.h
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialogbase.ui
Log:
First try to specify diagram sizes in map units

Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramdialog.cpp
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramdialog.cpp	2008-11-29 13:19:56 UTC (rev 9716)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramdialog.cpp	2008-11-29 13:57:02 UTC (rev 9717)
@@ -179,6 +179,11 @@
       return;
     }
 
+  if(renderer->factory())
+  {
+      renderer->factory()->setSizeUnit(rendererWidget->sizeUnit());
+  }
+
   //create QgsDiagramOverlay and add the renderer to it
     
     //the overlay may need a different attribute list than the renderer

Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramrendererwidget.h
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramrendererwidget.h	2008-11-29 13:19:56 UTC (rev 9716)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramrendererwidget.h	2008-11-29 13:57:02 UTC (rev 9717)
@@ -19,6 +19,7 @@
 #define QGSDIAGRAMRENDERERWIDGET_H
 
 #include <QWidget>
+#include "qgsdiagramfactory.h"
 typedef QList<int> QgsAttributeList;
 
 class QgsDiagramRenderer;
@@ -41,6 +42,8 @@
   virtual void applySettings(const QgsDiagramRenderer* renderer) = 0;
   /**Possibility to adapt the dialog to a new field*/
   virtual void changeClassificationField(int newField){}
+
+  virtual QgsDiagramFactory::SizeUnit sizeUnit() const {return QgsDiagramFactory::MM;}
   
  private:
   QgsDiagramRendererWidget();

Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.cpp
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.cpp	2008-11-29 13:19:56 UTC (rev 9716)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.cpp	2008-11-29 13:57:02 UTC (rev 9717)
@@ -25,6 +25,8 @@
 {
   setupUi(this);
   QObject::connect(mFindMaximumValueButton, SIGNAL(clicked()), this, SLOT(insertMaximumAttributeValue()));
+  mSizeUnitComboBox->addItem(tr("Millimeter"));
+  mSizeUnitComboBox->addItem(tr("Map units"));
 }
 
 QgsLinearlyScalingDialog::~QgsLinearlyScalingDialog()
@@ -119,3 +121,15 @@
 	}
     }
 }
+
+QgsDiagramFactory::SizeUnit QgsLinearlyScalingDialog::sizeUnit() const
+{
+    if(mSizeUnitComboBox->currentText() == tr("Map units"))
+    {
+        return QgsDiagramFactory::MapUnits;
+    }
+    else
+    {
+        return QgsDiagramFactory::MM;
+    }
+}

Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.h
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.h	2008-11-29 13:19:56 UTC (rev 9716)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialog.h	2008-11-29 13:57:02 UTC (rev 9717)
@@ -36,6 +36,8 @@
   void changeClassificationField(int newField){mClassificationField = newField;}
   void setWellKnownName(const QString& wkn);
 
+  QgsDiagramFactory::SizeUnit sizeUnit() const;
+
  private:
   QString mClassificationAttribute;
   QString mWellKnownName;

Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialogbase.ui
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialogbase.ui	2008-11-29 13:19:56 UTC (rev 9716)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgslinearlyscalingdialogbase.ui	2008-11-29 13:57:02 UTC (rev 9717)
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>609</width>
+    <width>527</width>
     <height>91</height>
    </rect>
   </property>
@@ -13,42 +13,50 @@
    <string>Form</string>
   </property>
   <layout class="QGridLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
-    <number>6</number>
-   </property>
-   <item row="1" column="2" >
-    <widget class="QLabel" name="mSizeLabel" >
-     <property name="text" >
-      <string>Size:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="3" >
-    <widget class="QSpinBox" name="mSizeSpinBox" >
-     <property name="maximum" >
-      <number>999</number>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="0" colspan="3" >
+   <item row="0" column="0" >
     <widget class="QLabel" name="mTitleLabel" >
      <property name="text" >
       <string>Scale linearly between 0 and the following attribute value/ diagram size:</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="QLineEdit" name="mValueLineEdit" />
-   </item>
    <item row="1" column="0" >
-    <widget class="QPushButton" name="mFindMaximumValueButton" >
-     <property name="text" >
-      <string>find maximum Value:</string>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" >
+     <item>
+      <widget class="QPushButton" name="mFindMaximumValueButton" >
+       <property name="text" >
+        <string>find maximum Value:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="mValueLineEdit" />
+     </item>
+     <item>
+      <widget class="QLabel" name="mSizeLabel" >
+       <property name="text" >
+        <string>Size:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QSpinBox" name="mSizeSpinBox" >
+       <property name="maximum" >
+        <number>10000000</number>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="mSizeUnitLabel" >
+       <property name="text" >
+        <string>Size unit: </string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QComboBox" name="mSizeUnitComboBox" />
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>



More information about the QGIS-commit mailing list