[QGIS Commit] r11152 - in trunk/qgis: python/core src/app src/core
src/core/renderer src/core/symbology src/ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Jul 23 06:59:59 EDT 2009
Author: jef
Date: 2009-07-23 06:59:59 -0400 (Thu, 23 Jul 2009)
New Revision: 11152
Modified:
trunk/qgis/python/core/qgscontinuouscolorrenderer.sip
trunk/qgis/python/core/qgsgraduatedsymbolrenderer.sip
trunk/qgis/python/core/qgslabel.sip
trunk/qgis/python/core/qgsmarkercatalogue.sip
trunk/qgis/python/core/qgsrenderer.sip
trunk/qgis/python/core/qgssinglesymbolrenderer.sip
trunk/qgis/python/core/qgsuniquevaluerenderer.sip
trunk/qgis/src/app/qgssinglesymboldialog.cpp
trunk/qgis/src/app/qgssinglesymboldialog.h
trunk/qgis/src/core/CMakeLists.txt
trunk/qgis/src/core/qgslabel.cpp
trunk/qgis/src/core/qgslabel.h
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/qgsvectorlayer.h
trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.cpp
trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.h
trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.h
trunk/qgis/src/core/renderer/qgsrenderer.h
trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp
trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.h
trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.h
trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
trunk/qgis/src/core/symbology/qgsmarkercatalogue.h
trunk/qgis/src/core/symbology/qgssymbol.cpp
trunk/qgis/src/core/symbology/qgssymbol.h
trunk/qgis/src/ui/qgssinglesymboldialogbase.ui
Log:
[FEATURE] symbology enhancements:
- add QgsMarkerCatalogue::refreshList() to refresh the symbol list w/o restart
- allow refresh of symbols via popup menu on the renderer's symbol selection
- add support for data define symbol(name)s
- add support for font symbol markers (only data define - no gui yet)
- pass QgsRenderContext to rendering methods
- add symbol size in map units (ie. symbols that keep the size in mapunits
independant of the mapscale)
Modified: trunk/qgis/python/core/qgscontinuouscolorrenderer.sip
===================================================================
--- trunk/qgis/python/core/qgscontinuouscolorrenderer.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgscontinuouscolorrenderer.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -10,8 +10,9 @@
QgsContinuousColorRenderer(QGis::GeometryType type);
QgsContinuousColorRenderer(const QgsContinuousColorRenderer& other);
virtual ~QgsContinuousColorRenderer();
- /**Renders the feature using the minimum and maximum value of the classification field*/
- void renderFeature(QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
+ /**Renders the feature using the minimum and maximum value of the classification field
+ * added in 1.2 */
+ void renderFeature(QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected);
/**Returns the number of the classification field*/
int classificationField() const;
/**Sets the id of the classification field*/
Modified: trunk/qgis/python/core/qgsgraduatedsymbolrenderer.sip
===================================================================
--- trunk/qgis/python/core/qgsgraduatedsymbolrenderer.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgsgraduatedsymbolrenderer.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -48,11 +48,11 @@
@param f a pointer to the feature to determine if rendering will happen*/
bool willRenderFeature(QgsFeature *f);
- /**Renders an OGRFeature
+ /**Renders a feature
\param p a painter (usually the one from the current map canvas)
\param f a pointer to a feature to render
\param t the transform object containing the information how to transform the map coordinates to screen coordinates*/
- void renderFeature(QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
+ void renderFeature(QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected);
/**Sets the number of the classicifation field
\param field the number of the field to classify*/
Modified: trunk/qgis/python/core/qgslabel.sip
===================================================================
--- trunk/qgis/python/core/qgslabel.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgslabel.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -45,14 +45,24 @@
QgsPoint p;
double angle;
};
-
+
+
/** \brief render label
- * \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
- */
+ \note deprecated
+ */
void renderLabel ( QPainter* painter, QgsRectangle& viewExtent,
QgsCoordinateTransform* coordinateTransform,
QgsMapToPixel *transform,
QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0, double sizeScale = 1, double rasterScaleFactor = 1);
+
+ /** \brief render label
+ * \param renderContext renderer context
+ * \param feature feature to render
+ * \param selected is to be shown selected
+ * \param classAttributes attributes to use for labeling
+ * \note added in 1.2
+ */
+ void renderLabel ( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0);
/** Reads the renderer configuration from an XML file
@param rnode the Dom node to read
Modified: trunk/qgis/python/core/qgsmarkercatalogue.sip
===================================================================
--- trunk/qgis/python/core/qgsmarkercatalogue.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgsmarkercatalogue.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -1,6 +1,6 @@
/** Catalogue of point symbols */
-class QgsMarkerCatalogue /NoDefaultCtors/
+class QgsMarkerCatalogue : QObject /NoDefaultCtors/
{
%TypeHeaderCode
#include <qgsmarkercatalogue.h>
@@ -29,5 +29,15 @@
/** Returns a pixmap given a file name of a svg marker
* NOTE: this method needs to be public static for QgsMarkerDialog::visualizeMarkers */
static void svgMarker (QPainter * thepPainter, QString name, int size );
+
+ public slots:
+ // reload the symbols
+ // added in 1.2
+ void refreshList();
+
+ signals:
+ // symbols were reloaded
+ // added in 1.2
+ void markersRefreshed();
};
Modified: trunk/qgis/python/core/qgsrenderer.sip
===================================================================
--- trunk/qgis/python/core/qgsrenderer.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgsrenderer.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -15,8 +15,22 @@
@param p the painter storing brush and pen
@param f a pointer to the feature to be rendered
@param pic pointer to a marker from SVG (is only used by marker renderers)
- @param scalefactor pointer to the scale factor for the marker image*/
- virtual void renderFeature(QPainter* p, QgsFeature& f,QImage* pic, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0)=0;
+ @param selected feature is to be shown selected
+ @param widthScale scale factor
+ @param rasterScaleFactor scale factor for rasters
+
+ deprecated */
+ void renderFeature(QPainter* p, QgsFeature& f,QImage* pic, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
+
+ /**A vector layer passes features to a renderer object to change the brush ans pen of the qpainter
+ @param renderContext context of the rendering operation
+ @param f the feature to render
+ @param pic pointer to marker to render (is only used by marker renderers)
+ @param selected the feature is to be shown selected
+
+ added in 1.2 */
+ virtual void renderFeature(QgsRenderContext &renderContext, QgsFeature& f,QImage* pic, bool selected)=0;
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer*/
Modified: trunk/qgis/python/core/qgssinglesymbolrenderer.sip
===================================================================
--- trunk/qgis/python/core/qgssinglesymbolrenderer.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgssinglesymbolrenderer.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -9,12 +9,15 @@
QgsSingleSymbolRenderer(QGis::GeometryType type);
QgsSingleSymbolRenderer(const QgsSingleSymbolRenderer& other);
virtual ~QgsSingleSymbolRenderer();
+
/**Replaces the current mSymbol by sy*/
void addSymbol(QgsSymbol* sy /Transfer/);
/*Returns a pointer to mSymbol*/
const QgsSymbol* symbol() const;
- /**Renders an OGRFeature*/
- void renderFeature(QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
+
+ /**Renders a feature added in 1.2 */
+ void renderFeature(QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected);
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer*/
Modified: trunk/qgis/python/core/qgsuniquevaluerenderer.sip
===================================================================
--- trunk/qgis/python/core/qgsuniquevaluerenderer.sip 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/python/core/qgsuniquevaluerenderer.sip 2009-07-23 10:59:59 UTC (rev 11152)
@@ -11,7 +11,11 @@
/** Determines if a feature will be rendered or not
@param f a pointer to the feature to determine if rendering will happen*/
bool willRenderFeature(QgsFeature *f);
- void renderFeature(QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
+
+ /* render feature
+ * added in 1.2 */
+ void renderFeature(QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected);
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer*/
Modified: trunk/qgis/src/app/qgssinglesymboldialog.cpp
===================================================================
--- trunk/qgis/src/app/qgssinglesymboldialog.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/app/qgssinglesymboldialog.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -40,7 +40,7 @@
QgsDebugMsg( "entered." );
}
-QgsSingleSymbolDialog::QgsSingleSymbolDialog( QgsVectorLayer * layer, bool disabled ): QDialog(), mVectorLayer( layer )
+QgsSingleSymbolDialog::QgsSingleSymbolDialog( QgsVectorLayer * layer, bool disabled ): QDialog(), mVectorLayer( layer ), mDisabled( disabled )
{
setupUi( this );
QgsDebugMsg( "entered." );
@@ -59,7 +59,44 @@
// loops can be removed now with changes I have made to use combo
// boxes for line style and fill style...test and remove if poss.
+ QAction *refreshAction = new QAction( tr( "Refresh markers" ), lstSymbols );
+ lstSymbols->addAction( refreshAction );
+ connect( refreshAction, SIGNAL( triggered() ), QgsMarkerCatalogue::instance(), SLOT( refreshList() ) );
+ connect( QgsMarkerCatalogue::instance(), SIGNAL( markersRefreshed() ), this, SLOT( refreshMarkers() ) );
+ lstSymbols->setContextMenuPolicy( Qt::ActionsContextMenu );
+ //do the signal/slot connections
+ connect( btnOutlineColor, SIGNAL( clicked() ), this, SLOT( selectOutlineColor() ) );
+ connect( btnFillColor, SIGNAL( clicked() ), this, SLOT( selectFillColor() ) );
+ connect( outlinewidthspinbox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
+ connect( mLabelEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( resendSettingsChanged() ) );
+ connect( lstSymbols, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ),
+ this, SLOT( symbolChanged( QListWidgetItem *, QListWidgetItem * ) ) );
+ connect( mPointSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
+ connect( mPointSizeUnitsCheckBox, SIGNAL( toggled() ), this, SLOT( resendSettingsChanged() ) );
+ connect( mRotationClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
+ this, SLOT( resendSettingsChanged() ) );
+ connect( mScaleClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
+ this, SLOT( resendSettingsChanged() ) );
+ connect( mSymbolComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
+ this, SLOT( resendSettingsChanged() ) );
+ connect( cboOutlineStyle, SIGNAL(
+ currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
+ connect( cboFillStyle, SIGNAL(
+ currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
+ //need this to deal with when texture fill is selected or deselected
+ connect( cboFillStyle, SIGNAL(
+ currentIndexChanged( int ) ), this, SLOT( fillStyleChanged( int ) ) );
+ connect( toolSelectTexture, SIGNAL( clicked() ), this, SLOT( selectTextureImage() ) );
+
+ refreshMarkers();
+}
+
+void QgsSingleSymbolDialog::refreshMarkers()
+{
+ lstSymbols->blockSignals( true );
+ lstSymbols->clear();
+
QPen pen( QColor( 0, 0, 255 ) );
QBrush brush( QColor( 220, 220, 220 ), Qt::SolidPattern );
int size = 18;
@@ -73,17 +110,18 @@
myIcon.addPixmap( myPixmap );
mypItem->setIcon( myIcon );
mypItem->setText( "" );
+ mypItem->setToolTip( *it );
//store the symbol offset in the UserData role for later retrieval
mypItem->setData( Qt::UserRole, *it );
mypItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
- if ( layer->geometryType() != QGis::Point )
+ if ( mVectorLayer && mVectorLayer->geometryType() != QGis::Point )
{
break;
}
++myCounter;
}
- // Find out the numerical fields of mVectorLayer, and populate the ComboBox
+ // Find out the numerical fields of mVectorLayer, and populate the ComboBoxes
QgsVectorDataProvider *provider = mVectorLayer->dataProvider();
if ( provider )
{
@@ -92,6 +130,7 @@
mRotationClassificationComboBox->addItem( DO_NOT_USE_STR, -1 );
mScaleClassificationComboBox->addItem( DO_NOT_USE_STR, -1 );
+ mSymbolComboBox->addItem( DO_NOT_USE_STR, -1 );
for ( QgsFieldMap::const_iterator it = fields.begin();
it != fields.end();
++it )
@@ -102,6 +141,10 @@
mRotationClassificationComboBox->addItem( it->name(), it.key() );
mScaleClassificationComboBox->addItem( it->name(), it.key() );
}
+ else if ( type == QVariant::String )
+ {
+ mSymbolComboBox->addItem( it->name(), it.key() );
+ }
}
}
else
@@ -139,13 +182,13 @@
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "NoBrush" ) ), tr( "No Brush" ), "NoBrush" );
cboFillStyle->addItem( QIcon( QgsSymbologyUtils::char2PatternPixmap( "TexturePattern" ) ), tr( "Texture" ), "TexturePattern" );
- if ( mVectorLayer && layer->geometryType() != QGis::Point )
+ if ( mVectorLayer && mVectorLayer->geometryType() != QGis::Point )
{
mGroupPoint->setVisible( false );
mGroupPoint->setEnabled( false );
}
- if ( disabled )
+ if ( mDisabled )
{
unset();
}
@@ -173,27 +216,7 @@
}
}
- //do the signal/slot connections
- connect( btnOutlineColor, SIGNAL( clicked() ), this, SLOT( selectOutlineColor() ) );
- connect( btnFillColor, SIGNAL( clicked() ), this, SLOT( selectFillColor() ) );
- connect( outlinewidthspinbox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
- connect( mLabelEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( resendSettingsChanged() ) );
- connect( lstSymbols, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ),
- this, SLOT( symbolChanged( QListWidgetItem *, QListWidgetItem * ) ) );
- connect( mPointSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
- connect( mRotationClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
- this, SLOT( resendSettingsChanged() ) );
- connect( mScaleClassificationComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
- this, SLOT( resendSettingsChanged() ) );
- connect( cboOutlineStyle, SIGNAL(
- currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
- connect( cboFillStyle, SIGNAL(
- currentIndexChanged( const QString & ) ), this, SLOT( resendSettingsChanged() ) );
- //need this to deal with when texture fill is selected or deselected
- connect( cboFillStyle, SIGNAL(
- currentIndexChanged( int ) ), this, SLOT( fillStyleChanged( int ) ) );
- connect( toolSelectTexture, SIGNAL( clicked() ), this, SLOT( selectTextureImage() ) );
-
+ lstSymbols->blockSignals( false );
}
QgsSingleSymbolDialog::~QgsSingleSymbolDialog()
@@ -264,6 +287,8 @@
if ( mPointSizeSpinBox->isEnabled() )
sy->setPointSize( mPointSizeSpinBox->value() );
+ if ( mPointSizeUnitsCheckBox->isEnabled() )
+ sy->setPointSizeUnits( mPointSizeUnitsCheckBox->isChecked() );
std::map<QString, int>::iterator iter;
if ( mRotationClassificationComboBox->isEnabled() )
@@ -276,6 +301,11 @@
sy->setScaleClassificationField( mScaleClassificationComboBox->itemData( mScaleClassificationComboBox->currentIndex() ).toInt() );
}
+ if ( mSymbolComboBox->isEnabled() )
+ {
+ sy->setSymbolField( mSymbolComboBox->itemData( mSymbolComboBox->currentIndex() ).toInt() );
+ }
+
//
// Apply the line style
//
@@ -323,8 +353,10 @@
mLabelEdit->setEnabled( false );
lstSymbols->setEnabled( false );
mPointSizeSpinBox->setEnabled( false );
+ mPointSizeUnitsCheckBox->setEnabled( false );
mRotationClassificationComboBox->setEnabled( false );
mScaleClassificationComboBox->setEnabled( false );
+ mSymbolComboBox->setEnabled( false );
outlinewidthspinbox->setEnabled( false );
btnOutlineColor->setEnabled( false );
cboOutlineStyle->setEnabled( false );
@@ -350,6 +382,7 @@
}
}
mPointSizeSpinBox->setValue( sy->pointSize() );
+ mPointSizeUnitsCheckBox->setChecked( sy->pointSizeUnits() );
int index;
@@ -359,6 +392,9 @@
index = mScaleClassificationComboBox->findData( sy->scaleClassificationField() );
mScaleClassificationComboBox->setCurrentIndex( index < 0 ? 0 : index );
+ index = mSymbolComboBox->findData( sy->symbolField() );
+ mSymbolComboBox->setCurrentIndex( index < 0 ? 0 : index );
+
outlinewidthspinbox->setValue( sy->pen().widthF() );
//set line width 1 as minimum to avoid confusion between line width 0 and no pen line style
@@ -418,8 +454,10 @@
mLabelEdit->setEnabled( true );
lstSymbols->setEnabled( true );
mPointSizeSpinBox->setEnabled( true );
+ mPointSizeUnitsCheckBox->setEnabled( true );
mRotationClassificationComboBox->setEnabled( true );
mScaleClassificationComboBox->setEnabled( true );
+ mSymbolComboBox->setEnabled( true );
outlinewidthspinbox->setEnabled( true );
btnOutlineColor->setEnabled( true );
cboOutlineStyle->setEnabled( true );
@@ -442,6 +480,9 @@
if ( mPointSizeSpinBox->isEnabled() && mPointSizeSpinBox->value() != sy->pointSize() )
mPointSizeSpinBox->setEnabled( false );
+ if ( mPointSizeUnitsCheckBox->isEnabled() && mPointSizeUnitsCheckBox->isChecked() != sy->pointSizeUnits() )
+ mPointSizeUnitsCheckBox->setEnabled( false );
+
if ( mRotationClassificationComboBox->isEnabled() &&
mRotationClassificationComboBox->itemData( mRotationClassificationComboBox->currentIndex() ).toInt() != sy->rotationClassificationField() )
mRotationClassificationComboBox->setEnabled( false );
@@ -450,6 +491,10 @@
mScaleClassificationComboBox->itemData( mScaleClassificationComboBox->currentIndex() ).toInt() != sy->scaleClassificationField() )
mScaleClassificationComboBox->setEnabled( false );
+ if ( mSymbolComboBox->isEnabled() &&
+ mSymbolComboBox->itemData( mSymbolComboBox->currentIndex() ).toInt() != sy->symbolField() )
+ mSymbolComboBox->setEnabled( false );
+
if ( outlinewidthspinbox->isEnabled() && outlinewidthspinbox->value() != sy->pen().widthF() )
outlinewidthspinbox->setEnabled( false );
Modified: trunk/qgis/src/app/qgssinglesymboldialog.h
===================================================================
--- trunk/qgis/src/app/qgssinglesymboldialog.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/app/qgssinglesymboldialog.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -48,6 +48,7 @@
protected:
QgsVectorLayer* mVectorLayer;
+ bool mDisabled;
public slots:
/* arrange the widgets on this dialog to reflect the current state of QgsSymbol */
@@ -65,6 +66,8 @@
*/
void fillStyleChanged( int theIndex );
+ void refreshMarkers();
+
protected slots:
void selectOutlineColor();
void selectFillColor();
Modified: trunk/qgis/src/core/CMakeLists.txt
===================================================================
--- trunk/qgis/src/core/CMakeLists.txt 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/CMakeLists.txt 2009-07-23 10:59:59 UTC (rev 11152)
@@ -182,6 +182,7 @@
composer/qgscomposerscalebar.h
composer/qgscomposeritemgroup.h
composer/qgslegendmodel.h
+symbology/qgsmarkercatalogue.h
raster/qgsrasterlayer.h
)
Modified: trunk/qgis/src/core/qgslabel.cpp
===================================================================
--- trunk/qgis/src/core/qgslabel.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/qgslabel.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -33,6 +33,7 @@
#include "qgsrectangle.h"
#include "qgsmaptopixel.h"
#include "qgscoordinatetransform.h"
+#include "qgsrendercontext.h"
#include "qgslabelattributes.h"
#include "qgslabel.h"
@@ -85,11 +86,9 @@
}
}
-void QgsLabel::renderLabel( QPainter * painter, const QgsRectangle& viewExtent,
- const QgsCoordinateTransform* coordinateTransform,
- const QgsMapToPixel *transform,
- QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes,
- double sizeScale, double rasterScaleFactor )
+void QgsLabel::renderLabel( QgsRenderContext &renderContext,
+ QgsFeature &feature, bool selected,
+ QgsLabelAttributes *classAttributes )
{
QPen pen;
QFont font;
@@ -98,9 +97,9 @@
/* Calc scale (not nice) */
QgsPoint point;
- point = transform->transform( 0, 0 );
+ point = renderContext.mapToPixel().transform( 0, 0 );
double x1 = point.x();
- point = transform->transform( 1000, 0 );
+ point = renderContext.mapToPixel().transform( 1000, 0 );
double x2 = point.x();
double scale = ( x2 - x1 ) * 0.001;
@@ -155,12 +154,12 @@
else //point units
{
double sizeMM = size * 0.3527;
- size = sizeMM * sizeScale;
+ size = sizeMM * renderContext.scaleFactor();
}
//Request font larger (multiplied by rasterScaleFactor) as a workaround for the Qt font bug
//and scale the painter down by rasterScaleFactor when drawing the label
- size *= rasterScaleFactor;
+ size *= renderContext.rasterScaleFactor();
if (( int )size <= 0 )
// skip too small labels
@@ -333,8 +332,8 @@
}
else
{
- xoffset = xoffset * 0.3527 * sizeScale;
- yoffset = yoffset * 0.3527 * sizeScale;
+ xoffset = xoffset * 0.3527 * renderContext.scaleFactor();
+ yoffset = yoffset * 0.3527 * renderContext.scaleFactor();
}
// Angle
@@ -355,9 +354,8 @@
// part.
if ( useOverridePoint )
{
- renderLabel( painter, overridePoint, coordinateTransform,
- transform, text, font, pen, dx, dy,
- xoffset, yoffset, ang, width, height, alignment, sizeScale, rasterScaleFactor );
+ renderLabel( renderContext, overridePoint, text, font, pen, dx, dy,
+ xoffset, yoffset, ang, width, height, alignment );
}
else
{
@@ -365,28 +363,28 @@
labelPoint( points, feature );
for ( uint i = 0; i < points.size(); ++i )
{
- renderLabel( painter, points[i].p, coordinateTransform,
- transform, text, font, pen, dx, dy,
- xoffset, yoffset, mLabelAttributes->angleIsAuto() ? points[i].angle : ang, width, height, alignment, sizeScale, rasterScaleFactor );
+ renderLabel( renderContext, points[i].p, text, font, pen, dx, dy,
+ xoffset, yoffset, mLabelAttributes->angleIsAuto() ? points[i].angle : ang, width, height, alignment );
}
}
}
-void QgsLabel::renderLabel( QPainter* painter, QgsPoint point,
- const QgsCoordinateTransform* coordinateTransform,
- const QgsMapToPixel* transform,
+void QgsLabel::renderLabel( QgsRenderContext &renderContext,
+ QgsPoint point,
QString text, QFont font, QPen pen,
int dx, int dy,
double xoffset, double yoffset,
double ang,
- int width, int height, int alignment, double sizeScale, double rasterScaleFactor )
+ int width, int height, int alignment )
{
+ QPainter *painter = renderContext.painter();
+
// Convert point to projected units
- if ( coordinateTransform )
+ if ( renderContext.coordinateTransform() )
{
try
{
- point = coordinateTransform->transform( point );
+ point = renderContext.coordinateTransform()->transform( point );
}
catch ( QgsCsException &cse )
{
@@ -397,7 +395,7 @@
}
// and then to canvas units
- transform->transform( &point );
+ renderContext.mapToPixel().transform( &point );
double x = point.x();
double y = point.y();
@@ -411,7 +409,7 @@
painter->setFont( font );
painter->translate( x, y );
//correct oversampled font size back by scaling painter down
- painter->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
+ painter->scale( 1.0 / renderContext.rasterScaleFactor(), 1.0 / renderContext.rasterScaleFactor() );
painter->rotate( -ang );
//
@@ -419,7 +417,7 @@
//
if ( mLabelAttributes->bufferSizeIsSet() && mLabelAttributes->bufferEnabled() )
{
- double myBufferSize = mLabelAttributes->bufferSize() * 0.3527 * sizeScale * rasterScaleFactor;
+ double myBufferSize = mLabelAttributes->bufferSize() * 0.3527 * renderContext.scaleFactor() * renderContext.rasterScaleFactor();
QPen bufferPen;
if ( mLabelAttributes->bufferColorIsSet() )
{
@@ -432,13 +430,13 @@
painter->setPen( bufferPen );
double bufferStepSize; //hack to distinguish pixel devices from logical devices
- if (( sizeScale - 1 ) > 1.5 )
+ if (( renderContext.scaleFactor() - 1 ) > 1.5 )
{
bufferStepSize = 1;
}
else //draw more dense in case of logical devices
{
- bufferStepSize = 1 / rasterScaleFactor;
+ bufferStepSize = 1 / renderContext.rasterScaleFactor();
}
for ( double i = dx - myBufferSize; i <= dx + myBufferSize; i += bufferStepSize )
Modified: trunk/qgis/src/core/qgslabel.h
===================================================================
--- trunk/qgis/src/core/qgslabel.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/qgslabel.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -35,11 +35,10 @@
class QgsFeature;
class QgsField;
class QgsLabelAttributes;
-class QgsRectangle;
-class QgsMapToPixel;
-class QgsCoordinateTransform;
#include "qgsfield.h"
+#include "qgsrectangle.h"
+#include "qgsrendercontext.h"
typedef QList<int> QgsAttributeList;
@@ -93,12 +92,29 @@
/** \brief render label
* \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
+ * \note deprecated
*/
void renderLabel( QPainter* painter, const QgsRectangle& viewExtent,
- const QgsCoordinateTransform* coordinateTransform,
+ QgsCoordinateTransform* coordinateTransform,
const QgsMapToPixel *transform,
- QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0, double sizeScale = 1., double rasterScaleFactor = 1.0 );
+ QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0, double sizeScale = 1., double rasterScaleFactor = 1.0 )
+ {
+ QgsRenderContext r;
+ r.setExtent( viewExtent );
+ r.setCoordinateTransform( new QgsCoordinateTransform( coordinateTransform->sourceCrs(), coordinateTransform->destCRS() ) );
+ r.setMapToPixel( *transform );
+ r.setPainter( painter );
+ r.setScaleFactor( sizeScale );
+ r.setRasterScaleFactor( rasterScaleFactor );
+ renderLabel( r, feature, selected, classAttributes );
+ }
+ /** \brief render label
+ * \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
+ * \note added in 1.2
+ */
+ void renderLabel( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0 );
+
/** Reads the renderer configuration from an XML file
@param rnode the Dom node to read
*/
@@ -151,14 +167,12 @@
/** Does the actual rendering of a label at the given point
*
*/
- void renderLabel( QPainter* painter, QgsPoint point,
- const QgsCoordinateTransform* coordinateTransform,
- const QgsMapToPixel* transform,
+ void renderLabel( QgsRenderContext &renderContext, QgsPoint point,
QString text, QFont font, QPen pen,
int dx, int dy,
double xoffset, double yoffset,
double ang,
- int width, int height, int alignment, double sizeScale = 1.0, double rasterScaleFactor = 1.0 );
+ int width, int height, int alignment );
bool readLabelField( QDomElement &el, int attr, QString prefix );
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -325,7 +325,7 @@
if ( mRenderer->willRenderFeature( &fet ) )
{
bool sel = mSelectedFeatureIds.contains( fet.id() );
- mLabel->renderLabel( rendererContext.painter(), rendererContext.extent(), rendererContext.coordinateTransform(), &( rendererContext.mapToPixel() ), fet, sel, 0, rendererContext.scaleFactor(), rendererContext.rasterScaleFactor() );
+ mLabel->renderLabel( rendererContext, fet, sel, 0 );
}
featureCount++;
}
@@ -348,13 +348,9 @@
}
-unsigned char* QgsVectorLayer::drawLineString(
- unsigned char *feature,
- QPainter* p,
- const QgsMapToPixel* mtp,
- const QgsCoordinateTransform* ct,
- bool drawingToEditingCanvas )
+unsigned char *QgsVectorLayer::drawLineString( unsigned char *feature, QgsRenderContext &renderContext )
{
+ QPainter *p = renderContext.painter();
unsigned char *ptr = feature + 5;
unsigned int wkbType = *(( int* )( feature + 1 ) );
unsigned int nPoints = *(( int* )ptr );
@@ -381,7 +377,7 @@
// Transform the points into map coordinates (and reproject if
// necessary)
- transformPoints( x, y, z, mtp, ct );
+ transformPoints( x, y, z, renderContext );
#if defined(Q_WS_X11)
// Work around a +/- 32768 limitation on coordinates in X11
@@ -440,7 +436,7 @@
p->drawPolyline( pa );
// draw vertex markers if in editing mode, but only to the main canvas
- if ( mEditable && drawingToEditingCanvas )
+ if ( mEditable && renderContext.drawEditingInformation() )
{
std::vector<double>::const_iterator xIt;
@@ -457,13 +453,9 @@
return ptr;
}
-unsigned char *QgsVectorLayer::drawPolygon(
- unsigned char *feature,
- QPainter *p,
- const QgsMapToPixel *mtp,
- const QgsCoordinateTransform *ct,
- bool drawingToEditingCanvas )
+unsigned char *QgsVectorLayer::drawPolygon( unsigned char *feature, QgsRenderContext &renderContext )
{
+ QPainter *p = renderContext.painter();
typedef std::pair<std::vector<double>, std::vector<double> > ringType;
typedef ringType* ringTypePtr;
typedef std::vector<ringTypePtr> ringsType;
@@ -517,7 +509,7 @@
continue;
}
- transformPoints( ring->first, ring->second, zVector, mtp, ct );
+ transformPoints( ring->first, ring->second, zVector, renderContext );
#if defined(Q_WS_X11)
// Work around a +/- 32768 limitation on coordinates in X11
@@ -642,7 +634,7 @@
// draw vertex markers if in editing mode, but only to the main canvas
- if ( mEditable && drawingToEditingCanvas )
+ if ( mEditable && renderContext.drawEditingInformation() )
{
for ( int i = 0; i < path.elementCount(); ++i )
{
@@ -683,7 +675,7 @@
/*Pointer to a marker image*/
QImage marker;
//vertex marker type for selection
- QgsVectorLayer::VertexMarkerType vertexMarker;
+ QgsVectorLayer::VertexMarkerType vertexMarker = QgsVectorLayer::NoMarker;
if ( mEditable )
{
@@ -747,26 +739,13 @@
//QgsDebugMsg(QString("markerScale before renderFeature(): %1").arg(markerScaleFactor));
// markerScalerFactore reflects the wanted scaling of the marker
- mRenderer->renderFeature(
- rendererContext.painter(),
- fet,
- &marker,
- sel,
- rendererContext.scaleFactor(),
- rendererContext.rasterScaleFactor() );
+ mRenderer->renderFeature( rendererContext, fet, &marker, sel );
+
// markerScalerFactore now reflects the actual scaling of the marker that the render performed.
//QgsDebugMsg(QString("markerScale after renderFeature(): %1").arg(markerScaleFactor));
//double scale = rendererContext.scaleFactor() / markerScaleFactor;
- drawFeature(
- rendererContext.painter(),
- fet,
- &rendererContext.mapToPixel(),
- rendererContext.coordinateTransform(),
- &marker,
- rendererContext.scaleFactor(),
- rendererContext.rasterScaleFactor(),
- rendererContext.drawEditingInformation() );
+ drawFeature( rendererContext, fet, &marker );
++featureCount;
}
@@ -1558,7 +1537,7 @@
geometry = mChangedGeometries[atFeatureId];
}
- if (!geometry.deleteVertex( atVertex ))
+ if ( !geometry.deleteVertex( atVertex ) )
{
return false;
}
@@ -3487,15 +3466,11 @@
}
}
-void QgsVectorLayer::drawFeature( QPainter* p,
+void QgsVectorLayer::drawFeature( QgsRenderContext &renderContext,
QgsFeature& fet,
- const QgsMapToPixel* theMapToPixelTransform,
- const QgsCoordinateTransform* ct,
- QImage * marker,
- double widthScale,
- double rasterScaleFactor,
- bool drawingToEditingCanvas )
+ QImage * marker )
{
+ QPainter *p = renderContext.painter();
// Only have variables, etc outside the switch() statement that are
// used in all cases of the statement (otherwise they may get
// executed, but never used, in a bit of code where performance is
@@ -3518,13 +3493,14 @@
double x = *(( double * )( feature + 5 ) );
double y = *(( double * )( feature + 5 + sizeof( double ) ) );
- transformPoint( x, y, theMapToPixelTransform, ct );
+ transformPoint( x, y, &renderContext.mapToPixel(), renderContext.coordinateTransform() );
//QPointF pt(x - (marker->width()/2), y - (marker->height()/2));
- QPointF pt( x*rasterScaleFactor - ( marker->width() / 2 ), y*rasterScaleFactor - ( marker->height() / 2 ) );
+ QPointF pt( x*renderContext.rasterScaleFactor() - ( marker->width() / 2 ),
+ y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
p->save();
//p->scale(markerScaleFactor,markerScaleFactor);
- p->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
+ p->scale( 1.0 / renderContext.rasterScaleFactor(), 1.0 / renderContext.rasterScaleFactor() );
p->drawImage( pt, *marker );
p->restore();
@@ -3539,7 +3515,7 @@
p->save();
//p->scale(markerScaleFactor, markerScaleFactor);
- p->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
+ p->scale( 1.0 / renderContext.rasterScaleFactor(), 1.0 / renderContext.rasterScaleFactor() );
for ( register unsigned int i = 0; i < nPoints; ++i )
{
@@ -3552,10 +3528,11 @@
if ( wkbType == QGis::WKBMultiPoint25D ) // ignore Z value
ptr += sizeof( double );
- transformPoint( x, y, theMapToPixelTransform, ct );
+ transformPoint( x, y, &renderContext.mapToPixel(), renderContext.coordinateTransform() );
//QPointF pt(x - (marker->width()/2), y - (marker->height()/2));
//QPointF pt(x/markerScaleFactor - (marker->width()/2), y/markerScaleFactor - (marker->height()/2));
- QPointF pt( x*rasterScaleFactor - ( marker->width() / 2 ), y*rasterScaleFactor - ( marker->height() / 2 ) );
+ QPointF pt( x*renderContext.rasterScaleFactor() - ( marker->width() / 2 ),
+ y*renderContext.rasterScaleFactor() - ( marker->height() / 2 ) );
//QPointF pt( x, y );
#if defined(Q_WS_X11)
@@ -3574,11 +3551,7 @@
case QGis::WKBLineString:
case QGis::WKBLineString25D:
{
- drawLineString( feature,
- p,
- theMapToPixelTransform,
- ct,
- drawingToEditingCanvas );
+ drawLineString( feature, renderContext );
break;
}
case QGis::WKBMultiLineString:
@@ -3590,22 +3563,14 @@
for ( register unsigned int jdx = 0; jdx < numLineStrings; jdx++ )
{
- ptr = drawLineString( ptr,
- p,
- theMapToPixelTransform,
- ct,
- drawingToEditingCanvas );
+ ptr = drawLineString( ptr, renderContext );
}
break;
}
case QGis::WKBPolygon:
case QGis::WKBPolygon25D:
{
- drawPolygon( feature,
- p,
- theMapToPixelTransform,
- ct,
- drawingToEditingCanvas );
+ drawPolygon( feature, renderContext );
break;
}
case QGis::WKBMultiPolygon:
@@ -3615,11 +3580,7 @@
unsigned int numPolygons = *(( int* )ptr );
ptr = feature + 9;
for ( register unsigned int kdx = 0; kdx < numPolygons; kdx++ )
- ptr = drawPolygon( ptr,
- p,
- theMapToPixelTransform,
- ct,
- drawingToEditingCanvas );
+ ptr = drawPolygon( ptr, renderContext );
break;
}
default:
@@ -3672,15 +3633,15 @@
inline void QgsVectorLayer::transformPoints(
std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
- const QgsMapToPixel* mtp, const QgsCoordinateTransform* ct )
+ QgsRenderContext &renderContext )
{
// transform the point
- if ( ct )
- ct->transformInPlace( x, y, z );
+ if ( renderContext.coordinateTransform() )
+ renderContext.coordinateTransform()->transformInPlace( x, y, z );
// transform from projected coordinate system to pixel
// position on map canvas
- mtp->transformInPlace( x, y );
+ renderContext.mapToPixel().transformInPlace( x, y );
}
Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/qgsvectorlayer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -550,41 +550,26 @@
bool setDataProvider( QString const & provider );
/** Draws features. May cause projections exceptions to be generated
- * (i.e., code that calls this function needs to catch them)
- */
- void drawFeature( QPainter* p,
+ * (i.e., code that calls this function needs to catch them) */
+ void drawFeature( QgsRenderContext &renderContext,
QgsFeature& fet,
- const QgsMapToPixel* cXf,
- const QgsCoordinateTransform* ct,
- QImage* marker,
- double widthScale,
- double markerScaleFactor,
- bool drawingToEditingCanvas );
+ QImage* marker );
/** Convenience function to transform the given point */
void transformPoint( double& x, double& y,
const QgsMapToPixel* mtp, const QgsCoordinateTransform* ct );
- void transformPoints( std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
- const QgsMapToPixel* mtp, const QgsCoordinateTransform* ct );
+ void transformPoints( std::vector<double>& x, std::vector<double>& y, std::vector<double>& z, QgsRenderContext &renderContext );
/** Draw the linestring as given in the WKB format. Returns a pointer
* to the byte after the end of the line string binary data stream (WKB).
*/
- unsigned char *drawLineString( unsigned char *WKBlinestring,
- QPainter *p,
- const QgsMapToPixel *mtp,
- const QgsCoordinateTransform *ct,
- bool drawingToEditingCanvas );
+ unsigned char *drawLineString( unsigned char *WKBlinestring, QgsRenderContext &renderContext );
/** Draw the polygon as given in the WKB format. Returns a pointer to
* the byte after the end of the polygon binary data stream (WKB).
*/
- unsigned char *drawPolygon( unsigned char *WKBpolygon,
- QPainter *p,
- const QgsMapToPixel *mtp,
- const QgsCoordinateTransform *ct,
- bool drawingToEditingCanvas );
+ unsigned char *drawPolygon( unsigned char *WKBpolygon, QgsRenderContext &renderContext );
/** Goes through all features and finds a free id (e.g. to give it temporarily to a not-commited feature) */
int findFreeId();
Modified: trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -22,6 +22,7 @@
#include "qgssymbologyutils.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
+#include "qgsrendercontext.h"
#include <cfloat>
#include <QDomElement>
@@ -73,8 +74,10 @@
mMaximumSymbol = sy;
}
-void QgsContinuousColorRenderer::renderFeature( QPainter * p, QgsFeature & f, QImage* img, bool selected, double widthScale, double rasterScaleFactor )
+void QgsContinuousColorRenderer::renderFeature( QgsRenderContext &renderContext, QgsFeature & f, QImage* img, bool selected )
{
+ QPainter *p = renderContext.painter();
+
if (( mMinimumSymbol && mMaximumSymbol ) )
{
//first find out the value for the classification attribute
@@ -129,7 +132,7 @@
// later add support for both pen and brush to dialog
QPen pen = mMinimumSymbol->pen();
pen.setColor( QColor( red, green, blue ) );
- pen.setWidthF( widthScale * pen.widthF() );
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
QBrush brush = mMinimumSymbol->brush();
@@ -145,13 +148,13 @@
brush.setStyle( Qt::SolidPattern );
*img = QgsMarkerCatalogue::instance()->imageMarker( mMinimumSymbol->pointSymbolName(),
- mMinimumSymbol->pointSize() * widthScale * rasterScaleFactor, pen, brush );
+ mMinimumSymbol->pointSize() * renderContext.scaleFactor() * renderContext.rasterScaleFactor(), pen, brush );
}
else if ( mGeometryType == QGis::Line )
{
QPen linePen;
linePen.setColor( QColor( red, green, blue ) );
- linePen.setWidthF( widthScale*mMinimumSymbol->pen().widthF() );
+ linePen.setWidthF( renderContext.scaleFactor()*mMinimumSymbol->pen().widthF() );
p->setPen( linePen );
}
else //polygon
@@ -161,7 +164,7 @@
{
QPen pen;
pen.setColor( QColor( 0, 0, 0 ) );
- pen.setWidthF( widthScale*mMinimumSymbol->pen().widthF() );
+ pen.setWidthF( renderContext.scaleFactor()*mMinimumSymbol->pen().widthF() );
p->setPen( pen );
}
else
Modified: trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.h
===================================================================
--- trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgscontinuouscolorrenderer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -35,8 +35,11 @@
QgsContinuousColorRenderer( const QgsContinuousColorRenderer& other );
QgsContinuousColorRenderer& operator=( const QgsContinuousColorRenderer& other );
virtual ~QgsContinuousColorRenderer();
- /**Renders the feature using the minimum and maximum value of the classification field*/
- void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 );
+
+ /**Renders the feature using the minimum and maximum value of the classification field
+ * added in 1.2 */
+ void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected );
+
/**Returns the number of the classification field*/
int classificationField() const;
/**Sets the id of the classification field*/
Modified: trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -24,6 +24,7 @@
#include "qgssymbologyutils.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
+#include "qgsrendercontext.h"
#include <math.h>
#include <QDomNode>
#include <QDomElement>
@@ -115,8 +116,9 @@
return ( symbolForFeature( f ) != 0 );
}
-void QgsGraduatedSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QImage* img, bool selected, double widthScale, double rasterScaleFactor )
+void QgsGraduatedSymbolRenderer::renderFeature( QgsRenderContext &renderContext, QgsFeature & f, QImage* img, bool selected )
{
+ QPainter *p = renderContext.painter();
QgsSymbol* theSymbol = symbolForFeature( &f );
if ( !theSymbol )
{
@@ -144,15 +146,31 @@
//first find out the value for the scale classification attribute
const QgsAttributeMap& attrs = f.attributeMap();
fieldScale = sqrt( fabs( attrs[theSymbol->scaleClassificationField()].toDouble() ) );
- QgsDebugMsg( QString( "Feature has field scale factor %1" ).arg( fieldScale ) );
+ QgsDebugMsgLevel( QString( "Feature has field scale factor %1" ).arg( fieldScale ), 3 );
}
if ( theSymbol->rotationClassificationField() >= 0 )
{
const QgsAttributeMap& attrs = f.attributeMap();
rotation = attrs[theSymbol->rotationClassificationField()].toDouble();
- QgsDebugMsg( QString( "Feature has rotation factor %1" ).arg( rotation ) );
+ QgsDebugMsgLevel( QString( "Feature has rotation factor %1" ).arg( rotation ), 3 );
}
- *img = theSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor );
+
+ QString oldName;
+
+ if ( theSymbol->symbolField() >= 0 )
+ {
+ const QgsAttributeMap& attrs = f.attributeMap();
+ QString name = attrs[theSymbol->symbolField()].toString();
+ QgsDebugMsgLevel( QString( "Feature has name %1" ).arg( name ), 3 );
+ oldName = theSymbol->pointSymbolName();
+ theSymbol->setNamedPointSymbol( name );
+ }
+ *img = theSymbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor, fieldScale, rotation, renderContext.rasterScaleFactor() );
+
+ if ( !oldName.isNull() )
+ {
+ theSymbol->setNamedPointSymbol( oldName );
+ }
}
// Line, polygon
@@ -161,25 +179,25 @@
if ( !selected )
{
QPen pen = theSymbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
p->setPen( pen );
if ( mGeometryType == QGis::Polygon )
{
QBrush brush = theSymbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
p->setBrush( brush );
}
}
else
{
QPen pen = theSymbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
if ( mGeometryType == QGis::Polygon )
{
QBrush brush = theSymbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
@@ -283,15 +301,20 @@
for ( it = mSymbols.begin(); it != mSymbols.end(); ++it )
{
int rotationField = ( *it )->rotationClassificationField();
- if ( rotationField >= 0 && !( mSymbolAttributes.contains( rotationField ) ) )
+ if ( rotationField >= 0 && !mSymbolAttributes.contains( rotationField ) )
{
mSymbolAttributes.append( rotationField );
}
int scaleField = ( *it )->scaleClassificationField();
- if ( scaleField >= 0 && !( mSymbolAttributes.contains( scaleField ) ) )
+ if ( scaleField >= 0 && !mSymbolAttributes.contains( scaleField ) )
{
mSymbolAttributes.append( scaleField );
}
+ int symbolField = ( *it )->symbolField();
+ if ( symbolField >= 0 && !mSymbolAttributes.contains( symbolField ) )
+ {
+ mSymbolAttributes.append( symbolField );
+ }
}
}
Modified: trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.h
===================================================================
--- trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -66,11 +66,12 @@
@param f a pointer to the feature to determine if rendering will happen*/
virtual bool willRenderFeature( QgsFeature *f );
- /**Renders an OGRFeature
+ /**Renders a feature
\param p a painter (usually the one from the current map canvas)
\param f a pointer to a feature to render
- \param t the transform object containing the information how to transform the map coordinates to screen coordinates*/
- void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 );
+ \param t the transform object containing the information how to transform the map coordinates to screen coordinates
+ \note added in 1.2 */
+ void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected );
/**Sets the classicifation field by index
\param field the number of the field to classify*/
Modified: trunk/qgis/src/core/renderer/qgsrenderer.h
===================================================================
--- trunk/qgis/src/core/renderer/qgsrenderer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgsrenderer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -27,6 +27,7 @@
class QColor;
#include "qgis.h"
+#include "qgsrendercontext.h"
#include <QList>
class QgsSymbol;
@@ -58,8 +59,21 @@
@param p the painter storing brush and pen
@param f a pointer to the feature to be rendered
@param pic pointer to an image (used for point symbols)
- @param scalefactor pointer to the scale factor for the marker image*/
- virtual void renderFeature( QPainter* p, QgsFeature& f, QImage* pic, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 ) = 0;
+ @param scalefactor pointer to the scale factor for the marker image
+ @note deprecated */
+ void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 )
+ {
+ QgsRenderContext r;
+ r.setPainter( p );
+ r.setScaleFactor( widthScale );
+ r.setRasterScaleFactor( rasterScaleFactor );
+ renderFeature( r, f, img, selected );
+ }
+
+ /**A vector layer passes features to a renderer object to change the brush and pen of the qpainter
+ @note added in 1.2 */
+ virtual void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* pic, bool selected ) = 0;
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer
Modified: trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -24,6 +24,7 @@
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgsvectorlayer.h"
+#include "qgsrendercontext.h"
#include <QDomNode>
#include <QImage>
@@ -53,15 +54,14 @@
sy->setFillStyle( Qt::SolidPattern );
sy->setColor( QColor( 0, 0, 0 ) );
}
- mSymbol = sy;
+ mSymbol0 = sy;
+ mSymbols[ QString()] = sy;
updateSymbolAttributes();
}
QgsSingleSymbolRenderer::QgsSingleSymbolRenderer( const QgsSingleSymbolRenderer& other )
{
- mGeometryType = other.mGeometryType;
- mSymbol = new QgsSymbol( *other.mSymbol );
- updateSymbolAttributes();
+ *this = other;
}
QgsSingleSymbolRenderer& QgsSingleSymbolRenderer::operator=( const QgsSingleSymbolRenderer & other )
@@ -69,8 +69,9 @@
if ( this != &other )
{
mGeometryType = other.mGeometryType;
- delete mSymbol;
- mSymbol = new QgsSymbol( *other.mSymbol );
+
+ for ( QMap<QString, QgsSymbol *>::const_iterator it = other.mSymbols.begin(); it != other.mSymbols.end(); it++ )
+ mSymbols[ it.key()] = new QgsSymbol( *it.value() );
}
updateSymbolAttributes();
return *this;
@@ -78,18 +79,25 @@
QgsSingleSymbolRenderer::~QgsSingleSymbolRenderer()
{
- delete mSymbol;
+ for ( QMap<QString, QgsSymbol *>::iterator it = mSymbols.begin(); it != mSymbols.end(); it++ )
+ delete it.value();
}
-void QgsSingleSymbolRenderer::addSymbol( QgsSymbol* sy )
+void QgsSingleSymbolRenderer::addSymbol( QgsSymbol *sy )
{
- delete mSymbol;
- mSymbol = sy;
+ for ( QMap<QString, QgsSymbol *>::iterator it = mSymbols.begin(); it != mSymbols.end(); it++ )
+ delete it.value();
+
+ mSymbol0 = sy;
+ mSymbols[ QString()] = sy;
+
updateSymbolAttributes();
}
-void QgsSingleSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QImage* img, bool selected, double widthScale, double rasterScaleFactor )
+void QgsSingleSymbolRenderer::renderFeature( QgsRenderContext &renderContext, QgsFeature & f, QImage* img, bool selected )
{
+ QPainter *p = renderContext.painter();
+
// Point
if ( img && mGeometryType == QGis::Point )
{
@@ -97,49 +105,84 @@
// If scale field is non-negative, use it to scale.
double fieldScale = 1.0;
double rotation = 0.0;
+ QgsSymbol *sy = mSymbol0;
- if ( mSymbol->scaleClassificationField() >= 0 )
+ if ( mSymbol0->symbolField() >= 0 )
{
+ const QgsAttributeMap& attrs = f.attributeMap();
+ QString name = attrs[ mSymbol0->symbolField()].toString();
+ QgsDebugMsgLevel( QString( "Feature has name %1" ).arg( name ), 3 );
+
+ if ( !mSymbols.contains( name ) )
+ {
+ sy = new QgsSymbol( mGeometryType );
+ sy->setNamedPointSymbol( name );
+ mSymbols[ name ] = sy;
+ }
+ else
+ {
+ sy = mSymbols[ name ];
+ }
+
+ sy->setPointSize( mSymbol0->pointSize() );
+ sy->setPointSizeUnits( mSymbol0->pointSizeUnits() );
+ }
+
+ if ( mSymbol0->scaleClassificationField() >= 0 )
+ {
//first find out the value for the scale classification attribute
const QgsAttributeMap& attrs = f.attributeMap();
- fieldScale = sqrt( fabs( attrs[mSymbol->scaleClassificationField()].toDouble() ) );
+ fieldScale = sqrt( fabs( attrs[ mSymbol0->scaleClassificationField()].toDouble() ) );
QgsDebugMsgLevel( QString( "Feature has field scale factor %1" ).arg( fieldScale ), 3 );
}
- if ( mSymbol->rotationClassificationField() >= 0 )
+ if ( mSymbol0->rotationClassificationField() >= 0 )
{
const QgsAttributeMap& attrs = f.attributeMap();
- rotation = attrs[mSymbol->rotationClassificationField()].toDouble();
+ rotation = attrs[ mSymbol0->rotationClassificationField()].toDouble();
QgsDebugMsgLevel( QString( "Feature has rotation factor %1" ).arg( rotation ), 3 );
}
- *img = mSymbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor, fieldScale, rotation, rasterScaleFactor );
+ double scale = renderContext.scaleFactor();
+
+ if ( sy->pointSizeUnits() )
+ {
+ /* Calc scale (still not nice) */
+ QgsPoint point;
+ point = renderContext.mapToPixel().transform( 0, 0 );
+ double x1 = point.x();
+ point = renderContext.mapToPixel().transform( 1000, 0 );
+ double x2 = point.x();
+
+ scale *= ( x2 - x1 ) * 0.001;
+ }
+
+ *img = sy->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale, rotation, renderContext.rasterScaleFactor() );
}
-
// Line, polygon
if ( mGeometryType != QGis::Point )
{
if ( !selected )
{
- QPen pen = mSymbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ QPen pen = mSymbol0->pen();
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
p->setPen( pen );
if ( mGeometryType == QGis::Polygon )
{
- QBrush brush = mSymbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ QBrush brush = mSymbol0->brush();
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
p->setBrush( brush );
}
}
else
{
- QPen pen = mSymbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ QPen pen = mSymbol0->pen();
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
if ( mGeometryType == QGis::Polygon )
{
- QBrush brush = mSymbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ QBrush brush = mSymbol0->brush();
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
@@ -184,9 +227,9 @@
QDomElement singlesymbol = document.createElement( "singlesymbol" );
layer_node.appendChild( singlesymbol );
- if ( mSymbol )
+ if ( mSymbol0 )
{
- returnval = mSymbol->writeXML( singlesymbol, document, &vl );
+ returnval = mSymbol0->writeXML( singlesymbol, document, &vl );
}
return returnval;
}
@@ -203,16 +246,21 @@
// Timing is not so important.
mSymbolAttributes.clear();
- int rotationField = mSymbol->rotationClassificationField();
+ int rotationField = mSymbol0->rotationClassificationField();
if ( rotationField >= 0 && !( mSymbolAttributes.contains( rotationField ) ) )
{
mSymbolAttributes.append( rotationField );
}
- int scaleField = mSymbol->scaleClassificationField();
+ int scaleField = mSymbol0->scaleClassificationField();
if ( scaleField >= 0 && !( mSymbolAttributes.contains( scaleField ) ) )
{
mSymbolAttributes.append( scaleField );
}
+ int symbolField = mSymbol0->symbolField();
+ if ( symbolField >= 0 && !( mSymbolAttributes.contains( symbolField ) ) )
+ {
+ mSymbolAttributes.append( symbolField );
+ }
}
QString QgsSingleSymbolRenderer::name() const
@@ -222,9 +270,7 @@
const QList<QgsSymbol*> QgsSingleSymbolRenderer::symbols() const
{
- QList<QgsSymbol*> list;
- list.append( mSymbol );
- return list;
+ return mSymbols.values();
}
QgsRenderer* QgsSingleSymbolRenderer::clone() const
Modified: trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.h
===================================================================
--- trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -19,7 +19,9 @@
#ifndef QGSSINGLESYMBOLRENDERER_H
#define QGSSINGLESYMBOLRENDERER_H
+#include <QMap>
#include "qgsrenderer.h"
+#include "qgsrendercontext.h"
/**Render class to display all the features with a single QgsSymbol*/
@@ -30,12 +32,16 @@
QgsSingleSymbolRenderer( const QgsSingleSymbolRenderer& other );
QgsSingleSymbolRenderer& operator=( const QgsSingleSymbolRenderer& other );
virtual ~QgsSingleSymbolRenderer();
+
/**Replaces the current mSymbol by sy*/
void addSymbol( QgsSymbol* sy );
/*Returns a pointer to mSymbol*/
const QgsSymbol* symbol() const;
- /**Renders a feature*/
- void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 );
+
+ /**Renders a feature
+ * added in 1.2 */
+ void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected );
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer
@@ -60,14 +66,15 @@
QgsRenderer* clone() const;
protected:
/**Object containing symbology information*/
- QgsSymbol* mSymbol;
+ QgsSymbol *mSymbol0;
+ QMap<QString, QgsSymbol*> mSymbols;
/**Cached copy of all underlying symbols required attribute fields*/
QgsAttributeList mSymbolAttributes;
};
inline const QgsSymbol* QgsSingleSymbolRenderer::symbol() const
{
- return mSymbol;
+ return mSymbol0;
}
inline bool QgsSingleSymbolRenderer::needsAttributes() const
Modified: trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -20,6 +20,7 @@
#include "qgsfeature.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
+#include "qgsrendercontext.h"
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgslogger.h"
@@ -104,8 +105,9 @@
return ( symbolForFeature( f ) != 0 );
}
-void QgsUniqueValueRenderer::renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale, double rasterScaleFactor )
+void QgsUniqueValueRenderer::renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected )
{
+ QPainter *p = renderContext.painter();
QgsSymbol* symbol = symbolForFeature( &f );
if ( !symbol ) //no matching symbol
{
@@ -138,8 +140,23 @@
const QgsAttributeMap& attrs = f.attributeMap();
rotation = attrs[symbol->rotationClassificationField()].toDouble();
}
- *img = symbol->getPointSymbolAsImage( widthScale, selected, mSelectionColor,
- fieldScale, rotation, rasterScaleFactor );
+
+ QString oldName;
+
+ if ( symbol->symbolField() >= 0 )
+ {
+ const QgsAttributeMap& attrs = f.attributeMap();
+ QString name = attrs[symbol->symbolField()].toString();
+ oldName = symbol->pointSymbolName();
+ symbol->setNamedPointSymbol( name );
+ }
+
+ *img = symbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor,
+ fieldScale, rotation, renderContext.rasterScaleFactor() );
+ if ( !oldName.isNull() )
+ {
+ symbol->setNamedPointSymbol( oldName );
+ }
}
// Line, polygon
else if ( mGeometryType != QGis::Point )
@@ -147,23 +164,23 @@
if ( !selected )
{
QPen pen = symbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
p->setPen( pen );
if ( mGeometryType == QGis::Polygon )
{
QBrush brush = symbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
p->setBrush( brush );
}
}
else
{
QPen pen = symbol->pen();
- pen.setWidthF( widthScale * pen.widthF() );
+ pen.setWidthF( renderContext.scaleFactor() * pen.widthF() );
if ( mGeometryType == QGis::Polygon )
{
QBrush brush = symbol->brush();
- scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
+ scaleBrush( brush, renderContext.rasterScaleFactor() ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
@@ -259,6 +276,11 @@
{
mSymbolAttributes.append( scaleField );
}
+ int symbolField = ( *it )->symbolField();
+ if ( symbolField >= 0 && !mSymbolAttributes.contains( symbolField ) )
+ {
+ mSymbolAttributes.append( symbolField );
+ }
}
}
Modified: trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.h
===================================================================
--- trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -31,7 +31,11 @@
/** Determines if a feature will be rendered or not
@param f a pointer to the feature to determine if rendering will happen*/
virtual bool willRenderFeature( QgsFeature *f );
- void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 );
+
+ /** Render feature
+ * added in 1.2 */
+ void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected );
+
/**Reads the renderer configuration from an XML file
@param rnode the Dom node to read
@param vl the vector layer which will be associated with the renderer
Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -47,7 +47,13 @@
QgsMarkerCatalogue::QgsMarkerCatalogue()
{
+ refreshList();
+}
+
+void QgsMarkerCatalogue::refreshList()
+{
// Init list
+ mList.clear();
// Hardcoded markers
mList.append( "hard:circle" );
@@ -65,7 +71,7 @@
// SVG
QString svgPath = QgsApplication::svgPath();
- // TODO recursiv ?
+ // TODO recursive ?
QDir dir( svgPath );
QStringList dl = dir.entryList( QDir::Dirs );
@@ -84,6 +90,8 @@
mList.append( "svg:" + svgPath + *it + "/" + *it2 );
}
}
+
+ emit markersRefreshed();
}
QStringList QgsMarkerCatalogue::list()
@@ -120,7 +128,7 @@
QImage myImage;
int imageSize;
- if ( fullName.left( 5 ) == "hard:" )
+ if ( fullName.startsWith( "hard:" ) )
{
int pw = (( pen.width() == 0 ? 1 : pen.width() ) + 1 ) / 2 * 2; // make even (round up); handle cosmetic pen
imageSize = (( int ) size + pw ) / 2 * 2 + 1; // make image width, height odd; account for pen width
@@ -145,7 +153,7 @@
//
// Now pass the paintdevice along to have the marker rendered on it
//
- if ( fullName.left( 4 ) == "svg:" )
+ if ( fullName.startsWith( "svg:" ) )
{
if ( svgMarker( &myPainter, fullName.mid( 4 ), size ) )
return myImage;
@@ -154,8 +162,26 @@
fullName = "hard:circle";
}
- if ( fullName.left( 5 ) == "hard:" )
+ if ( fullName.startsWith( "font:" ) )
{
+ if ( fontMarker( &myPainter, fullName.mid( 5 ), size ) )
+ return myImage;
+
+ QgsDebugMsg( QString( "%1 not found - replacing with hard:circle" ).arg( fullName ) );
+ fullName = "hard:circle";
+ }
+
+ if ( fullName.endsWith( ".svg", Qt::CaseInsensitive ) )
+ {
+ if ( svgMarker( &myPainter, fullName, size ) )
+ return myImage;
+
+ QgsDebugMsg( QString( "%1 not found - replacing with hard:circle" ).arg( fullName ) );
+ fullName = "hard:circle";
+ }
+
+ if ( fullName.startsWith( "hard:" ) )
+ {
hardMarker( &myPainter, imageSize, fullName.mid( 5 ), size, pen, brush, qtBug );
#ifdef IMAGEDEBUG
QgsDebugMsg( "*** Saving hard marker to hardMarker.png ***" );
@@ -214,6 +240,40 @@
return QPicture(); // empty
}
+bool QgsMarkerCatalogue::fontMarker( QPainter *thepPainter, QString fullName, double scaleFactor )
+{
+ QStringList args = fullName.split( "," );
+ if ( args.size() == 0 )
+ return false;
+
+ QChar c;
+
+ if ( args.size() > 0 )
+ {
+ if ( args[0] == "#" )
+ {
+ c = QChar( '#' );
+ }
+ else if ( args[0].startsWith( "#" ) )
+ {
+ c = QChar( args[0].mid( 1 ).toInt() );
+ }
+ else
+ {
+ c = args[0][0];
+ }
+ }
+
+ QString family = args.size() >= 2 ? args[1] : "Helvetica";
+ int weight = args.size() >= 3 ? args[2].toInt() : -1;
+ int italic = args.size() >= 4 ? args[3].toInt() != 0 : false;
+
+ thepPainter->setFont( QFont( family, scaleFactor, weight, italic ) );
+ thepPainter->drawText( 0, 0, c );
+
+ return true;
+}
+
bool QgsMarkerCatalogue::svgMarker( QPainter * thepPainter, QString fileName, double scaleFactor )
{
QSvgRenderer mySVG;
Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.h
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -27,9 +27,9 @@
/** Catalogue of point symbols */
-class CORE_EXPORT QgsMarkerCatalogue
+class CORE_EXPORT QgsMarkerCatalogue : public QObject
{
-
+ Q_OBJECT
public:
//! Destructor
~QgsMarkerCatalogue();
@@ -53,6 +53,13 @@
/** Returns a pixmap given a file name of a svg marker
* NOTE: this method needs to be public static for QgsMarkerDialog::visualizeMarkers */
static bool svgMarker( QPainter * thepPainter, QString name, double size );
+
+ public slots:
+ void refreshList();
+
+ signals:
+ void markersRefreshed();
+
private:
/**Constructor*/
@@ -66,6 +73,8 @@
/** Hard coded */
void hardMarker( QPainter * thepPainter, int imageSize, QString name, double size, QPen pen, QBrush brush, bool qtBug = true );
+ bool fontMarker( QPainter * thepPainter, QString name, double size );
+
};
#endif // QGSMARKERCATALOGUE_H
Modified: trunk/qgis/src/core/symbology/qgssymbol.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.cpp 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/symbology/qgssymbol.cpp 2009-07-23 10:59:59 UTC (rev 11152)
@@ -43,13 +43,15 @@
mLabel( label ),
mType( t ),
mPointSymbolName( "hard:circle" ),
- mPointSize( DEFAULT_POINT_SIZE ),
+ mSize( DEFAULT_POINT_SIZE ),
+ mSizeInMapUnits( false ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
- mScaleClassificationField( -1 )
+ mScaleClassificationField( -1 ),
+ mSymbolField( -1 )
{
mPen.setWidthF( DEFAULT_LINE_WIDTH );
}
@@ -63,26 +65,30 @@
mPen( c ),
mBrush( c ),
mPointSymbolName( "hard:circle" ),
- mPointSize( DEFAULT_POINT_SIZE ),
+ mSize( DEFAULT_POINT_SIZE ),
+ mSizeInMapUnits( false ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
- mScaleClassificationField( -1 )
+ mScaleClassificationField( -1 ),
+ mSymbolField( -1 )
{
mPen.setWidthF( DEFAULT_LINE_WIDTH );
}
QgsSymbol::QgsSymbol()
: mPointSymbolName( "hard:circle" ),
- mPointSize( DEFAULT_POINT_SIZE ),
+ mSize( DEFAULT_POINT_SIZE ),
+ mSizeInMapUnits( false ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
- mScaleClassificationField( -1 )
+ mScaleClassificationField( -1 ),
+ mSymbolField( -1 )
{
mPen.setWidthF( DEFAULT_LINE_WIDTH );
}
@@ -92,13 +98,15 @@
: mPen( c ),
mBrush( c ),
mPointSymbolName( "hard:circle" ),
- mPointSize( DEFAULT_POINT_SIZE ),
+ mSize( DEFAULT_POINT_SIZE ),
+ mSizeInMapUnits( false ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
- mScaleClassificationField( -1 )
+ mScaleClassificationField( -1 ),
+ mSymbolField( -1 )
{
mPen.setWidthF( DEFAULT_LINE_WIDTH );
}
@@ -115,7 +123,8 @@
mBrush = s.mBrush;
mTextureFilePath = s.mTextureFilePath;
mPointSymbolName = s.mPointSymbolName;
- mPointSize = s.mPointSize;
+ mSize = s.mSize;
+ mSizeInMapUnits = s.mSizeInMapUnits;
mPointSymbolImage = s.mPointSymbolImage;
mPointSymbolImageSelected = s.mPointSymbolImageSelected;
mWidthScale = s.mWidthScale;
@@ -127,6 +136,7 @@
mSelectionColor2 = s.mSelectionColor2;
mRotationClassificationField = s.mRotationClassificationField;
mScaleClassificationField = s.mScaleClassificationField;
+ mSymbolField = s.mSymbolField;
}
}
@@ -196,50 +206,53 @@
void QgsSymbol::setNamedPointSymbol( QString name )
{
- // do some sanity checking for svgs...
- QString myTempName = name;
- myTempName.replace( "svg:", "" );
- QFile myFile( myTempName );
- if ( !myFile.exists() )
+ if ( name.startsWith( "svg:" ) )
{
- QgsDebugMsg( "\n\n\n *** Svg Symbol not found on fs ***" );
- QgsDebugMsg( "Name: " + name );
- //see if we can resolve the problem...
- //by using the qgis svg dir from this local machine
- //one day when user specified svg are allowed we need
- //to adjust this logic probably...
- QString svgPath = QgsApplication::svgPath();
- QgsDebugMsg( "SvgPath: " + svgPath );
- QFileInfo myInfo( myTempName );
- QString myFileName = myInfo.fileName(); // foo.svg
- QString myLowestDir = myInfo.dir().dirName();
- QString myLocalPath = svgPath + QDir::separator() +
- myLowestDir + QDir::separator() +
- myFileName;
- QgsDebugMsg( "Alternative svg path: " + myLocalPath );
- if ( QFile( myLocalPath ).exists() )
+ // do some sanity checking for svgs...
+ QString myTempName = name;
+ myTempName.replace( "svg:", "" );
+ QFile myFile( myTempName );
+ if ( !myFile.exists() )
{
- name = "svg:" + myLocalPath;
- QgsDebugMsg( "Svg found in alternative path" );
- }
- else if ( myInfo.isRelative() )
- {
- QFileInfo pfi( QgsProject::instance()->fileName() );
- if ( pfi.exists() && QFile( pfi.canonicalPath() + QDir::separator() + myTempName ).exists() )
+ QgsDebugMsg( "\n\n\n *** Svg Symbol not found on fs ***" );
+ QgsDebugMsg( "Name: " + name );
+ //see if we can resolve the problem...
+ //by using the qgis svg dir from this local machine
+ //one day when user specified svg are allowed we need
+ //to adjust this logic probably...
+ QString svgPath = QgsApplication::svgPath();
+ QgsDebugMsg( "SvgPath: " + svgPath );
+ QFileInfo myInfo( myTempName );
+ QString myFileName = myInfo.fileName(); // foo.svg
+ QString myLowestDir = myInfo.dir().dirName();
+ QString myLocalPath = svgPath + QDir::separator() +
+ myLowestDir + QDir::separator() +
+ myFileName;
+ QgsDebugMsg( "Alternative svg path: " + myLocalPath );
+ if ( QFile( myLocalPath ).exists() )
{
- name = "svg:" + pfi.canonicalPath() + QDir::separator() + myTempName;
+ name = "svg:" + myLocalPath;
QgsDebugMsg( "Svg found in alternative path" );
}
+ else if ( myInfo.isRelative() )
+ {
+ QFileInfo pfi( QgsProject::instance()->fileName() );
+ if ( pfi.exists() && QFile( pfi.canonicalPath() + QDir::separator() + myTempName ).exists() )
+ {
+ name = "svg:" + pfi.canonicalPath() + QDir::separator() + myTempName;
+ QgsDebugMsg( "Svg found in alternative path" );
+ }
+ else
+ {
+ QgsDebugMsg( "Svg not found in project path" );
+ }
+ }
else
{
- QgsDebugMsg( "Svg not found in project path" );
+ //couldnt find the file, no happy ending :-(
+ QgsDebugMsg( "Computed alternate path but no svg there either" );
}
}
- else
- {
- //couldnt find the file, no happy ending :-(
- QgsDebugMsg( "Computed alternate path but no svg there either" );
- }
}
mPointSymbolName = name;
mCacheUpToDate = mCacheUpToDate2 = false;
@@ -250,22 +263,35 @@
return mPointSymbolName;
}
+void QgsSymbol::setPointSizeUnits( bool sizeInMapUnits )
+{
+ mSizeInMapUnits = sizeInMapUnits;
+}
+
+bool QgsSymbol::pointSizeUnits() const
+{
+ return mSizeInMapUnits;
+}
+
void QgsSymbol::setPointSize( double s )
{
- if ( s < MINIMUM_POINT_SIZE )
- mPointSize = MINIMUM_POINT_SIZE;
+ if ( mSizeInMapUnits )
+ {
+ mSize = s;
+ }
+ else if ( s < MINIMUM_POINT_SIZE )
+ mSize = MINIMUM_POINT_SIZE;
else
- mPointSize = s;
+ mSize = s;
mCacheUpToDate = mCacheUpToDate2 = false;
}
double QgsSymbol::pointSize() const
{
- return mPointSize;
+ return mSize;
}
-
QImage QgsSymbol::getLineSymbolAsImage()
{
//Note by Tim: dont use premultiplied - it causes
@@ -374,15 +400,19 @@
pen.setColor( selectionColor );
QBrush brush = mBrush;
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(
- mPointSymbolName, ( float )( mPointSize * scale * widthScale *
- rasterScaleFactor ),
+ mPointSymbolName,
+ ( float )( mSize * scale * widthScale * rasterScaleFactor ),
pen, mBrush );
}
else
{
+ QgsDebugMsg( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6" )
+ .arg( mPointSymbolName )
+ .arg( mSize ).arg( mSizeInMapUnits ? "true" : "false" )
+ .arg( scale ).arg( widthScale ).arg( rasterScaleFactor ) );
preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(
- mPointSymbolName, ( float )( mPointSize * scale * widthScale *
- rasterScaleFactor ),
+ mPointSymbolName,
+ ( float )( mSize * scale * widthScale * rasterScaleFactor ),
pen, mBrush );
}
@@ -403,11 +433,11 @@
// composer. Not sure why...
// brush.setColor ( selectionColor );
- mPointSymbolImage = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mPointSize,
+ mPointSymbolImage = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mSize,
mPen, mBrush );
mPointSymbolImageSelected = QgsMarkerCatalogue::instance()->imageMarker(
- mPointSymbolName, mPointSize, pen, brush );
+ mPointSymbolName, mSize, pen, brush );
mSelectionColor = selectionColor;
mCacheUpToDate = true;
@@ -420,7 +450,7 @@
QPen pen = mPen;
pen.setWidthF( widthScale * pen.widthF() );
- mPointSymbolImage2 = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mPointSize * widthScale,
+ mPointSymbolImage2 = QgsMarkerCatalogue::instance()->imageMarker( mPointSymbolName, mSize * widthScale,
pen, mBrush, false );
QBrush brush = mBrush;
@@ -428,7 +458,7 @@
pen.setColor( selectionColor );
mPointSymbolImageSelected2 = QgsMarkerCatalogue::instance()->imageMarker(
- mPointSymbolName, mPointSize * widthScale, pen, brush, false );
+ mPointSymbolName, mSize * widthScale, pen, brush, false );
mSelectionColor2 = selectionColor;
@@ -492,6 +522,7 @@
{
appendField( symbol, document, *vl, "rotationclassificationfieldname", mRotationClassificationField );
appendField( symbol, document, *vl, "scaleclassificationfieldname", mScaleClassificationField );
+ appendField( symbol, document, *vl, "symbolfieldname", mSymbolField );
}
QDomElement outlinecolor = document.createElement( "outlinecolor" );
@@ -580,16 +611,25 @@
QDomNode psizenode = synode.namedItem( "pointsize" );
- if ( ! psizenode.isNull() )
+ if ( ! psizenode.isNull() )
{
QDomElement psizeelement = psizenode.toElement();
setPointSize( psizeelement.text().toFloat() );
}
+ QDomNode psizeunitnodes = synode.namedItem( "pointsizeunits" );
+ if ( ! psizeunitnodes.isNull() )
+ {
+ QDomElement psizeunitelement = psizeunitnodes.toElement();
+ QgsDebugMsg( QString( "psizeunitelement:%1" ).arg( psizeunitelement.text() ) );
+ setPointSizeUnits( psizeunitelement.text().compare( "mapunits", Qt::CaseInsensitive ) == 0 );
+ }
+
if ( vl )
{
mRotationClassificationField = readFieldName( synode, "rotationclassificationfield", *vl );
mScaleClassificationField = readFieldName( synode, "scaleclassificationfield", *vl );
+ mSymbolField = readFieldName( synode, "symbolfield", *vl );
}
else
{
@@ -650,3 +690,13 @@
{
mScaleClassificationField = field;
}
+
+int QgsSymbol::symbolField() const
+{
+ return mSymbolField;
+}
+
+void QgsSymbol::setSymbolField( int field )
+{
+ mSymbolField = field;
+}
Modified: trunk/qgis/src/core/symbology/qgssymbol.h
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.h 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/core/symbology/qgssymbol.h 2009-07-23 10:59:59 UTC (rev 11152)
@@ -34,7 +34,6 @@
(lower value, upper value)*/
class CORE_EXPORT QgsSymbol
{
-
public:
/**Constructor*/
QgsSymbol( QGis::GeometryType t, QString lvalue = "", QString uvalue = "", QString label = "" );
@@ -86,10 +85,17 @@
virtual void setNamedPointSymbol( QString name );
/**Get point symbol*/
virtual QString pointSymbolName() const;
- /**Set size*/
+
+ /**Set point size*/
virtual void setPointSize( double s );
/**Get size*/
virtual double pointSize() const;
+
+ /**Set point size units*/
+ virtual void setPointSizeUnits( bool sizeInMapUnits );
+ /**get point size units*/
+ virtual bool pointSizeUnits() const;
+
//! Destructor
virtual ~QgsSymbol();
@@ -135,6 +141,12 @@
\param field the number of the field to classify for scale*/
void setScaleClassificationField( int field );
+ /**Returns the number of the symbol field*/
+ int symbolField() const;
+ /**Sets the number of the symbol field
+ \param field the number of the field to select the symbol*/
+ void setSymbolField( int field );
+
protected:
/**Lower value for classification*/
@@ -150,9 +162,12 @@
QString mTextureFilePath;
/* Point symbol name */
QString mPointSymbolName;
- /* Point size */
- double mPointSize;
+ /* size */
+ double mSize;
+ /* units of size */
+ bool mSizeInMapUnits;
+
/* TODO Because for printing we always need a symbol without oversampling but with line width scale,
* we keep also separate picture with line width scale */
@@ -197,6 +212,7 @@
/**Index of the classification fields (it must be a numerical field index)*/
int mRotationClassificationField;
int mScaleClassificationField;
+ int mSymbolField;
private:
int readFieldName( QDomNode &synode, QString name, const QgsVectorLayer &vl );
Modified: trunk/qgis/src/ui/qgssinglesymboldialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgssinglesymboldialogbase.ui 2009-07-23 09:41:59 UTC (rev 11151)
+++ trunk/qgis/src/ui/qgssinglesymboldialogbase.ui 2009-07-23 10:59:59 UTC (rev 11152)
@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>486</width>
+ <width>717</width>
<height>529</height>
</rect>
</property>
@@ -64,109 +64,6 @@
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QGroupBox" name="mGroupPoint" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Point Symbol</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="3" >
- <widget class="QListWidget" name="lstSymbols" >
- <property name="showDropIndicator" stdset="0" >
- <bool>false</bool>
- </property>
- <property name="dragDropMode" >
- <enum>QAbstractItemView::NoDragDrop</enum>
- </property>
- <property name="alternatingRowColors" >
- <bool>false</bool>
- </property>
- <property name="iconSize" >
- <size>
- <width>0</width>
- <height>-1</height>
- </size>
- </property>
- <property name="resizeMode" >
- <enum>QListView::Adjust</enum>
- </property>
- <property name="viewMode" >
- <enum>QListView::IconMode</enum>
- </property>
- <property name="uniformItemSizes" >
- <bool>true</bool>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="textLabel1_3" >
- <property name="text" >
- <string>Rotation field</string>
- </property>
- <property name="buddy" >
- <cstring>mRotationClassificationComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLabel" name="textLabel9" >
- <property name="text" >
- <string>Area scale field</string>
- </property>
- <property name="buddy" >
- <cstring>mScaleClassificationComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QLabel" name="textLabel1_2" >
- <property name="text" >
- <string>Size</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QComboBox" name="mRotationClassificationComboBox" >
- <property name="minimumSize" >
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QComboBox" name="mScaleClassificationComboBox" >
- <property name="minimumSize" >
- <size>
- <width>0</width>
- <height>20</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <widget class="QDoubleSpinBox" name="mPointSizeSpinBox" >
- <property name="singleStep" >
- <double>0.100000000000000</double>
- </property>
- <property name="value" >
- <double>1.000000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item row="2" column="0" >
<widget class="QGroupBox" name="groupBox_3" >
<property name="sizePolicy" >
@@ -345,8 +242,135 @@
</layout>
</item>
</layout>
+ <zorder>outlinecolorlabel_2</zorder>
+ <zorder>cboOutlineStyle</zorder>
+ <zorder>outlinecolorlabel</zorder>
+ <zorder>btnOutlineColor</zorder>
+ <zorder>outlinewidthlabel</zorder>
+ <zorder>outlinewidthspinbox</zorder>
+ <zorder>fillcolorlabel</zorder>
+ <zorder>btnFillColor</zorder>
+ <zorder>fillcolorlabel_2</zorder>
+ <zorder>mGroupPoint</zorder>
</widget>
</item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="mGroupPoint" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title" >
+ <string>Point Symbol</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QListWidget" name="lstSymbols" >
+ <property name="dragDropMode" >
+ <enum>QAbstractItemView::DragDrop</enum>
+ </property>
+ <property name="alternatingRowColors" >
+ <bool>false</bool>
+ </property>
+ <property name="iconSize" >
+ <size>
+ <width>0</width>
+ <height>-1</height>
+ </size>
+ </property>
+ <property name="resizeMode" >
+ <enum>QListView::Adjust</enum>
+ </property>
+ <property name="viewMode" >
+ <enum>QListView::IconMode</enum>
+ </property>
+ <property name="uniformItemSizes" >
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel1_3" >
+ <property name="text" >
+ <string>Rotation field</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mRotationClassificationComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QComboBox" name="mRotationClassificationComboBox" >
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QComboBox" name="mScaleClassificationComboBox" >
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="textLabel9" >
+ <property name="text" >
+ <string>Area scale field</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mScaleClassificationComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QComboBox" name="mSymbolComboBox" />
+ </item>
+ <item row="2" column="2" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Symbol field</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QLabel" name="textLabel1_2" >
+ <property name="text" >
+ <string>Size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3" >
+ <widget class="QDoubleSpinBox" name="mPointSizeSpinBox" >
+ <property name="singleStep" >
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value" >
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="4" >
+ <widget class="QCheckBox" name="mPointSizeUnitsCheckBox" >
+ <property name="text" >
+ <string>Size in map units</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
@@ -360,9 +384,6 @@
<tabstops>
<tabstop>mLabelEdit</tabstop>
<tabstop>lstSymbols</tabstop>
- <tabstop>mRotationClassificationComboBox</tabstop>
- <tabstop>mScaleClassificationComboBox</tabstop>
- <tabstop>mPointSizeSpinBox</tabstop>
<tabstop>cboOutlineStyle</tabstop>
<tabstop>btnOutlineColor</tabstop>
<tabstop>outlinewidthspinbox</tabstop>
More information about the QGIS-commit
mailing list