Vespucci  1.0.0
scalebardialog.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 *******************************************************************************/
21 #include "ui_scalebardialog.h"
22 
28 ScaleBarDialog::ScaleBarDialog(QWidget *parent, QSharedPointer<MapData> map_data) :
29  QDialog(parent),
30  ui(new Ui::ScaleBarDialog)
31 {
32  ui->setupUi(this);
33  color_ = Qt::black;
34  map_data_ = map_data;
35 }
36 
38 {
39  delete ui;
40 }
41 
45 void ScaleBarDialog::on_colorPushButton_clicked()
46 {
47  color_ = QColorDialog::getColor(color_, this, "Select Color");
48 }
49 
53 void ScaleBarDialog::on_buttonBox_accepted()
54 {
55  QMessageBox::information(this, "Scale Bar", "Click on the map to show the scale bar.");
56  double width = ui->widthDoubleSpinBox->value();
57  double height = ui->heightDoubleSpinBox->value();
58  QString units = ui->unitsLineEdit->text();
59  QString position = ui->positionComboBox->currentText();
60  QFont font = ui->fontComboBox->currentFont();
61  int font_size = ui->fontSizeSpinBox->value();
62  font.setPointSize(font_size);
63  font.setBold(true);
64 
65 
66  map_data_->DrawScaleBar(width,
67  height,
68  units,
69  color_,
70  position,
71  font);
72  close();
73 
74 }
75 
79 void ScaleBarDialog::on_buttonBox_rejected()
80 {
81  close();
82 }
Definition: ahcadialog.h:26
VESPUCCI_EXPORT void position(arma::uword index, arma::uword n_rows, arma::uword n_cols, arma::uword &i, arma::uword &j)
Vespucci::Math::position Find row and column numbers for index.
Definition: accessory.cpp:469
ScaleBarDialog(QWidget *parent, QSharedPointer< MapData > map_data)
ScaleBarDialog::ScaleBarDialog.
The ScaleBarDialog class Dialog for the user to create a scale bar on the image.