Vespucci  1.0.0
ahcadialog.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
20 #include "ahcadialog.h"
21 #include "ui_ahcadialog.h"
23 
24 AHCADialog::AHCADialog(QWidget *parent, QSharedPointer<VespucciWorkspace> ws, QSharedPointer<AbstractDataAnalyzer> analyzer) :
25  QDialog(parent),
26  ui(new Ui::AHCADialog),
27  workspace_(ws)
28 {
29  ui->setupUi(this);
30  analyzer_ = analyzer;
31 }
32 
34 {
35  delete ui;
36 }
37 
38 void AHCADialog::on_buttonBox_accepted()
39 {
40  QString name = ui->nameLineEdit->text().toLower();
41  QString metric = ui->metricComboBox->currentText().toLower();
42  QString linkage = ui->linkageComboBox->currentText().toLower();
43  metric.remove(" ");
44  linkage.remove(" ");
45  try{
46  analyzer_->AgglomerativeClustering(name, linkage, metric);
47  }catch(exception e){
48  workspace_->main_window()->DisplayExceptionWarning(e);
49  }
50  close();
51 }
52 
53 void AHCADialog::on_linkageComboBox_currentTextChanged(const QString &arg1)
54 {
55  ui->metricComboBox->clear();
56  QStringList metric_list;
57  if (arg1 == "Ward"){
58  metric_list = QStringList({"Squared Euclidean"});
59  }
60  else{
61  metric_list = QStringList({"Squared Euclidean",
62  "Euclidean",
63  "Manhattan",
64  "Chebyshev",
65  "Cosine",
66  "Correlation"});
67  }
68  ui->metricComboBox->addItems(metric_list);
69 }
Definition: ahcadialog.h:26
AHCADialog(QWidget *parent, QSharedPointer< VespucciWorkspace > ws, QSharedPointer< AbstractDataAnalyzer > analyzer)
Definition: ahcadialog.cpp:24