@@ -104,109 +104,137 @@ def initGui( self ):
104
104
self .menu = rasterMenu
105
105
self .menu .addSeparator ()
106
106
107
- if self .GdalVersion >= "1.6" :
108
- self .buildVRT = QAction ( QIcon (":/icons/vrt.png" ), QCoreApplication .translate ( "GdalTools" , "Build Virtual Raster (Catalog)" ), self .iface .mainWindow () )
109
- self .buildVRT .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Builds a VRT from a list of datasets" ) )
110
- QObject .connect ( self .buildVRT , SIGNAL ( "triggered()" ), self .doBuildVRT )
111
- self .menu .addAction (self .buildVRT )
107
+ # projections menu (Warp (Reproject), Assign projection)
108
+ self .projectionsMenu = QMenu ( QCoreApplication .translate ( "GdalTools" , "Projections" ) )
112
109
113
- if self .GdalVersion >= "1.6" :
114
- self .contour = QAction ( QIcon (":/icons/contour.png" ), QCoreApplication .translate ( "GdalTools" , "Contour" ), self .iface .mainWindow () )
115
- self .contour .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Builds vector contour lines from a DEM" ) )
116
- QObject .connect ( self .contour , SIGNAL ( "triggered()" ), self .doContour )
117
- self .menu .addAction (self .contour )
110
+ self .warp = QAction ( QIcon (":/icons/warp.png" ), QCoreApplication .translate ( "GdalTools" , "Warp (Reproject)" ), self .iface .mainWindow () )
111
+ self .warp .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Warp an image into a new coordinate system" ) )
112
+ QObject .connect ( self .warp , SIGNAL ( "triggered()" ), self .doWarp )
113
+
114
+ self .projection = QAction ( QIcon ( ":icons/projection-add.png" ), QCoreApplication .translate ( "GdalTools" , "Assign projection" ), self .iface .mainWindow () )
115
+ self .projection .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Add projection info to the raster" ) )
116
+ QObject .connect ( self .projection , SIGNAL ( "triggered()" ), self .doProjection )
117
+
118
+ self .extractProj = QAction ( QIcon ( ":icons/projection-export.png" ), QCoreApplication .translate ( "GdalTools" , "Extract projection" ), self .iface .mainWindow () )
119
+ self .extractProj .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Extract projection information from raster(s)" ) )
120
+ QObject .connect ( self .extractProj , SIGNAL ( "triggered()" ), self .doExtractProj )
121
+
122
+ self .projectionsMenu .addActions ( [ self .warp , self .projection , self .extractProj ] )
123
+
124
+ # conversion menu (Rasterize (Vector to raster), Polygonize (Raster to vector), Translate, RGB to PCT, PCT to RGB)
125
+ self .conversionMenu = QMenu ( QCoreApplication .translate ( "GdalTools" , "Conversion" ) )
118
126
119
127
if self .GdalVersion >= "1.3" :
120
128
self .rasterize = QAction ( QIcon (":/icons/rasterize.png" ), QCoreApplication .translate ( "GdalTools" , "Rasterize (Vector to raster)" ), self .iface .mainWindow () )
121
129
self .rasterize .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Burns vector geometries into a raster" ) )
122
130
QObject .connect ( self .rasterize , SIGNAL ( "triggered()" ), self .doRasterize )
123
- self .menu .addAction (self .rasterize )
131
+ self .conversionMenu .addAction ( self .rasterize )
124
132
125
133
if self .GdalVersion >= "1.6" :
126
134
self .polygonize = QAction ( QIcon (":/icons/polygonize.png" ), QCoreApplication .translate ( "GdalTools" , "Polygonize (Raster to vector)" ), self .iface .mainWindow () )
127
135
self .polygonize .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Produces a polygon feature layer from a raster" ) )
128
136
QObject .connect ( self .polygonize , SIGNAL ( "triggered()" ), self .doPolygonize )
129
- self .menu .addAction (self .polygonize )
137
+ self .conversionMenu .addAction ( self .polygonize )
130
138
131
- self .merge = QAction ( QIcon (":/icons/merge.png" ), QCoreApplication .translate ( "GdalTools" , "Merge" ), self .iface .mainWindow () )
132
- self .merge .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Build a quick mosaic from a set of images" ) )
133
- QObject .connect ( self .merge , SIGNAL ( "triggered()" ), self .doMerge )
134
- self .menu .addAction (self .merge )
139
+ self .translate = QAction ( QIcon (":/icons/translate.png" ), QCoreApplication .translate ( "GdalTools" , "Translate (Convert format)" ), self .iface .mainWindow () )
140
+ self .translate .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Converts raster data between different formats" ) )
141
+ QObject .connect ( self .translate , SIGNAL ( "triggered()" ), self .doTranslate )
142
+
143
+ self .paletted = QAction ( QIcon ( ":icons/raster-paletted.png" ), QCoreApplication .translate ( "GdalTools" , "RGB to PCT" ), self .iface .mainWindow () )
144
+ self .paletted .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Convert a 24bit RGB image to 8bit paletted" ) )
145
+ QObject .connect ( self .paletted , SIGNAL ( "triggered()" ), self .doPaletted )
146
+
147
+ self .rgb = QAction ( QIcon ( ":icons/raster-paletted.png" ), QCoreApplication .translate ( "GdalTools" , "PCT to RGB" ), self .iface .mainWindow () )
148
+ self .rgb .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Convert an 8bit paletted image to 24bit RGB" ) )
149
+ QObject .connect ( self .rgb , SIGNAL ( "triggered()" ), self .doRGB )
150
+
151
+ self .conversionMenu .addActions ( [ self .translate , self .paletted , self .rgb ] )
152
+
153
+ # extraction menu (Clipper, Contour)
154
+ self .extractionMenu = QMenu ( QCoreApplication .translate ( "GdalTools" , "Extraction" ) )
155
+
156
+ if self .GdalVersion >= "1.6" :
157
+ self .contour = QAction ( QIcon (":/icons/contour.png" ), QCoreApplication .translate ( "GdalTools" , "Contour" ), self .iface .mainWindow () )
158
+ self .contour .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Builds vector contour lines from a DEM" ) )
159
+ QObject .connect ( self .contour , SIGNAL ( "triggered()" ), self .doContour )
160
+ self .extractionMenu .addAction ( self .contour )
161
+
162
+ self .clipper = QAction ( QIcon ( ":icons/raster-clip.png" ), QCoreApplication .translate ( "GdalTools" , "Clipper" ), self .iface .mainWindow () )
163
+ #self.clipper.setStatusTip( QCoreApplication.translate( "GdalTools", "Converts raster data between different formats") )
164
+ QObject .connect ( self .clipper , SIGNAL ( "triggered()" ), self .doClipper )
165
+
166
+ self .extractionMenu .addActions ( [ self .clipper ] )
167
+
168
+ # analysis menu (DEM (Terrain model), Grid (Interpolation), Near black, Proximity (Raster distance), Sieve)
169
+ self .analysisMenu = QMenu ( QCoreApplication .translate ( "GdalTools" , "Analysis" ) )
135
170
136
171
if self .GdalVersion >= "1.6" :
137
172
self .sieve = QAction ( QIcon (":/icons/sieve.png" ), QCoreApplication .translate ( "GdalTools" , "Sieve" ), self .iface .mainWindow () )
138
173
self .sieve .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Removes small raster polygons" ) )
139
174
QObject .connect ( self .sieve , SIGNAL ( "triggered()" ), self .doSieve )
140
- self .menu .addAction (self .sieve )
141
-
142
- if self .GdalVersion >= "1.6" :
143
- self .proximity = QAction ( QIcon (":/icons/proximity.png" ), QCoreApplication .translate ( "GdalTools" , "Proximity (Raster distance)" ), self .iface .mainWindow () )
144
- self .proximity .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Produces a raster proximity map" ) )
145
- QObject .connect ( self .proximity , SIGNAL ( "triggered()" ), self .doProximity )
146
- self .menu .addAction (self .proximity )
175
+ self .analysisMenu .addAction ( self .sieve )
147
176
148
177
if self .GdalVersion >= "1.5" :
149
178
self .nearBlack = QAction ( QIcon (":/icons/nearblack.png" ), QCoreApplication .translate ( "GdalTools" , "Near black" ), self .iface .mainWindow () )
150
179
self .nearBlack .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Convert nearly black/white borders to exact value" ) )
151
180
QObject .connect ( self .nearBlack , SIGNAL ( "triggered()" ), self .doNearBlack )
152
- self .menu .addAction (self .nearBlack )
181
+ self .analysisMenu .addAction ( self .nearBlack )
153
182
154
- self .warp = QAction ( QIcon (":/icons/warp.png" ), QCoreApplication .translate ( "GdalTools" , "Warp (Reproject)" ), self .iface .mainWindow () )
155
- self .warp .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Warp an image into a new coordinate system" ) )
156
- QObject .connect ( self .warp , SIGNAL ( "triggered()" ), self .doWarp )
157
- self .menu .addAction (self .warp )
183
+ if self .GdalVersion >= "1.6" :
184
+ self .proximity = QAction ( QIcon (":/icons/proximity.png" ), QCoreApplication .translate ( "GdalTools" , "Proximity (Raster distance)" ), self .iface .mainWindow () )
185
+ self .proximity .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Produces a raster proximity map" ) )
186
+ QObject .connect ( self .proximity , SIGNAL ( "triggered()" ), self .doProximity )
187
+ self .analysisMenu .addAction ( self .proximity )
158
188
159
189
if self .GdalVersion >= "1.5" :
160
190
self .grid = QAction ( QIcon (":/icons/grid.png" ), QCoreApplication .translate ( "GdalTools" , "Grid (Interpolation)" ), self .iface .mainWindow () )
161
191
self .grid .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Create raster from the scattered data" ) )
162
192
QObject .connect ( self .grid , SIGNAL ( "triggered()" ), self .doGrid )
163
- self .menu .addAction (self .grid )
193
+ self .analysisMenu .addAction ( self .grid )
164
194
165
- self .translate = QAction ( QIcon (":/icons/translate.png" ), QCoreApplication .translate ( "GdalTools" , "Translate (Convert format)" ), self .iface .mainWindow () )
166
- self .translate .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Converts raster data between different formats" ) )
167
- QObject .connect ( self .translate , SIGNAL ( "triggered()" ), self .doTranslate )
168
- self .menu .addAction (self .translate )
195
+ if self .GdalVersion >= "1.7" :
196
+ self .dem = QAction ( QIcon ( ":icons/dem.png" ), QCoreApplication .translate ( "GdalTools" , "DEM (Terrain models)" ), self .iface .mainWindow () )
197
+ self .dem .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Tool to analyze and visualize DEMs" ) )
198
+ QObject .connect ( self .dem , SIGNAL ( "triggered()" ), self .doDEM )
199
+ self .analysisMenu .addAction ( self .dem )
200
+
201
+ #self.analysisMenu.addActions( [ ] )
202
+
203
+ # miscellaneous menu (Build overviews (Pyramids), Tile index, Information, Merge, Build Virtual Raster (Catalog))
204
+ self .miscellaneousMenu = QMenu ( QCoreApplication .translate ( "GdalTools" , "Miscellaneous" ) )
205
+
206
+ if self .GdalVersion >= "1.6" :
207
+ self .buildVRT = QAction ( QIcon (":/icons/vrt.png" ), QCoreApplication .translate ( "GdalTools" , "Build Virtual Raster (Catalog)" ), self .iface .mainWindow () )
208
+ self .buildVRT .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Builds a VRT from a list of datasets" ) )
209
+ QObject .connect ( self .buildVRT , SIGNAL ( "triggered()" ), self .doBuildVRT )
210
+ self .miscellaneousMenu .addAction ( self .buildVRT )
211
+
212
+ self .merge = QAction ( QIcon (":/icons/merge.png" ), QCoreApplication .translate ( "GdalTools" , "Merge" ), self .iface .mainWindow () )
213
+ self .merge .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Build a quick mosaic from a set of images" ) )
214
+ QObject .connect ( self .merge , SIGNAL ( "triggered()" ), self .doMerge )
169
215
170
216
self .info = QAction ( QIcon ( ":/icons/raster-info.png" ), QCoreApplication .translate ( "GdalTools" , "Information" ), self .iface .mainWindow () )
171
217
self .info .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Lists information about raster dataset" ) )
172
218
QObject .connect ( self .info , SIGNAL ("triggered()" ), self .doInfo )
173
- self .menu .addAction ( self .info )
174
-
175
- self .projection = QAction ( QIcon ( ":icons/projection-add.png" ), QCoreApplication .translate ( "GdalTools" , "Assign projection" ), self .iface .mainWindow () )
176
- self .projection .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Add projection info to the raster" ) )
177
- QObject .connect ( self .projection , SIGNAL ( "triggered()" ), self .doProjection )
178
- self .menu .addAction ( self .projection )
179
219
180
220
self .overview = QAction ( QIcon ( ":icons/raster-overview.png" ), QCoreApplication .translate ( "GdalTools" , "Build overviews (Pyramids)" ), self .iface .mainWindow () )
181
221
self .overview .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Builds or rebuilds overview images" ) )
182
222
QObject .connect ( self .overview , SIGNAL ( "triggered()" ), self .doOverview )
183
- self .menu .addAction ( self .overview )
184
-
185
- self .clipper = QAction ( QIcon ( ":icons/raster-clip.png" ), QCoreApplication .translate ( "GdalTools" , "Clipper" ), self .iface .mainWindow () )
186
- #self.clipper.setStatusTip( QCoreApplication.translate( "GdalTools", "Converts raster data between different formats") )
187
- QObject .connect ( self .clipper , SIGNAL ( "triggered()" ), self .doClipper )
188
- self .menu .addAction (self .clipper )
189
-
190
- self .paletted = QAction ( QIcon ( ":icons/raster-paletted.png" ), QCoreApplication .translate ( "GdalTools" , "RGB to PCT" ), self .iface .mainWindow () )
191
- self .paletted .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Convert a 24bit RGB image to 8bit paletted" ) )
192
- QObject .connect ( self .paletted , SIGNAL ( "triggered()" ), self .doPaletted )
193
- self .menu .addAction (self .paletted )
194
-
195
- self .rgb = QAction ( QIcon ( ":icons/raster-paletted.png" ), QCoreApplication .translate ( "GdalTools" , "PCT to RGB" ), self .iface .mainWindow () )
196
- self .rgb .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Convert an 8bit paletted image to 24bit RGB" ) )
197
- QObject .connect ( self .rgb , SIGNAL ( "triggered()" ), self .doRGB )
198
- self .menu .addAction (self .rgb )
199
223
200
224
self .tileindex = QAction ( QIcon ( ":icons/tileindex.png" ), QCoreApplication .translate ( "GdalTools" , "Tile index" ), self .iface .mainWindow () )
201
225
self .tileindex .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Build a shapefile as a raster tileindex" ) )
202
226
QObject .connect ( self .tileindex , SIGNAL ( "triggered()" ), self .doTileIndex )
203
- self .menu .addAction (self .tileindex )
204
227
205
- if self .GdalVersion >= "1.7" :
206
- self .dem = QAction ( QIcon ( ":icons/dem.png" ), QCoreApplication .translate ( "GdalTools" , "DEM (Terrain models)" ), self .iface .mainWindow () )
207
- self .dem .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Tool to analyze and visualize DEMs" ) )
208
- QObject .connect ( self .dem , SIGNAL ( "triggered()" ), self .doDEM )
209
- self .menu .addAction (self .dem )
228
+ self .miscellaneousMenu .addActions ( [ self .merge , self .info , self .overview , self .tileindex ] )
229
+
230
+ self .menu .addMenu ( self .projectionsMenu )
231
+ self .menu .addMenu ( self .conversionMenu )
232
+ self .menu .addMenu ( self .extractionMenu )
233
+
234
+ if not self .analysisMenu .isEmpty ():
235
+ self .menu .addMenu ( self .analysisMenu )
236
+
237
+ self .menu .addMenu ( self .miscellaneousMenu )
210
238
211
239
self .settings = QAction ( QCoreApplication .translate ( "GdalTools" , "GdalTools settings" ), self .iface .mainWindow () )
212
240
self .settings .setStatusTip ( QCoreApplication .translate ( "GdalTools" , "Various settings for Gdal Tools" ) )
@@ -317,6 +345,11 @@ def doTileIndex( self ):
317
345
d = TileIndex ( self .iface )
318
346
self .runToolDialog ( d )
319
347
348
+ def doExtractProj ( self ):
349
+ from tools .doExtractProj import GdalToolsDialog as ExtractProj
350
+ d = ExtractProj ( self .iface )
351
+ d .exec_ ()
352
+
320
353
def doDEM ( self ):
321
354
from tools .doDEM import GdalToolsDialog as DEM
322
355
d = DEM ( self .iface )
0 commit comments