Skip to content
Permalink
Browse files

1) svg related

Removed deprecated references to qgssvgcache
Some additional small changes to src/core/qgsmarkercatalogue to support svg from directly in the catalog
Added static method too src/core/qgsmarkercatalogue to retrun a pixmap of svg given a filename and a scale factor

2) Vector props
Removed unimplemented collision detection option on vetor label properties dialog and signal slot setup for 
that option in lable subclass



git-svn-id: http://svn.osgeo.org/qgis/trunk@5140 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Apr 3, 2006
1 parent 5ac7396 commit 01b1171074938d811a4270298208b9078746cebf
@@ -26,9 +26,9 @@
#include <QPolygon>
#include <QDir>
#include <QPicture>
#include <QSvgRenderer>

#include "qgsapplication.h"
#include "qgssvgcache.h"
#include "qgsmarkercatalogue.h"

QgsMarkerCatalogue *QgsMarkerCatalogue::mMarkerCatalogue = 0;
@@ -122,11 +122,42 @@ QPixmap QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrus
return QPixmap(); // empty
}

QPixmap QgsMarkerCatalogue::svgMarker ( QString name, int s)
QPixmap QgsMarkerCatalogue::svgMarker ( QString filename, int scaleFactor)
{
QPixmap pixmap = QgsSVGCache::instance().getPixmap(name,s);
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
if (scaleFactor < 1) scaleFactor=1;

//QPixmap myPixmap = QPixmap(width,height);
QPixmap myPixmap = QPixmap(scaleFactor,scaleFactor);

// The following is window-system-conditional since (at least)
// the combination of Qt 4.1.0 and RealVNC's Xvnc 4.1
// will result in the pixmap becoming invisible if it is filled
// with a non-opaque colour.
// This is probably because Xvnc 4.1 doesn't have the RENDER
// extension compiled into it.
#if defined(Q_WS_X11)
// Do a runtime test to see if the X RENDER extension is available
if ( myPixmap.x11PictureHandle() )
{
#endif
myPixmap.fill(QColor(255,255,255,0)); // transparent
#if defined(Q_WS_X11)
}
else
{
myPixmap.fill(QColor(255,255,255)); // opaque
}
#endif
QPainter myPainter(&myPixmap);
myPainter.setRenderHint(QPainter::Antialiasing);
mySVG.render(&myPainter);

return pixmap;
return myPixmap;
}

QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, bool qtBug )
@@ -43,6 +43,8 @@ class QgsMarkerCatalogue{
*/
QPixmap marker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );

/* Returns a pixmap given a filename of a svg marker */
static QPixmap svgMarker ( QString name, int size );
private:

/**Constructor*/
@@ -56,8 +58,6 @@ class QgsMarkerCatalogue{
/** Hard coded */
QPicture hardMarker ( QString name, int size, QPen pen, QBrush brush, bool qtBug = true );

/** Hard coded */
QPixmap svgMarker ( QString name, int size );
};

#endif // QGSMARKERCATALOGUE_H
@@ -21,7 +21,6 @@

#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"
#include "qgsmarkercatalogue.h"

#include <QPainter>
@@ -21,7 +21,6 @@
#include "qgsgraduatedsymbolrenderer.h"
#include "qgslegendsymbologyitem.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"
#include <QDomNode>
#include <QDomElement>
#include <QPixmap>
@@ -64,8 +64,6 @@ QgsLabelDialog::QgsLabelDialog ( QgsLabel *label, QWidget *parent )
this, SLOT(changeFontColor()) );
connect( chkUseBuffer, SIGNAL(toggled(bool)),
this, SLOT(chkUseBuffer_toggled(bool)) );
connect( cbxUseCollisionDetection, SIGNAL(toggled(bool)),
this, SLOT(cbxUseCollisionDetection_toggled(bool)) );
}


@@ -18,14 +18,14 @@

#include "qgsmarkerdialog.h"
#include "qgsapplication.h"
#include "qgssvgcache.h"

#include <QDir>
#include <QFileDialog>
#include <Q3IconView>
#include <QPixmap>

#include "qgsconfig.h"
#include <qgsmarkercatalogue.h>

QgsMarkerDialog::QgsMarkerDialog(QString startdir):
//paramters removed by Tim during qt4 ui port - FIXME!!!
@@ -88,7 +88,7 @@ void QgsMarkerDialog::visualizeMarkers(QString directory)
qWarning((*it).toLocal8Bit().data());

//render the SVG file to a pixmap and put it into mIconView
QPixmap pix = QgsSVGCache::instance().getPixmap(mCurrentDir + "/" +
QPixmap pix = QgsMarkerCatalogue::svgMarker(mCurrentDir + "/" +
(*it), 1);
Q3IconViewItem* ivi=new Q3IconViewItem(mIconView,*it,pix);

@@ -21,7 +21,6 @@
#include "qgis.h"
#include "qgisapp.h"
#include "qgslayerprojectionselector.h"
#include "qgssvgcache.h"
#include "qgsspatialrefsys.h"
#include <QFileDialog>
#include <QSettings>
@@ -19,7 +19,6 @@
#include "qgssinglesymboldialog.h"
#include "qgsmarkercatalogue.h"
#include "qgssinglesymbolrenderer.h"
#include "qgssvgcache.h"
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgsvectorlayer.h"
@@ -22,7 +22,6 @@
#include "qgsvectorlayer.h"
#include "qgslegenditem.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"

#include <QString>
#include <QDomNode>
@@ -21,7 +21,6 @@
#include "qgsvectorlayer.h"
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"
#include <QDomNode>
#include <QPainter>
#include <QPixmap>
@@ -50,40 +50,39 @@
#include <QString>
#include <QSettings>

#include "qgsapplication.h"
#include "qgis.h" //for globals
#include "qgisapp.h"
#include "qgsproject.h"
#include "qgsrect.h"
#include "qgspoint.h"
#include "qgsmaptopixel.h"
#include "qgsvectorlayer.h"
#include "qgsapplication.h"
#include "qgsattributedialog.h"
#include "qgsattributetable.h"
#include "qgsattributetabledisplay.h"
#include "qgscontinuouscolorrenderer.h"
#include "qgscoordinatetransform.h"
#include "qgsdistancearea.h"
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgsgraduatedsymbolrenderer.h"
#include "qgslabel.h"
#include "qgslabelattributes.h"
#include "qgslegend.h"
#include "qgsvectorlayerproperties.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaptopixel.h"
#include "qgspoint.h"
#include "qgsproject.h"
#include "qgsproviderregistry.h"
#include "qgsrect.h"
#include "qgsrect.h"
#include "qgsrenderer.h"
#include "qgsrenderitem.h"
#include "qgssinglesymbolrenderer.h"
#include "qgsgraduatedsymbolrenderer.h"
#include "qgscontinuouscolorrenderer.h"
#include "qgsspatialrefsys.h"
#include "qgsuniquevaluerenderer.h"
#include "qgsrenderitem.h"
#include "qgsproviderregistry.h"
#include "qgsrect.h"
#include "qgslabelattributes.h"
#include "qgslabel.h"
#include "qgscoordinatetransform.h"
#include "qgsmaplayerregistry.h"
#include "qgsattributedialog.h"
#include "qgsattributetabledisplay.h"
#include "qgsdistancearea.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#ifdef Q_WS_X11
#include "qgsclipper.h"
#endif
#include "qgssvgcache.h"
#include "qgsspatialrefsys.h"
#include "qgis.h" //for globals
//#include "wkbheader.h"

#ifdef TESTPROVIDERLIB
@@ -295,16 +295,6 @@
</layout>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<widget class="QCheckBox" name="cbxUseCollisionDetection" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Use best judgement when labels collide</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QSpinBox" name="spinAngle" >
<property name="suffix" >

0 comments on commit 01b1171

Please sign in to comment.
You can’t perform that action at this time.