[QGIS Commit] r10018 - in branches/vector_overlay_branch/src: core
plugins/diagram_overlay
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jan 26 03:11:49 EST 2009
Author: mhugent
Date: 2009-01-26 03:11:48 -0500 (Mon, 26 Jan 2009)
New Revision: 10018
Modified:
branches/vector_overlay_branch/src/core/qgspalobjectpositionmanager.cpp
branches/vector_overlay_branch/src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp
Log:
Specify proper diagram dimensions also for proportional svg symbols
Modified: branches/vector_overlay_branch/src/core/qgspalobjectpositionmanager.cpp
===================================================================
--- branches/vector_overlay_branch/src/core/qgspalobjectpositionmanager.cpp 2009-01-26 08:05:26 UTC (rev 10017)
+++ branches/vector_overlay_branch/src/core/qgspalobjectpositionmanager.cpp 2009-01-26 08:11:48 UTC (rev 10018)
@@ -86,7 +86,6 @@
QMap<int, QgsOverlayObject*>::const_iterator objectIt = positionObjects->begin();
for(; objectIt != positionObjects->end(); ++objectIt)
{
- //positionLayer->registerFeature (const char *geom_id, double label_x, double label_y, PalGeometry *userGeom)
positionLayer->registerFeature(strdup(QString::number(objectNr).toAscii().data()), objectIt.value()->width(), objectIt.value()->height(), objectIt.value());
++objectNr;
}
Modified: branches/vector_overlay_branch/src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp
===================================================================
--- branches/vector_overlay_branch/src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp 2009-01-26 08:05:26 UTC (rev 10017)
+++ branches/vector_overlay_branch/src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp 2009-01-26 08:11:48 UTC (rev 10018)
@@ -66,7 +66,20 @@
int QgsSVGDiagramFactory::getDiagramDimensions(int size, const QgsFeature& f, const QgsRenderContext& context, int& width, int& height) const
{
- return 1; //soon...
+ double scaleFactor;
+ QSize defaultSize = mRenderer.defaultSize();
+ //size parameter applies to maximum of width, height
+ if(defaultSize.width() >= defaultSize.height())
+ {
+ scaleFactor = ((double)size * diagramSizeScaleFactor(context) * context.rasterScaleFactor()) / defaultSize.width();
+ }
+ else
+ {
+ scaleFactor = ((double)size * diagramSizeScaleFactor(context) * context.rasterScaleFactor()) / defaultSize.height();
+ }
+ width = (int)(defaultSize.width() * scaleFactor);
+ height = (int)(defaultSize.height() * scaleFactor);
+ return 0;
}
bool QgsSVGDiagramFactory::setSVGData(const QByteArray& data, const QString& filePath)
More information about the QGIS-commit
mailing list