24
24
QCoreApplication , Qt , QSizeF )
25
25
from PyQt4 .QtGui import QDockWidget , QIcon , QAction , QTextDocument , QColor
26
26
from gazetteersearchdialog import gazetteerSearchDialog
27
- from qgis .core import (QgsApplication , QgsMessageLog , QgsCoordinateReferenceSystem ,
27
+ from qgis .core import (QGis , QgsApplication , QgsMessageLog , QgsCoordinateReferenceSystem ,
28
28
QgsRectangle , QgsCoordinateTransform )
29
29
from qgis .gui import QgsVertexMarker , QgsAnnotationItem
30
30
@@ -57,9 +57,12 @@ def __init__(self, iface):
57
57
# initialize plugin directory
58
58
self .plugin_dir = QFileInfo (QgsApplication .qgisUserDbFilePath ()).path () + "/python/plugins/gazetteersearch"
59
59
# initialize locale
60
+
60
61
localePath = ""
61
- locale = QSettings ().value ("locale/userLocale" ).toString ()[0 :2 ]
62
-
62
+ if QGis .QGIS_VERSION_INT < 10900 :
63
+ locale = QSettings ().value ("locale/userLocale" ).toString ()[0 :2 ]
64
+ else :
65
+ locale = QSettings ().value ("locale/userLocale" )[0 :2 ]
63
66
if QFileInfo (self .plugin_dir ).exists ():
64
67
localePath = self .plugin_dir + "/i18n/gazetteersearch_" + locale + ".qm"
65
68
@@ -69,7 +72,7 @@ def __init__(self, iface):
69
72
70
73
if qVersion () > '4.3.3' :
71
74
QCoreApplication .installTranslator (self .translator )
72
-
75
+
73
76
def initGui (self ):
74
77
# Create action that will start plugin configuration
75
78
self .action = QAction (QIcon (":/plugins/gazetteersearch/icon.png" ), \
@@ -136,8 +139,11 @@ def zoomTo(self, name):
136
139
for res in self .results :
137
140
if unicode (res .description ) == unicode (name ):
138
141
dest_crs = self .canvas .mapRenderer ().destinationCrs ()
139
- src_crs = QgsCoordinateReferenceSystem ()
140
- src_crs .createFromEpsg (res .epsg )
142
+ if QGis .QGIS_VERSION_INT < 10900 :
143
+ src_crs = QgsCoordinateReferenceSystem ()
144
+ src_crs .createFromEpsg (res .epsg )
145
+ else :
146
+ src_crs = QgsCoordinateReferenceSystem (res .epsg , QgsCoordinateReferenceSystem .EpsgCrsId )
141
147
transform = QgsCoordinateTransform (src_crs , dest_crs )
142
148
new_point = transform .transform (res .x , res .y )
143
149
x = new_point .x ()
0 commit comments