-
Notifications
You must be signed in to change notification settings - Fork 0
/
rasterbender.py
92 lines (69 loc) · 3.01 KB
/
rasterbender.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
"""
/***************************************************************************
RasterBender
A QGIS plugin
Deforms vector to adapt them despite heavy and irregular deformations
-------------------
begin : 2014-05-21
copyright : (C) 2014 by Olivier Dalang
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
# Import the PyQt and QGIS libraries
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *
# Basic dependencies
import os.path, shutil
import sys
import math
import numpy
# Other classes
from rasterbenderdialog import RasterBenderDialog
from rasterbenderhelp import RasterBenderHelp
class RasterBender:
def __init__(self, iface):
self.iface = iface
self.dlg = RasterBenderDialog(iface,self)
self._abort = False
self.ptsA = []
self.ptsB = []
self.transformer = None
self.aboutWindow = None
def initGui(self):
self.action = QAction( QIcon(os.path.join(os.path.dirname(__file__),'resources','icon.png')), "Raster Bender", self.iface.mainWindow())
self.action.triggered.connect(self.showUi)
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu(u"&Raster Bender", self.action)
self.helpAction = QAction( QIcon(os.path.join(os.path.dirname(__file__),'resources','about.png')), "Raster Bender Help", self.iface.mainWindow())
self.helpAction.triggered.connect(self.showHelp)
self.iface.addPluginToMenu(u"&Raster Bender", self.helpAction)
def showHelp(self):
if self.aboutWindow is None:
self.aboutWindow = RasterBenderHelp()
self.aboutWindow.show()
self.aboutWindow.raise_()
def unload(self):
if self.dlg is not None:
self.dlg.close()
self.dlg = None
if self.aboutWindow is not None:
self.aboutWindow.close()
self.aboutWindow = None
self.iface.removePluginMenu(u"&Raster Bender", self.action)
self.iface.removePluginMenu(u"&Raster Bender", self.helpAction)
self.iface.removeToolBarIcon(self.action)
def showUi(self):
self.dlg.show()
self.dlg.raise_()
self.dlg.refreshStates()