Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove Qt3 stuff
Change #includes to Qt4 form
Remove unnecessary #includes


git-svn-id: http://svn.osgeo.org/qgis/trunk@5750 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 2, 2006
1 parent 7c7acf5 commit 1961fea
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 256 deletions.
4 changes: 1 addition & 3 deletions src/plugins/georeferencer/mapcoordsdialog.cpp
@@ -1,6 +1,4 @@
#include <qlineedit.h>
#include <qvalidator.h>

#include <QValidator>
#include <mapcoordsdialog.h>


Expand Down
13 changes: 0 additions & 13 deletions src/plugins/georeferencer/plugin.cpp
Expand Up @@ -46,19 +46,6 @@
#include <qgsmaplayer.h>
#include <qgsrasterlayer.h>
#include "plugin.h"
#include <q3toolbar.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <q3popupmenu.h>
#include <qlineedit.h>
#include <qaction.h>
#include <qapplication.h>
#include <qcursor.h>
#include <QMenu>
//
//non qt includes
//
#include <iostream>

//
//the gui subclass
Expand Down
5 changes: 1 addition & 4 deletions src/plugins/georeferencer/plugin.h
Expand Up @@ -50,8 +50,7 @@
//
//QT Includes
//
#include <qwidget.h>
#include <Q3ToolBar>
#include <QWidget>

/**
* \class Plugin
Expand Down Expand Up @@ -103,8 +102,6 @@ public slots:
////////////////////////////////////////////////////////////////////

int mPluginType;
//! Pointer to our toolbar
Q3ToolBar *mToolBarPointer;
//! Pionter to QGIS main application object
QgisApp *mQGisApp;
//! Pointer to the QGIS interface object
Expand Down
130 changes: 53 additions & 77 deletions src/plugins/georeferencer/pluginguibase.ui
Expand Up @@ -25,78 +25,33 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="3" >
<widget class="QLineEdit" name="leSelectRaster" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="4" >
<widget class="QPushButton" name="pbnSelectRaster" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="3" colspan="2" >
<widget class="QPushButton" name="pbnEnterWorldCoords" >
<item row="1" column="2" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<string>Enter world coordinates</string>
<string>Raster file:</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3" >
<widget class="Q3TextEdit" name="teInstructions_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>6</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style="font-size:11pt;font-family:Tahoma">
&lt;p style="margin-top:16px" dir="ltr">&lt;span style="font-size:14pt;font-weight:600">Description&lt;/span>&lt;/p>
&lt;p dir="ltr">This plugin can generate world files for rasters. You select points on the raster and give their world coordinates, and the plugin will compute the world file parameters. The more coordinates you can provide the better the result will be.&lt;/p>
&lt;/body>&lt;/html>
</string>
</property>
<property name="wordWrap" >
<enum>Q3TextEdit::WidgetWidth</enum>
<widget class="QTextEdit" name="textEdit" >
<property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:11pt; font-weight:600;">Description&lt;/span>&lt;/p>&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This plugin can generate world files for rasters. You select points on the raster and give their world coordinates, and the plugin will compute the world file parameters. The more coordinates you can provide the better the result will be.&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item rowspan="3" row="0" column="1" >
<widget class="Line" name="line1" >
<item rowspan="3" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel2" >
<property name="maximumSize" >
<size>
<width>2</width>
<width>150</width>
<height>32767</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::VLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
<property name="pixmap" >
<pixmap resource="georeferencer.qrc" >:/georef.png</pixmap>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
</item>
Expand Down Expand Up @@ -133,42 +88,63 @@
</item>
</layout>
</item>
<item rowspan="3" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel2" >
<item rowspan="3" row="0" column="1" >
<widget class="Line" name="line1" >
<property name="maximumSize" >
<size>
<width>150</width>
<width>2</width>
<height>32767</height>
</size>
</property>
<property name="pixmap" >
<pixmap resource="georeferencer.qrc" >:/georef.png</pixmap>
<property name="frameShape" >
<enum>QFrame::VLine</enum>
</property>
<property name="scaledContents" >
<bool>true</bool>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="textLabel1" >
<item row="2" column="3" colspan="2" >
<widget class="QPushButton" name="pbnEnterWorldCoords" >
<property name="text" >
<string>Raster file:</string>
<string>Enter world coordinates</string>
</property>
</widget>
</item>
<item row="1" column="4" >
<widget class="QPushButton" name="pbnSelectRaster" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QLineEdit" name="leSelectRaster" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3TextEdit</class>
<extends></extends>
<header>q3textedit.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<resources>
<include location="georeferencer.qrc" />
</resources>
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/georeferencer/qgsgeorefwarpoptionsdialog.cpp
@@ -1,7 +1,3 @@
#include <iostream>

#include <qcheckbox.h>
#include <QComboBox>

#include "qgsgeorefwarpoptionsdialog.h"

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsimagewarper.h
Expand Up @@ -2,7 +2,7 @@
#define QGSIMAGEWARPER_H

#include <gdalwarper.h>
#include <qstring.h>
#include <QString>


class QgsImageWarper {
Expand Down
14 changes: 8 additions & 6 deletions src/plugins/georeferencer/qgsleastsquares.cpp
Expand Up @@ -3,6 +3,8 @@

#include <gsl/gsl_linalg.h>

#include <QObject>

#include "qgsleastsquares.h"


Expand All @@ -11,8 +13,8 @@ void QgsLeastSquares::linear(std::vector<QgsPoint> mapCoords,
QgsPoint& origin, double& pixelSize) {
int n = mapCoords.size();
if (n < 2) {
throw std::domain_error("Fit to a linear transform requires at "
"least 2 points.");
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),
Expand Down Expand Up @@ -48,8 +50,8 @@ void QgsLeastSquares::helmert(std::vector<QgsPoint> mapCoords,
double& rotation) {
int n = mapCoords.size();
if (n < 2) {
throw std::domain_error("Fit to a Helmert transform requires at "
"least 2 points.");
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;
Expand Down Expand Up @@ -100,8 +102,8 @@ void QgsLeastSquares::affine(std::vector<QgsPoint> mapCoords,
std::vector<QgsPoint> pixelCoords) {
int n = mapCoords.size();
if (n < 4) {
throw std::domain_error("Fit to an affine transform requires at "
"least 4 points.");
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,
Expand Down
23 changes: 11 additions & 12 deletions src/plugins/georeferencer/qgspointdialog.cpp
@@ -1,6 +1,5 @@
#include <cmath>

#include <Q3Frame>
#include <QPushButton>
#include <QComboBox>
#include <QFileDialog>
Expand Down Expand Up @@ -223,15 +222,15 @@ void QgsPointDialog::on_pbnGenerateAndLoad_clicked()
void QgsPointDialog::on_pbnSelectWorldFile_clicked()
{
QString filename = QFileDialog::getSaveFileName(this,
"Choose a name for the world file", ".");
tr("Choose a name for the world file"), ".");
leSelectWorldFile->setText(filename);
}


void QgsPointDialog::on_pbnSelectModifiedRaster_clicked()
{
QString filename = QFileDialog::getSaveFileName(this,
"Choose a name for the world file", ".");
tr("Choose a name for the world file"), ".");
if (filename.right(4) != ".tif")
filename += ".tif";
leSelectModifiedRaster->setText(filename);
Expand Down Expand Up @@ -264,29 +263,29 @@ bool QgsPointDialog::generateWorldFile()
}
else if (cmbTransformType->currentItem() == 1)
{
int res = QMessageBox::warning(this, "Warning",
"A Helmert transform requires modifications in "
int res = QMessageBox::warning(this, tr("Warning"),
tr("A Helmert transform requires modifications in "
"the raster layer.\nThe modifed raster will be "
"saved in a new file and a world file will be "
"generated for this new file instead.\nAre you "
"sure that this is what you want?",
"sure that this is what you want?"),
QMessageBox::No, QMessageBox::Yes);
if (res == QMessageBox::No)
return false;
QgsLeastSquares::helmert(mapCoords, pixelCoords, origin, pixelSize, rotation);
}
else if (cmbTransformType->currentItem() == 2)
{
QMessageBox::critical(this, "Not implemented!",
"An affine transform requires changing the "
QMessageBox::critical(this, tr("Not implemented!"),
tr("An affine transform requires changing the "
"original raster file. This is not yet "
"supported.");
"supported."));
return false;
}
}
catch (std::domain_error& e)
{
QMessageBox::critical(this, "Error", QString(e.what()));
QMessageBox::critical(this, tr("Error"), QString(e.what()));
return false;
}

Expand All @@ -308,8 +307,8 @@ bool QgsPointDialog::generateWorldFile()
QFile file(leSelectWorldFile->text());
if (!file.open(QIODevice::WriteOnly))
{
QMessageBox::critical(this, "Error",
"Could not write to " + leSelectWorldFile->text());
QMessageBox::critical(this, tr("Error"),
tr("Could not write to ") + leSelectWorldFile->text());
return false;
}
QTextStream stream(&file);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/georeferencer/qgspointdialog.h
Expand Up @@ -14,14 +14,14 @@

#include <vector>

#include <qcursor.h>
//#include <QCursor>
#include <QDialog>

#include <qgsmapcanvas.h>

#include "qgsrasterlayer.h"

#include <ui_qgspointdialogbase.h>
#include <QDialog>

class QAction;
class QActionGroup;
Expand Down

0 comments on commit 1961fea

Please sign in to comment.