• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
LatLonBoxWidget.cpp
Go to the documentation of this file.
1 // This library is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU Lesser General Public
3 // License as published by the Free Software Foundation; either
4 // version 2.1 of the License, or (at your option) any later version.
5 //
6 // This library is distributed in the hope that it will be useful,
7 // but WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 // Lesser General Public License for more details.
10 //
11 // You should have received a copy of the GNU Lesser General Public
12 // License along with this library. If not, see <http://www.gnu.org/licenses/>.
13 
14 #include "LatLonBoxWidget.h"
15 
16 #include "GeoDataLatLonBox.h"
17 #include "ui_LatLonBoxWidget.h"
18 
19 namespace Marble
20 {
21 
22 class LatLonBoxWidget::Private
23 {
24 public:
25  explicit Private( QWidget * const parent );
26  Ui::LatLonBoxWidget m_ui;
27 };
28 
29 LatLonBoxWidget::Private::Private( QWidget * const parent )
30 {
31  m_ui.setupUi( parent );
32 }
33 
34 
35 LatLonBoxWidget::LatLonBoxWidget( QWidget * const parent, Qt::WindowFlags const f )
36  : QWidget( parent, f ),
37  d( new Private( this ))
38 {
39  // used for updating tiles count in DownloadRegionDialog
40  connect( d->m_ui.northSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
41  connect( d->m_ui.southSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
42  connect( d->m_ui.eastSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
43  connect( d->m_ui.westSpinBox, SIGNAL(valueChanged(double)), SIGNAL(valueChanged()));
44  // used for adjusting single step values
45  connect( d->m_ui.northSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLatSingleStep()));
46  connect( d->m_ui.southSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLatSingleStep()));
47  connect( d->m_ui.eastSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLonSingleStep()));
48  connect( d->m_ui.westSpinBox, SIGNAL(valueChanged(double)), SLOT(updateLonSingleStep()));
49 }
50 
51 LatLonBoxWidget::~LatLonBoxWidget()
52 {
53  delete d;
54 }
55 
56 GeoDataLatLonBox LatLonBoxWidget::latLonBox() const
57 {
58  return GeoDataLatLonBox( d->m_ui.northSpinBox->value(), d->m_ui.southSpinBox->value(),
59  d->m_ui.eastSpinBox->value(), d->m_ui.westSpinBox->value(),
60  GeoDataCoordinates::Degree );
61 }
62 
63 void LatLonBoxWidget::setLatLonBox( GeoDataLatLonBox const & latLonBox )
64 {
65  d->m_ui.northSpinBox->setValue( latLonBox.north( GeoDataCoordinates::Degree ));
66  d->m_ui.southSpinBox->setValue( latLonBox.south( GeoDataCoordinates::Degree ));
67  d->m_ui.eastSpinBox->setValue( latLonBox.east( GeoDataCoordinates::Degree ));
68  d->m_ui.westSpinBox->setValue( latLonBox.west( GeoDataCoordinates::Degree ));
69 }
70 
71 void LatLonBoxWidget::updateLatSingleStep()
72 {
73  double const singleStep =
74  qAbs( d->m_ui.northSpinBox->value() - d->m_ui.southSpinBox->value() ) / 10.0;
75  d->m_ui.northSpinBox->setSingleStep( singleStep );
76  d->m_ui.southSpinBox->setSingleStep( singleStep );
77 }
78 
79 void LatLonBoxWidget::updateLonSingleStep()
80 {
81  double const singleStep =
82  qAbs( d->m_ui.eastSpinBox->value() - d->m_ui.westSpinBox->value() ) / 10.0;
83  d->m_ui.eastSpinBox->setSingleStep( singleStep );
84  d->m_ui.westSpinBox->setSingleStep( singleStep );
85 }
86 
87 }
88 
89 #include "LatLonBoxWidget.moc"
Marble::LatLonBoxWidget::valueChanged
void valueChanged()
QWidget
Marble::LatLonBoxWidget::latLonBox
GeoDataLatLonBox latLonBox() const
Definition: LatLonBoxWidget.cpp:56
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::LatLonBoxWidget::LatLonBoxWidget
LatLonBoxWidget(QWidget *const parent=0, Qt::WindowFlags const f=0)
Definition: LatLonBoxWidget.cpp:35
Marble::GeoDataLatLonBox::north
qreal north(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
Get the northern boundary of the bounding box.
Definition: GeoDataLatLonBox.cpp:93
Marble::GeoDataLatLonBox::east
qreal east(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
Get the eastern boundary of the bounding box.
Definition: GeoDataLatLonBox.cpp:135
Marble::LatLonBoxWidget::~LatLonBoxWidget
~LatLonBoxWidget()
Definition: LatLonBoxWidget.cpp:51
GeoDataLatLonBox.h
Marble::GeoDataLatLonBox::west
qreal west(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
Get the western boundary of the bounding box.
Definition: GeoDataLatLonBox.cpp:156
LatLonBoxWidget.h
Marble::GeoDataLatLonBox::south
qreal south(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
Get the southern boundary of the bounding box.
Definition: GeoDataLatLonBox.cpp:114
Marble::LatLonBoxWidget::setLatLonBox
void setLatLonBox(GeoDataLatLonBox const &)
Definition: LatLonBoxWidget.cpp:63
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal