Skip to content

Commit 5f2fb16

Browse files
author
timlinux
committedJan 23, 2006
Remove all use of oversampling
Enable antialiasing for marker symbols Show larger marker previews in vector props marker combo NOTE: There is still an issue with markes being placed at incorrect offset that I need to resolve. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4723 c8812cc2-4d05-0410-92ff-de0c093fc19c

21 files changed

+90
-243
lines changed
 

‎src/composer/qgscomposermap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void QgsComposerMap::draw ( QPainter *painter, QgsRect *extent, QgsMapToPixel *t
122122
widthScale *= mComposition->viewScale();
123123
}
124124
double symbolScale = mSymbolScale * mComposition->scale();
125-
vector->draw( painter, extent, transform, device, widthScale, symbolScale, 0 );
125+
vector->draw( painter, extent, transform, device, widthScale, symbolScale);
126126

127127
} else {
128128
// raster

‎src/core/qgsmarkercatalogue.cpp

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,23 @@ QgsMarkerCatalogue *QgsMarkerCatalogue::instance()
8484
return QgsMarkerCatalogue::mMarkerCatalogue;
8585
}
8686

87-
QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling, bool qtBug )
87+
QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
8888
{
8989
//std::cerr << "QgsMarkerCatalogue::marker" << std::endl;
9090
if ( fullName.left(5) == "hard:" ) {
91-
QPicture myPicture = hardMarker ( fullName.mid(5), size, pen, brush, oversampling, qtBug );
91+
QPicture myPicture = hardMarker ( fullName.mid(5), size, pen, brush, qtBug );
9292
QPixmap myPixmap = QPixmap (myPicture.width(),myPicture.height());
9393
QPainter myPainter(&myPixmap);
9494
myPainter.drawPicture(0,0,myPicture);
9595
return myPixmap;
9696
} else if ( fullName.left(4) == "svg:" ) {
97-
return svgMarker ( fullName.mid(4), size, oversampling );
97+
return svgMarker ( fullName.mid(4), size );
9898
}
9999

100100
return QPixmap(); // empty
101101
}
102102

103-
QPixmap QgsMarkerCatalogue::svgMarker ( QString name, int s, int oversampling )
103+
QPixmap QgsMarkerCatalogue::svgMarker ( QString name, int s)
104104
{
105105
QPixmap pixmap = QgsSVGCache::instance().getPixmap(name,1.);
106106

@@ -111,7 +111,7 @@ QPixmap QgsMarkerCatalogue::svgMarker ( QString name, int s, int oversampling )
111111
return pixmap;
112112
}
113113

114-
QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, int oversampling, bool qtBug )
114+
QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, bool qtBug )
115115
{
116116
// Size of polygon symbols is calculated so that the area is equal to circle with
117117
// diameter mPointSize
@@ -195,52 +195,6 @@ QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush
195195
picture.setBoundingRect ( box );
196196
}
197197

198-
// If oversampling > 1 create pixmap
199-
200-
// Hardcoded symbols are not oversampled at present, because the problem is especially
201-
// with SVG markers (I am not sure why)
202-
/*
203-
if ( oversampling > 1 ) {
204-
QRect br = picture.boundingRect();
205-
QPixmap pixmap ( oversampling * br.width(), oversampling * br.height() );
206-
207-
// Find bg color (must differ from line and fill)
208-
QColor transparent;
209-
for ( int i = 0; i < 255; i++ ) {
210-
if ( pen.color().red() != i && brush.color().red() != i ) {
211-
transparent = QColor ( i, 0, 0 );
212-
break;
213-
}
214-
}
215-
216-
pixmap.fill( transparent );
217-
QPainter pixpainter;
218-
pixpainter.begin(&pixmap);
219-
pixpainter.scale ( oversampling, oversampling );
220-
pixpainter.drawPicture ( -br.x(), -br.y(), picture );
221-
pixpainter.end();
222-
223-
QImage img = pixmap.convertToImage();
224-
img.setAlphaBuffer(true);
225-
for ( int i = 0; i < img.width(); i++ ) {
226-
for ( int j = 0; j < img.height(); j++ ) {
227-
QRgb pixel = img.pixel(i, j);
228-
int alpha = 255;
229-
if ( qRed(pixel) == transparent.red() ) {
230-
alpha = 0;
231-
}
232-
img.setPixel ( i, j, qRgba(qRed(pixel), qGreen(pixel), qBlue(pixel), alpha) );
233-
}
234-
}
235-
img = img.smoothScale( br.width(), br.height());
236-
pixmap.convertFromImage ( img );
237-
238-
picpainter.begin(&picture);
239-
picpainter.drawPixmap ( 0, 0, pixmap );
240-
picpainter.end();
241-
}
242-
*/
243-
244198
return picture;
245199
}
246200

‎src/core/qgsmarkercatalogue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class QgsMarkerCatalogue{
4343
/** Returns picture of the marker
4444
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
4545
*/
46-
QPixmap marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling = 1, bool qtBug = true );
46+
QPixmap marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );
4747

4848
private:
4949

@@ -56,10 +56,10 @@ class QgsMarkerCatalogue{
5656
QStringList mList;
5757

5858
/** Hard coded */
59-
QPicture hardMarker ( QString name, int size, QPen pen, QBrush brush, int oversampling = 1, bool qtBug = true );
59+
QPicture hardMarker ( QString name, int size, QPen pen, QBrush brush, bool qtBug = true );
6060

6161
/** Hard coded */
62-
QPixmap svgMarker ( QString name, int size, int oversampling = 1 );
62+
QPixmap svgMarker ( QString name, int size );
6363
};
6464

6565
#endif // QGSMARKERCATALOGUE_H

‎src/core/qgsrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class QgsRenderer
5353
@param f a pointer to the feature to be rendered
5454
@param pic pointer to a marker from SVG (is only used by marker renderers)
5555
@param scalefactor pointer to the scale factor for the marker image*/
56-
virtual void renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.)=0;
56+
virtual void renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic, double* scalefactor, bool selected, double widthScale = 1.)=0;
5757
/**Reads the renderer configuration from an XML file
5858
@param rnode the DOM node to read
5959
@param vl the vector layer which will be associated with the renderer*/

‎src/core/qgssvgcache.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
QgsSVGCache::QgsSVGCache() {
3434
QSettings settings;
35-
oversampling = settings.readNumEntry("/qgis/svgoversampling", 4);
3635
pixelLimit = settings.readNumEntry("/qgis/svgcachesize", 200000);
3736
totalPixels = 0;
3837
}
@@ -98,6 +97,7 @@ QPixmap QgsSVGCache::getPixmap(QString filename, double scaleFactor)
9897
QPixmap myPixmap = QPixmap(width,height);
9998
myPixmap.fill(QColor(255,255,255,0)); //transparent
10099
QPainter myPainter(&myPixmap);
100+
myPainter.setRenderHint(QPainter::Antialiasing);
101101
mySVG.render(&myPainter);
102102
pixmapMap[std::pair<QString, double>(filename, scaleFactor)] = myPixmap;
103103
return myPixmap;
@@ -111,11 +111,3 @@ void QgsSVGCache::clear() {
111111
}
112112

113113

114-
void QgsSVGCache::setOversampling(int oversamplingFactor) {
115-
oversampling = oversamplingFactor;
116-
}
117-
118-
119-
int QgsSVGCache::getOversampling() const {
120-
return oversampling;
121-
}

‎src/core/qgssvgcache.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,6 @@ class QgsSVGCache {
5151
has changed and you want to get rid of cached lower-quality pixmaps. */
5252
void clear();
5353

54-
/** When a pixmap is requested and it is not in the cache, it will be
55-
loaded using a QPicture and rendered to a QPixmap. Since Qt does not do
56-
any kind of anti-aliasing or smoothing, the QPicture is first rendered
57-
to a pixmap that is larger than the requested size, and then it's scaled
58-
down using QImage::smoothScale() to smooth out sharp edges and lines.
59-
The oversampling factor determins how much larger the first pixmap is -
60-
the larger this factor is the smoother the final pixmap will look, but
61-
it will also take longer time to render and scale the image. This
62-
function sets the oversampling factor. It should be larger than or equal
63-
to 1.
64-
*/
65-
void setOversampling(int oversamplingFactor);
66-
67-
/** This function returns the oversampling factor.
68-
@see setOversampling()
69-
*/
70-
int getOversampling() const;
7154

7255
/** This function returns a reference to the singleton object. */
7356
static inline QgsSVGCache& instance();
@@ -78,7 +61,6 @@ class QgsSVGCache {
7861
PictureMap pictureMap;
7962
typedef std::map<std::pair<QString, double>,QPixmap> PixmapMap;
8063
PixmapMap pixmapMap;
81-
int oversampling;
8264
std::queue<std::pair<QString, double> > fifo;
8365
int pixelLimit;
8466
int totalPixels;

‎src/core/qgssymbol.cpp

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
4040
mType(t),
4141
mPointSymbolName( "hard:circle" ),
4242
mPointSize( 6 ),
43-
mOversampling(1),
4443
mPointSymbolPixmap(1,1),
4544
mWidthScale(1.0),
4645
mCacheUpToDate( false ),
@@ -57,7 +56,6 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
5756
mBrush( c ),
5857
mPointSymbolName( "hard:circle" ),
5958
mPointSize( 6 ),
60-
mOversampling(1),
6159
mPointSymbolPixmap(1,1),
6260
mWidthScale(1.0),
6361
mCacheUpToDate( false ),
@@ -67,7 +65,6 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
6765
QgsSymbol::QgsSymbol()
6866
: mPointSymbolName( "hard:circle" ),
6967
mPointSize( 6 ),
70-
mOversampling(1),
7168
mPointSymbolPixmap(1,1),
7269
mWidthScale(1.0),
7370
mCacheUpToDate( false ),
@@ -80,7 +77,6 @@ QgsSymbol::QgsSymbol(QColor c)
8077
mBrush( c ),
8178
mPointSymbolName( "hard:circle" ),
8279
mPointSize( 6 ),
83-
mOversampling(1),
8480
mPointSymbolPixmap(1,1),
8581
mWidthScale(1.0),
8682
mCacheUpToDate( false ),
@@ -186,59 +182,39 @@ QPixmap QgsSymbol::getPolygonSymbolAsPixmap()
186182
return pix; //this is ok because of qts sharing mechanism
187183
}
188184

189-
QPixmap QgsSymbol::getPointSymbolAsPixmap( int oversampling, double widthScale,
185+
QPixmap QgsSymbol::getPointSymbolAsPixmap( double widthScale,
190186
bool selected, QColor selectionColor )
191187
{
192-
//std::cerr << "QgsSymbol::getPointSymbolAsPixmap oversampling = " << oversampling <<
193-
// " widthScale = " << widthScale << std::endl;
194188

195-
if ( oversampling >= 1 ) // called for canvas -> mPointSymbolPixmap
196-
{
197-
if ( !mCacheUpToDate || oversampling != mOversampling
189+
if ( !mCacheUpToDate
198190
|| ( selected && mSelectionColor != selectionColor ) )
199191
{
200192
if ( selected ) {
201-
cache( oversampling, selectionColor );
193+
cache( selectionColor );
202194
} else {
203-
cache( oversampling, mSelectionColor );
195+
cache( mSelectionColor );
204196
}
205197
}
206198
if ( selected ) {
207199
return mPointSymbolPixmapSelected;
208200
}
209201
return mPointSymbolPixmap;
210-
}
211202

212-
// called by composer -> mPointSymbolPixmap2
213-
if ( !mCacheUpToDate2 || widthScale != mWidthScale
214-
|| ( selected && mSelectionColor2 != selectionColor ) )
215-
{
216-
if ( selected ) {
217-
cache2( widthScale, selectionColor );
218-
} else {
219-
cache2( widthScale, mSelectionColor );
220-
}
221-
}
222-
if ( selected ) {
223-
return mPointSymbolPixmapSelected2;
224-
}
225-
return mPointSymbolPixmap2;
226203
}
227204

228-
void QgsSymbol::cache( int oversampling, QColor selectionColor )
205+
void QgsSymbol::cache( QColor selectionColor )
229206
{
230207
QPen pen = mPen;
231208
pen.setColor ( selectionColor );
232209
QBrush brush = mBrush;
233210
brush.setColor ( selectionColor );
234211

235212
mPointSymbolPixmap = QgsMarkerCatalogue::instance()->marker ( mPointSymbolName, mPointSize,
236-
mPen, mBrush, oversampling );
213+
mPen, mBrush );
237214

238215
mPointSymbolPixmapSelected = QgsMarkerCatalogue::instance()->marker (
239-
mPointSymbolName, mPointSize, pen, brush, oversampling );
216+
mPointSymbolName, mPointSize, pen, brush );
240217

241-
mOversampling = oversampling;
242218
mSelectionColor = selectionColor;
243219
mCacheUpToDate = true;
244220
}
@@ -247,20 +223,19 @@ void QgsSymbol::cache2( double widthScale, QColor selectionColor )
247223
{
248224
//std::cerr << "QgsSymbol::cache2 widthScale = " << widthScale << std::endl;
249225

250-
// Vector without oversampling with width scale */
251226
QPen pen = mPen;
252227
pen.setWidth ( (int) ( widthScale * pen.width() ) );
253228

254229

255230
mPointSymbolPixmap2 = QgsMarkerCatalogue::instance()->marker ( mPointSymbolName, mPointSize,
256-
pen, mBrush, 1, false );
231+
pen, mBrush, false );
257232

258233
QBrush brush = mBrush;
259234
brush.setColor ( selectionColor );
260235
pen.setColor ( selectionColor );
261236

262237
mPointSymbolPixmapSelected2 = QgsMarkerCatalogue::instance()->marker (
263-
mPointSymbolName, mPointSize, pen, brush, 1, false );
238+
mPointSymbolName, mPointSize, pen, brush, false );
264239

265240
mSelectionColor2 = selectionColor;
266241

‎src/core/qgssymbol.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,8 @@ class QgsSymbol{
9191
virtual QPixmap getPolygonSymbolAsPixmap();
9292

9393
/** Get QPixmap representation of point symbol with current settings
94-
* \param oversampling oversampling factor
95-
* >= 1 -> returns mPointSymbolPixmap, widthScale ignored
96-
* 0 -> returns mPointSymbolPixmap2, with widthScale
9794
*/
98-
virtual QPixmap getPointSymbolAsPixmap(int oversampling = 1, double widthScale = 1.,
95+
virtual QPixmap getPointSymbolAsPixmap( double widthScale = 1.,
9996
bool selected = false, QColor selectionColor = Qt::yellow );
10097

10198
/**Writes the contents of the symbol to a configuration file
@@ -126,24 +123,30 @@ class QgsSymbol{
126123
/* TODO Because for printing we always need a symbol without oversampling but with line width scale,
127124
* we keep also separate picture with line width scale */
128125

129-
/* Oversampling used for current mPointSymbolPixmap and mPointSymbolPixmap */
130-
int mOversampling;
131-
132-
/* Point symbol cache with oversampling mOversampling */
126+
//
127+
//
128+
// NOTE THE LOGIC OF THESE MEMBER VARS NEED TO BE REVISITED NOW THAT
129+
// I HAVE REMOVED SVG OVERSAMPLING (NEEDED IN QT3 WITH POOR SVG SUPPORT)
130+
// Tim Sutton 2006 XXX FIXME
131+
//
132+
//
133+
134+
135+
/* Point symbol cache */
133136
QPixmap mPointSymbolPixmap;
134137

135-
/* Point symbol cache with oversampling mOversampling (but vector if mOversampling == 1) */
138+
/* Point symbol cache */
136139
QPixmap mPointSymbolPixmapSelected;
137140

138141
/* Current line width scale used by mPointSymbolVectorPixmap */
139142
double mWidthScale;
140143

141-
/* Point symbol cache without oversampling (always vector picture) but with line width scale mWidthScale */
144+
/* Point symbol cache but with line width scale mWidthScale */
142145
QPixmap mPointSymbolPixmap2;
143146
QPixmap mPointSymbolPixmapSelected2;
144147

145148
/* Create point symbol mPointSymbolPixmap/mPointSymbolPixmap cache */
146-
void cache( int oversampling, QColor selectionColor );
149+
void cache( QColor selectionColor );
147150

148151
/* Create point symbol mPointSymbolPixmap2 cache */
149152
void cache2( double widthScale, QColor selectionColor );

‎src/gui/qgscontinuouscolrenderer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void QgsContinuousColRenderer::setMaximumSymbol(QgsSymbol* sy)
7373
}
7474

7575
void QgsContinuousColRenderer::renderFeature(QPainter * p, QgsFeature * f, QPixmap* pic,
76-
double* scalefactor, bool selected, int oversampling, double widthScale)
76+
double* scalefactor, bool selected, double widthScale)
7777
{
7878
if ((mMinimumSymbol && mMaximumSymbol))
7979
{
@@ -135,9 +135,8 @@ void QgsContinuousColRenderer::renderFeature(QPainter * p, QgsFeature * f, QPixm
135135
}
136136
brush.setStyle ( Qt::SolidPattern );
137137

138-
// Always with oversampling 0
139138
*pic = QgsMarkerCatalogue::instance()->marker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize(),
140-
pen, brush, 0 );
139+
pen, brush);
141140

142141
if ( scalefactor ) *scalefactor = 1;
143142
}

‎src/gui/qgscontinuouscolrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class QgsContinuousColRenderer: public QgsRenderer
3737
QgsContinuousColRenderer& operator=(const QgsContinuousColRenderer& other);
3838
virtual ~QgsContinuousColRenderer();
3939
/**Renders the feature using the minimum and maximum value of the classification field*/
40-
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.);
40+
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, double widthScale = 1.);
4141
/**Returns the number of the classification field*/
4242
int classificationField() const;
4343
/**Sets the id of the classification field*/

‎src/gui/qgsgraduatedsymrenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void QgsGraduatedSymRenderer::removeSymbols()
8484
}
8585

8686
void QgsGraduatedSymRenderer::renderFeature(QPainter * p, QgsFeature * f, QPixmap* pic,
87-
double* scalefactor, bool selected, int oversampling, double widthScale)
87+
double* scalefactor, bool selected, double widthScale)
8888
{
8989
//first find out the value for the classification attribute
9090
std::vector < QgsFeatureAttribute > vec = f->attributeMap();
@@ -111,7 +111,7 @@ void QgsGraduatedSymRenderer::renderFeature(QPainter * p, QgsFeature * f, QPixma
111111
// Point
112112
if ( pic && mVectorType == QGis::Point )
113113
{
114-
*pic = (*it)->getPointSymbolAsPixmap( oversampling, widthScale,
114+
*pic = (*it)->getPointSymbolAsPixmap( widthScale,
115115
selected, mSelectionColor );
116116

117117
if ( scalefactor ) *scalefactor = 1;

‎src/gui/qgsgraduatedsymrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class QgsGraduatedSymRenderer: public QgsRenderer
4949
\param p a painter (usually the one from the current map canvas)
5050
\param f a pointer to a feature to render
5151
\param t the transform object containing the information how to transform the map coordinates to screen coordinates*/
52-
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.);
52+
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, double widthScale = 1.);
5353
/**Sets the number of the classicifation field
5454
\param field the number of the field to classify*/
5555
void setClassificationField(int field);

‎src/gui/qgsoptions.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
5454

5555
// set the current theme
5656
cmbTheme->setCurrentText(settings.readEntry("/Themes"));
57-
// set the SVG oversampling factor
58-
spbSVGOversampling->setValue(QgsSVGCache::instance().getOversampling());
5957
// set the display update threshold
6058
spinBoxUpdateThreshold->setValue(settings.readNumEntry("/Map/updateThreshold"));
6159
//set the default projection behaviour radio buttongs
@@ -156,8 +154,6 @@ void QgsOptions::saveOptions()
156154
settings.writeEntry("/Themes",cmbTheme->currentText());
157155
}
158156
settings.writeEntry("/Map/updateThreshold", spinBoxUpdateThreshold->value());
159-
QgsSVGCache::instance().setOversampling(spbSVGOversampling->value());
160-
settings.writeEntry("/qgis/svgoversampling", spbSVGOversampling->value());
161157
//check behaviour so default projection when new layer is added with no
162158
//projection defined...
163159
if (radPromptForProjection->isChecked())

‎src/gui/qgssinglesymrenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ void QgsSingleSymRenderer::addSymbol(QgsSymbol* sy)
8686
}
8787

8888
void QgsSingleSymRenderer::renderFeature(QPainter * p, QgsFeature * f, QPixmap* pic,
89-
double* scalefactor, bool selected, int oversampling, double widthScale)
89+
double* scalefactor, bool selected, double widthScale)
9090
{
9191
// Point
9292
if ( pic && mVectorType == QGis::Point) {
93-
*pic = mSymbol->getPointSymbolAsPixmap( oversampling, widthScale,
93+
*pic = mSymbol->getPointSymbolAsPixmap( widthScale,
9494
selected, mSelectionColor );
9595

9696
if ( scalefactor ) *scalefactor = 1;

‎src/gui/qgssinglesymrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class QgsSingleSymRenderer: public QgsRenderer
4141
/*Returns a pointer to mSymbol*/
4242
const QgsSymbol* symbol() const;
4343
/**Renders an OGRFeature*/
44-
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.);
44+
void renderFeature(QPainter* p, QgsFeature* f, QPixmap* pic, double* scalefactor, bool selected, double widthScale = 1.);
4545
/**Reads the renderer configuration from an XML file
4646
@param rnode the DOM node to read
4747
@param vl the vector layer which will be associated with the renderer*/

‎src/gui/qgssisydialog.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ QgsSiSyDialog::QgsSiSyDialog(QgsVectorLayer * layer): QDialog(), mVectorLayer(la
6565
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it ) {
6666

6767
QPixmap pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
68-
pen, brush, QgsSVGCache::instance().getOversampling() );
68+
pen, brush );
6969

7070

7171
if ( pic.width() > maxwidth ) maxwidth = pic.width();
@@ -78,16 +78,10 @@ QgsSiSyDialog::QgsSiSyDialog(QgsVectorLayer * layer): QDialog(), mVectorLayer(la
7878
mMarkers.push_back ( *it );
7979

8080
QPixmap pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
81-
pen, brush, QgsSVGCache::instance().getOversampling() );
81+
pen, brush );
8282

8383

84-
QPixmap pm( 10+maxwidth, 10+pic.height() );
85-
pm.fill(QColor(255,255,255));
86-
QPainter p;
87-
p.begin(&pm);
88-
p.drawPixmap ( 5-pic.width()+(maxwidth-pic.width())/2 , 5-pic.height(), pic);
89-
p.end();
90-
mPointSymbolComboBox->insertItem ( pm );
84+
mPointSymbolComboBox->insertItem ( pic );
9185

9286
if (layer->vectorType() != QGis::Point)
9387
break;

‎src/gui/qgsuniquevalrenderer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int QgsUniqueValRenderer::classificationField()
9999
}
100100

101101
void QgsUniqueValRenderer::renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic,
102-
double* scalefactor, bool selected, int oversampling, double widthScale)
102+
double* scalefactor, bool selected, double widthScale)
103103
{
104104
std::vector < QgsFeatureAttribute > vec = f->attributeMap();
105105
QString value = vec[0].fieldValue();
@@ -110,8 +110,8 @@ void QgsUniqueValRenderer::renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic
110110

111111
// Point
112112
if ( pic && mVectorType == QGis::Point ) {
113-
*pic = symbol->getPointSymbolAsPixmap( oversampling, widthScale,
114-
selected, mSelectionColor );
113+
*pic = symbol->getPointSymbolAsPixmap( widthScale,
114+
selected, mSelectionColor );
115115

116116
if ( scalefactor ) *scalefactor = 1;
117117
}

‎src/gui/qgsuniquevalrenderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QgsUniqueValRenderer: public QgsRenderer
3131
QgsUniqueValRenderer(const QgsUniqueValRenderer& other);
3232
QgsUniqueValRenderer& operator=(const QgsUniqueValRenderer& other);
3333
virtual ~QgsUniqueValRenderer();
34-
void renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.);
34+
void renderFeature(QPainter* p, QgsFeature* f,QPixmap* pic, double* scalefactor, bool selected, double widthScale = 1.);
3535
/**Reads the renderer configuration from an XML file
3636
@param rnode the DOM node to read
3737
@param vl the vector layer which will be associated with the renderer*/

‎src/gui/qgsvectorlayer.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -795,14 +795,11 @@ std::cerr << i << ": " << ring->first[i]
795795

796796
void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * theMapToPixelTransform, QPaintDevice* dst)
797797
{
798-
QSettings settings;
799-
int oversampling = settings.readNumEntry("/qgis/svgoversampling", 1);
800-
801-
draw ( p, viewExtent, theMapToPixelTransform, dst, 1., 1., oversampling );
798+
draw ( p, viewExtent, theMapToPixelTransform, dst, 1., 1.);
802799
}
803800

804801
void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * theMapToPixelTransform,
805-
QPaintDevice* dst, double widthScale, double symbolScale, int oversampling)
802+
QPaintDevice* dst, double widthScale, double symbolScale)
806803
{
807804
if ( /*1 == 1 */ m_renderer)
808805
{
@@ -930,7 +927,7 @@ void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * th
930927

931928
bool sel=mSelected.find(fet->featureId()) != mSelected.end();
932929
m_renderer->renderFeature(p, fet, &marker, &markerScaleFactor,
933-
sel, oversampling, widthScale );
930+
sel, widthScale );
934931

935932
double scale = markerScaleFactor * symbolScale;
936933
drawFeature(p,fet,theMapToPixelTransform,&marker, scale,
@@ -954,7 +951,7 @@ void QgsVectorLayer::draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * th
954951
{
955952
bool sel=mSelected.find((*it)->featureId()) != mSelected.end();
956953
m_renderer->renderFeature(p, fet, &marker, &markerScaleFactor,
957-
sel, oversampling, widthScale);
954+
sel, widthScale);
958955
double scale = markerScaleFactor * symbolScale;
959956
drawFeature(p,*it,theMapToPixelTransform,&marker,scale,
960957
projectionsEnabledFlag);

‎src/gui/qgsvectorlayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ public slots:
406406
* \param widthScale line width scale
407407
* \param symbolScale symbol scale
408408
*/
409-
void draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice * dst, double widthScale, double symbolScale, int oversampling = 1);
409+
void draw(QPainter * p, QgsRect * viewExtent, QgsMapToPixel * cXf, QPaintDevice * dst, double widthScale, double symbolScale);
410410

411411
/** \brief Draws the layer labels using coordinate transformation
412412
* \param scale size scale, applied to all values in pixels

‎src/ui/qgsoptionsbase.ui

Lines changed: 35 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,22 @@
210210
<number>6</number>
211211
</property>
212212
<item row="3" column="0" >
213-
<widget class="QGroupBox" name="groupBox_3" >
213+
<spacer>
214+
<property name="orientation" >
215+
<enum>Qt::Vertical</enum>
216+
</property>
217+
<property name="sizeHint" >
218+
<size>
219+
<width>20</width>
220+
<height>40</height>
221+
</size>
222+
</property>
223+
</spacer>
224+
</item>
225+
<item row="2" column="0" >
226+
<widget class="QGroupBox" name="groupBox_8" >
214227
<property name="title" >
215-
<string>&amp;SVG Options</string>
228+
<string>Anti-aliasing</string>
216229
</property>
217230
<layout class="QGridLayout" >
218231
<property name="margin" >
@@ -221,46 +234,32 @@
221234
<property name="spacing" >
222235
<number>6</number>
223236
</property>
224-
<item row="0" column="2" >
225-
<spacer>
226-
<property name="orientation" >
227-
<enum>Qt::Horizontal</enum>
228-
</property>
229-
<property name="sizeType" >
230-
<enum>QSizePolicy::Expanding</enum>
231-
</property>
232-
<property name="sizeHint" >
233-
<size>
234-
<width>180</width>
235-
<height>20</height>
236-
</size>
237-
</property>
238-
</spacer>
239-
</item>
240-
<item row="1" column="0" colspan="3" >
241-
<widget class="QLabel" name="textLabel1_5_2" >
237+
<item row="0" column="0" >
238+
<widget class="QCheckBox" name="chkAntiAliasing" >
242239
<property name="text" >
243-
<string>&lt;b>Note: &lt;/b>A higher value gives smoother SVG symbols, but can slow down rendering</string>
244-
</property>
245-
<property name="alignment" >
246-
<set>Qt::AlignVCenter</set>
247-
</property>
248-
<property name="wordWrap" >
249-
<bool>true</bool>
250-
</property>
251-
</widget>
252-
</item>
253-
<item row="0" column="1" >
254-
<widget class="QSpinBox" name="spbSVGOversampling" >
255-
<property name="minimum" >
256-
<number>1</number>
240+
<string>Make lines appear less jagged at the expense of some drawing performance</string>
257241
</property>
258242
</widget>
259243
</item>
244+
</layout>
245+
</widget>
246+
</item>
247+
<item row="1" column="0" >
248+
<widget class="QGroupBox" name="groupBox_4" >
249+
<property name="title" >
250+
<string>Initial Visibility</string>
251+
</property>
252+
<layout class="QGridLayout" >
253+
<property name="margin" >
254+
<number>9</number>
255+
</property>
256+
<property name="spacing" >
257+
<number>6</number>
258+
</property>
260259
<item row="0" column="0" >
261-
<widget class="QLabel" name="textLabel1_7" >
260+
<widget class="QCheckBox" name="chkAddedVisibility" >
262261
<property name="text" >
263-
<string>SVG oversampling factor</string>
262+
<string>New la&amp;yers added to the map are not displayed</string>
264263
</property>
265264
</widget>
266265
</item>
@@ -316,50 +315,6 @@
316315
</layout>
317316
</widget>
318317
</item>
319-
<item row="1" column="0" >
320-
<widget class="QGroupBox" name="groupBox_4" >
321-
<property name="title" >
322-
<string>Initial Visibility</string>
323-
</property>
324-
<layout class="QGridLayout" >
325-
<property name="margin" >
326-
<number>9</number>
327-
</property>
328-
<property name="spacing" >
329-
<number>6</number>
330-
</property>
331-
<item row="0" column="0" >
332-
<widget class="QCheckBox" name="chkAddedVisibility" >
333-
<property name="text" >
334-
<string>New la&amp;yers added to the map are not displayed</string>
335-
</property>
336-
</widget>
337-
</item>
338-
</layout>
339-
</widget>
340-
</item>
341-
<item row="2" column="0" >
342-
<widget class="QGroupBox" name="groupBox_8" >
343-
<property name="title" >
344-
<string>Anti-aliasing</string>
345-
</property>
346-
<layout class="QGridLayout" >
347-
<property name="margin" >
348-
<number>9</number>
349-
</property>
350-
<property name="spacing" >
351-
<number>6</number>
352-
</property>
353-
<item row="0" column="0" >
354-
<widget class="QCheckBox" name="chkAntiAliasing" >
355-
<property name="text" >
356-
<string>Make lines appear less jagged at the expense of some drawing performance</string>
357-
</property>
358-
</widget>
359-
</item>
360-
</layout>
361-
</widget>
362-
</item>
363318
</layout>
364319
</widget>
365320
<widget class="QWidget" name="tabMap" >

0 commit comments

Comments
 (0)
Please sign in to comment.