Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

omggdalrastercontour.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Tim Sutton   *
00003  *   tim@linfiniti.com   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include "omggdalrastercontour.h"
00022 #include "omglayerselector.h"
00023 
00024 //qt includes
00025 #include <QSettings>
00026 #include <QFileDialog>
00027 #include <QString>
00028 #include <QMessageBox>
00029 #include <QListWidget>
00030 #include <QListWidgetItem>
00031 #include <QLineEdit>
00032 
00033 OmgGdalRasterContour::OmgGdalRasterContour(QWidget* parent, Qt::WFlags fl)
00034     : QDialog(parent,fl) 
00035 {
00036   //required by Qt4 to initialise the ui
00037   setupUi(this);
00038   readSettings();
00039   connect(&mOmgGdal, SIGNAL(error(QString)), this, SLOT(error(QString)));
00040   connect(&mOmgGdal, SIGNAL(updateProgress(int, int )), this, SLOT(updateProgress(int, int )));
00041   //connect(&mOmgGdal, SIGNAL(contourComplete()), this, SLOT(contourComplete()));
00042 }
00043 
00044 OmgGdalRasterContour::~OmgGdalRasterContour()
00045 {}
00046 
00047 void OmgGdalRasterContour::accept()
00048 {
00049   writeSettings();
00050   done(1);
00051 }
00052 
00053 void OmgGdalRasterContour::on_pbnSelectFile_clicked()
00054 {
00055   QStringList myList;
00056   QSettings mySettings;
00057   QString myBaseDir = mySettings.value("gdalrastercontour/layersDirectory","c:\tmp").toString(); //initial dir
00058   OmgLayerSelector myOmgLayerSelector (myBaseDir, this);
00059   if(myOmgLayerSelector.exec())
00060   {
00061     myList=myOmgLayerSelector.getSelectedLayers();
00062     mySettings.setValue("gdalrastercontour/layersDirectory",myOmgLayerSelector.getBaseDir());
00063     lstInputFiles->addItems(myList);
00064   }
00065 }
00066 
00067 void OmgGdalRasterContour::on_pbnSelectDir_clicked()
00068 {
00069   QSettings mySettings;
00070   QString myLastDir = mySettings.value("gdalrastercontour/outputDirectory","c:\tmp").toString(); //initial dir
00071   QString myDir = QFileDialog::getExistingDirectory(
00072                     this,
00073                     "Choose a directory",
00074                     myLastDir);
00075 
00076   mySettings.setValue("gdalrastercontour/outputDirectory",myDir);
00077   leOutputDir->setText(myDir);
00078 }
00079 
00080 void OmgGdalRasterContour::on_pbnProcess_clicked()
00081 {
00082   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
00083 
00084   // Iterate through file list and process
00085   for ( int myFileInt = 0; myFileInt < lstInputFiles->count(); myFileInt++ )
00086   {
00087     QListWidgetItem *myFileItem = lstInputFiles->item( myFileInt );
00088     mOmgGdal.contour(myFileItem->text());
00089     //mOmgGdal.contour(myFileItem->text(), leOutputDir->text());
00090     progressBar->reset();
00091   }
00092   QApplication::restoreOverrideCursor();
00093 }
00094 
00095 void OmgGdalRasterContour::readSettings()
00096 {
00097 }
00098 
00099 void OmgGdalRasterContour::writeSettings()
00100 {
00101 }
00102 
00103 void OmgGdalRasterContour::error(QString theError)
00104 {
00105   QMessageBox::warning( this,QString(tr("File Format Converter Error")),theError);
00106 }
00107 
00108 void OmgGdalRasterContour::updateProgress (int theCurrentValue, int theMaximumValue)
00109 {
00110   progressBar->setMaximum(theMaximumValue);
00111   progressBar->setValue(theCurrentValue);
00112   QApplication::processEvents();
00113 }

Generated on Mon Apr 28 15:07:18 2008 for openModellerDesktop by  doxygen 1.4.1-20050210