[QGIS Commit] r12766 - trunk/qgis/src/core/symbology-ng
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Jan 15 04:14:42 EST 2010
Author: wonder
Date: 2010-01-15 04:14:37 -0500 (Fri, 15 Jan 2010)
New Revision: 12766
Modified:
trunk/qgis/src/core/symbology-ng/qgssymbologyv2conversion.cpp
Log:
Fixed conversions between V1 and V2 symbols: don't convert pixels<->mm anymore
Modified: trunk/qgis/src/core/symbology-ng/qgssymbologyv2conversion.cpp
===================================================================
--- trunk/qgis/src/core/symbology-ng/qgssymbologyv2conversion.cpp 2010-01-14 22:01:40 UTC (rev 12765)
+++ trunk/qgis/src/core/symbology-ng/qgssymbologyv2conversion.cpp 2010-01-15 09:14:37 UTC (rev 12766)
@@ -15,11 +15,7 @@
#include "qgsgraduatedsymbolrendererv2.h"
#include "qgscategorizedsymbolrendererv2.h"
-// some ad-hoc conversions
-#define MM2PIXELS(x) ((x)/0.26)
-#define PIXELS2MM(x) ((x)*0.26)
-
QgsSymbolV2* QgsSymbologyV2Conversion::symbolV1toV2( const QgsSymbol* s )
{
switch ( s->type() )
@@ -27,7 +23,7 @@
case QGis::Point:
{
QgsMarkerSymbolLayerV2* sl = NULL;
- double size = MM2PIXELS( s->pointSize() );
+ double size = s->pointSize();
double angle = 0; // rotation only from classification field
QString symbolName = s->pointSymbolName();
if ( symbolName.startsWith( "hard:" ) )
@@ -52,7 +48,7 @@
case QGis::Line:
{
QColor color = s->color();
- double width = MM2PIXELS( s->lineWidth() );
+ double width = s->lineWidth();
Qt::PenStyle penStyle = s->pen().style();
QgsLineSymbolLayerV2* sl = new QgsSimpleLineSymbolLayerV2( color, width, penStyle );
@@ -67,7 +63,7 @@
QColor borderColor = s->color();
Qt::BrushStyle brushStyle = s->brush().style();
Qt::PenStyle borderStyle = s->pen().style();
- double borderWidth = MM2PIXELS( s->lineWidth() );
+ double borderWidth = s->lineWidth();
QgsFillSymbolLayerV2* sl = new QgsSimpleFillSymbolLayerV2( color, brushStyle, borderColor, borderStyle, borderWidth );
QgsSymbolLayerV2List layers;
@@ -96,7 +92,7 @@
QgsSymbol* sOld = new QgsSymbol( QGis::Point );
sOld->setFillColor( sl->color() );
sOld->setFillStyle( Qt::SolidPattern );
- sOld->setPointSize( PIXELS2MM( msl->size() ) );
+ sOld->setPointSize( msl->size() );
if ( sl->layerType() == "SimpleMarker" )
{
QgsSimpleMarkerSymbolLayerV2* smsl = static_cast<QgsSimpleMarkerSymbolLayerV2*>( sl );
@@ -117,7 +113,7 @@
QgsLineSymbolLayerV2* lsl = static_cast<QgsLineSymbolLayerV2*>( sl );
QgsSymbol* sOld = new QgsSymbol( QGis::Line );
sOld->setColor( sl->color() );
- sOld->setLineWidth( PIXELS2MM( lsl->width() ) );
+ sOld->setLineWidth( lsl->width() );
if ( sl->layerType() == "SimpleLine" )
{
// add specific settings
@@ -136,7 +132,7 @@
// add specifc settings
QgsSimpleFillSymbolLayerV2* sfsl = static_cast<QgsSimpleFillSymbolLayerV2*>( sl );
sOld->setColor( sfsl->borderColor() );
- sOld->setLineWidth( PIXELS2MM( sfsl->borderWidth() ) );
+ sOld->setLineWidth( sfsl->borderWidth() );
sOld->setLineStyle( sfsl->borderStyle() );
sOld->setFillStyle( sfsl->brushStyle() );
}
More information about the QGIS-commit
mailing list