[Qgis-community-team] hi
Sahana BS
sahana at analytica-india.com
Fri Feb 13 04:45:56 EST 2009
hi,
i have used mapcanvas() to render ellipse on qgis application, i have
installed qgis_1.0.0 in windows and created one plugin from that plugin i
have to render a ellipse on screen this my code it works on linux but not
in windows please can anybody help me.
here is the code.
#include "qgspointconverterplugin.h"
#ifdef WIN32
#define QGISEXTERN extern "C" __declspec( dllexport )
#else
#define QGISEXTERN extern "C"
#endif
QgsPointConverterPlugin::QgsPointConverterPlugin(QgisInterface* iface):
mIface(iface), qGisInterface( iface)
{
}
QgsPointConverterPlugin::~QgsPointConverterPlugin()
{
}
void QgsPointConverterPlugin::initGui()
{
// myQActionPointer = new QAction( QIcon( ":/scale_bar.png" ), tr( "&Scale
Bar" ), this );
mAction = new QAction(tr("&Convert to point"), this);
connect(mAction, SIGNAL(activated()), this, SLOT( run() ) );
connect( qGisInterface->getMapCanvas(), SIGNAL( renderComplete( QPainter *
) ), this, SLOT( render(QPainter * )) );
mIface->addToolBarIcon(mAction);
mIface->addPluginMenu(tr("&Convert to point"), mAction);
}
void QgsPointConverterPlugin::unload()
{
mIface->removeToolBarIcon(mAction);
mIface->removePluginMenu(tr("&Convert to point"), mAction);
delete mAction;
}
//void QgsPointConverterPlugin::refreshCanvas()
//{
// qGisInterface->mapCanvas()->refresh();
//}
void QgsPointConverterPlugin::run()
{
/*QgsScaleBarPluginGui *myPluginGui = new QgsScaleBarPluginGui(
qGisInterface->mainWindow(), QgisGui::ModalDialogFlags );
myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
myPluginGui->setPreferredSize( mPreferredSize );
myPluginGui->setSnapping( mSnapping );
myPluginGui->setPlacementLabels( mPlacementLabels );
myPluginGui->setPlacement( mPlacementIndex );
myPluginGui->setEnabled( mEnabled );
myPluginGui->setStyleLabels( mStyleLabels );
myPluginGui->setStyle( mStyleIndex );
myPluginGui->setColour( mColour );*/
/*connect( myPluginGui, SIGNAL( changePreferredSize( int ) ), this, SLOT(
setPreferredSize( int ) ) );
connect( myPluginGui, SIGNAL( changeSnapping( bool ) ), this, SLOT(
setSnapping( bool ) ) );
connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT(
setPlacement( int ) ) );
connect( myPluginGui, SIGNAL( changeEnabled( bool ) ), this, SLOT(
setEnabled( bool ) ) );
connect( myPluginGui, SIGNAL( changeStyle( int ) ), this, SLOT( setStyle(
int ) ) );
connect( myPluginGui, SIGNAL( changeColour( QColor ) ), this, SLOT(
setColour( QColor ) ) );
connect( myPluginGui, SIGNAL( refreshCanvas() ), this, SLOT(
refreshCanvas() ) );
myPluginGui->show();*/
}
void QgsPointConverterPlugin::render(QPainter *painter)//
{
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));
painter->setBrush(QBrush(Qt::green, Qt::SolidPattern));
painter->drawEllipse(10, 10, 100, 140);
}
QGISEXTERN QgisPlugin* classFactory(QgisInterface* iface)
{
return new QgsPointConverterPlugin(iface);
}
QGISEXTERN QString name()
{
return "point converter plugin";
}
QGISEXTERN QString description()
{
return "A plugin that converts vector layers to delimited text point
files";
}
QGISEXTERN QString version()
{
return "0.00001";
}
// Return the type (either UI or MapLayer plugin)
QGISEXTERN int type()
{
return QgisPlugin::UI;
}
// Delete ourself
QGISEXTERN void unload(QgisPlugin* theQgsPointConverterPluginPointer)
{
//disconnect( qGisInterface->mapCanvas(), SIGNAL( renderComplete( QPainter
* ) ),
//this, SLOT( renderScaleBar( QPainter * ) ) );
// refreshCanvas();
//delete myQActionPointer;
delete theQgsPointConverterPluginPointer;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-community-team/attachments/20090213/ecddd9dc/attachment-0001.html
More information about the Qgis-community-team
mailing list