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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Nov 29 09:00:29 EST 2008


Author: mhugent
Date: 2008-11-29 09:00:29 -0500 (Sat, 29 Nov 2008)
New Revision: 9718

Added:
   branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramfactory.cpp
Log:
Forgot to add new file in last commit

Added: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramfactory.cpp
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramfactory.cpp	                        (rev 0)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgsdiagramfactory.cpp	2008-11-29 14:00:29 UTC (rev 9718)
@@ -0,0 +1,48 @@
+/***************************************************************************
+                         qgsdiagramfactory.cpp  -  description
+                         ---------------------
+    begin                : November 2008
+    copyright            : (C) 2008 by Marco Hugentobler
+    email                : marco dot hugentobler at karto dot baug dot ethz dot ch
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "qgsdiagramfactory.h"
+#include "qgsrendercontext.h"
+
+QgsDiagramFactory::QgsDiagramFactory(): mSizeUnit(MM)
+ {
+
+ }
+
+ QgsDiagramFactory::~QgsDiagramFactory()
+ {
+
+ }
+
+ QgsDiagramFactory::SizeType QgsDiagramFactory::sizeType() const
+ {
+     return QgsDiagramFactory::HEIGHT;
+ }
+
+ double QgsDiagramFactory::diagramSizeScaleFactor(const QgsRenderContext& context) const
+ {
+     if(mSizeUnit == MM)
+     {
+        return context.scaleFactor();
+     }
+     else if(mSizeUnit == MapUnits)
+     {
+         return 1 / context.mapToPixel().mapUnitsPerPixel(); //pixel based devices
+     }
+
+     return 1.0;
+ }



More information about the QGIS-commit mailing list