dump/FillPits/fillpits.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Form implementation generated from reading ui file 'fillpits.ui'
00003 **
00004 ** Created: Sat Feb 3 18:37:25 2007
00005 **      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.1   edited Nov 24 13:47 $)
00006 **
00007 ** WARNING! All changes made in this file will be lost!
00008 ****************************************************************************/
00009 
00010 #include "fillpits.h"
00011 
00012 #include <qvariant.h>
00013 #include <qbuttongroup.h>
00014 #include <qlineedit.h>
00015 #include <qpushbutton.h>
00016 #include <qlabel.h>
00017 #include <qtextbrowser.h>
00018 #include <qcheckbox.h>
00019 #include <qlayout.h>
00020 #include <qtooltip.h>
00021 #include <qwhatsthis.h>
00022 
00023 #include <qstring.h>
00024 #include <qfiledialog.h>
00025 //#include <qgsrasterlayer.h>
00026 //#include <qapplication.h>
00027 //#include <qgsrasterlayerproperties.h>
00028 
00029 #include "./pihmLIBS/helpDialog/helpdialog.h"
00030 #include "./pihmRasterLIBS/lsm.h"
00031 #include "./pihmRasterLIBS/flood.h"
00032 
00033 //int flood(char *demfile, char *pointfile, char *newfile);
00034 /*
00035  *  Constructs a FillPits as a child of 'parent', with the
00036  *  name 'name' and widget flags set to 'f'.
00037  *
00038  *  The dialog will by default be modeless, unless you set 'modal' to
00039  *  TRUE to construct a modal dialog.
00040  */
00041 FillPits::FillPits( QWidget* parent, const char* name, bool modal, WFlags fl )
00042     : QDialog( parent, name, modal, fl )
00043 {
00044     if ( !name )
00045         setName( "FillPits" );
00046 
00047     buttonGroup1 = new QButtonGroup( this, "buttonGroup1" );
00048     buttonGroup1->setGeometry( QRect( 10, 10, 581, 101 ) );
00049 
00050     inputFileLineEdit = new QLineEdit( buttonGroup1, "inputFileLineEdit" );
00051     inputFileLineEdit->setGeometry( QRect( 130, 41, 325, 29 ) );
00052 
00053     inputBrowseButton = new QPushButton( buttonGroup1, "inputBrowseButton" );
00054     inputBrowseButton->setGeometry( QRect( 470, 40, 81, 32 ) );
00055     inputBrowseButton->setAutoMask( FALSE );
00056     inputBrowseButton->setToggleButton( FALSE );
00057     inputBrowseButton->setOn( FALSE );
00058     inputBrowseButton->setAutoDefault( FALSE );
00059     inputBrowseButton->setFlat( FALSE );
00060 
00061     textLabel1 = new QLabel( buttonGroup1, "textLabel1" );
00062     textLabel1->setGeometry( QRect( 30, 40, 70, 31 ) );
00063 
00064     runButton = new QPushButton( this, "runButton" );
00065     runButton->setGeometry( QRect( 510, 229, 81, 32 ) );
00066     runButton->setAutoMask( FALSE );
00067     runButton->setAutoDefault( FALSE );
00068 
00069     helpButton = new QPushButton( this, "helpButton" );
00070     helpButton->setGeometry( QRect( 10, 229, 81, 32 ) );
00071     helpButton->setAutoMask( FALSE );
00072     helpButton->setAutoDefault( FALSE );
00073 
00074     closeButton = new QPushButton( this, "closeButton" );
00075     closeButton->setGeometry( QRect( 424, 229, 81, 32 ) );
00076     closeButton->setAutoMask( FALSE );
00077     closeButton->setAutoDefault( FALSE );
00078 
00079     messageLog = new QTextBrowser( this, "messageLog" );
00080     messageLog->setGeometry( QRect( 10, 269, 581, 130 ) );
00081 
00082     buttonGroup2 = new QButtonGroup( this, "buttonGroup2" );
00083     buttonGroup2->setGeometry( QRect( 10, 120, 581, 100 ) );
00084 
00085     outputFileLineEdit = new QLineEdit( buttonGroup2, "outputFileLineEdit" );
00086     outputFileLineEdit->setGeometry( QRect( 130, 41, 325, 29 ) );
00087 
00088     outputBrowseButton = new QPushButton( buttonGroup2, "outputBrowseButton" );
00089     outputBrowseButton->setGeometry( QRect( 470, 40, 81, 32 ) );
00090     outputBrowseButton->setAutoMask( FALSE );
00091     outputBrowseButton->setAutoDefault( FALSE );
00092 
00093     textLabel1_2 = new QLabel( buttonGroup2, "textLabel1_2" );
00094     textLabel1_2->setGeometry( QRect( 30, 40, 90, 31 ) );
00095 
00096     showPF_DFrame = new QCheckBox( buttonGroup2, "showPF_DFrame" );
00097     showPF_DFrame->setGeometry( QRect( 336, 73, 140, 21 ) );
00098     QFont showPF_DFrame_font(  showPF_DFrame->font() );
00099     showPF_DFrame_font.setPointSize( 8 );
00100     showPF_DFrame->setFont( showPF_DFrame_font ); 
00101     showPF_DFrame->setChecked( TRUE );
00102     languageChange();
00103     resize( QSize(604, 409).expandedTo(minimumSizeHint()) );
00104     clearWState( WState_Polished );
00105 
00106     // signals and slots connections
00107     connect( inputBrowseButton, SIGNAL( clicked() ), this, SLOT( handleInputBrowseButton() ) );
00108     connect( outputBrowseButton, SIGNAL( clicked() ), this, SLOT( handleOutputBrowseButton() ) );
00109     connect( runButton, SIGNAL( clicked() ), this, SLOT( handleRunButton() ) );
00110     connect( helpButton, SIGNAL( clicked() ), this, SLOT( handleHelpButton() ) );
00111     connect( closeButton, SIGNAL( clicked() ), this, SLOT( close() ) );
00112 }
00113 
00114 /*
00115  *  Destroys the object and frees any allocated resources
00116  */
00117 FillPits::~FillPits()
00118 {
00119     // no need to delete child widgets, Qt does it all for us
00120 }
00121 
00122 /*
00123  *  Sets the strings of the subwidgets using the current
00124  *  language.
00125  */
00126 void FillPits::languageChange()
00127 {
00128     setCaption( tr( "Fill Pits" ) );
00129     buttonGroup1->setTitle( tr( "Input" ) );
00130     inputBrowseButton->setText( tr( "Browse" ) );
00131     textLabel1->setText( tr( "DEM Grid" ) );
00132     runButton->setText( tr( "Run" ) );
00133     helpButton->setText( tr( "Help" ) );
00134     closeButton->setText( tr( "Close" ) );
00135     buttonGroup2->setTitle( tr( "Output" ) );
00136     outputBrowseButton->setText( tr( "Browse" ) );
00137     textLabel1_2->setText( tr( "Pit-Filled Grid" ) );
00138     showPF_DFrame->setText( tr( "Load in Data Frame" ) );
00139 }
00140 
00141 void FillPits::handleInputBrowseButton()
00142 {
00143     //qWarning( "FillPits::handleInputBrowseButton(): Not implemented yet" );
00144     QString temp = QFileDialog::getOpenFileName("~/","DEM Grid File(*.adf *.asc)",this,"open file dialog", "Select file");
00145     inputFileLineEdit->setText(temp);
00146 }
00147 
00148 void FillPits::handleOutputBrowseButton()
00149 {
00150     //qWarning( "FillPits::handleOutputBrowseButton(): Not implemented yet" );
00151     QString temp = QFileDialog::getSaveFileName(NULL,"Grid File(*.asc)",this,"Save file dialog", "Select file");
00152     QString tmp  = temp;
00153     if(!(tmp.lower()).endsWith(".asc")){
00154         tmp.append(".asc");
00155         temp = tmp;
00156         }
00157     outputFileLineEdit->setText(temp);
00158 }
00159 
00160 void FillPits::handleRunButton()
00161 {
00162     //qWarning( "FillPits::handleRunButton(): Not implemented yet" );
00163     QString inputFileName((inputFileLineEdit->text()).ascii());
00164     QString outputFileName((outputFileLineEdit->text()).ascii());
00165     int err = flood((char *)inputFileName.ascii(), "dummy", (char *)outputFileName.ascii() );
00166     if(showPF_DFrame->isChecked() == 1){
00167         //QgsRasterLayer *tempLayer = new QgsRasterLayer("/backup/pihm/RasterProcessing/FillPits", "morgedem.asc");
00168     }
00169          
00170          
00171 }
00172 
00173 void FillPits::handleHelpButton()
00174 {
00175     //qWarning( "FillPits::handleHelpButton(): Not implemented yet" );
00176     helpDialog* hlpDlg = new helpDialog(NULL,NULL,TRUE,0,"/root/QGIS/qgis-0.6.0/plugins/latest_test/Help/shpFileInputDialog.html","Help: Merger Features");
00177     hlpDlg->show();
00178 }
00179 

Generated on Sun Aug 5 17:33:58 2007 for PIHMgis by  doxygen 1.5.2