[pktools] 224/375: clear input and output console at begin of run
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:54:16 UTC 2014
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 509911597661f085f030d380f78bc2c5d4cbe598
Author: Pieter Kempeneers <kempenep at gmail.com>
Date: Tue Apr 1 18:49:42 2014 +0200
clear input and output console at begin of run
---
qt/pkinfo/main.cpp | 31 --
qt/pkinfo/mainwindow.cpp | 158 ----------
qt/pkinfo/mainwindow.h | 57 ----
qt/pkinfo/mainwindow.ui | 727 --------------------------------------------
qt/pkinfo/pkinfo.pro | 20 --
qt/pksvm_gui/mainwindow.cpp | 36 ++-
qt/pksvm_gui/mainwindow.h | 8 +-
qt/pksvm_gui/mainwindow.ui | 4 +-
src/apps/pksvm.cc | 35 ++-
9 files changed, 50 insertions(+), 1026 deletions(-)
diff --git a/qt/pkinfo/main.cpp b/qt/pkinfo/main.cpp
deleted file mode 100644
index b53cf84..0000000
--- a/qt/pkinfo/main.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/**********************************************************************
-main.cc
-Copyright (C) 2008-2014 Pieter Kempeneers
-
-This file is part of pktools
-
-pktools 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 3 of the License, or
-(at your option) any later version.
-
-pktools is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pktools. If not, see <http://www.gnu.org/licenses/>.
-***********************************************************************/
-
-#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/pkinfo/mainwindow.cpp b/qt/pkinfo/mainwindow.cpp
deleted file mode 100644
index 8bd1b6e..0000000
--- a/qt/pkinfo/mainwindow.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/**********************************************************************
-mainwindow.cc
-Copyright (C) 2008-2014 Pieter Kempeneers
-
-This file is part of pktools
-
-pktools 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 3 of the License, or
-(at your option) any later version.
-
-pktools is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pktools. If not, see <http://www.gnu.org/licenses/>.
-***********************************************************************/
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-#include <QFileDialog>
-#include <QMessageBox>
-#include <QDir>
-#include <QProcess>
-#include <QDebug>
-
-MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainWindow)
-{
- ui->setupUi(this);
-
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
-}
-
-void MainWindow::on_button_input_clicked()
-{
- MainWindow::on_menu_input_triggered();
-}
-
-void MainWindow::on_pushButton_Run_clicked()
-{
- ui->outputEdit->clear();
- ui->commandLineEdit->clear();
-
- QObject *parent;
-
- try{
- QString program = "pkinfo";
- if(m_inputFilename.isEmpty())
- MainWindow::on_menu_input_triggered();
-
- if(m_inputFilename.isEmpty()){
- QString qsError="No input image selected";
- throw(qsError);
- }
- program+=" --input ";
- program+=m_inputFilename;
-
- 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->insertPlainText(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_pushButton_clearOutput_clicked()
-{
- ui->outputEdit->clear();
-}
-
-void MainWindow::on_pushButton_clearCommandLine_clicked()
-{
- ui->commandLineEdit->clear();
-}
-
-void MainWindow::on_menu_input_triggered()
-{
- QObject *parent;
-// QProcess *myProcess = new QProcess(parent);
- QProcess *myProcess = new QProcess(this);
- QString program;
- m_inputFilename = QFileDialog::getOpenFileName(this, "Input image");
- if ( m_inputFilename.isNull() == false ){
- //fill in combobox with number of bands
- program="pkinfo -nb -i ";
- program+=m_inputFilename;
- myProcess->start(program);
- myProcess->waitForFinished(-1);
- QString p_stdout = myProcess->readAll();
- qDebug() << p_stdout;
- int nband=p_stdout.section(' ',1).toInt();
- QStringList list;
- for(int iband=0;iband<nband;++iband){
- QString qsband="band";
- qsband+=QString::number(iband);
- list.append(qsband);
- }
- ui->band->addItems(list);
- myProcess->close();
- }
- delete myProcess;
-}
-
-void MainWindow::on_actionQuit_triggered()
-{
- close();
-}
diff --git a/qt/pkinfo/mainwindow.h b/qt/pkinfo/mainwindow.h
deleted file mode 100644
index 7db3424..0000000
--- a/qt/pkinfo/mainwindow.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**********************************************************************
-mainwindow.h
-Copyright (C) 2008-2014 Pieter Kempeneers
-
-This file is part of pktools
-
-pktools 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 3 of the License, or
-(at your option) any later version.
-
-pktools is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pktools. If not, see <http://www.gnu.org/licenses/>.
-***********************************************************************/
-
-#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_pushButton_Run_clicked();
-
- void on_button_input_clicked();
-
- void on_pushButton_clearOutput_clicked();
-
- void on_pushButton_clearCommandLine_clicked();
-
- void on_menu_input_triggered();
-
- void on_actionQuit_triggered();
-
-private:
- Ui::MainWindow *ui;
- QString m_inputFilename;
-};
-
-#endif // MAINWINDOW_H
diff --git a/qt/pkinfo/mainwindow.ui b/qt/pkinfo/mainwindow.ui
deleted file mode 100644
index 14d1593..0000000
--- a/qt/pkinfo/mainwindow.ui
+++ /dev/null
@@ -1,727 +0,0 @@
-<?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>664</width>
- <height>898</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>pkinfo</string>
- </property>
- <widget class="QWidget" name="centralWidget">
- <widget class="QPushButton" name="pushButton_clearOutput">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>790</y>
- <width>105</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Clear</string>
- </property>
- </widget>
- <widget class="QPushButton" name="button_input">
- <property name="geometry">
- <rect>
- <x>240</x>
- <y>0</y>
- <width>97</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Input image...</string>
- </property>
- </widget>
- <widget class="QPushButton" name="pushButton_Run">
- <property name="geometry">
- <rect>
- <x>490</x>
- <y>0</y>
- <width>105</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Run</string>
- </property>
- </widget>
- <widget class="QPlainTextEdit" name="outputEdit">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>661</y>
- <width>591</width>
- <height>121</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_3">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>630</y>
- <width>66</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Output</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_4">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>460</y>
- <width>101</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Command line</string>
- </property>
- </widget>
- <widget class="QTabWidget" name="tabWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>40</y>
- <width>581</width>
- <height>411</height>
- </rect>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="datasetinfo">
- <attribute name="title">
- <string>general</string>
- </attribute>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>9</x>
- <y>10</y>
- <width>207</width>
- <height>220</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="nband">
- <property name="text">
- <string>number of bands</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="ns">
- <property name="text">
- <string>number of samples</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="nl">
- <property name="text">
- <string>number of lines</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="interleave">
- <property name="text">
- <string>band encoding (interleave)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="otype">
- <property name="text">
- <string>data type</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="description">
- <property name="text">
- <string>image description</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>geo</string>
- </attribute>
- <widget class="QCheckBox" name="cover">
- <property name="geometry">
- <rect>
- <x>190</x>
- <y>80</y>
- <width>111</width>
- <height>26</height>
- </rect>
- </property>
- <property name="text">
- <string>covers area</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="ulx">
- <property name="geometry">
- <rect>
- <x>320</x>
- <y>60</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_5">
- <property name="geometry">
- <rect>
- <x>330</x>
- <y>40</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>upper left x</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_6">
- <property name="geometry">
- <rect>
- <x>450</x>
- <y>40</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>upper left y</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="uly">
- <property name="geometry">
- <rect>
- <x>440</x>
- <y>60</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_7">
- <property name="geometry">
- <rect>
- <x>330</x>
- <y>90</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>lower right x</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_8">
- <property name="geometry">
- <rect>
- <x>450</x>
- <y>90</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>lower right y</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="lry">
- <property name="geometry">
- <rect>
- <x>440</x>
- <y>110</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLineEdit" name="lrx">
- <property name="geometry">
- <rect>
- <x>320</x>
- <y>110</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLineEdit" name="xpos">
- <property name="geometry">
- <rect>
- <x>320</x>
- <y>170</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_9">
- <property name="geometry">
- <rect>
- <x>330</x>
- <y>150</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>position x</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="ypos">
- <property name="geometry">
- <rect>
- <x>440</x>
- <y>170</y>
- <width>113</width>
- <height>33</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_10">
- <property name="geometry">
- <rect>
- <x>450</x>
- <y>150</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>position y</string>
- </property>
- </widget>
- <widget class="QCheckBox" name="read">
- <property name="geometry">
- <rect>
- <x>190</x>
- <y>170</y>
- <width>121</width>
- <height>26</height>
- </rect>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>position in image coordinates (col, row), unless geotransform is selected</p></body></html></string>
- </property>
- <property name="text">
- <string>read data at:</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_15">
- <property name="geometry">
- <rect>
- <x>400</x>
- <y>10</y>
- <width>66</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Set area:</string>
- </property>
- </widget>
- <widget class="QPushButton" name="pushButton_extent">
- <property name="geometry">
- <rect>
- <x>440</x>
- <y>220</y>
- <width>97</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Browse...</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_16">
- <property name="geometry">
- <rect>
- <x>270</x>
- <y>220</y>
- <width>161</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>Set area via vector file:</string>
- </property>
- </widget>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>10</y>
- <width>152</width>
- <height>240</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="dx">
- <property name="text">
- <string>cell size in x</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="dy">
- <property name="text">
- <string>cell size in y</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="bbox">
- <property name="text">
- <string>bounding box</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="centre">
- <property name="text">
- <string>image center</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="ref">
- <property name="text">
- <string>reference pixel
-(center of gravity)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="a_srs">
- <property name="text">
- <string>projection info</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="geo">
- <property name="text">
- <string>geotransform</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <zorder>layoutWidget</zorder>
- <zorder>cover</zorder>
- <zorder>ulx</zorder>
- <zorder>label_5</zorder>
- <zorder>label_6</zorder>
- <zorder>uly</zorder>
- <zorder>label_7</zorder>
- <zorder>label_8</zorder>
- <zorder>lry</zorder>
- <zorder>lrx</zorder>
- <zorder>xpos</zorder>
- <zorder>label_9</zorder>
- <zorder>ypos</zorder>
- <zorder>label_10</zorder>
- <zorder>read</zorder>
- <zorder>label_15</zorder>
- <zorder>pushButton_extent</zorder>
- <zorder>label_16</zorder>
- </widget>
- <widget class="QWidget" name="tab_3">
- <attribute name="title">
- <string>stats</string>
- </attribute>
- <widget class="QCheckBox" name="minmax">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>120</y>
- <width>171</width>
- <height>26</height>
- </rect>
- </property>
- <property name="text">
- <string>minimum and maximum</string>
- </property>
- </widget>
- <widget class="QCheckBox" name="min">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>150</y>
- <width>91</width>
- <height>26</height>
- </rect>
- </property>
- <property name="text">
- <string>minimum </string>
- </property>
- </widget>
- <widget class="QCheckBox" name="max">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>180</y>
- <width>91</width>
- <height>26</height>
- </rect>
- </property>
- <property name="text">
- <string>maximum</string>
- </property>
- </widget>
- <widget class="QLabel" name="band_label">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>91</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>input band(s)</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="nbin">
- <property name="geometry">
- <rect>
- <x>340</x>
- <y>210</y>
- <width>41</width>
- <height>33</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- <widget class="QCheckBox" name="stats">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>60</y>
- <width>141</width>
- <height>26</height>
- </rect>
- </property>
- <property name="text">
- <string>basic statistics</string>
- </property>
- </widget>
- <widget class="QLabel" name="label_13">
- <property name="geometry">
- <rect>
- <x>260</x>
- <y>60</y>
- <width>111</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>source minimum</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="src_min">
- <property name="geometry">
- <rect>
- <x>370</x>
- <y>50</y>
- <width>41</width>
- <height>33</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- <widget class="QLineEdit" name="src_max">
- <property name="geometry">
- <rect>
- <x>370</x>
- <y>100</y>
- <width>41</width>
- <height>33</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- <widget class="QLabel" name="label_14">
- <property name="geometry">
- <rect>
- <x>260</x>
- <y>100</y>
- <width>111</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>source maximum</string>
- </property>
- </widget>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>210</y>
- <width>327</width>
- <height>28</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QCheckBox" name="hist">
- <property name="text">
- <string>histogram</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="rel">
- <property name="text">
- <string>relative (in %)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_nbin">
- <property name="text">
- <string>number of bins</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QLabel" name="label_17">
- <property name="geometry">
- <rect>
- <x>260</x>
- <y>150</y>
- <width>111</width>
- <height>21</height>
- </rect>
- </property>
- <property name="text">
- <string>nodata value</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="nodata">
- <property name="geometry">
- <rect>
- <x>370</x>
- <y>150</y>
- <width>41</width>
- <height>33</height>
- </rect>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- <widget class="QComboBox" name="band">
- <property name="geometry">
- <rect>
- <x>120</x>
- <y>20</y>
- <width>83</width>
- <height>29</height>
- </rect>
- </property>
- </widget>
- </widget>
- </widget>
- <widget class="QPlainTextEdit" name="commandLineEdit">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>490</y>
- <width>591</width>
- <height>61</height>
- </rect>
- </property>
- <property name="plainText">
- <string/>
- </property>
- </widget>
- <widget class="QPushButton" name="pushButton_clearCommandLine">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>560</y>
- <width>105</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Clear</string>
- </property>
- </widget>
- </widget>
- <widget class="QMenuBar" name="menuBar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>664</width>
- <height>21</height>
- </rect>
- </property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>File</string>
- </property>
- <addaction name="menu_input"/>
- <addaction name="actionQuit"/>
- </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="menu_input">
- <property name="text">
- <string>Input image</string>
- </property>
- </action>
- <action name="actionQuit">
- <property name="text">
- <string>Quit</string>
- </property>
- </action>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>
diff --git a/qt/pkinfo/pkinfo.pro b/qt/pkinfo/pkinfo.pro
deleted file mode 100644
index 02495e8..0000000
--- a/qt/pkinfo/pkinfo.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2014-03-20T15:39:07
-#
-#-------------------------------------------------
-
-QT += core gui
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-TARGET = pkinfo
-TEMPLATE = app
-
-
-SOURCES += main.cpp\
- mainwindow.cpp
-
-HEADERS += mainwindow.h
-
-FORMS += mainwindow.ui
diff --git a/qt/pksvm_gui/mainwindow.cpp b/qt/pksvm_gui/mainwindow.cpp
index 10b389b..2cac7d5 100644
--- a/qt/pksvm_gui/mainwindow.cpp
+++ b/qt/pksvm_gui/mainwindow.cpp
@@ -65,27 +65,27 @@ void MainWindow::setDefaults()
void MainWindow::on_actionTraining_triggered()
{
- m_training = QFileDialog::getOpenFileName(this, "Training");
- ui->training->setText(m_training);
+ QString qstraining = QFileDialog::getOpenFileName(this, "Training");
+ ui->training->setText(qstraining);
this->on_training_returnPressed();
}
void MainWindow::on_actionMask_triggered()
{
- m_mask = QFileDialog::getOpenFileName(this, "Mask");
- ui->mask->setText(m_mask);
+ QString qsmask = QFileDialog::getOpenFileName(this, "Mask");
+ ui->mask->setText(qsmask);
}
void MainWindow::on_actionOutput_triggered()
{
- m_output = QFileDialog::getOpenFileName(this, "Output");
- ui->output->setText(m_output);
+ QString qsoutput = QFileDialog::getOpenFileName(this, "Output");
+ ui->output->setText(qsoutput);
}
void MainWindow::on_actionInput_triggered()
{
- m_input = QFileDialog::getOpenFileName(this, "Input");
- ui->input->setText(m_input);
+ QString qsinput = QFileDialog::getOpenFileName(this, "Input");
+ ui->input->setText(qsinput);
}
void MainWindow::on_toolButton_input_clicked()
@@ -133,11 +133,12 @@ void MainWindow::setClassTable(const QStringList &labels)
void MainWindow::on_pushButton_run_clicked()
{
try{
+ ui->commandLineEdit->clear();
+ ui->consoleEdit->clear();
QString program = "pksvm";
- if(m_training.isEmpty())
+ if(ui->training->text().isEmpty())
MainWindow::on_actionTraining_triggered();
-
- if(m_training.isEmpty()){
+ if(ui->training->text().isEmpty()){
QString qsError="No training vector file selected";
throw(qsError);
}
@@ -153,6 +154,16 @@ void MainWindow::on_pushButton_run_clicked()
// }
// }
+ for(int irow=0;irow<ui->tableView_labels->model()->rowCount();++irow){
+ QString qsOption;
+ qsOption+=" --class ";
+ qsOption+=ui->tableView_labels->model()->data(ui->tableView_labels->model()->index(irow,0)).toString();
+ qsOption+=" --reclass ";
+ qsOption+=ui->tableView_labels->model()->data(ui->tableView_labels->model()->index(irow,1)).toString();
+ qsOption+=" --prior ";
+ qsOption+=ui->tableView_labels->model()->data(ui->tableView_labels->model()->index(irow,2)).toString();
+ program+=qsOption;
+ }
QList<QComboBox*> qcomboBoxList = this->findChildren<QComboBox *>();
for(QList<QComboBox*>::ConstIterator qcbit=qcomboBoxList.begin();qcbit!=qcomboBoxList.end();++qcbit){
@@ -177,14 +188,13 @@ void MainWindow::on_pushButton_run_clicked()
}
}
- ui->commandLineEdit->insert(program);
+ ui->commandLineEdit->setText(program);
// QProcess *myProcess = new QProcess(parent);
QProcess *myProcess = new QProcess(this);
myProcess->start(program);
myProcess->waitForFinished(-1);
QString p_stdout = myProcess->readAll();
- ui->consoleEdit->clear();
ui->consoleEdit->insertPlainText(p_stdout);
delete myProcess;
}
diff --git a/qt/pksvm_gui/mainwindow.h b/qt/pksvm_gui/mainwindow.h
index 27fa254..851787a 100644
--- a/qt/pksvm_gui/mainwindow.h
+++ b/qt/pksvm_gui/mainwindow.h
@@ -64,10 +64,10 @@ private:
void setDefaults();
Ui::MainWindow *ui;
- QString m_input;
- QString m_training;
- QString m_mask;
- QString m_output;
+// QString m_input;
+// QString m_training;
+// QString m_mask;
+// QString m_output;
};
#endif // MAINWINDOW_H
diff --git a/qt/pksvm_gui/mainwindow.ui b/qt/pksvm_gui/mainwindow.ui
index 19cdd63..bd4c37b 100644
--- a/qt/pksvm_gui/mainwindow.ui
+++ b/qt/pksvm_gui/mainwindow.ui
@@ -24,7 +24,7 @@
</rect>
</property>
<property name="currentIndex">
- <number>2</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@@ -595,7 +595,7 @@
<x>0</x>
<y>0</y>
<width>423</width>
- <height>21</height>
+ <height>27</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
diff --git a/src/apps/pksvm.cc b/src/apps/pksvm.cc
index 9e3deaa..c8032f8 100644
--- a/src/apps/pksvm.cc
+++ b/src/apps/pksvm.cc
@@ -404,22 +404,29 @@ int main(int argc, char *argv[])
}
map<string,Vector2d<float> >::iterator mapit=trainingMap.begin();
bool doSort=true;
- while(mapit!=trainingMap.end()){
- nameVector.push_back(mapit->first);
- if(classValueMap.size()){
- //check if name in training is covered by classname_opt (values can not be 0)
- if(classValueMap[mapit->first]>0){
- if(cm.getClassIndex(type2string<short>(classValueMap[mapit->first]))<0)
- cm.pushBackClassName(type2string<short>(classValueMap[mapit->first]),doSort);
- }
- else{
- std::cerr << "Error: names in classname option are not complete, please check names in training vector and make sure classvalue is > 0" << std::endl;
- exit(1);
+ try{
+ while(mapit!=trainingMap.end()){
+ nameVector.push_back(mapit->first);
+ if(classValueMap.size()){
+ //check if name in training is covered by classname_opt (values can not be 0)
+ if(classValueMap[mapit->first]>0){
+ if(cm.getClassIndex(type2string<short>(classValueMap[mapit->first]))<0){
+ cm.pushBackClassName(type2string<short>(classValueMap[mapit->first]),doSort);
+ }
+ }
+ else{
+ std::cerr << "Error: names in classname option are not complete, please check names in training vector and make sure classvalue is > 0" << std::endl;
+ exit(1);
+ }
}
+ else
+ cm.pushBackClassName(mapit->first,doSort);
+ ++mapit;
}
- else
- cm.pushBackClassName(mapit->first,doSort);
- ++mapit;
+ }
+ catch(BadConversion conversionString){
+ std::cerr << "Error: did you provide class pairs names (-c) and integer values (-r) for each class in training vector?" << std::endl;
+ exit(1);
}
if(classname_opt.empty()){
std::cerr << "Warning: no class name and value pair provided for all " << nclass << " classes, using string2type<int> instead!" << std::endl;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git
More information about the Pkg-grass-devel
mailing list