-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applied the patch attached to #3331 to implement gdaltindex. Thanks a…
…lexbruy! git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15135 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
brushtyler
committed
Feb 8, 2011
1 parent
0351fcf
commit 9548bd7
Showing
5 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
from PyQt4.QtCore import * | ||
from PyQt4.QtGui import * | ||
from qgis.core import * | ||
from qgis.gui import * | ||
|
||
from ui_widgetTileIndex import Ui_GdalToolsWidget as Ui_Widget | ||
from widgetPluginBase import GdalToolsBasePluginWidget as BasePluginWidget | ||
import GdalTools_utils as Utils | ||
|
||
import os.path | ||
|
||
class GdalToolsDialog( QWidget, Ui_Widget, BasePluginWidget ): | ||
|
||
def __init__( self, iface ): | ||
QWidget.__init__( self ) | ||
self.iface = iface | ||
|
||
self.setupUi( self ) | ||
BasePluginWidget.__init__( self, self.iface, "gdaltindex" ) | ||
|
||
self.setParamsStatus( | ||
[ | ||
( self.inputDirEdit, SIGNAL( "textChanged( const QString & )" ) ), | ||
#( self.recurseCheck, SIGNAL( "stateChanged( int )" ), | ||
( self.outputFileEdit, SIGNAL( "textChanged( const QString & )" ) ), | ||
( self.indexFieldEdit, SIGNAL( "textChanged( const QString & )" ), self.indexFieldCheck), | ||
( self.absolutePathCheck, SIGNAL( "stateChanged( int )" ) ), | ||
( self.skipDifferentProjCheck, SIGNAL( "stateChanged( int )" ) ) | ||
] | ||
) | ||
|
||
self.connect( self.selectInputDirButton, SIGNAL( "clicked()" ), self.fillInputDirEdit ) | ||
self.connect( self.selectOutputFileButton, SIGNAL( "clicked()" ), self.fillOutputFileEdit ) | ||
|
||
def fillInputDirEdit( self ): | ||
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select the input directory with raster files" )) | ||
if inputDir.isEmpty(): | ||
return | ||
|
||
self.inputDirEdit.setText( inputDir ) | ||
|
||
def fillOutputFileEdit( self ): | ||
lastUsedFilter = Utils.FileFilter.lastUsedVectorFilter() | ||
outputFile, encoding = Utils.FileDialog.getSaveFileName( self, self.tr( "Select where to save the TileIndex output" ), Utils.FileFilter.allVectorsFilter(), lastUsedFilter, True ) | ||
if outputFile.isEmpty(): | ||
return | ||
Utils.FileFilter.setLastUsedVectorFilter(lastUsedFilter) | ||
|
||
self.outputFormat = Utils.fillVectorOutputFormat( lastUsedFilter, outputFile ) | ||
self.outputFileEdit.setText( outputFile ) | ||
self.lastEncoding = encoding | ||
|
||
def getArguments( self ): | ||
arguments = QStringList() | ||
if self.indexFieldCheck.isChecked() and not self.indexFieldEdit.text().isEmpty(): | ||
arguments << "-tileindex" | ||
arguments << self.indexFieldEdit.text() | ||
if self.absolutePathCheck.isChecked(): | ||
arguments << "-write_absolute_path" | ||
if self.skipDifferentProjCheck.isChecked(): | ||
arguments << "-skip_different_projection" | ||
arguments << self.outputFileEdit.text() | ||
arguments << Utils.getRasterFiles( self.inputDirEdit.text(), self.recurseCheck.isChecked() ) | ||
return arguments | ||
|
||
def getOutputFileName( self ): | ||
return self.outputFileEdit.text() | ||
|
||
def addLayerIntoCanvas( self, fileInfo ): | ||
vl = self.iface.addVectorLayer( fileInfo.filePath(), fileInfo.baseName(), "ogr" ) | ||
if vl.isValid(): | ||
if hasattr( self, 'lastEncoding' ): | ||
vl.setProviderEncoding( self.lastEncoding ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>GdalToolsWidget</class> | ||
<widget class="QWidget" name="GdalToolsWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>188</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Raster tile index</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Input directory</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QLineEdit" name="inputDirEdit"/> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="selectInputDirButton"> | ||
<property name="text"> | ||
<string>Select...</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item row="1" column="1"> | ||
<widget class="QCheckBox" name="recurseCheck"> | ||
<property name="text"> | ||
<string>Recurse subdirectories</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="0"> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="text"> | ||
<string>Output shapefile</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="1"> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
<item> | ||
<widget class="QLineEdit" name="outputFileEdit"/> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="selectOutputFileButton"> | ||
<property name="text"> | ||
<string>Select...</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item row="3" column="0"> | ||
<widget class="QCheckBox" name="indexFieldCheck"> | ||
<property name="text"> | ||
<string>Tile index field</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="3" column="1"> | ||
<widget class="QLineEdit" name="indexFieldEdit"> | ||
<property name="enabled"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="text"> | ||
<string>location</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QCheckBox" name="absolutePathCheck"> | ||
<property name="text"> | ||
<string>Write absolute path</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QCheckBox" name="skipDifferentProjCheck"> | ||
<property name="text"> | ||
<string>Skip files with different projection ref</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |