1
#include <q3popupmenu.h>
2
#include <qmessagebox.h>
3
#include "../qgisplugin.h"
4
#include "maplayertest.h"
5
// xpm for creating the toolbar icon
7
MapLayerTest::MapLayerTest(){
9
void MapLayerTest::setQgisMainWindow(Q3MainWindow *app){
12
// set the coordinate transform for drawing the layer
13
void MapLayerTest::setCoordinateTransform(QgsMapToPixel *xform){
14
coordTransform = xform;
16
void MapLayerTest::initGui(){
18
Q3PopupMenu *mapLayerPluginMenu = new Q3PopupMenu( qgisApp );
20
mapLayerPluginMenu->insertItem("&Add Foobar Layer", this, SLOT(open()));
21
mapLayerPluginMenu->insertItem( "&Unload Foobar Plugin", this, SLOT(unload()));
23
menu = ((Q3MainWindow *)qgisApp)->menuBar();
25
menuId = menu->insertItem( "&PluginMenu", mapLayerPluginMenu );
26
//QAction *zoomPreviousAction = new QAction( "Zoom Previous",QIconSet(icon_matrix), "&Zoom Previous", CTRL+Key_S, qgisMainWindow, "zoomFull" );
28
// connect( zoomPreviousAction, SIGNAL( activated() ) , this, SLOT( zoomPrevious() ) );
31
void MapLayerTest::unload(){
33
menu->removeItem(menuId);
34
// cleanup anything else that needs to be nuked
36
void MapLayerTest::open(){
37
// try and open a layer dialog
38
QMessageBox::information(qgisApp,"Plugin Message","You clicked the Add Foobar Layer menu item");
40
void MapLayerTest::draw(){
42
extern "C" QgsMapLayerInterface * classFactory(){
43
return new MapLayerTest();
45
extern "C" QString name(){
46
return QString("Map Layer test plugin");
48
extern "C" QString description(){
49
return QString("Map Layer test plugin using QgsMapLayerInterface interface");
51
// Return the type (either UI or MapLayer plugin)
54
return QgisPlugin::MAPLAYER;