hi,<br><br>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.<br>
here is the code.<br><br><br><br><br>#include "qgspointconverterplugin.h"<br><br><br>#ifdef WIN32<br>#define QGISEXTERN extern "C" __declspec( dllexport )<br>#else<br>#define QGISEXTERN extern "C"<br>
#endif<br>QgsPointConverterPlugin::<div id=":6f" class="ArwC7c ckChnd">QgsPointConverterPlugin(QgisInterface* iface): mIface(iface), qGisInterface( iface)<br>
{<br>}<br>QgsPointConverterPlugin::~QgsPointConverterPlugin()<br>{<br>}<br>void QgsPointConverterPlugin::initGui()<br>{<br> // myQActionPointer = new QAction( QIcon( ":/scale_bar.png" ), tr( "&Scale Bar" ), this );<br>
mAction = new QAction(tr("&Convert to point"), this);<br> connect(mAction, SIGNAL(activated()), this, SLOT( run() ) );<br> connect( qGisInterface->getMapCanvas(), SIGNAL( renderComplete( QPainter * ) ), this, SLOT( render(QPainter * )) ); <br>
<br> mIface->addToolBarIcon(mAction);<br> mIface->addPluginMenu(tr("&Convert to point"), mAction);<br>}<br>void QgsPointConverterPlugin::unload()<br>{<br> mIface->removeToolBarIcon(mAction);<br>
mIface->removePluginMenu(tr("&Convert to point"), mAction);<br> delete mAction;<br>}<br>//void QgsPointConverterPlugin::refreshCanvas()<br>//{<br>// qGisInterface->mapCanvas()->refresh();<br>//}<br>
<br>void QgsPointConverterPlugin::run()<br>{<br> /*QgsScaleBarPluginGui *myPluginGui = new QgsScaleBarPluginGui( qGisInterface->mainWindow(), QgisGui::ModalDialogFlags );<br> myPluginGui->setAttribute( Qt::WA_DeleteOnClose );<br>
myPluginGui->setPreferredSize( mPreferredSize );<br> myPluginGui->setSnapping( mSnapping );<br> myPluginGui->setPlacementLabels( mPlacementLabels );<br> myPluginGui->setPlacement( mPlacementIndex );<br> myPluginGui->setEnabled( mEnabled );<br>
myPluginGui->setStyleLabels( mStyleLabels );<br> myPluginGui->setStyle( mStyleIndex );<br> myPluginGui->setColour( mColour );*/<br><br> /*connect( myPluginGui, SIGNAL( changePreferredSize( int ) ), this, SLOT( setPreferredSize( int ) ) );<br>
connect( myPluginGui, SIGNAL( changeSnapping( bool ) ), this, SLOT( setSnapping( bool ) ) );<br> connect( myPluginGui, SIGNAL( changePlacement( int ) ), this, SLOT( setPlacement( int ) ) );<br> connect( myPluginGui, SIGNAL( changeEnabled( bool ) ), this, SLOT( setEnabled( bool ) ) );<br>
connect( myPluginGui, SIGNAL( changeStyle( int ) ), this, SLOT( setStyle( int ) ) );<br> connect( myPluginGui, SIGNAL( changeColour( QColor ) ), this, SLOT( setColour( QColor ) ) );<br> connect( myPluginGui, SIGNAL( refreshCanvas() ), this, SLOT( refreshCanvas() ) );<br>
myPluginGui->show();*/<br>}<br>void QgsPointConverterPlugin::render(QPainter *painter)//<br>{<br><br> painter->setRenderHint(QPainter::Antialiasing, true);<br> painter->setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));<br>
painter->setBrush(QBrush(Qt::green, Qt::SolidPattern));<br> painter->drawEllipse(10, 10, 100, 140);<br><br><br>}<br><br>QGISEXTERN QgisPlugin* classFactory(QgisInterface* iface)<br>{<br> return new QgsPointConverterPlugin(iface);<br>
}<br><br>QGISEXTERN QString name()<br>{<br> return "point converter plugin";<br>}<br>QGISEXTERN QString description()<br>{<br> return "A plugin that converts vector layers to delimited text point files";<br>
}<br>QGISEXTERN QString version()<br>{<br> return "0.00001";<br>}<br><br><br>// Return the type (either UI or MapLayer plugin)<br>QGISEXTERN int type()<br>{<br> return QgisPlugin::UI;<br>}<br>// Delete ourself<br>
QGISEXTERN void unload(QgisPlugin* theQgsPointConverterPluginPointer)<br>{<br> <br> //disconnect( qGisInterface->mapCanvas(), SIGNAL( renderComplete( QPainter * ) ),<br> //this, SLOT( renderScaleBar( QPainter * ) ) );<br>
// refreshCanvas();<br><br> //delete myQActionPointer;<br> delete theQgsPointConverterPluginPointer;<br>}</div><br>