Skip to content
Permalink
Browse files

Added option to choose compression method for helmert-transformed tif…

… file

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@7144 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Aug 19, 2007
1 parent f3371e1 commit cce3ca8413b9652eddfc1512b52433189367ec4a
@@ -6,14 +6,22 @@ QgsGeorefWarpOptionsDialog::QgsGeorefWarpOptionsDialog(QWidget* parent)
: QgsGeorefWarpOptionsDialogBase()
{
setupUi(this);
QStringList compressionMethods;
compressionMethods << "LZW";
compressionMethods << "PACKBITS";
compressionMethods << "DEFLATE";
compressionMethods << "NONE";
mCompressionComboBox->addItems(compressionMethods);
}


void QgsGeorefWarpOptionsDialog::
getWarpOptions(QgsImageWarper::ResamplingMethod& resampling,
bool& useZeroForTransparency) {
bool& useZeroForTransparency, QString& compression)
{
resampling = this->resampling;
useZeroForTransparency = this->useZeroAsTransparency;
compression = mCompressionComboBox->currentText();
}


@@ -24,7 +24,7 @@ Q_OBJECT

QgsGeorefWarpOptionsDialog(QWidget* parent);
void getWarpOptions(QgsImageWarper::ResamplingMethod& resampling,
bool& useZeroForTransparency);
bool& useZeroForTransparency, QString& compression);

public slots:

@@ -5,20 +5,30 @@
<rect>
<x>0</x>
<y>0</y>
<width>348</width>
<height>103</height>
<width>366</width>
<height>130</height>
</rect>
</property>
<property name="windowTitle" >
<string>Warp options</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>10</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" colspan="2" >
<widget class="QComboBox" name="mCompressionComboBox" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="mCompressionLabel" >
<property name="text" >
<string>Compression:</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
@@ -48,23 +58,23 @@
</item>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="pbnOK" >
<item row="2" column="0" colspan="2" >
<widget class="QCheckBox" name="cbxZeroAsTrans" >
<property name="text" >
<string>OK</string>
<string>Use 0 for transparency when needed</string>
</property>
<property name="default" >
<bool>true</bool>
<property name="checked" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QCheckBox" name="cbxZeroAsTrans" >
<item row="2" column="2" >
<widget class="QPushButton" name="pbnOK" >
<property name="text" >
<string>Use 0 for transparency when needed</string>
<string>OK</string>
</property>
<property name="checked" >
<bool>false</bool>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
@@ -14,7 +14,7 @@

void QgsImageWarper::warp(const QString& input, const QString& output,
double& xOffset, double& yOffset,
ResamplingMethod resampling, bool useZeroAsTrans) {
ResamplingMethod resampling, bool useZeroAsTrans, const QString& compression) {
// Open input file
GDALAllRegister();
GDALDataset* hSrcDS = static_cast<GDALDataset*>(GDALOpen(QFile::encodeName(input).constData(),
@@ -61,6 +61,7 @@ void QgsImageWarper::warp(const QString& input, const QString& output,
GDALDriver* driver = static_cast<GDALDriver*>(GDALGetDriverByName("GTiff"));
char **papszOptions = NULL;
papszOptions = CSLSetNameValue(papszOptions, "INIT_DEST", "NO_DATA");
papszOptions = CSLSetNameValue(papszOptions, "COMPRESS", compression);
GDALDataset* hDstDS =
driver->Create(QFile::encodeName(output).constData(), newXSize, newYSize,
hSrcDS->GetRasterCount(),
@@ -19,7 +19,7 @@ class QgsImageWarper {

void warp(const QString& input, const QString& output,
double& xOffset, double& yOffset,
ResamplingMethod resampling = Bilinear, bool useZeroAsTrans = true);
ResamplingMethod resampling = Bilinear, bool useZeroAsTrans = true, const QString& compression = "NONE");

private:

@@ -367,11 +367,12 @@ bool QgsPointDialog::generateWorldFile()
QgsGeorefWarpOptionsDialog d(this);
d.exec();
bool useZeroForTrans;
QString compressionMethod;
QgsImageWarper::ResamplingMethod resampling;
QgsImageWarper warper(-rotation);
d.getWarpOptions(resampling, useZeroForTrans);
d.getWarpOptions(resampling, useZeroForTrans, compressionMethod);
warper.warp(mLayer->source(), outputFileName,
xOffset, yOffset, resampling, useZeroForTrans);
xOffset, yOffset, resampling, useZeroForTrans, compressionMethod);
}

// write the world file

0 comments on commit cce3ca8

Please sign in to comment.
You can’t perform that action at this time.