[QGIS Commit] r9051 - trunk/qgis/src/plugins/georeferencer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Aug 12 13:53:40 EDT 2008
Author: ersts
Date: 2008-08-12 13:53:39 -0400 (Tue, 12 Aug 2008)
New Revision: 9051
Modified:
trunk/qgis/src/plugins/georeferencer/plugingui.cpp
trunk/qgis/src/plugins/georeferencer/pluginguibase.ui
trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp
trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp
trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
Log:
-Fixed color error when creating new file, closes ticket #1034
-Updated the auto arrange
-Fixed an issue that caused qgis to segfault
Modified: trunk/qgis/src/plugins/georeferencer/plugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugingui.cpp 2008-08-12 15:42:24 UTC (rev 9050)
+++ trunk/qgis/src/plugins/georeferencer/plugingui.cpp 2008-08-12 17:53:39 UTC (rev 9051)
@@ -165,85 +165,45 @@
return;
}
- int width, height; //width and height of screen
+ int myScreenWidth, myScreenHeight; //width and height of screen
//store initial size and position of qgis window
mPluginWindowsArranged = true;
origSize = mainWindow->size();
origPos = mainWindow->pos();
-
- //qt distinguishes between geometry with and without window frame
- int widthIncrMainWindow, heightIncrMainWindow;
- int widthIncrPointDialog, heightIncrPointDialog;
- int widthIncrThis, heightIncrThis;
-
//read the desktop geometry
QDesktopWidget* desktop = QApplication::desktop();
QRect screenGeometry = desktop->availableGeometry();
- width = screenGeometry.width();
- height = screenGeometry.height();
+ myScreenWidth = screenGeometry.width();
+ myScreenHeight = screenGeometry.height();
- int leftRightBorder; //border between plugin/point dialogs on the left and qgis main window on the right
- int pluginPointDialogBorder; //border on y-axis between plugin dialog and point dialog
+ int newPluginDialogHeight = qMax(int(myScreenHeight * 0.2), minimumHeight());
+ int newPluginDialogWidth = qMax(int(myScreenWidth * 0.33), minimumWidth());
+ int newPointDialogHeight = qMax(int(myScreenHeight * 0.70), mPointDialog->minimumHeight());
+ int newPointDialogWidth = qMax(int(myScreenWidth * 0.33), mPointDialog->minimumWidth());
+ int newMainWindowHeight = qMax(int(myScreenHeight * 0.95), mainWindow->minimumHeight());
+ int newMainWindowWidth = qMax(int(myScreenWidth * 0.65), mainWindow->minimumHeight());
-
- leftRightBorder = width/3;
- pluginPointDialogBorder = height/5;
-
- //consider minimum heights of plugin dialog and mPointDialog
- int minPluginDialogHeight = minimumHeight() + (frameSize().height() - this->height());
- int minPointDialogHeight = mPointDialog->minimumHeight() + \
- (mPointDialog->frameSize().height() - mPointDialog->height());
-
- if((height - pluginPointDialogBorder) < minPointDialogHeight)
- {
- pluginPointDialogBorder = (height - minPointDialogHeight);
- }
- if(pluginPointDialogBorder < minPluginDialogHeight)
- {
- pluginPointDialogBorder = minPluginDialogHeight;
- }
-
- //consider minimum widths of plugin/point dialogs and qgis main window
- int minPluginDialogWidth = minimumWidth() + (frameSize().width() - this->width());
- int minPointDialogWidth = mPointDialog->minimumWidth() + \
- (mPointDialog->frameSize().width() - mPointDialog->width());
- int minMainWindowWidth = mainWindow->minimumWidth() + \
- (mainWindow->frameSize().width() - mainWindow->width());
-
- if(leftRightBorder < minPointDialogWidth)
- {
- leftRightBorder = minPointDialogWidth;
- }
- if(leftRightBorder < minPluginDialogWidth)
- {
- leftRightBorder = minPluginDialogWidth;
- }
- if((width - leftRightBorder) < minMainWindowWidth)
- {
- leftRightBorder = width - minMainWindowWidth;
- }
-
//place main window
- widthIncrMainWindow = (width -leftRightBorder) - mainWindow->frameSize().width();
- heightIncrMainWindow = height - mainWindow->frameSize().height();
mainWindow->setEnabled(false); //avoid getting two resize events for the main canvas
- mainWindow->resize(mainWindow->width() + widthIncrMainWindow, mainWindow->height() + heightIncrMainWindow);
- mainWindow->move(leftRightBorder, 0);
+ mainWindow->resize(newMainWindowWidth, newMainWindowHeight);
+ //Resize again to account for frame border width -- Probably a better way to do this.
+ mainWindow->resize(newMainWindowWidth - (mainWindow->width() - newMainWindowWidth), newMainWindowHeight - (mainWindow->height() - newMainWindowHeight));
+ mainWindow->move(myScreenWidth - newMainWindowWidth, 0);
mainWindow->setEnabled(true);
-
- //place point dialog
- widthIncrPointDialog = leftRightBorder - mPointDialog->frameSize().width();
- heightIncrPointDialog = height - pluginPointDialogBorder - mPointDialog->frameSize().height();
- mPointDialog->resize(mPointDialog->width() + widthIncrPointDialog, mPointDialog->height() + heightIncrPointDialog);
- mPointDialog->move(0, pluginPointDialogBorder);
-
+
//place this dialog
- widthIncrThis = leftRightBorder - frameSize().width();
- heightIncrThis = pluginPointDialogBorder - frameSize().height();
- resize(this->width() + widthIncrThis, this->height() + heightIncrThis);
+ resize(newPluginDialogWidth, newPluginDialogHeight);
+ resize(newPluginDialogWidth - (width() - newPluginDialogWidth), newPluginDialogHeight - (height() - newPluginDialogHeight));
move(0, 0);
+
+ //place point dialog
+ mPointDialog->resize(newPointDialogWidth, newPointDialogHeight);
+ mPointDialog->resize(newPointDialogWidth - (mPointDialog->width() - newPointDialogWidth), newPointDialogHeight - (mPointDialog->height() - newPointDialogHeight));
+ mPointDialog->move(0, int(myScreenHeight * 0.3));
+
+
}
}
Modified: trunk/qgis/src/plugins/georeferencer/pluginguibase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/pluginguibase.ui 2008-08-12 15:42:24 UTC (rev 9050)
+++ trunk/qgis/src/plugins/georeferencer/pluginguibase.ui 2008-08-12 17:53:39 UTC (rev 9051)
@@ -6,71 +6,63 @@
<x>0</x>
<y>0</y>
<width>424</width>
- <height>155</height>
+ <height>131</height>
</rect>
</property>
<property name="windowTitle" >
<string>Georeferencer</string>
</property>
<property name="windowIcon" >
- <iconset resource="georeferencer.qrc" >:/icon.png</iconset>
+ <iconset/>
</property>
<layout class="QGridLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="1" column="1" colspan="2" >
- <widget class="QPushButton" name="mArrangeWindowsButton" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1" >
<property name="text" >
- <string>Arrange plugin windows</string>
+ <string>Raster file:</string>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="pbnSelectRaster" >
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="leSelectRaster" >
<property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text" >
- <string>...</string>
- </property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="leSelectRaster" >
+ <item row="0" column="2" >
+ <widget class="QPushButton" name="pbnSelectRaster" >
<property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="textLabel1" >
<property name="text" >
- <string>Raster file:</string>
+ <string>...</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="3" >
+ <item row="1" column="0" colspan="3" >
<layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
<property name="spacing" >
<number>6</number>
</property>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
<item>
<widget class="QPushButton" name="pbnDescription" >
<property name="text" >
@@ -79,6 +71,13 @@
</widget>
</item>
<item>
+ <widget class="QPushButton" name="mArrangeWindowsButton" >
+ <property name="text" >
+ <string>Arrange plugin windows</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
Modified: trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp 2008-08-12 15:42:24 UTC (rev 9050)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp 2008-08-12 17:53:39 UTC (rev 9051)
@@ -22,9 +22,9 @@
setupUi(this);
QStringList compressionMethods;
compressionMethods << "NONE";
- compressionMethods << "LZW (" + tr("unstable") + ")";
- compressionMethods << "PACKBITS (" + tr("unstable") + ")";
- compressionMethods << "DEFLATE (" + tr("unstable") + ")";
+ compressionMethods << "LZW";
+ compressionMethods << "PACKBITS";
+ compressionMethods << "DEFLATE";
mCompressionComboBox->addItems(compressionMethods);
}
Modified: trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp 2008-08-12 15:42:24 UTC (rev 9050)
+++ trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp 2008-08-12 17:53:39 UTC (rev 9051)
@@ -85,10 +85,11 @@
{
GDALRasterBandH hSrcBand = GDALGetRasterBand(hSrcDS,i+1);
GDALRasterBandH hDstBand = GDALGetRasterBand(hDstDS,i+1);
- GDALColorTableH cTable = GDALGetRasterColorTable(hSrcDS);
+ GDALColorTableH cTable = GDALGetRasterColorTable(hSrcBand);
+ GDALSetRasterColorInterpretation (hDstBand, GDALGetRasterColorInterpretation(hSrcBand));
if (cTable)
{
- GDALSetRasterColorTable(hDstDS,cTable);
+ GDALSetRasterColorTable(hDstBand,cTable);
}
double noData = GDALGetRasterNoDataValue(hSrcBand,NULL);
Modified: trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp 2008-08-12 15:42:24 UTC (rev 9050)
+++ trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp 2008-08-12 17:53:39 UTC (rev 9051)
@@ -313,7 +313,14 @@
QgsImageWarper::ResamplingMethod resampling;
QgsImageWarper warper(-rotation);
d.getWarpOptions(resampling, useZeroForTrans, compressionMethod);
- warper.warp(mLayer->source(), outputFileName,
+ //Closing the dialog by pressing the X button rather than clicking the OK button causes GDAL to barf and QGIS
+ //to crash because reasampling is not a valid option
+ //**not sure exactly what is going on in the case as the other two options are still correct but that could be coincidence
+ if(resampling != QgsImageWarper::NearestNeighbour && resampling != QgsImageWarper::Bilinear && resampling != QgsImageWarper::Cubic)
+ {
+ return false;
+ }
+ warper.warp(mLayer->source(), outputFileName,
xOffset, yOffset, resampling, useZeroForTrans, compressionMethod);
}
More information about the QGIS-commit
mailing list