Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 committed Apr 3, 2006
1 parent 5ac7396 commit 01b1171
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 48 deletions.
39 changes: 35 additions & 4 deletions src/core/qgsmarkercatalogue.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmarkercatalogue.h
Expand Up @@ -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*/
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/core/qgssymbol.cpp
Expand Up @@ -21,7 +21,6 @@

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

#include <QPainter>
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsgraduatedsymbolrenderer.cpp
Expand Up @@ -21,7 +21,6 @@
#include "qgsgraduatedsymbolrenderer.h"
#include "qgslegendsymbologyitem.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"
#include <QDomNode>
#include <QDomElement>
#include <QPixmap>
Expand Down
2 changes: 0 additions & 2 deletions src/gui/qgslabeldialog.cpp
Expand Up @@ -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)) );
}


Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmarkerdialog.cpp
Expand Up @@ -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!!!
Expand Down Expand Up @@ -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);

Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsoptions.cpp
Expand Up @@ -21,7 +21,6 @@
#include "qgis.h"
#include "qgisapp.h"
#include "qgslayerprojectionselector.h"
#include "qgssvgcache.h"
#include "qgsspatialrefsys.h"
#include <QFileDialog>
#include <QSettings>
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgssinglesymboldialog.cpp
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgssinglesymbolrenderer.cpp
Expand Up @@ -22,7 +22,6 @@
#include "qgsvectorlayer.h"
#include "qgslegenditem.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"

#include <QString>
#include <QDomNode>
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgsuniquevaluerenderer.cpp
Expand Up @@ -21,7 +21,6 @@
#include "qgsvectorlayer.h"
#include "qgssymbol.h"
#include "qgssymbologyutils.h"
#include "qgssvgcache.h"
#include <QDomNode>
#include <QPainter>
#include <QPixmap>
Expand Down
43 changes: 21 additions & 22 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions src/ui/qgslabeldialogbase.ui
Expand Up @@ -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" >
Expand Down

0 comments on commit 01b1171

Please sign in to comment.