Skip to content

Commit 9320b44

Browse files
author
timlinux
committed
Some refactoring to prepare the way for reinstating qpicture based symbo drawing for composer
git-svn-id: http://svn.osgeo.org/qgis/trunk@5533 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 03dcacf commit 9320b44

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

src/core/qgsmarkercatalogue.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,21 @@ QgsMarkerCatalogue *QgsMarkerCatalogue::instance()
8787
return QgsMarkerCatalogue::mMarkerCatalogue;
8888
}
8989

90-
QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
90+
QPixmap QgsMarkerCatalogue::pixmapMarker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
9191
{
9292
//std::cerr << "QgsMarkerCatalogue::marker " << fullName.toLocal8Bit().data() << " sice:" << size << std::endl;
9393
if ( fullName.left(5) == "hard:" )
9494
{
95-
return hardMarker ( fullName.mid(5), size, pen, brush, qtBug );
95+
return hardPixmapMarker ( fullName.mid(5), size, pen, brush, qtBug );
9696
}
9797
else if ( fullName.left(4) == "svg:" )
9898
{
99-
return svgMarker ( fullName.mid(4), size );
99+
return svgPixmapMarker ( fullName.mid(4), size );
100100
}
101101
return QPixmap(); // empty
102102
}
103103

104-
QPixmap QgsMarkerCatalogue::svgMarker ( QString filename, int scaleFactor)
104+
QPixmap QgsMarkerCatalogue::svgPixmapMarker ( QString filename, int scaleFactor)
105105
{
106106
QSvgRenderer mySVG;
107107
mySVG.load(filename);
@@ -139,7 +139,7 @@ QPixmap QgsMarkerCatalogue::svgMarker ( QString filename, int scaleFactor)
139139
return myPixmap;
140140
}
141141

142-
QPixmap QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, bool qtBug )
142+
QPixmap QgsMarkerCatalogue::hardPixmapMarker ( QString name, int s, QPen pen, QBrush brush, bool qtBug )
143143
{
144144
//Note teh +1 offset below is required because the
145145
//scaling to odd numbers below will cause clipping otherwise

src/core/qgsmarkercatalogue.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ class QgsMarkerCatalogue{
3838
/**List of available markers*/
3939
QStringList list();
4040

41-
/** Returns picture of the marker
41+
/** Returns pixmap of the marker
4242
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
4343
*/
44-
QPixmap marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );
44+
QPixmap pixmapMarker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );
4545

46-
/* Returns a pixmap given a filename of a svg marker */
47-
static QPixmap svgMarker ( QString name, int size );
46+
/* Returns a pixmap given a filename of a svg marker
47+
* NOTE: this method needs to be public static for QgsMarkerDialog::visualizeMarkers */
48+
static QPixmap svgPixmapMarker ( QString name, int size );
4849
private:
4950

5051
/**Constructor*/
@@ -56,7 +57,7 @@ class QgsMarkerCatalogue{
5657
QStringList mList;
5758

5859
/** Hard coded */
59-
QPixmap hardMarker ( QString name, int size, QPen pen, QBrush brush, bool qtBug = true );
60+
QPixmap hardPixmapMarker ( QString name, int size, QPen pen, QBrush brush, bool qtBug = true );
6061

6162
};
6263

src/core/qgssymbol.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ void QgsSymbol::cache( QColor selectionColor )
229229
// composer. Not sure why...
230230
// brush.setColor ( selectionColor );
231231

232-
mPointSymbolPixmap = QgsMarkerCatalogue::instance()->marker ( mPointSymbolName, mPointSize,
232+
mPointSymbolPixmap = QgsMarkerCatalogue::instance()->pixmapMarker ( mPointSymbolName, mPointSize,
233233
mPen, mBrush );
234234

235-
mPointSymbolPixmapSelected = QgsMarkerCatalogue::instance()->marker (
235+
mPointSymbolPixmapSelected = QgsMarkerCatalogue::instance()->pixmapMarker (
236236
mPointSymbolName, mPointSize, pen, brush );
237237

238238
mSelectionColor = selectionColor;
@@ -247,14 +247,14 @@ void QgsSymbol::cache2( double widthScale, QColor selectionColor )
247247
pen.setWidth ( (int) ( widthScale * pen.width() ) );
248248

249249

250-
mPointSymbolPixmap2 = QgsMarkerCatalogue::instance()->marker ( mPointSymbolName, mPointSize,
250+
mPointSymbolPixmap2 = QgsMarkerCatalogue::instance()->pixmapMarker ( mPointSymbolName, mPointSize,
251251
pen, mBrush, false );
252252

253253
QBrush brush = mBrush;
254254
brush.setColor ( selectionColor );
255255
pen.setColor ( selectionColor );
256256

257-
mPointSymbolPixmapSelected2 = QgsMarkerCatalogue::instance()->marker (
257+
mPointSymbolPixmapSelected2 = QgsMarkerCatalogue::instance()->pixmapMarker (
258258
mPointSymbolName, mPointSize, pen, brush, false );
259259

260260
mSelectionColor2 = selectionColor;

src/gui/qgscontinuouscolorrenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void QgsContinuousColorRenderer::renderFeature(QPainter * p, QgsFeature * f, QPi
138138
}
139139
brush.setStyle ( Qt::SolidPattern );
140140

141-
*pic = QgsMarkerCatalogue::instance()->marker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize(),
141+
*pic = QgsMarkerCatalogue::instance()->pixmapMarker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize(),
142142
pen, brush);
143143

144144
if ( scalefactor ) *scalefactor = 1;

src/gui/qgsmarkerdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void QgsMarkerDialog::visualizeMarkers(QString directory)
8888
qWarning((*it).toLocal8Bit().data());
8989

9090
//render the SVG file to a pixmap and put it into mIconView
91-
QPixmap pix = QgsMarkerCatalogue::svgMarker(mCurrentDir + "/" +
91+
QPixmap pix = QgsMarkerCatalogue::svgPixmapMarker(mCurrentDir + "/" +
9292
(*it), 1);
9393
Q3IconViewItem* ivi=new Q3IconViewItem(mIconView,*it,pix);
9494

src/gui/qgssinglesymboldialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog(QgsVectorLayer * layer): QDialog(),
6363
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it )
6464
{
6565
mMarkers.push_back ( *it );
66-
QPixmap pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
66+
QPixmap pic = QgsMarkerCatalogue::instance()->pixmapMarker ( *it, size,
6767
pen, brush );
6868
mPointSymbolComboBox->insertItem ( pic );
6969
if (layer->vectorType() != QGis::Point)

0 commit comments

Comments
 (0)