Skip to content
Permalink
Browse files
Renamed QgsMarkerCatalogue::pixmapMarker() to imageMarker() as now it…
… returns QImage.

Added Python wrappers for QgsSymbologyUtils and QgsMarkerCatalogue.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6866 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Apr 2, 2007
1 parent 4000bb5 commit ea5e0598440f069c7c70ec97b559f2187bc052a6
@@ -28,6 +28,7 @@
%Include qgsmaplayerregistry.sip
%Include qgsmaprender.sip
%Include qgsmaptopixel.sip
%Include qgsmarkercatalogue.sip
%Include qgsmessageoutput.sip
%Include qgspoint.sip
%Include qgsproject.sip
@@ -45,6 +46,7 @@
%Include qgsspatialindex.sip
%Include qgsspatialrefsys.sip
%Include qgssymbol.sip
%Include qgssymbologyutils.sip
%Include qgsuniquevaluerenderer.sip
%Include qgsvectordataprovider.sip
%Include qgsvectorlayer.sip
@@ -0,0 +1,33 @@

/** Catalogue of point symbols */
class QgsMarkerCatalogue /NoDefaultCtors/
{
%TypeHeaderCode
#include <qgsmarkercatalogue.h>
%End

public:
//! Destructor
~QgsMarkerCatalogue();

//! Access to canonical QgsMarkerCatalogue instance
static QgsMarkerCatalogue *instance();

/**List of available markers*/
QStringList list();

/** Returns pixmap of the marker
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
*/
QImage imageMarker (QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );

/** Returns qpicture of the marker
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
*/
QPicture pictureMarker (QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );

/** Returns a pixmap given a filename of a svg marker
* NOTE: this method needs to be public static for QgsMarkerDialog::visualizeMarkers */
static void svgMarker (QPainter * thepPainter, QString name, int size );
};

@@ -0,0 +1,24 @@

/**Namespace containing static methods which are useful for the symbology widgets*/
namespace QgsSymbologyUtils
{
%TypeHeaderCode
#include <qgssymbologyutils.h>
%End

QPixmap qString2LinePixmap(QString string);
QPixmap char2LinePixmap(const char* c);
QPixmap qString2PatternPixmap(QString string);
QPixmap char2PatternPixmap(const char* c);
QString penStyle2QString(Qt::PenStyle penstyle);
const char* penStyle2Char(Qt::PenStyle penstyle);
QPixmap penStyle2Pixmap(Qt::PenStyle penstyle);
Qt::PenStyle qString2PenStyle(QString string);
Qt::PenStyle char2PenStyle(const char* c);
QString brushStyle2QString(Qt::BrushStyle brushstyle);
const char* brushStyle2Char(Qt::BrushStyle brushstyle);
QPixmap brushStyle2Pixmap(Qt::BrushStyle brushstyle);
Qt::BrushStyle qString2BrushStyle(QString string);
Qt::BrushStyle char2BrushStyle(const char* c);
};

@@ -64,7 +64,7 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog(QgsVectorLayer * layer): QDialog(),
for ( QStringList::iterator it = ml.begin(); it != ml.end(); ++it )
{
mMarkers.push_back ( *it );
QPixmap pic = QPixmap::fromImage(QgsMarkerCatalogue::instance()->pixmapMarker ( *it, size, pen, brush ));
QPixmap pic = QPixmap::fromImage(QgsMarkerCatalogue::instance()->imageMarker ( *it, size, pen, brush ));
mPointSymbolComboBox->insertItem ( pic );
if (layer->vectorType() != QGis::Point)
{
@@ -135,7 +135,7 @@ void QgsContinuousColorRenderer::renderFeature(QPainter * p, QgsFeature & f, QIm
}
brush.setStyle ( Qt::SolidPattern );

*img = QgsMarkerCatalogue::instance()->pixmapMarker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize(),
*img = QgsMarkerCatalogue::instance()->imageMarker ( mMinimumSymbol->pointSymbolName(), mMinimumSymbol->pointSize(),
pen, brush);

if ( scalefactor ) *scalefactor = 1;
@@ -87,7 +87,7 @@ QgsMarkerCatalogue *QgsMarkerCatalogue::instance()
return QgsMarkerCatalogue::mMarkerCatalogue;
}

QImage QgsMarkerCatalogue::pixmapMarker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
QImage QgsMarkerCatalogue::imageMarker ( QString fullName, int size, QPen pen, QBrush brush, bool qtBug )
{
//std::cerr << "QgsMarkerCatalogue::marker " << fullName.toLocal8Bit().data() << " sice:" << size << std::endl;

@@ -43,7 +43,7 @@ class CORE_EXPORT QgsMarkerCatalogue
/** Returns pixmap of the marker
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
*/
QImage pixmapMarker (QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );
QImage imageMarker (QString fullName, int size, QPen pen, QBrush brush, bool qtBug = true );

/** Returns qpicture of the marker
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
@@ -232,10 +232,10 @@ void QgsSymbol::cache( QColor selectionColor )
// composer. Not sure why...
// brush.setColor ( selectionColor );

mPointSymbolImage = QgsMarkerCatalogue::instance()->pixmapMarker ( mPointSymbolName, mPointSize,
mPointSymbolImage = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, mPointSize,
mPen, mBrush );

mPointSymbolImageSelected = QgsMarkerCatalogue::instance()->pixmapMarker (
mPointSymbolImageSelected = QgsMarkerCatalogue::instance()->imageMarker (
mPointSymbolName, mPointSize, pen, brush );

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


mPointSymbolImage2 = QgsMarkerCatalogue::instance()->pixmapMarker ( mPointSymbolName, mPointSize,
mPointSymbolImage2 = QgsMarkerCatalogue::instance()->imageMarker ( mPointSymbolName, mPointSize,
pen, mBrush, false );

QBrush brush = mBrush;
brush.setColor ( selectionColor );
pen.setColor ( selectionColor );

mPointSymbolImageSelected2 = QgsMarkerCatalogue::instance()->pixmapMarker (
mPointSymbolImageSelected2 = QgsMarkerCatalogue::instance()->imageMarker (
mPointSymbolName, mPointSize, pen, brush, false );

mSelectionColor2 = selectionColor;

0 comments on commit ea5e059

Please sign in to comment.