maplayer plugin test

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@239 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2003-08-15 02:41:56 +00:00
parent 75601810e7
commit 0d0c1adfeb
4 changed files with 198 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# File generated by kdevelop's qmake manager.
# -------------------------------------------
# Subdir relative project main directory: ./plugins
# Target is a library:
TEMPLATE = lib
CONFIG += debug \
warn_on \
qt \
thread
SOURCES += maplayertest.cpp
HEADERS += maplayertest.h \
../../src/qgsmaplayerinterface.h

View File

@ -0,0 +1,53 @@
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include "maplayertest.h"
// xpm for creating the toolbar icon
#include "matrix1.xpm"
MapLayerTest::MapLayerTest(){
}
void MapLayerTest::setQgisMainWindow(QMainWindow *app){
qgisApp = app;
}
// set the coordinate transform for drawing the layer
void MapLayerTest::setCoordinateTransform(QgsCoordinateTransform *xform){
coordTransform = xform;
}
int MapLayerTest::getInt(){
return 999;
}
void MapLayerTest::initGui(){
// setup the menu
QPopupMenu *mapLayerPluginMenu = new QPopupMenu( qgisApp );
mapLayerPluginMenu->insertItem("&Add Foobar Layer", this, SLOT(open()));
mapLayerPluginMenu->insertItem( "&Unload Foobar Plugin", this, SLOT(unload()));
// create the menubar
menu = ((QMainWindow *)qgisApp)->menuBar();
menuId = menu->insertItem( "&PluginMenu", mapLayerPluginMenu );
//QAction *zoomPreviousAction = new QAction( "Zoom Previous",QIconSet(icon_matrix), "&Zoom Previous", CTRL+Key_S, qgisMainWindow, "zoomFull" );
// connect( zoomPreviousAction, SIGNAL( activated() ) , this, SLOT( zoomPrevious() ) );
}
void MapLayerTest::unload(){
// remove the GUI
menu->removeItem(menuId);
// cleanup anything else that needs to be nuked
}
void MapLayerTest::open(){
// try and open a layer dialog
QMessageBox::information(qgisApp,"Plugin Message","You clicked the Add Foobar Layer menu item");
}
void MapLayerTest::draw(){
}
extern "C" QgsMapLayerInterface * classFactory(){
return new MapLayerTest();
}
extern "C" QString name(){
return QString("Map Layer test plugin");
}
extern "C" QString description(){
return QString("Map Layer test plugin using QgsMapLayerInterface interface");
}

View File

@ -0,0 +1,27 @@
#ifndef QGSMAPLAYERTESTPLUGIN_H
#define QGSMAPLAYERTESTPLUGIN_H
#include <qmainwindow.h>
#include <qmenubar.h>
#include "../../src/qgsmaplayerinterface.h"
#include "../../src/qgscoordinatetransform.h"
class MapLayerTest : public QgsMapLayerInterface{
Q_OBJECT
public:
MapLayerTest();
void setQgisMainWindow(QMainWindow *app);
void setCoordinateTransform(QgsCoordinateTransform *xform);
int getInt();
void initGui();
public slots:
void open();
void unload();
void draw();
private:
QMainWindow *qgisApp;
QMenuBar *menu;
int menuId;
QgsCoordinateTransform *coordTransform;
};
#endif //QGSMAPLAYERTESTPLUGIN_H

View File

@ -0,0 +1,105 @@
/* XPM */
static const char *icon_matrix[] = {
/* width height ncolors chars_per_pixel */
"22 22 76 1",
/* colors */
" c #000000",
". c #00FF00",
"X c #00FD00",
"o c #00FB00",
"O c #00F500",
"+ c #00E300",
"@ c #00DF00",
"# c #00DD00",
"$ c #00DB00",
"% c #00D700",
"& c #00CF00",
"* c #00C700",
"= c #00BB00",
"- c #00B500",
"; c #00B300",
": c #00B100",
"> c #00A300",
", c #00A100",
"< c #009D00",
"1 c #009700",
"2 c #009300",
"3 c #008B00",
"4 c #008300",
"5 c #007300",
"6 c #005500",
"7 c #005300",
"8 c #004B00",
"9 c #002D00",
"0 c #002B00",
"q c #001900",
"w c #00FE00",
"e c #00F800",
"r c #00F600",
"t c #00F400",
"y c #00EC00",
"u c #00EA00",
"i c #00E800",
"p c #00E200",
"a c #00E000",
"s c #00DC00",
"d c #00D800",
"f c #00D400",
"g c #00D000",
"h c #00CC00",
"j c #00CA00",
"k c #00C600",
"l c #00C000",
"z c #00BA00",
"x c #00B600",
"c c #00B200",
"v c #00AC00",
"b c #00AA00",
"n c #00A400",
"m c #00A000",
"M c #009800",
"N c #009400",
"B c #008C00",
"V c #008800",
"C c #008400",
"Z c #008200",
"A c #008000",
"S c #007200",
"D c #007000",
"F c #006A00",
"G c #006600",
"H c #006400",
"J c #006000",
"K c #004600",
"L c #004400",
"P c #004000",
"I c #003400",
"U c #003200",
"Y c #003000",
"T c #001E00",
"R c #000600",
"E c None",
/* pixels */
" 77 PP JL ",
"dd 0R pp PP GK GB jV ",
"9= t5 ff . G. ez PP ",
"cc OS A AT ",
" 0R eF mP ;; Gq kk ",
"qG rL PP 11 aK 77 ",
"Zo 6y PP 77 BB ",
"<r R0 r4 mm 0R 77 ",
"qq i% ,0 ",
" ;q FA .hUTA PP ",
"2: XZ qq Pb P* s5 ",
"8w ;I aa Uh AA gL ",
"T. aa 0, >Y Y> ",
"qC DD YY LJ o4 Lv R0 ",
" @@ l+ PP AT GG Bc ",
"nh 77 R0 PP zM ",
"9i TP qq PP PP PP ",
"77 yY A* GG NN ",
" -Y GG PP DD .M HH ",
"qq qG qq mm vM zz ",
"$u Ka qq qq && qq 77 ",
"3# >> GG xx GG BB "
};