[QGIS Commit] r10107 - trunk/qgis/src/plugins/georeferencer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Feb 4 16:45:50 EST 2009


Author: homann
Date: 2009-02-04 16:45:50 -0500 (Wed, 04 Feb 2009)
New Revision: 10107

Removed:
   trunk/qgis/src/plugins/georeferencer/affine.jpg
   trunk/qgis/src/plugins/georeferencer/helmert.jpg
   trunk/qgis/src/plugins/georeferencer/plugingui.cpp
   trunk/qgis/src/plugins/georeferencer/plugingui.h
   trunk/qgis/src/plugins/georeferencer/pluginguibase.ui
Modified:
   trunk/qgis/src/plugins/georeferencer/CMakeLists.txt
   trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp
   trunk/qgis/src/plugins/georeferencer/plugin.cpp
   trunk/qgis/src/plugins/georeferencer/plugin.h
   trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp
   trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp
   trunk/qgis/src/plugins/georeferencer/qgsimagewarper.h
   trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp
   trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
   trunk/qgis/src/plugins/georeferencer/qgspointdialog.h
   trunk/qgis/src/plugins/georeferencer/qgspointdialogbase.ui
Log:
New georeferencer from GIS-Lab thanks to Maxim Dubinin!

Modified: trunk/qgis/src/plugins/georeferencer/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/georeferencer/CMakeLists.txt	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/CMakeLists.txt	2009-02-04 21:45:50 UTC (rev 10107)
@@ -1,11 +1,9 @@
-
 ########################################################
 # Files
 
 SET (GEOREF_SRCS
      plugin.cpp
      qgsgeorefdatapoint.cpp
-     plugingui.cpp
      qgsimagewarper.cpp
      qgsleastsquares.cpp
      qgspointdialog.cpp
@@ -15,7 +13,6 @@
 )
 
 SET (GEOREF_UIS
-     pluginguibase.ui
      qgspointdialogbase.ui
      mapcoordsdialogbase.ui
      qgsgeorefdescriptiondialogbase.ui
@@ -24,7 +21,6 @@
 
 SET (GEOREF_MOC_HDRS
      plugin.h
-     plugingui.h
      qgspointdialog.h
      mapcoordsdialog.h
      qgsgeorefwarpoptionsdialog.h
@@ -51,7 +47,9 @@
      ../../gui
      ..
      ${GSL_INCLUDE_DIR}
+     ${QGIS_INCLUDE_DIR}
      ${GDAL_INCLUDE_DIR}
+     ${QT_QTXML_INCLUDE_DIR}
 )
 
 TARGET_LINK_LIBRARIES(georefplugin
@@ -60,7 +58,6 @@
   ${GSL_LIBRARIES}
 )
 
-
 ########################################################
 # Install
 

Deleted: trunk/qgis/src/plugins/georeferencer/affine.jpg
===================================================================
(Binary files differ)

Deleted: trunk/qgis/src/plugins/georeferencer/helmert.jpg
===================================================================
(Binary files differ)

Modified: trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/mapcoordsdialog.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -21,7 +21,10 @@
 
 MapCoordsDialog::MapCoordsDialog()
 {
-
+      this->setWindowFlags(!Qt::Dialog);
+      this->setWindowFlags(Qt::WindowSystemMenuHint);
+      this->setWindowFlags(Qt::WindowMinimizeButtonHint);
+      this->setWindowFlags(Qt::WindowMaximizeButtonHint);
 }
 
 

Modified: trunk/qgis/src/plugins/georeferencer/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugin.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/plugin.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -50,12 +50,13 @@
 //
 //the gui subclass
 //
-#include "plugingui.h"
+//#include "plugingui.h"
+#include "qgspointdialog.h"
+#include "qgsgeorefdescriptiondialog.h"
 
-
 static const char * const sIdent = "$Id$";
-static const QString sName = QObject::tr( "Georeferencer" );
-static const QString sDescription = QObject::tr( "Adding projection info to rasters" );
+static const QString sName = QObject::tr( "Georeferencer GDAL" );
+static const QString sDescription = QObject::tr( "Adding projection info to rasters using GDAL" );
 static const QString sPluginVersion = QObject::tr( "Version 0.1" );
 static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
 
@@ -97,19 +98,53 @@
   mQGisIface->addToolBarIcon( mQActionPointer );
   mQGisIface->addPluginToMenu( tr( "&Georeferencer" ), mQActionPointer );
 
+  mQActionPointer = new QAction( QIcon( ":/about.png" ), tr( "&Georeferencer" ), this );
+  mQActionPointer = new QAction("About", this);
+  connect(mQActionPointer, SIGNAL(triggered()), SLOT(about()));
+  mQGisIface->addPluginToMenu(tr ("&Georeferencer"), mQActionPointer);
+
+  mQActionPointer = new QAction( QIcon( ":/help.png" ), tr( "&Georeferencer" ), this );
+  mQActionPointer = new QAction("Help", this);
+  connect(mQActionPointer, SIGNAL(triggered()), SLOT(help()));
+  mQGisIface->addPluginToMenu(tr ("&Georeferencer"), mQActionPointer);
 }
 //method defined in interface
 void QgsGeorefPlugin::help()
 {
-  //implement me!
+	QgsGeorefDescriptionDialog dlg( mQGisIface->mainWindow( ) );
+	dlg.exec();
 }
 
+void QgsGeorefPlugin::about( )
+{
+	QDialog dlg( mQGisIface->mainWindow( ) );
+	dlg.setWindowFlags( dlg.windowFlags( ) | Qt::MSWindowsFixedSizeDialogHint );
+	dlg.setWindowFlags( dlg.windowFlags( ) &~ Qt::WindowContextHelpButtonHint );
+	QVBoxLayout *lines = new QVBoxLayout( &dlg );
+	lines->addWidget( new QLabel( tr( "<b>Georeferencer GDAL</b>") ) );
+	lines->addWidget( new QLabel( tr( "    Based on original Georeferencer Plugin" ) ) );
+	lines->addWidget( new QLabel( tr( "<b>Developers:</b>" ) ) );
+	lines->addWidget( new QLabel( tr( "    Lars Luthman (original Georeferencer)" ) ) );
+	lines->addWidget( new QLabel( "    Lynx (lynx21.12.12 at gmail.ru)" ));
+	lines->addWidget( new QLabel( "    Maxim Dubinin (sim at gis-lab.info)" ));
+	lines->addWidget( new QLabel( tr( "<b>Links:</b>" ) ) );
+	QLabel *link = new QLabel( "     <a href=\"http://gis-lab.info/qa/qgis-georef-new-eng.html\">http://gis-lab.info/qa/qgis-georef-new-eng.html</a>");
+	link->setOpenExternalLinks( true );
+	lines->addWidget( link );
+
+	dlg.exec( );
+}
+
 // Slot called when the buffer menu item is triggered
 void QgsGeorefPlugin::run()
 {
-  QgsGeorefPluginGui *myPluginGui = new QgsGeorefPluginGui( mQGisIface, QgsGeorefPluginGui::findMainWindow() );
-  myPluginGui->show();
-  myPluginGui->setFocus();
+//  QgsGeorefPluginGui *myPluginGui = new QgsGeorefPluginGui( mQGisIface, QgsGeorefPluginGui::findMainWindow(), Qt::Window | Qt::WindowMinimizeButtonHint);
+//  myPluginGui->show();
+//  myPluginGui->setFocus();
+    QgsPointDialog *myPlugin = new QgsPointDialog(mQGisIface, QgsPointDialog::findMainWindow(), Qt::Window | Qt::WindowMinimizeButtonHint);
+    myPlugin->move(0, 0);
+    myPlugin->show();
+    myPlugin->setFocus();
 }
 
 // Unload the plugin by cleaning up the GUI

Modified: trunk/qgis/src/plugins/georeferencer/plugin.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugin.h	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/plugin.h	2009-02-04 21:45:50 UTC (rev 10107)
@@ -87,6 +87,7 @@
     //! show the help document
     void help();
 
+    void about( );
     //////////////////////////////////////////////////////////////////////
     //
     //                  END OF MANDATORY PLUGIN METHODS

Deleted: trunk/qgis/src/plugins/georeferencer/plugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugingui.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/plugingui.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -1,231 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005 by Lars Luthman
- *   larsl at users.sourceforge.net
- *                                                                         *
- *   This is a plugin generated from the QGIS plugin template              *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
-#include "plugingui.h"
-#include "qgsgeorefdescriptiondialog.h"
-#include "qgsleastsquares.h"
-#include "qgspointdialog.h"
-#include "qgsrasterlayer.h"
-#include "qgsmaplayerregistry.h"
-#include "qgsproject.h"
-
-//qt includes
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QFileDialog>
-#include <QLineEdit>
-#include <QMessageBox>
-#include <QPushButton>
-#include <QSettings>
-
-//standard includes
-
-QgsGeorefPluginGui::QgsGeorefPluginGui() : QgsGeorefPluginGuiBase()
-{
-
-}
-
-QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface,
-                                        QWidget* parent, Qt::WFlags fl )
-    : QDialog( parent, fl ), mIface( theQgisInterface ), mPluginWindowsArranged( false )
-{
-  setupUi( this );
-  setAttribute( Qt::WA_DeleteOnClose );
-  mPointDialog = new QgsPointDialog( mIface, parent );
-  //move point dialog to the left of the screen so that both windows are visible
-  mPointDialog->move( 0, mPointDialog->pos().y() );
-  mPointDialog->show();
-}
-
-
-QgsGeorefPluginGui::~QgsGeorefPluginGui()
-{
-  delete mPointDialog;
-
-  //restore size of qgis main window if arrange button was used
-  if ( mPluginWindowsArranged )
-  {
-    QWidget* mainWindow = QgsGeorefPluginGui::findMainWindow();
-    if ( mainWindow )
-    {
-      mainWindow->resize( origSize );
-      mainWindow->move( origPos );
-    }
-  }
-}
-
-
-void QgsGeorefPluginGui::on_pbnClose_clicked()
-{
-  close();
-}
-
-void QgsGeorefPluginGui::on_pbnDescription_clicked()
-{
-  QgsGeorefDescriptionDialog d( 0 );
-  d.exec();
-}
-
-
-void QgsGeorefPluginGui::on_pbnSelectRaster_clicked()
-{
-  QSettings settings;
-  QString dir = settings.value( "/Plugin-GeoReferencer/rasterdirectory" ).toString();
-  if ( dir.isEmpty() )
-    dir = ".";
-  QString fileName =
-    QFileDialog::getOpenFileName( this,
-                                  tr( "Choose a raster file" ),
-                                  dir,
-                                  tr( "Raster files (*.*)" ) );
-
-  if ( fileName.isNull() )
-  {
-    return;
-  }
-  leSelectRaster->setText( fileName );
-
-  // do we think that this is a valid raster?
-  if ( !QgsRasterLayer::isValidRasterFileName( leSelectRaster->text() ) )
-  {
-    QMessageBox::critical( this, tr( "Error" ),
-                           tr( "The selected file is not a valid raster file." ) );
-    return;
-  }
-
-  // remember the directory
-  {
-    QSettings settings;
-    QFileInfo fileInfo( leSelectRaster->text() );
-    settings.setValue( "/Plugin-GeoReferencer/rasterdirectory",
-                       fileInfo.path() );
-  }
-
-  // guess the world file name
-  QString raster = leSelectRaster->text();
-  int point = raster.lastIndexOf( '.' );
-  QString worldfile;
-  if ( point != -1 && point != raster.length() - 1 )
-  {
-    worldfile = raster.left( point + 1 );
-    worldfile += ( "wld" );
-  }
-
-  // check if there already is a world file
-  if ( !worldfile.isEmpty() )
-  {
-    if ( QFile::exists( worldfile ) )
-    {
-      int r = QMessageBox::question( this, tr( "World file exists" ),
-                                     tr( "<p>The selected file already seems to have a "
-                                         "world file! Do you want to replace it with the "
-                                         "new world file?</p>" ),
-                                     QMessageBox::Yes | QMessageBox::Default,
-                                     QMessageBox::No | QMessageBox::Escape );
-      if ( r == QMessageBox::No )
-        return;
-      else
-        QFile::remove( worldfile );
-    }
-  }
-
-  // XXX This is horrible, but it works and I'm tired / ll
-  {
-    QSettings settings;
-    QgsProject* prj = QgsProject::instance();
-    mProjBehaviour = settings.value( "/Projections/defaultBehaviour" ).toString();
-    mProjectCRS = prj->readEntry( "SpatialRefSys", "/ProjectCRSProj4String" );
-    mProjectCRSID = prj->readNumEntry( "SpatialRefSys", "/ProjectCRSID" );
-
-    settings.setValue( "/Projections/defaultBehaviour", "useProject" );
-    prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", GEOPROJ4 );
-    prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", int( GEOCRS_ID ) );
-
-    settings.setValue( "/Projections/defaultBehaviour", mProjBehaviour );
-    prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", mProjectCRS );
-    prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", mProjectCRSID );
-  }
-
-  mPointDialog->openImageFile( fileName );
-  mPointDialog->show();
-}
-
-
-
-void QgsGeorefPluginGui::on_mArrangeWindowsButton_clicked()
-{
-  if ( mPointDialog && mIface )
-  {
-    QWidget* mainWindow = QgsGeorefPluginGui::findMainWindow();
-    if ( !mainWindow )
-    {
-      return;
-    }
-
-    int myScreenWidth, myScreenHeight; //width and height of screen
-
-    //store initial size and position of qgis window
-    mPluginWindowsArranged = true;
-    origSize = mainWindow->size();
-    origPos = mainWindow->pos();
-
-    //read the desktop geometry
-    QDesktopWidget* desktop = QApplication::desktop();
-    QRect screenGeometry = desktop->availableGeometry();
-    myScreenWidth = screenGeometry.width();
-    myScreenHeight = screenGeometry.height();
-
-    int newPluginDialogHeight = qMax( int( myScreenHeight * 0.2 ), minimumHeight() );
-    int newPluginDialogWidth = qMax( int( myScreenWidth * 0.33 ), minimumWidth() );
-    int newPointDialogHeight = qMax( int( myScreenHeight * 0.60 ), mPointDialog->minimumHeight() );
-    int newPointDialogWidth = qMax( int( myScreenWidth * 0.33 ), mPointDialog->minimumWidth() );
-    int newMainWindowHeight = qMax( int( myScreenHeight * 0.90 ), mainWindow->minimumHeight() );
-    int newMainWindowWidth = qMax( int( myScreenWidth * 0.65 ), mainWindow->minimumHeight() );
-
-    //place main window
-    mainWindow->setEnabled( false ); //avoid getting two resize events for the main canvas
-    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, int( myScreenHeight * 0.05 ) );
-    mainWindow->setEnabled( true );
-
-    //place this dialog
-    resize( newPluginDialogWidth, newPluginDialogHeight );
-    resize( newPluginDialogWidth - ( width() - newPluginDialogWidth ), newPluginDialogHeight - ( height() - newPluginDialogHeight ) );
-    move( 0, int( myScreenHeight * 0.05 ) );
-
-    //place point dialog
-    mPointDialog->resize( newPointDialogWidth, newPointDialogHeight );
-    mPointDialog->resize( newPointDialogWidth - ( mPointDialog->width() - newPointDialogWidth ), newPointDialogHeight - ( mPointDialog->height() - newPointDialogHeight ) );
-    mPointDialog->move( 0, int( myScreenHeight * 0.35 ) );
-
-
-  }
-}
-
-
-QWidget* QgsGeorefPluginGui::findMainWindow()
-{
-  QWidget* result = 0;
-
-  QWidgetList topLevelWidgets = qApp->topLevelWidgets();
-  QWidgetList::iterator it = topLevelWidgets.begin();
-  for ( ; it != topLevelWidgets.end(); ++it )
-  {
-    if (( *it )->objectName() == "QgisApp" )
-    {
-      result = *it;
-      break;
-    }
-  }
-  return result;
-}

Deleted: trunk/qgis/src/plugins/georeferencer/plugingui.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugingui.h	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/plugingui.h	2009-02-04 21:45:50 UTC (rev 10107)
@@ -1,55 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005 by Lars Luthman
- *   larsl at users.sourceforge.net
- *                                                                         *
- *   This is a plugin generated from the QGIS plugin template              *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
-#ifndef PLUGINGUI_H
-#define PLUGINGUI_H
-
-#include <ui_pluginguibase.h>
-#include <QDialog>
-
-class QgisInterface;
-class QgsPointDialog;
-
-/**
- at author Tim Sutton
-*/
-class QgsGeorefPluginGui : public QDialog, private Ui::QgsGeorefPluginGuiBase
-{
-    Q_OBJECT
-  public:
-    QgsGeorefPluginGui();
-    QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent = 0, Qt::WFlags fl = 0 );
-    ~QgsGeorefPluginGui();
-
-    /**Finds the qgis main window
-     @return window pointer or 0 in case or error*/
-    static QWidget* findMainWindow();
-
-  public slots:
-    void on_pbnClose_clicked();
-    void on_pbnDescription_clicked();
-    void on_pbnSelectRaster_clicked();
-    void on_mArrangeWindowsButton_clicked();
-
-  private:
-
-    QString mProjBehaviour, mProjectCRS;
-    int mProjectCRSID;
-    QgisInterface* mIface;
-    /**dialog to enter reference point*/
-    QgsPointDialog* mPointDialog;
-    /**Flag if plugin windows have been arranged with button*/
-    bool mPluginWindowsArranged;
-    QSize origSize;
-    QPoint origPos;
-};
-
-#endif

Deleted: trunk/qgis/src/plugins/georeferencer/pluginguibase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/pluginguibase.ui	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/pluginguibase.ui	2009-02-04 21:45:50 UTC (rev 10107)
@@ -1,112 +0,0 @@
-<ui version="4.0" >
- <class>QgsGeorefPluginGuiBase</class>
- <widget class="QDialog" name="QgsGeorefPluginGuiBase" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>424</width>
-    <height>131</height>
-   </rect>
-  </property>
-  <property name="windowTitle" >
-   <string>Georeferencer</string>
-  </property>
-  <property name="windowIcon" >
-   <iconset/>
-  </property>
-  <layout class="QGridLayout" >
-   <item row="0" column="0" >
-    <widget class="QLabel" name="textLabel1" >
-     <property name="text" >
-      <string>Raster file:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1" >
-    <widget class="QLineEdit" name="leSelectRaster" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="2" >
-    <widget class="QPushButton" name="pbnSelectRaster" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="text" >
-      <string>...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0" colspan="3" >
-    <layout class="QHBoxLayout" >
-     <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" >
-        <string>Description...</string>
-       </property>
-      </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>
-       </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Expanding</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>141</width>
-         <height>36</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="pbnClose" >
-       <property name="text" >
-        <string>Close</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <resources>
-  <include location="georeferencer.qrc" />
- </resources>
- <connections/>
-</ui>

Modified: trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -17,7 +17,7 @@
 
 
 QgsGeorefWarpOptionsDialog::QgsGeorefWarpOptionsDialog( QWidget* parent )
-    : QgsGeorefWarpOptionsDialogBase()
+    : QDialog(parent) //QgsGeorefWarpOptionsDialogBase()
 {
   setupUi( this );
   QStringList compressionMethods;

Modified: trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgsimagewarper.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -25,29 +25,43 @@
 
 #include "qgsimagewarper.h"
 
+bool QgsImageWarper::openSrcDSAndGetWarpOpt(const QString &input, const QString &output,
+                            const ResamplingMethod &resampling, const GDALTransformerFunc &pfnTransform,
+                            GDALDatasetH &hSrcDS, GDALWarpOptions *&psWarpOptions)
+{
+      // Open input file
+      GDALAllRegister();
+      hSrcDS = GDALOpen( QFile::encodeName( input ).constData(), GA_ReadOnly );
+      if (hSrcDS == NULL) return false;
+
+      // Setup warp options.
+      psWarpOptions = GDALCreateWarpOptions();
+      psWarpOptions->hSrcDS = hSrcDS;
+      psWarpOptions->nBandCount = GDALGetRasterCount( hSrcDS );
+      psWarpOptions->panSrcBands =
+      ( int * ) CPLMalloc( sizeof( int ) * psWarpOptions->nBandCount );
+      psWarpOptions->panDstBands =
+      ( int * ) CPLMalloc( sizeof( int ) * psWarpOptions->nBandCount );
+      for ( int i = 0; i < psWarpOptions->nBandCount; ++i )
+      {
+      psWarpOptions->panSrcBands[i] = i + 1;
+      psWarpOptions->panDstBands[i] = i + 1;
+      }
+      psWarpOptions->pfnProgress = GDALTermProgress;
+      psWarpOptions->pfnTransformer = pfnTransform;
+      psWarpOptions->eResampleAlg = GDALResampleAlg( resampling );
+
+      return true;
+}
+
 void QgsImageWarper::warp( const QString& input, const QString& output,
                            double& xOffset, double& yOffset,
                            ResamplingMethod resampling, bool useZeroAsTrans, const QString& compression )
 {
-  // Open input file
-  GDALAllRegister();
-  GDALDatasetH hSrcDS = GDALOpen( QFile::encodeName( input ).constData(), GA_ReadOnly );
-  // Setup warp options.
-  GDALWarpOptions *psWarpOptions = GDALCreateWarpOptions();
-  psWarpOptions->hSrcDS = hSrcDS;
-  psWarpOptions->nBandCount = GDALGetRasterCount( hSrcDS );
-  psWarpOptions->panSrcBands =
-    ( int * ) CPLMalloc( sizeof( int ) * psWarpOptions->nBandCount );
-  psWarpOptions->panDstBands =
-    ( int * ) CPLMalloc( sizeof( int ) * psWarpOptions->nBandCount );
-  for ( int i = 0; i < psWarpOptions->nBandCount; ++i )
-  {
-    psWarpOptions->panSrcBands[i] = i + 1;
-    psWarpOptions->panDstBands[i] = i + 1;
-  }
-  psWarpOptions->pfnProgress = GDALTermProgress;
-  psWarpOptions->pfnTransformer = &QgsImageWarper::transform;
-  psWarpOptions->eResampleAlg = GDALResampleAlg( resampling );
+      GDALDatasetH hSrcDS;
+      GDALWarpOptions *psWarpOptions;
+      openSrcDSAndGetWarpOpt(input, output, resampling,  &QgsImageWarper::transform,
+                  hSrcDS, psWarpOptions);
 
   // check the bounds for the warped raster
   // order: upper right, lower right, lower left (y points down)
@@ -142,3 +156,80 @@
   }
   return TRUE;
 }
+
+bool QgsImageWarper::warpgcp( const QString& input, const QString& output,
+                              const char *worldExt,
+                              std::vector<QgsPoint> mapCoords,
+                              std::vector<QgsPoint> pixelCoords,
+                              const int nReqOrder, ResamplingMethod resampling, 
+                              bool useZeroAsTrans, const QString& compression, bool bUseTPS)
+{
+      int n = mapCoords.size();
+      if ((nReqOrder == 1 && n < 3) || (nReqOrder == 2 && n < 6) || 
+                  (nReqOrder == 3 && n < 10) ) return false;
+
+      CPLErr eErr;
+      GDALDatasetH hSrcDS;
+      GDALWarpOptions *psWarpOptions;
+      openSrcDSAndGetWarpOpt(input, output, resampling,  
+                  bUseTPS ? *GDALTPSTransform : *GDALGCPTransform,
+                  hSrcDS, psWarpOptions);
+
+      GDAL_GCP *pasGCPList = (GDAL_GCP *) malloc(n * sizeof(GDAL_GCP));
+
+      for (int i = 0; i < n; i++) {
+            pasGCPList[i].pszId = (char *) malloc(20 * sizeof(char));
+            sprintf(pasGCPList[i].pszId, "gcp%i", i);
+            pasGCPList[i].pszInfo = NULL;
+            pasGCPList[i].dfGCPPixel = pixelCoords[i].x();
+            pasGCPList[i].dfGCPLine = - pixelCoords[i].y();
+            pasGCPList[i].dfGCPX = mapCoords[i].x();
+            pasGCPList[i].dfGCPY = mapCoords[i].y();
+            pasGCPList[i].dfGCPZ = 0;
+      }
+
+      GDALDriverH hDriver = GDALGetDriverByName( "GTiff" );
+      GDALDatasetH hSrcCopyDS = GDALCreateCopy(hDriver, ".tmpcopy.tif", hSrcDS, 
+                  TRUE, NULL, NULL, NULL);
+      if (hSrcCopyDS == NULL) return false;
+
+      GDALSetGCPs(hSrcCopyDS, n, pasGCPList, "");
+
+      if(bUseTPS)
+            psWarpOptions->pTransformerArg = GDALCreateTPSTransformer(n, pasGCPList, false);
+      else
+            psWarpOptions->pTransformerArg = GDALCreateGCPTransformer(n, pasGCPList, nReqOrder, false);
+
+      if (psWarpOptions->pTransformerArg == NULL) return false;
+
+      // create and warp the output file
+      char **papszOptions = NULL;
+      papszOptions = CSLSetNameValue( papszOptions, "INIT_DEST", "NO_DATA" );
+      papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", compression.toAscii() );
+      eErr = GDALCreateAndReprojectImage(hSrcCopyDS,
+                  /*pszSrcWKT*/"", QFile::encodeName(output).constData(), /*pszDstWKT*/"",
+                  hDriver, papszOptions, GDALResampleAlg(resampling), 0.0, 0, NULL, NULL, psWarpOptions);
+      if (eErr != CE_None) return false;
+
+      // write worldfile
+      int nPixels, nLines;
+      double adfGeoTransform[6];
+
+      eErr = GDALSuggestedWarpOutput(hSrcDS, GDALGCPTransform,
+            psWarpOptions->pTransformerArg, 
+            adfGeoTransform, &nPixels, &nLines);
+      if (eErr != CE_None) return false;
+
+      GDALWriteWorldFile(QFile::encodeName(output).constData(), worldExt, adfGeoTransform);
+
+      free(pasGCPList);
+      if (bUseTPS)
+            GDALDestroyTPSTransformer(psWarpOptions->pTransformerArg);
+      else
+            GDALDestroyGCPTransformer(psWarpOptions->pTransformerArg);
+      GDALDestroyWarpOptions( psWarpOptions );
+      GDALClose( hSrcDS );
+
+      return true;
+}
+

Modified: trunk/qgis/src/plugins/georeferencer/qgsimagewarper.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsimagewarper.h	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgsimagewarper.h	2009-02-04 21:45:50 UTC (rev 10107)
@@ -19,6 +19,8 @@
 #include <gdalwarper.h>
 #include <QString>
 
+#include <vector>
+#include "qgspoint.h"
 
 class QgsImageWarper
 {
@@ -28,16 +30,27 @@
     {
       NearestNeighbour = GRA_NearestNeighbour,
       Bilinear = GRA_Bilinear,
-      Cubic = GRA_Cubic
+      Cubic = GRA_Cubic,
     };
 
 
-    QgsImageWarper( double angle ) : mAngle( angle ) { }
+    QgsImageWarper() { };
+    QgsImageWarper( double angle) : mAngle( angle ) { };
 
     void warp( const QString& input, const QString& output,
                double& xOffset, double& yOffset,
-               ResamplingMethod resampling = Bilinear, bool useZeroAsTrans = true, const QString& compression = "NONE" );
+               ResamplingMethod resampling = Bilinear, 
+               bool useZeroAsTrans = true, 
+               const QString& compression = "NONE" );
 
+      bool warpgcp( const QString& input, const QString& output,
+                    const char *worldExt,
+                    std::vector<QgsPoint> mapCoords,
+                    std::vector<QgsPoint> pixelCoords,
+                    const int nReqOrder = 1, ResamplingMethod resampling = Bilinear, 
+                    bool useZeroAsTrans = true, const QString& compression = "NONE",
+                    bool bUseTPS = false);
+
   private:
 
     struct TransformParameters
@@ -47,6 +60,9 @@
       double y0;
     };
 
+      bool openSrcDSAndGetWarpOpt(const QString &input, const QString &output,
+                                  const ResamplingMethod &resampling, const GDALTransformerFunc &pfnTransform,
+                                  GDALDatasetH &hSrcDS, GDALWarpOptions *&psWarpOptions);
 
     static int transform( void *pTransformerArg, int bDstToSrc, int nPointCount,
                           double *x, double *y, double *z, int *panSuccess );

Modified: trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -30,7 +30,8 @@
   int n = mapCoords.size();
   if ( n < 2 )
   {
-    throw std::domain_error( QObject::tr( "Fit to a linear transform requires at least 2 points." ).toLocal8Bit().constData() );
+    throw std::domain_error( QObject::tr( "Fit to a linear transform requires at "
+                                          "least 2 points." ).toLocal8Bit().constData() );
   }
 
   double sumPx( 0 ), sumPy( 0 ), sumPx2( 0 ), sumPy2( 0 ), sumPxMx( 0 ), sumPyMy( 0 ),
@@ -71,7 +72,8 @@
   int n = mapCoords.size();
   if ( n < 2 )
   {
-    throw std::domain_error( QObject::tr( "Fit to a Helmert transform requires at least 2 points." ).toLocal8Bit().constData() );
+    throw std::domain_error( QObject::tr( "Fit to a Helmert transform requires at "
+                                          "least 2 points." ).toLocal8Bit().constData() );
   }
 
   double A = 0, B = 0, C = 0, D = 0, E = 0, F = 0, G = 0, H = 0, I = 0, J = 0;
@@ -126,7 +128,8 @@
   int n = mapCoords.size();
   if ( n < 4 )
   {
-    throw std::domain_error( QObject::tr( "Fit to an affine transform requires at least 4 points." ).toLocal8Bit().constData() );
+    throw std::domain_error( QObject::tr( "Fit to an affine transform requires at "
+                                          "least 4 points." ).toLocal8Bit().constData() );
   }
 
   double A = 0, B = 0, C = 0, D = 0, E = 0, F = 0,

Modified: trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgspointdialog.cpp	2009-02-04 21:45:50 UTC (rev 10107)
@@ -23,6 +23,9 @@
 #include <QTextStream>
 #include <QSettings>
 
+#include <gdalwarper.h>
+#include <ogr_spatialref.h>
+
 #include "qgisinterface.h"
 #include "qgsapplication.h"
 #include "qgspointdialog.h"
@@ -35,7 +38,9 @@
 #include "qgsmaptoolpan.h"
 #include "qgsgeorefdatapoint.h"
 #include "qgslogger.h"
+#include "qgsproject.h"
 
+#include <QDebug>
 class QgsGeorefTool : public QgsMapTool
 {
   public:
@@ -129,26 +134,9 @@
   mCanvas->setLayerSet( layers );
 
   // load previously added points
-  QFile pointFile( mLayer->source() + ".points" );
-  if ( pointFile.open( QIODevice::ReadOnly ) )
-  {
-    QTextStream points( &pointFile );
-    QString tmp;
-    // read the header
-    points >> tmp >> tmp >> tmp >> tmp;
-    // read the first line
-    double mapX, mapY, pixelX, pixelY;
-    points >> mapX >> mapY >> pixelX >> pixelY;
-    while ( !points.atEnd() )
-    {
-      QgsPoint mapCoords( mapX, mapY );
-      QgsPoint pixelCoords( pixelX, pixelY );
-      addPoint( pixelCoords, mapCoords );
-      // read the next line
-      points >> mapX >> mapY >> pixelX >> pixelY;
-    }
-  }
-
+  QString gcpsPath( layerPath + ".points");
+  loadGCPs( gcpsPath );
+  
   mCanvas->setExtent( mLayer->extent() );
   mCanvas->freeze( false );
 
@@ -168,14 +156,61 @@
   mCanvas->refresh();
 }
 
+void QgsPointDialog::on_leSelectModifiedRaster_textChanged(const QString &name)
+{
+  leSelectWorldFile->setText(guessWorldFileName(name));
+}
+
+void QgsPointDialog::on_pbnSelectWorldFile_clicked()
+{
+  QString fileName = QFileDialog::getSaveFileName( this,
+                     tr( "Choose a name for the world file" ), "." );
+  leSelectWorldFile->setText( fileName );
+}
+
 void QgsPointDialog::on_pbnGenerateWorldFile_clicked()
 {
-  generateWorldFile();
+      generateWorldFileAndWarp();
 }
 
+void QgsPointDialog::on_pbnLoadGCPs_clicked()
+{ 
+  QSettings settings;
+  QString dir = settings.value( "/Plugin-GeoReferencer/rasterdirectory" ).toString();
+  if ( dir.isEmpty() )
+    dir = ".";
+
+  QString fileName =
+    QFileDialog::getOpenFileName( this,
+                                  tr( "Select GCPs file" ),
+                                  dir,
+                                  tr( "GCPs points (*.points)" ) );
+
+  if ( fileName.isNull() )
+  {
+	QMessageBox::information( this, tr( "Information" ), tr( "GCPs was not loaded." ) );
+    return;
+  }
+
+  loadGCPs(fileName);
+}
+
+void QgsPointDialog::on_pbnSaveGCPs_clicked()
+{
+	// create arrays with points from mPoints
+	std::vector<QgsPoint> pixelCoords, mapCoords;
+	for ( unsigned int i = 0; i < mPoints.size(); i++ )
+	{
+		QgsGeorefDataPoint* pt = mPoints[i];
+		pixelCoords.push_back( pt->pixelCoords() );
+		mapCoords.push_back( pt->mapCoords() );
+	}
+	saveGCPs( mapCoords, pixelCoords );
+}
+
 void QgsPointDialog::on_pbnGenerateAndLoad_clicked()
 {
-  if ( generateWorldFile() )
+  if ( generateWorldFileAndWarp() )
   {
     QString source = mLayer->source();
 
@@ -192,14 +227,6 @@
 }
 
 
-void QgsPointDialog::on_pbnSelectWorldFile_clicked()
-{
-  QString fileName = QFileDialog::getSaveFileName( this,
-                     tr( "Choose a name for the world file" ), "." );
-  leSelectWorldFile->setText( fileName );
-}
-
-
 void QgsPointDialog::on_pbnSelectModifiedRaster_clicked()
 {
   QString fileName = QFileDialog::getSaveFileName( this,
@@ -212,45 +239,81 @@
 
 void QgsPointDialog::on_cmbTransformType_currentIndexChanged( const QString& value )
 {
-  if ( value == tr( "Helmert" ) )
+  if (value == tr( "Linear" ))
   {
-    enableModifiedRasterControls( true );
-    // Make up a modified raster field name based on the layer file name
+        // Reset to the default file name
+    leSelectModifiedRaster->setText( "" );
+    enableModifiedRasterControls( false );
     if ( mLayer )
     {
+      leSelectWorldFile->setText( guessWorldFileName( mLayer->source() ) );
+    }
+  }
+  else
+  {
+      enableModifiedRasterControls( true );
+      // Make up a modified raster field name based on the layer file name
+      if ( mLayer )
+      {
       QString fileName( mLayer->source() );
       QFileInfo file( mLayer->source() );
       int pos = fileName.size() - file.suffix().size() - 1;
       fileName.insert( pos, tr( "-modified", "Georeferencer:QgsPointDialog.cpp - used to modify a user given file name" ) );
+
       pos = fileName.size() - file.suffix().size();
       fileName.replace( pos, fileName.size(), "tif" );
 
       leSelectModifiedRaster->setText( fileName );
       leSelectWorldFile->setText( guessWorldFileName( fileName ) );
-    }
+      }
   }
-  else
-  {
-    // Reset to the default file name
-    leSelectModifiedRaster->setText( "" );
-    enableModifiedRasterControls( false );
-    if ( mLayer )
-    {
-      leSelectWorldFile->setText( guessWorldFileName( mLayer->source() ) );
-    }
-  }
 }
 
-bool QgsPointDialog::generateWorldFile()
+
+bool QgsPointDialog::generateWorldFileAndWarp()
 {
   QgsPoint origin( 0, 0 );
   double pixelXSize = 1;
   double pixelYSize = 1;
   double rotation = 0;
+  int nReqOrder = 0;
+  bool bUseTPS = false;
 
   QString outputFileName = leSelectModifiedRaster->text();
   QString worldFileName = leSelectWorldFile->text();
 
+  if ( !outputFileName.isEmpty() )
+  {
+    if ( QFile::exists( outputFileName ) )
+    {
+      int r = QMessageBox::question( this, tr( "Error!" ),
+                                     tr( "<p>Modified raster file exists! Overwrite it?</p>" ),
+                                     QMessageBox::Yes | QMessageBox::Default,
+                                     QMessageBox::No | QMessageBox::Escape );
+      if ( r == QMessageBox::No )
+        return false;
+      else
+        QFile::remove( outputFileName );
+    }
+  }
+
+  if ( !worldFileName.isEmpty() )
+  {
+    if ( QFile::exists( worldFileName ) )
+    {
+      int r = QMessageBox::question( this, tr( "World file exists" ),
+                                     tr( "<p>The selected file already seems to have a " ) +
+                                     tr( "world file! Do you want to replace it with the " ) +
+                                     tr( "new world file?</p>" ),
+                                     QMessageBox::Yes | QMessageBox::Default,
+                                     QMessageBox::No | QMessageBox::Escape );
+      if ( r == QMessageBox::No )
+        return false;
+      else
+        QFile::remove( worldFileName );
+    }
+  }
+
   // create arrays with points from mPoints
   std::vector<QgsPoint> pixelCoords, mapCoords;
   for ( unsigned int i = 0; i < mPoints.size(); i++ )
@@ -262,7 +325,8 @@
 
   // compute the parameters using the least squares method
   // (might throw std::domain_error)
-  try
+  
+try
   {
     if ( cmbTransformType->currentText() == tr( "Linear" ) )
     {
@@ -287,66 +351,200 @@
     }
     else if ( cmbTransformType->currentText() == tr( "Affine" ) )
     {
-      QMessageBox::critical( this, tr( "Not implemented!" ),
+        QMessageBox::critical( this, tr( "Not implemented!" ),
                              tr( "<p>An affine transform requires changing the "
                                  "original raster file. This is not yet "
                                  "supported.</p>" ) );
       return false;
     }
-    else
+    else if (cmbTransformType->currentText() == tr("Polynomial 1"))
     {
+            QMessageBox::StandardButton res = QMessageBox::warning( this, tr( "Warning" ),
+                        tr( "<p>A Polynomial transform requires changing "
+                        "the raster layer.</p><p>The changed raster will be "
+                        "saved in a new file and a world file will be "
+                        "generated for this new file instead.</p><p>Are you "
+                         "sure that this is what you want?</p>" ) +
+                         "<p><i>" + tr( "Currently all modified files will be written in TIFF format." ) +
+                         "</i><p>", QMessageBox::Ok | QMessageBox::Cancel );
+      if ( res == QMessageBox::Cancel )
+        return false;
+      
+      if (mPoints.size() < 3) {
+            QMessageBox::critical(this, tr("Error"), tr("Requires at least 3 points"));
+            return false;
+      }
+
+      nReqOrder = 1;
+    } 
+    else if (cmbTransformType->currentText() == tr("Polynomial 2"))
+    {
+            QMessageBox::StandardButton res = QMessageBox::warning( this, tr( "Warning" ),
+                        tr( "<p>A Polynomial transform requires changing "
+                        "the raster layer.</p><p>The changed raster will be "
+                        "saved in a new file and a world file will be "
+                        "generated for this new file instead.</p><p>Are you "
+                         "sure that this is what you want?</p>" ) +
+                         "<p><i>" + tr( "Currently all modified files will be written in TIFF format." ) +
+                         "</i><p>", QMessageBox::Ok | QMessageBox::Cancel );
+      if ( res == QMessageBox::Cancel )
+        return false;
+
+      if (mPoints.size() < 6) {
+            QMessageBox::critical(this, tr("Error"), tr("Requires at least 6 points"));
+            return false;
+      }
+
+      nReqOrder = 2;
+    } 
+    else if (cmbTransformType->currentText() == tr("Polynomial 3"))
+    {
+            QMessageBox::StandardButton res = QMessageBox::warning( this, tr( "Warning" ),
+                        tr( "<p>A Polynomial transform requires changing "
+                        "the raster layer.</p><p>The changed raster will be "
+                        "saved in a new file and a world file will be "
+                        "generated for this new file instead.</p><p>Are you "
+                         "sure that this is what you want?</p>" ) +
+                         "<p><i>" + tr( "Currently all modified files will be written in TIFF format." ) +
+                         "</i><p>", QMessageBox::Ok | QMessageBox::Cancel );
+      if ( res == QMessageBox::Cancel )
+        return false;
+
+      if (mPoints.size() < 10) {
+            QMessageBox::critical(this, tr("Error"), tr("Requires at least 10 points"));
+            return false;
+      }
+
+      nReqOrder = 3;
+    }
+    else if (cmbTransformType->currentText() == tr("Thin plate spline (TPS)"))
+    {
+            QMessageBox::StandardButton res = QMessageBox::warning( this, tr( "Warning" ),
+                        tr( "<p>A Polynomial transform requires changing "
+                        "the raster layer.</p><p>The changed raster will be "
+                        "saved in a new file and a world file will be "
+                        "generated for this new file instead.</p><p>Are you "
+                         "sure that this is what you want?</p>" ) +
+                         "<p><i>" + tr( "Currently all modified files will be written in TIFF format." ) +
+                         "</i><p>", QMessageBox::Ok | QMessageBox::Cancel );
+      if ( res == QMessageBox::Cancel )
+        return false;
+
+      bUseTPS = true;
+    } 
+ else
+    {
       QMessageBox::critical( this, tr( "Not implemented!" ),
-                             tr( "<p>The %1 transform is not yet supported.</p>" )
-                             .arg( cmbTransformType->currentText() ) );
+                             tr( "<p>The " ) +
+                             cmbTransformType->currentText() +
+                             tr( " transform is not yet supported.</p>" ) );
       return false;
     }
   }
   catch ( std::domain_error& e )
   {
-    QMessageBox::critical( this, tr( "Error" ), e.what() );
+    QMessageBox::critical( this, tr( "Error" ), QString( e.what() ) );
     return false;
   }
 
-  // warp the raster if needed
-  double xOffset = 0;
-  double yOffset = 0;
-  if ( rotation != 0 )
+      bool useZeroForTrans;
+      QString compressionMethod;
+      QgsImageWarper::ResamplingMethod resampling;
+
+      if ( rotation != 0 ) {
+            // warp the raster if needed
+            double xOffset = 0;
+            double yOffset = 0;
+
+            QgsGeorefWarpOptionsDialog d( this );
+//	    d.move(0, 0);
+            d.exec();
+            QgsImageWarper warper( -rotation );
+            d.getWarpOptions( resampling, useZeroForTrans, compressionMethod );
+            //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 );
+
+            // write the world file
+            QFile file( worldFileName );
+            if ( !file.open( QIODevice::WriteOnly ) )
+            {
+            QMessageBox::critical( this, tr( "Error" ),
+                                 tr( "Could not write to " ) + worldFileName );
+            return false;
+            }
+            QTextStream stream( &file );
+            stream << QString::number( pixelXSize, 'f', 15 ) << endl
+            << 0 << endl
+            << 0 << endl
+            << QString::number( -pixelYSize, 'f', 15 ) << endl
+            << QString::number(( origin.x() - xOffset * pixelXSize ), 'f', 15 ) << endl
+            << QString::number(( origin.y() + yOffset * pixelYSize ), 'f', 15 ) << endl;
+      }
+      else if (nReqOrder != 0 || bUseTPS)
+      {
+            QgsGeorefWarpOptionsDialog d( this );
+//	    d.move(0, 0);
+            d.exec();
+            QgsImageWarper warper;
+            d.getWarpOptions( resampling, useZeroForTrans, compressionMethod );
+            //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;
+            }
+
+            QByteArray worldExt = worldFileName.mid(worldFileName.lastIndexOf('.') + 1, worldFileName.length()).toAscii();
+
+            if (!warper.warpgcp(mLayer->source(), outputFileName, worldExt.data(),
+                           mapCoords, pixelCoords, nReqOrder, resampling, useZeroForTrans,
+                           compressionMethod, bUseTPS))
+			{
+				QMessageBox::critical( this, tr( "Error" ), tr( "Failed to compute GCP transform: Transform is not solvable." ) );
+				return false;
+			}
+      }
+
+	// write the data points in case we need them later
+//  saveGCPs( mapCoords, pixelCoords );
+  return true;
+}
+
+void QgsPointDialog::loadGCPs(QString &fileName)
+{
+ 
+  QFile pointFile( fileName );
+  if ( pointFile.open( QIODevice::ReadOnly ) )
   {
-
-    QgsGeorefWarpOptionsDialog d( this );
-    d.exec();
-    bool useZeroForTrans;
-    QString compressionMethod;
-    QgsImageWarper::ResamplingMethod resampling;
-    QgsImageWarper warper( -rotation );
-    d.getWarpOptions( resampling, useZeroForTrans, compressionMethod );
-    //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 )
+    QTextStream points( &pointFile );
+    QString tmp;
+    // read the header
+    points >> tmp >> tmp >> tmp >> tmp;
+    // read the first line
+    double mapX, mapY, pixelX, pixelY;
+    points >> mapX >> mapY >> pixelX >> pixelY;
+    while ( !points.atEnd() )
     {
-      return false;
+      QgsPoint mapCoords( mapX, mapY );
+      QgsPoint pixelCoords( pixelX, pixelY );
+      addPoint( pixelCoords, mapCoords );
+      // read the next line
+      points >> mapX >> mapY >> pixelX >> pixelY;
     }
-    warper.warp( mLayer->source(), outputFileName,
-                 xOffset, yOffset, resampling, useZeroForTrans, compressionMethod );
   }
+  mCanvas->refresh();
+}
 
-  // write the world file
-  QFile file( worldFileName );
-  if ( !file.open( QIODevice::WriteOnly ) )
-  {
-    QMessageBox::critical( this, tr( "Error" ),
-                           tr( "Could not write to %1" ).arg( worldFileName ) );
-    return false;
-  }
-  QTextStream stream( &file );
-  stream << QString::number( pixelXSize, 'f', 15 ) << endl
-  << 0 << endl
-  << 0 << endl
-  << QString::number( -pixelYSize, 'f', 15 ) << endl
-  << QString::number(( origin.x() - xOffset * pixelXSize ), 'f', 15 ) << endl
-  << QString::number(( origin.y() + yOffset * pixelYSize ), 'f', 15 ) << endl;
-  // write the data points in case we need them later
+void QgsPointDialog::saveGCPs(std::vector<QgsPoint> mapCoords, std::vector<QgsPoint> pixelCoords )
+{
   QFile pointFile( mLayer->source() + ".points" );
   if ( pointFile.open( QIODevice::WriteOnly ) )
   {
@@ -359,10 +557,8 @@
                   arg( pixelCoords[i].x(), 0, 'f', 15 ).arg( pixelCoords[i].y(), 0, 'f', 15 ) ) << endl;
     }
   }
-  return true;
 }
 
-
 void QgsPointDialog::zoomIn()
 {
   mCanvas->setMapTool( mToolZoomIn );
@@ -402,7 +598,104 @@
   mCanvas->setMapTool( mToolDeletePoint );
 }
 
+void QgsPointDialog::on_pbnClose_clicked()
+{
+  close();
+}
 
+void QgsPointDialog::on_pbnSelectRaster_clicked()
+{
+  QSettings settings;
+  QString dir = settings.value( "/Plugin-GeoReferencer/rasterdirectory" ).toString();
+  if ( dir.isEmpty() )
+    dir = ".";
+  QString fileName =
+    QFileDialog::getOpenFileName( this,
+                                  tr( "Choose a raster file" ),
+                                  dir,
+                                  tr( "Raster files (*.*)" ) );
+
+  if ( fileName.isNull() )
+  {
+    return;
+  }
+  leSelectRaster->setText( fileName );
+
+  // do we think that this is a valid raster?
+  if ( !QgsRasterLayer::isValidRasterFileName( leSelectRaster->text() ) )
+  {
+    QMessageBox::critical( this, tr( "Error" ),
+                           tr( "The selected file is not a valid raster file." ) );
+    return;
+  }
+
+  // remember the directory
+  {
+    QSettings settings;
+    QFileInfo fileInfo( leSelectRaster->text() );
+    settings.setValue( "/Plugin-GeoReferencer/rasterdirectory",
+                       fileInfo.path() );
+  }
+
+  // guess the world file name
+  QString worldfile = guessWorldFileName(leSelectRaster->text());
+  
+  // check if there already is a world file
+  if ( !worldfile.isEmpty() )
+  {
+    if ( QFile::exists( worldfile ) )
+    {
+      int r = QMessageBox::question( this, tr( "World file exists" ),
+                                     tr( "<p>The selected file already seems to have a " ) +
+                                     tr( "world file! Do you want to replace it with the " ) +
+                                     tr( "new world file?</p>" ),
+                                     QMessageBox::Yes | QMessageBox::Default,
+                                     QMessageBox::No | QMessageBox::Escape );
+      if ( r == QMessageBox::No )
+        return;
+      else
+        QFile::remove( worldfile );
+    }
+  }
+
+  // XXX This is horrible, but it works and I'm tired / ll
+  {
+    QSettings settings;
+    QgsProject* prj = QgsProject::instance();
+    mProjBehaviour = settings.value( "/Projections/defaultBehaviour" ).toString();
+    mProjectCRS = prj->readEntry( "SpatialRefSys", "/ProjectCRSProj4String" );
+    mProjectCrsId = prj->readNumEntry( "SpatialRefSys", "/ProjectCrsId" );
+
+    settings.setValue( "/Projections/defaultBehaviour", "useProject" );
+    prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", GEOPROJ4 );
+    prj->writeEntry( "SpatialRefSys", "/ProjectCrsId", int( GEOCRS_ID ) );
+
+    settings.setValue( "/Projections/defaultBehaviour", mProjBehaviour );
+    prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", mProjectCRS );
+    prj->writeEntry( "SpatialRefSys", "/ProjectCrsId", mProjectCrsId );
+  }
+
+  openImageFile( fileName );
+//  mPointDialog->show();
+}
+
+QWidget* QgsPointDialog::findMainWindow()
+{
+  QWidget* result = 0;
+
+  QWidgetList topLevelWidgets = qApp->topLevelWidgets();
+  QWidgetList::iterator it = topLevelWidgets.begin();
+  for ( ; it != topLevelWidgets.end(); ++it )
+  {
+    if (( *it )->objectName() == "QgisApp" )
+    {
+      result = *it;
+      break;
+    }
+  }
+  return result;
+}
+
 void QgsPointDialog::showCoordDialog( QgsPoint& pixelCoords )
 {
   MapCoordsDialog* mcd = new MapCoordsDialog( pixelCoords, mIface->mapCanvas(), this );
@@ -411,7 +704,6 @@
   mcd->show();
 }
 
-
 void QgsPointDialog::deleteDataPoint( QgsPoint& coords )
 {
   std::vector<QgsGeorefDataPoint*>::iterator it = mPoints.begin();
@@ -436,45 +728,12 @@
 }
 
 
-void QgsPointDialog::enableRelevantControls()
-{
-  if ( cmbTransformType->currentText() == tr( "Linear" ) )
-  {
-    leSelectModifiedRaster->setEnabled( false );
-    pbnSelectModifiedRaster->setEnabled( false );
-  }
-  else
-  {
-    leSelectModifiedRaster->setEnabled( true );
-    pbnSelectModifiedRaster->setEnabled( true );
-  }
-
-  if (( cmbTransformType->currentText() == tr( "Linear" ) &&
-        !leSelectWorldFile->text().isEmpty() ) ||
-      ( !leSelectWorldFile->text().isEmpty() &&
-        !leSelectModifiedRaster->text().isEmpty() ) )
-  {
-    pbnGenerateWorldFile->setEnabled( true );
-    pbnGenerateAndLoad->setEnabled( true );
-  }
-  else
-  {
-    pbnGenerateWorldFile->setEnabled( false );
-    pbnGenerateAndLoad->setEnabled( false );
-  }
-}
-
-
 QString QgsPointDialog::guessWorldFileName( const QString& raster )
 {
   int point = raster.lastIndexOf( '.' );
   QString worldfile = "";
   if ( point != -1 && point != raster.length() - 1 )
-  {
-    worldfile = raster.left( point + 1 );
-    //MH: suffix .wld seems to be fine for most GDAL drivers
-    worldfile += "wld";
-  }
+      worldfile = raster.left( point + 1) + "wld";
   return worldfile;
 }
 
@@ -489,6 +748,7 @@
 {
   setupUi( this );
 
+  setAttribute( Qt::WA_DeleteOnClose );
   // setup actions
   //
   mActionZoomIn = new QAction( getThemeIcon( "/mActionZoomIn.png" ), tr( "Zoom In" ), this );
@@ -526,7 +786,7 @@
   mActionZoomIn->setCheckable( true );
   mMapToolGroup->addAction( mActionZoomIn );
   mActionZoomOut->setCheckable( true );
-  mMapToolGroup->addAction( mActionZoomOut );
+//  mMapToolGroup->addAction( mActionZoomOut );
   mMapToolGroup->addAction( mActionZoomToLayer );
   mActionAddPoint->setCheckable( true );
   mMapToolGroup->addAction( mActionAddPoint );
@@ -571,11 +831,14 @@
   // set the currently supported transforms
   cmbTransformType->addItem( tr( "Linear" ) );
   cmbTransformType->addItem( tr( "Helmert" ) );
+  cmbTransformType->addItem( tr( "Polynomial 1" ) );
+  cmbTransformType->addItem( tr( "Polynomial 2" ) );
+  cmbTransformType->addItem( tr( "Polynomial 3" ) );
+  cmbTransformType->addItem( tr( "Thin plate spline (TPS)" ) );
 
   enableModifiedRasterControls( false );
   addPoint();
 
-  pbnGenerateWorldFile->setEnabled( false );
   pbnGenerateAndLoad->setEnabled( false );
 }
 

Modified: trunk/qgis/src/plugins/georeferencer/qgspointdialog.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgspointdialog.h	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgspointdialog.h	2009-02-04 21:45:50 UTC (rev 10107)
@@ -43,27 +43,36 @@
     void openImageFile( QString layerPath );
     void showCoordDialog( QgsPoint& pixelCoords );
     void deleteDataPoint( QgsPoint& pixelCoords );
+    static QWidget* findMainWindow();
 
   public slots:
 
     void addPoint( const QgsPoint& pixelCoords, const QgsPoint& mapCoords );
+    void on_pbnClose_clicked();
+    void on_pbnSelectRaster_clicked();
     void on_pbnGenerateWorldFile_clicked();
     void on_pbnGenerateAndLoad_clicked();
     void on_pbnSelectWorldFile_clicked();
     void on_pbnSelectModifiedRaster_clicked();
+    void on_pbnSaveGCPs_clicked();
+    void on_pbnLoadGCPs_clicked();
     void on_cmbTransformType_currentIndexChanged( const QString& );
+    void on_leSelectModifiedRaster_textChanged(const QString &);
     void zoomIn();
     void zoomOut();
     void zoomToLayer();
     void pan();
     void addPoint();
     void deletePoint();
-    void enableRelevantControls( void );
+//    void enableRelevantControls( void );
 
   private:
 
     void initialize();
-    bool generateWorldFile();
+    bool generateWorldFileAndWarp();
+    bool helmertWarp();
+	void loadGCPs(QString &);
+    void saveGCPs( std::vector<QgsPoint>, std::vector<QgsPoint> );
     QString guessWorldFileName( const QString& raster );
 
     void enableModifiedRasterControls( bool state );
@@ -86,6 +95,13 @@
     QgsMapTool* mToolAddPoint;
     QgsMapTool* mToolDeletePoint;
 
+    QString mProjBehaviour, mProjectCRS;
+    int mProjectCrsId;
+    /**dialog to enter reference point*/
+//    QgsPointDialog* mPointDialog;
+    /**Flag if plugin windows have been arranged with button*/
+//    QSize origSize;
+//    QPoint origPos;
 
 //  std::vector<QgsPoint> mPixelCoords, mMapCoords;
 //  std::vector<QString> mAcetateIDs;

Modified: trunk/qgis/src/plugins/georeferencer/qgspointdialogbase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgspointdialogbase.ui	2009-02-04 21:09:26 UTC (rev 10106)
+++ trunk/qgis/src/plugins/georeferencer/qgspointdialogbase.ui	2009-02-04 21:45:50 UTC (rev 10107)
@@ -5,266 +5,240 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>335</width>
-    <height>433</height>
+    <width>550</width>
+    <height>564</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Reference points</string>
   </property>
-  <property name="windowIcon" >
-   <iconset resource="georeferencer.qrc" >:/icon.png</iconset>
-  </property>
   <property name="autoFillBackground" >
    <bool>true</bool>
   </property>
-  <layout class="QGridLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
-    <number>6</number>
-   </property>
-   <item row="4" column="3" >
-    <widget class="QPushButton" name="pbnSelectWorldFile" >
-     <property name="text" >
-      <string>...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="3" >
-    <widget class="QPushButton" name="pbnSelectModifiedRaster" >
-     <property name="text" >
-      <string>...</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0" colspan="2" >
-    <widget class="QLabel" name="lblSelectModifiedRaster" >
-     <property name="text" >
-      <string>Modified raster:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0" colspan="2" >
-    <widget class="QLabel" name="textLabel1" >
-     <property name="text" >
-      <string>World file:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="2" >
-    <widget class="QLineEdit" name="leSelectModifiedRaster" />
-   </item>
-   <item row="4" column="2" >
-    <widget class="QLineEdit" name="leSelectWorldFile" />
-   </item>
-   <item row="2" column="0" colspan="2" >
-    <widget class="QLabel" name="textLabel2" >
-     <property name="text" >
-      <string>Transform type:</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="2" colspan="2" >
-    <widget class="QComboBox" name="cmbTransformType" />
-   </item>
-   <item row="5" column="0" >
-    <widget class="QPushButton" name="pbnGenerateWorldFile" >
-     <property name="text" >
-      <string>Create</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="2" >
-    <widget class="QFrame" name="frame5" >
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>0</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="frameShape" >
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow" >
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QHBoxLayout" >
-      <property name="margin" >
-       <number>11</number>
-      </property>
-      <property name="spacing" >
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QToolButton" name="tbnAddPoint" >
-        <property name="toolTip" >
-         <string>Add points</string>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2" >
+     <item>
+      <widget class="QFrame" name="frame4" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="frameShape" >
+        <enum>QFrame::NoFrame</enum>
+       </property>
+       <property name="frameShadow" >
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QHBoxLayout" >
+        <property name="spacing" >
+         <number>0</number>
         </property>
-        <property name="text" >
-         <string/>
+        <property name="margin" >
+         <number>11</number>
         </property>
-        <property name="icon" >
-         <iconset/>
+        <item>
+         <widget class="QToolButton" name="tbnZoomIn" >
+          <property name="toolTip" >
+           <string>Zoom in</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="tbnZoomOut" >
+          <property name="toolTip" >
+           <string>Zoom out</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="tbnZoomToLayer" >
+          <property name="toolTip" >
+           <string>Zoom to the raster extents</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="tbnPan" >
+          <property name="toolTip" >
+           <string>Pan</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <widget class="QFrame" name="frame5" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="frameShape" >
+        <enum>QFrame::NoFrame</enum>
+       </property>
+       <property name="frameShadow" >
+        <enum>QFrame::Raised</enum>
+       </property>
+       <layout class="QHBoxLayout" >
+        <property name="spacing" >
+         <number>0</number>
         </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
+        <property name="margin" >
+         <number>11</number>
         </property>
-        <property name="checkable" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="tbnDeletePoint" >
-        <property name="enabled" >
-         <bool>true</bool>
-        </property>
-        <property name="toolTip" >
-         <string>Delete points</string>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-        <property name="icon" >
-         <iconset/>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="checkable" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
+        <item>
+         <widget class="QToolButton" name="tbnAddPoint" >
+          <property name="toolTip" >
+           <string>Add points</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QToolButton" name="tbnDeletePoint" >
+          <property name="enabled" >
+           <bool>true</bool>
+          </property>
+          <property name="toolTip" >
+           <string>Delete points</string>
+          </property>
+          <property name="text" >
+           <string/>
+          </property>
+          <property name="icon" >
+           <iconset>
+            <normaloff/>
+           </iconset>
+          </property>
+          <property name="iconSize" >
+           <size>
+            <width>22</width>
+            <height>22</height>
+           </size>
+          </property>
+          <property name="checkable" >
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>13</width>
+         <height>13</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
    </item>
-   <item row="0" column="0" colspan="2" >
-    <widget class="QFrame" name="frame4" >
+   <item>
+    <widget class="QFrame" name="canvasFrame" >
      <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>0</hsizetype>
-       <vsizetype>0</vsizetype>
+      <sizepolicy vsizetype="Expanding" hsizetype="Minimum" >
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
-     <property name="frameShape" >
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow" >
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QHBoxLayout" >
-      <property name="margin" >
-       <number>11</number>
-      </property>
-      <property name="spacing" >
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QToolButton" name="tbnZoomIn" >
-        <property name="toolTip" >
-         <string>Zoom in</string>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-        <property name="icon" >
-         <iconset/>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="checkable" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="tbnZoomOut" >
-        <property name="toolTip" >
-         <string>Zoom out</string>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-        <property name="icon" >
-         <iconset/>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="checkable" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="tbnZoomToLayer" >
-        <property name="toolTip" >
-         <string>Zoom to the raster extents</string>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-        <property name="icon" >
-         <iconset/>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="checkable" >
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QToolButton" name="tbnPan" >
-        <property name="toolTip" >
-         <string>Pan</string>
-        </property>
-        <property name="text" >
-         <string/>
-        </property>
-        <property name="icon" >
-         <iconset/>
-        </property>
-        <property name="iconSize" >
-         <size>
-          <width>22</width>
-          <height>22</height>
-         </size>
-        </property>
-        <property name="checkable" >
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item row="1" column="0" colspan="4" >
-    <widget class="QFrame" name="canvasFrame" >
      <property name="autoFillBackground" >
       <bool>false</bool>
      </property>
@@ -276,29 +250,145 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="1" colspan="3" >
-    <widget class="QPushButton" name="pbnGenerateAndLoad" >
-     <property name="text" >
-      <string>Create and load layer</string>
-     </property>
-    </widget>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout" >
+     <item>
+      <layout class="QGridLayout" name="gridLayout" >
+       <item row="0" column="0" >
+        <widget class="QLabel" name="textLabel1_2" >
+         <property name="text" >
+          <string>Raster file:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1" colspan="3" >
+        <widget class="QLineEdit" name="leSelectRaster" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="4" >
+        <widget class="QPushButton" name="pbnSelectRaster" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text" >
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0" >
+        <widget class="QLabel" name="textLabel2" >
+         <property name="text" >
+          <string>Transform type:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1" colspan="4" >
+        <widget class="QComboBox" name="cmbTransformType" />
+       </item>
+       <item row="2" column="0" >
+        <widget class="QLabel" name="lblSelectModifiedRaster" >
+         <property name="text" >
+          <string>Modified raster:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1" colspan="3" >
+        <widget class="QLineEdit" name="leSelectModifiedRaster" />
+       </item>
+       <item row="2" column="4" >
+        <widget class="QPushButton" name="pbnSelectModifiedRaster" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" >
+        <widget class="QLabel" name="textLabel1" >
+         <property name="text" >
+          <string>World file:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1" colspan="3" >
+        <widget class="QLineEdit" name="leSelectWorldFile" />
+       </item>
+       <item row="3" column="4" >
+        <widget class="QPushButton" name="pbnSelectWorldFile" >
+         <property name="text" >
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="0" >
+        <widget class="QPushButton" name="pbnGenerateWorldFile" >
+         <property name="text" >
+          <string>Create</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1" >
+        <widget class="QPushButton" name="pbnGenerateAndLoad" >
+         <property name="text" >
+          <string>Create and load layer</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="4" >
+        <widget class="QPushButton" name="pbnClose" >
+         <property name="sizePolicy" >
+          <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text" >
+          <string>Close</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="3" >
+        <widget class="QPushButton" name="pbnSaveGCPs" >
+         <property name="text" >
+          <string>Save GCPs</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="2" >
+        <widget class="QPushButton" name="pbnLoadGCPs" >
+         <property name="text" >
+          <string>Load GCPs</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>18</width>
+         <height>17</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
    </item>
-   <item row="0" column="3" >
-    <spacer>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>41</width>
-       <height>53</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <layoutdefault spacing="6" margin="11" />



More information about the QGIS-commit mailing list