~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/georeferencer/plugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *  File Name:               plugin.cpp 
3
 
 * 
4
 
 *  The georeferencer plugin is a tool for adding projection info to rasters
5
 
 *
6
 
 *--------------------------------------------------------------------------
7
 
 *    begin                : Jan 21, 2004
8
 
 *    copyright            : (C) 2004 by Tim Sutton
9
 
 *    email                : tim@linfiniti.com
10
 
 *
11
 
 ***************************************************************************/
12
 
 
13
 
/***************************************************************************
14
 
 *                                                                         *
15
 
 *   This program is free software; you can redistribute it and/or modify  *
16
 
 *   it under the terms of the GNU General Public License as published by  *
17
 
 *   the Free Software Foundation; either version 2 of the License, or     *
18
 
 *   (at your option) any later version.                                   *
19
 
 *                                                                         *
20
 
 ***************************************************************************/
21
 
/*  $Id: plugin.cpp 6301 2006-12-22 07:43:47Z g_j_m $ */
22
 
 
23
 
/***************************************************************************
24
 
 *   QGIS Programming conventions:
25
 
 *   
26
 
 *   mVariableName - a class level member variable
27
 
 *   sVariableName - a static class level member variable
28
 
 *   variableName() - accessor for a class member (no 'get' in front of name)
29
 
 *   setVariableName() - mutator for a class member (prefix with 'set')
30
 
 *
31
 
 *   Additional useful conventions:
32
 
 *
33
 
 *   theVariableName - a method parameter (prefix with 'the')
34
 
 *   myVariableName - a locally declared variable within a method ('my' prefix)
35
 
 * 
36
 
 *   DO: Use mixed case variable names - myVariableName
37
 
 *   DON'T: separate variable names using underscores: my_variable_name (NO!)
38
 
 *
39
 
 * **************************************************************************/
40
 
 
41
 
//
42
 
// Required qgis includes
43
 
// 
44
 
 
45
 
#include <qgisapp.h>
46
 
#include <qgsmaplayer.h>
47
 
#include <qgsrasterlayer.h>
48
 
#include "plugin.h"
49
 
 
50
 
//
51
 
//the gui subclass
52
 
//
53
 
#include "plugingui.h"
54
 
 
55
 
 
56
 
#ifdef WIN32
57
 
#define QGISEXTERN extern "C" __declspec( dllexport )
58
 
#else
59
 
#define QGISEXTERN extern "C"
60
 
#endif
61
 
 
62
 
static const char * const sIdent = "$Id: plugin.cpp 6301 2006-12-22 07:43:47Z g_j_m $";
63
 
static const QString sName = QObject::tr("Georeferencer");
64
 
static const QString sDescription = QObject::tr("Adding projection info to rasters");
65
 
static const QString sPluginVersion = QObject::tr("Version 0.1");
66
 
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
67
 
 
68
 
//////////////////////////////////////////////////////////////////////
69
 
//
70
 
// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS
71
 
//
72
 
//////////////////////////////////////////////////////////////////////
73
 
 
74
 
/**
75
 
 * Constructor for the plugin. The plugin is passed a pointer to the main app
76
 
 * and an interface object that provides access to exposed functions in QGIS.
77
 
 * @param theQGisApp - Pointer to the QGIS main window
78
 
 * @param theQGisInterface - Pointer to the QGIS interface object
79
 
 */
80
 
QgsGeorefPlugin::QgsGeorefPlugin(QgisApp * theQGisApp, QgisIface * theQgisInterface):
81
 
                 QgisPlugin(sName,sDescription,sPluginVersion,sPluginType),
82
 
                 mQGisApp(theQGisApp), 
83
 
                 mQGisIface(theQgisInterface)
84
 
{
85
 
}
86
 
 
87
 
QgsGeorefPlugin::~QgsGeorefPlugin()
88
 
{
89
 
 
90
 
}
91
 
 
92
 
/*
93
 
 * Initialize the GUI interface for the plugin 
94
 
 */
95
 
void QgsGeorefPlugin::initGui()
96
 
{
97
 
  // Create the action for tool
98
 
  mQActionPointer = new QAction(QIcon(":/icon.png"), tr("&Georeferencer"), this);
99
 
 
100
 
  // Connect the action to the run
101
 
  connect(mQActionPointer, SIGNAL(activated()), this, SLOT(run()));
102
 
  
103
 
  // Add to the toolbar & menu
104
 
  mQGisIface->addToolBarIcon(mQActionPointer);
105
 
  mQGisIface->addPluginMenu(tr("&Georeferencer"), mQActionPointer);
106
 
 
107
 
}
108
 
//method defined in interface
109
 
void QgsGeorefPlugin::help()
110
 
{
111
 
  //implement me!
112
 
}
113
 
 
114
 
// Slot called when the buffer menu item is activated
115
 
void QgsGeorefPlugin::run()
116
 
{
117
 
  QgsGeorefPluginGui *myPluginGui=new QgsGeorefPluginGui(mQGisIface, mQGisApp);
118
 
  myPluginGui->show();
119
 
}
120
 
 
121
 
// Unload the plugin by cleaning up the GUI
122
 
void QgsGeorefPlugin::unload()
123
 
{
124
 
  // remove the GUI
125
 
  mQGisIface->removePluginMenu(tr("&Georeferencer"),mQActionPointer);
126
 
  mQGisIface->removeToolBarIcon(mQActionPointer);
127
 
  delete mQActionPointer;
128
 
}
129
 
 
130
 
//////////////////////////////////////////////////////////////////////
131
 
//
132
 
//                  END OF MANDATORY PLUGIN METHODS
133
 
//
134
 
//////////////////////////////////////////////////////////////////////
135
 
 
136
 
 
137
 
 
138
 
//////////////////////////////////////////////////////////////////////////
139
 
//
140
 
//
141
 
//  THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT
142
 
//    YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN
143
 
//      MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY
144
 
//
145
 
//
146
 
//////////////////////////////////////////////////////////////////////////
147
 
 
148
 
 
149
 
/** 
150
 
 * Required extern functions needed  for every plugin 
151
 
 * These functions can be called prior to creating an instance
152
 
 * of the plugin class
153
 
 */
154
 
// Class factory to return a new instance of the plugin class
155
 
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
156
 
{
157
 
  return new QgsGeorefPlugin(theQGisAppPointer, theQgisInterfacePointer);
158
 
}
159
 
// Return the name of the plugin - note that we do not user class members as
160
 
// the class may not yet be insantiated when this method is called.
161
 
QGISEXTERN QString name()
162
 
{
163
 
  return sName;
164
 
}
165
 
 
166
 
// Return the description
167
 
QGISEXTERN QString description()
168
 
{
169
 
  return sDescription;
170
 
}
171
 
 
172
 
// Return the type (either UI or MapLayer plugin)
173
 
QGISEXTERN int type()
174
 
{
175
 
  return sPluginType;
176
 
}
177
 
 
178
 
// Return the version number for the plugin
179
 
QGISEXTERN QString version()
180
 
{
181
 
  return sPluginVersion;
182
 
}
183
 
 
184
 
// Delete ourself
185
 
QGISEXTERN void unload(QgisPlugin * thePluginPointer)
186
 
{
187
 
  delete thePluginPointer;
188
 
}