Skip to content

Commit

Permalink
Get rid of excess baggage required for old svg resampling stuff but n…
Browse files Browse the repository at this point in the history
…ow no longer needed.

git-svn-id: http://svn.osgeo.org/qgis/trunk@4732 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jan 24, 2006
1 parent 7134a10 commit 333e237
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
11 changes: 4 additions & 7 deletions src/core/qgsmarkercatalogue.cpp
Expand Up @@ -86,8 +86,9 @@ QgsMarkerCatalogue *QgsMarkerCatalogue::instance()

QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
{
//std::cerr << "QgsMarkerCatalogue::marker" << std::endl;
if ( fullName.left(5) == "hard:" ) {
//std::cerr << "QgsMarkerCatalogue::marker " << fullName.toLocal8Bit().data() << " sice:" << size << std::endl;
if ( fullName.left(5) == "hard:" )
{
QPicture myPicture = hardMarker ( fullName.mid(5), size, pen, brush, qtBug );
QPixmap myPixmap = QPixmap (myPicture.width(),myPicture.height());
myPixmap.fill(QColor(255,255,255,0)); //transparent
Expand All @@ -103,11 +104,7 @@ QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrus

QPixmap QgsMarkerCatalogue::svgMarker ( QString name, int s)
{
QPixmap pixmap = QgsSVGCache::instance().getPixmap(name,1.);

double scale = 1. * s / ( ( pixmap.width() + pixmap.height() ) / 2 ) ;

pixmap = QgsSVGCache::instance().getPixmap(name,scale);
QPixmap pixmap = QgsSVGCache::instance().getPixmap(name,s);

return pixmap;
}
Expand Down
11 changes: 8 additions & 3 deletions src/core/qgssvgcache.cpp
Expand Up @@ -66,7 +66,6 @@ QPixmap QgsSVGCache::getPixmap(QString filename, double scaleFactor)
{

// make the symbols smaller
scaleFactor *= 0.30;
std::pair<QString, double> myPair(filename, scaleFactor) ;
PixmapMap::iterator i = pixmapMap.find(myPair);
while (i != pixmapMap.end())
Expand All @@ -81,20 +80,26 @@ QPixmap QgsSVGCache::getPixmap(QString filename, double scaleFactor)
#endif
QSvgRenderer mySVG;
mySVG.load(filename);

// TODO Change this logic so width is scaleFactor and height is same
// proportion of scale factor as in oritignal SVG TS XXX
/*
int width=mySVG.defaultSize().width();
width=static_cast<int>(static_cast<double>(width)*scaleFactor);
int height=mySVG.defaultSize().height();
height=static_cast<int>(static_cast<double>(height)*scaleFactor);

//prevent 0 width or height, which would cause a crash
if (width == 0) {
width = 1;
}
if (height == 0) {
height = 1;
}
*/
if (scaleFactor < 1) scaleFactor=1;

QPixmap myPixmap = QPixmap(width,height);
//QPixmap myPixmap = QPixmap(width,height);
QPixmap myPixmap = QPixmap(scaleFactor,scaleFactor);
myPixmap.fill(QColor(255,255,255,0)); //transparent
QPainter myPainter(&myPixmap);
myPainter.setRenderHint(QPainter::Antialiasing);
Expand Down
28 changes: 7 additions & 21 deletions src/gui/qgssisydialog.cpp
Expand Up @@ -56,35 +56,21 @@ QgsSiSyDialog::QgsSiSyDialog(QgsVectorLayer * layer): QDialog(), mVectorLayer(la
QStringList ml = QgsMarkerCatalogue::instance()->list();
mMarkers.clear();

int size = 100;
int maxwidth = 0;
int size = 18;
QPen pen (QColor(0,0,255));
QBrush brush ( QColor(220,220,220), Qt::SolidPattern );

// Get maximum symbol width - this is probably slow
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it ) {

QPixmap pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
pen, brush );


if ( pic.width() > maxwidth ) maxwidth = pic.width();

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

for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it ) {
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it )
{
mMarkers.push_back ( *it );

QPixmap pic = QgsMarkerCatalogue::instance()->marker ( *it, size,
pen, brush );


pen, brush );
mPointSymbolComboBox->insertItem ( pic );

if (layer->vectorType() != QGis::Point)
break;
{
break;
}
}

//
Expand Down

0 comments on commit 333e237

Please sign in to comment.