[Qgis-community-team] HI
Sahana BS
sahana at analytica-india.com
Fri Feb 13 00:17:15 EST 2009
Hi.
i am using qgis_0.11.0, in windows i have installed. i have created a
plugin but the problem is i need to draw something on the screen by using
this plugin but i am not getting here is my code.can anybody please help
me............... i am new to this.............
#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/27f021c6/attachment.html
More information about the Qgis-community-team
mailing list