This is an automated email from the git hooks/post-receive script. sebastic-guest pushed a commit to branch upstream-master in repository pktools.
commit 11d0102bc8e4b2cbbca75b7111e39f074f1eddb7 Author: Pieter Kempeneers <pieter.kempene...@vito.be> Date: Fri Mar 21 18:18:26 2014 +0100 from windows --- qt/pkclassify_svm/main.cpp | 11 + qt/pkclassify_svm/mainwindow.cpp | 152 ++++++++++ qt/pkclassify_svm/mainwindow.h | 51 ++++ qt/pkclassify_svm/mainwindow.ui | 573 +++++++++++++++++++++++++++++++++++ qt/pkclassify_svm/pkclassify_svm.pro | 20 ++ qt/pkinfo/mainwindow.cpp | 10 +- qt/pkinfo/mainwindow.ui | 4 +- 7 files changed, 815 insertions(+), 6 deletions(-) diff --git a/qt/pkclassify_svm/main.cpp b/qt/pkclassify_svm/main.cpp new file mode 100644 index 0000000..b48f94e --- /dev/null +++ b/qt/pkclassify_svm/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/qt/pkclassify_svm/mainwindow.cpp b/qt/pkclassify_svm/mainwindow.cpp new file mode 100644 index 0000000..9f58677 --- /dev/null +++ b/qt/pkclassify_svm/mainwindow.cpp @@ -0,0 +1,152 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include <QFileDialog> +#include <QStandardItemModel> +#include <QMessageBox> +#include <QProcess> + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +void MainWindow::on_actionTraining_triggered() +{ + m_training = QFileDialog::getOpenFileName(this, "Training"); + ui->training->setText(m_training); + this->on_training_returnPressed(); +} + +void MainWindow::on_actionMask_triggered() +{ + m_mask = QFileDialog::getOpenFileName(this, "Mask"); + ui->mask->setText(m_mask); +} + +void MainWindow::on_actionOutput_triggered() +{ + m_output = QFileDialog::getOpenFileName(this, "Output"); + ui->output->setText(m_output); +} + +void MainWindow::on_actionInput_triggered() +{ + m_input = QFileDialog::getOpenFileName(this, "Input"); +} + +void MainWindow::on_toolButton_input_clicked() +{ + on_actionInput_triggered(); +} + +void MainWindow::on_toolButton_mask_clicked() +{ + on_actionMask_triggered(); +} + +void MainWindow::on_toolButton_output_clicked() +{ + on_actionOutput_triggered(); +} + +void MainWindow::on_toolButton_training_clicked() +{ + on_actionTraining_triggered(); +} + +void MainWindow::on_training_returnPressed() +{ + QStringList labels; + labels << "forest" << "non-forest"; + setClassTable(labels); +} + +void MainWindow::setClassTable(const QStringList &labels) +{ + QStandardItemModel *model = new QStandardItemModel(labels.size(),2,this); //2 Rows and 3 Columns + model->setHorizontalHeaderItem(0, new QStandardItem(QString("label name"))); + model->setHorizontalHeaderItem(1, new QStandardItem(QString("class number"))); + for(int ilabel=0;ilabel<labels.size();++ilabel){ + QStandardItem *firstRow = new QStandardItem(QString(labels[ilabel])); + model->setItem(ilabel,0,firstRow); + } + ui->tableView_labels->setModel(model); +} + +void MainWindow::on_pushButton_run_clicked() +{ + try{ + QString program = "pkclassify_svm"; + if(m_training.isEmpty()) + MainWindow::on_actionTraining_triggered(); + + if(m_training.isEmpty()){ + QString qsError="No training vector file selected"; + throw(qsError); + } + program+=" --training "; + program+=m_training; + +// QList<QCheckBox*> qcheckBoxList = this->findChildren<QCheckBox *>(); + +// for(QList<QCheckBox*>::ConstIterator qcbit=qcheckBoxList.begin();qcbit!=qcheckBoxList.end();++qcbit){ +// if((*qcbit)->isChecked()){ +// QString qsOption; +// qsOption+=" --"; +// qsOption+=(*qcbit)->objectName(); +// program+=qsOption; +// } +// } + + QList<QComboBox*> qcomboBoxList = this->findChildren<QComboBox *>(); + + for(QList<QComboBox*>::ConstIterator qcbit=qcomboBoxList.begin();qcbit!=qcomboBoxList.end();++qcbit){ + QString qsOption; + qsOption+=" --"; + qsOption+=(*qcbit)->objectName(); + program+=qsOption; + program+=" "; + program+=QString::number((*qcbit)->currentIndex()); + } + + QList<QLineEdit*> qlineEditList = this->findChildren<QLineEdit *>(); + + for(QList<QLineEdit*>::ConstIterator qlbit=qlineEditList.begin();qlbit!=qlineEditList.end();++qlbit){ + if(!((*qlbit)->text().isEmpty())){ + QString qsOption; + qsOption+=" --"; + qsOption+=(*qlbit)->objectName(); + qsOption+=" "; + qsOption+=(*qlbit)->text(); + program+=qsOption; + } + } + + ui->commandLineEdit->insert(program); + +//// QProcess *myProcess = new QProcess(parent); +// QProcess *myProcess = new QProcess(this); +// myProcess->start(program); +// myProcess->waitForFinished(-1); +// QString p_stdout = myProcess->readAll(); +//// ui->outputEdit->appendPlainText(p_stdout); +// delete myProcess; + } + catch(QString qsError){ + QMessageBox msgBox; + msgBox.setText(qsError); + msgBox.exec(); + } +} + +void MainWindow::on_lineEdit_2_returnPressed() +{ + //run +} diff --git a/qt/pkclassify_svm/mainwindow.h b/qt/pkclassify_svm/mainwindow.h new file mode 100644 index 0000000..e7d7dd2 --- /dev/null +++ b/qt/pkclassify_svm/mainwindow.h @@ -0,0 +1,51 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private slots: + void on_actionInput_triggered(); + + void on_actionTraining_triggered(); + + void on_actionMask_triggered(); + + void on_actionOutput_triggered(); + + void on_toolButton_input_clicked(); + + void on_toolButton_mask_clicked(); + + void on_toolButton_output_clicked(); + + void on_toolButton_training_clicked(); + + void on_training_returnPressed(); + + void on_pushButton_run_clicked(); + + void on_lineEdit_2_returnPressed(); + +private: + void setClassTable(const QStringList &labels); + + Ui::MainWindow *ui; + QString m_input; + QString m_training; + QString m_mask; + QString m_output; +}; + +#endif // MAINWINDOW_H diff --git a/qt/pkclassify_svm/mainwindow.ui b/qt/pkclassify_svm/mainwindow.ui new file mode 100644 index 0000000..bb8c9d1 --- /dev/null +++ b/qt/pkclassify_svm/mainwindow.ui @@ -0,0 +1,573 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>423</width> + <height>458</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralWidget"> + <widget class="QTabWidget" name="tabWidget"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>391</width> + <height>341</height> + </rect> + </property> + <property name="currentIndex"> + <number>3</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Training</string> + </attribute> + <widget class="QLineEdit" name="label"> + <property name="geometry"> + <rect> + <x>160</x> + <y>50</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_2"> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>151</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>attribute name for class label</string> + </property> + </widget> + <widget class="QLineEdit" name="training"> + <property name="geometry"> + <rect> + <x>160</x> + <y>20</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_4"> + <property name="geometry"> + <rect> + <x>10</x> + <y>20</y> + <width>151</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Training vectorfile</string> + </property> + </widget> + <widget class="QToolButton" name="toolButton_training"> + <property name="geometry"> + <rect> + <x>280</x> + <y>20</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLineEdit" name="cv"> + <property name="geometry"> + <rect> + <x>160</x> + <y>80</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_5"> + <property name="geometry"> + <rect> + <x>10</x> + <y>80</y> + <width>111</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>n-fold cross validation</string> + </property> + </widget> + <widget class="QTableView" name="tableView_labels"> + <property name="geometry"> + <rect> + <x>160</x> + <y>110</y> + <width>221</width> + <height>201</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_17"> + <property name="geometry"> + <rect> + <x>10</x> + <y>110</y> + <width>111</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>class name-value pairs</string> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Input/Output</string> + </attribute> + <widget class="QLabel" name="label_3"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Input data</string> + </property> + </widget> + <widget class="QLineEdit" name="input"> + <property name="geometry"> + <rect> + <x>80</x> + <y>10</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_input"> + <property name="geometry"> + <rect> + <x>200</x> + <y>10</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_13"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Mask image</string> + </property> + </widget> + <widget class="QLineEdit" name="mask"> + <property name="geometry"> + <rect> + <x>80</x> + <y>40</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_mask"> + <property name="geometry"> + <rect> + <x>200</x> + <y>40</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_14"> + <property name="geometry"> + <rect> + <x>240</x> + <y>40</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>msknodata</string> + </property> + </widget> + <widget class="QLineEdit" name="msknodata"> + <property name="geometry"> + <rect> + <x>300</x> + <y>40</y> + <width>41</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_15"> + <property name="geometry"> + <rect> + <x>10</x> + <y>70</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Output data</string> + </property> + </widget> + <widget class="QLineEdit" name="output"> + <property name="geometry"> + <rect> + <x>80</x> + <y>70</y> + <width>113</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QToolButton" name="toolButton_output"> + <property name="geometry"> + <rect> + <x>200</x> + <y>70</y> + <width>25</width> + <height>19</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="label_16"> + <property name="geometry"> + <rect> + <x>240</x> + <y>70</y> + <width>41</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>nodata</string> + </property> + </widget> + <widget class="QLineEdit" name="nodata"> + <property name="geometry"> + <rect> + <x>300</x> + <y>70</y> + <width>41</width> + <height>20</height> + </rect> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Classifier</string> + </attribute> + <widget class="QComboBox" name="svmtype"> + <property name="geometry"> + <rect> + <x>100</x> + <y>10</y> + <width>69</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_6"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>SVM type</string> + </property> + </widget> + <widget class="QLabel" name="label_7"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Kernel type</string> + </property> + </widget> + <widget class="QComboBox" name="kerneltype"> + <property name="geometry"> + <rect> + <x>100</x> + <y>40</y> + <width>69</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_8"> + <property name="geometry"> + <rect> + <x>190</x> + <y>40</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Kernel degree</string> + </property> + </widget> + <widget class="QLineEdit" name="lineEdit"> + <property name="geometry"> + <rect> + <x>270</x> + <y>40</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_9"> + <property name="geometry"> + <rect> + <x>10</x> + <y>70</y> + <width>41</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Gamma</string> + </property> + </widget> + <widget class="QLineEdit" name="gamma"> + <property name="geometry"> + <rect> + <x>60</x> + <y>70</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_10"> + <property name="geometry"> + <rect> + <x>100</x> + <y>70</y> + <width>41</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>CCost</string> + </property> + </widget> + <widget class="QLineEdit" name="ccost"> + <property name="geometry"> + <rect> + <x>140</x> + <y>70</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_11"> + <property name="geometry"> + <rect> + <x>190</x> + <y>10</y> + <width>41</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Coef 0</string> + </property> + </widget> + <widget class="QLineEdit" name="coef0"> + <property name="geometry"> + <rect> + <x>230</x> + <y>10</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label_12"> + <property name="geometry"> + <rect> + <x>280</x> + <y>10</y> + <width>21</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>nu</string> + </property> + </widget> + <widget class="QLineEdit" name="nu"> + <property name="geometry"> + <rect> + <x>300</x> + <y>10</y> + <width>31</width> + <height>20</height> + </rect> + </property> + </widget> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Command line</string> + </attribute> + <widget class="QLabel" name="label_18"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>81</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Command line</string> + </property> + </widget> + <widget class="QLineEdit" name="commandLineEdit"> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>361</width> + <height>61</height> + </rect> + </property> + </widget> + </widget> + </widget> + <widget class="QPushButton" name="pushButton_run"> + <property name="geometry"> + <rect> + <x>10</x> + <y>380</y> + <width>75</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Run</string> + </property> + </widget> + <widget class="QPushButton" name="pushButton_restore"> + <property name="geometry"> + <rect> + <x>320</x> + <y>10</y> + <width>91</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Restore defaults</string> + </property> + </widget> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>423</width> + <height>21</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionInput"/> + <addaction name="actionTraining"/> + <addaction name="actionMask"/> + <addaction name="actionOutput"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QToolBar" name="mainToolBar"> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QStatusBar" name="statusBar"/> + <action name="actionInput"> + <property name="text"> + <string>Input</string> + </property> + </action> + <action name="actionTraining"> + <property name="text"> + <string>Training</string> + </property> + </action> + <action name="actionMask"> + <property name="text"> + <string>Mask</string> + </property> + </action> + <action name="actionOutput"> + <property name="text"> + <string>Output</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git a/qt/pkclassify_svm/pkclassify_svm.pro b/qt/pkclassify_svm/pkclassify_svm.pro new file mode 100644 index 0000000..002f3d8 --- /dev/null +++ b/qt/pkclassify_svm/pkclassify_svm.pro @@ -0,0 +1,20 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-03-21T13:16:29 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = pkclassify_svm +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += mainwindow.ui diff --git a/qt/pkinfo/mainwindow.cpp b/qt/pkinfo/mainwindow.cpp index d39fdbc..2b39832 100644 --- a/qt/pkinfo/mainwindow.cpp +++ b/qt/pkinfo/mainwindow.cpp @@ -1,6 +1,5 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -//#include "MyComboBox.h" #include <QFileDialog> #include <QMessageBox> #include <QDir> @@ -81,7 +80,8 @@ void MainWindow::on_pushButton_Run_clicked() ui->commandLineEdit->insertPlainText(program); - QProcess *myProcess = new QProcess(parent); +// QProcess *myProcess = new QProcess(parent); + QProcess *myProcess = new QProcess(this); myProcess->start(program); myProcess->waitForFinished(-1); QString p_stdout = myProcess->readAll(); @@ -108,9 +108,10 @@ void MainWindow::on_pushButton_clearCommandLine_clicked() void MainWindow::on_menu_input_triggered() { QObject *parent; - QProcess *myProcess = new QProcess(parent); +// QProcess *myProcess = new QProcess(parent); + QProcess *myProcess = new QProcess(this); QString program; - m_inputFilename = QFileDialog::getOpenFileName(this, "Input image","/tmp"); + m_inputFilename = QFileDialog::getOpenFileName(this, "Input image"); if ( m_inputFilename.isNull() == false ){ //fill in combobox with number of bands program="pkinfo -nb -i "; @@ -127,6 +128,7 @@ void MainWindow::on_menu_input_triggered() list.append(qsband); } ui->band->addItems(list); + myProcess->close(); } delete myProcess; } diff --git a/qt/pkinfo/mainwindow.ui b/qt/pkinfo/mainwindow.ui index f0a979c..67a1c27 100644 --- a/qt/pkinfo/mainwindow.ui +++ b/qt/pkinfo/mainwindow.ui @@ -99,7 +99,7 @@ </rect> </property> <property name="currentIndex"> - <number>1</number> + <number>2</number> </property> <widget class="QWidget" name="datasetinfo"> <attribute name="title"> @@ -689,7 +689,7 @@ <x>0</x> <y>0</y> <width>664</width> - <height>27</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuFile"> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel