QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsdirectionallightwidget.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdirectionallightwidget.cpp - QgsDirectionalLightWidget
3
4
---------------------
5
begin : 11.12.2022
6
copyright : (C) 2022 by Vincent Cloarec
7
email : vcloarec at gmail dot com
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
#include "ui_qgsdirectionallightwidget.h"
17
#include "
qgsdirectionallightwidget.h
"
18
19
#include "
qgis.h
"
20
21
#include <QDebug>
22
23
#include "moc_qgsdirectionallightwidget.cpp"
24
25
QgsDirectionalLightWidget::QgsDirectionalLightWidget
( QWidget *parent )
26
: QWidget( parent )
27
{
28
setupUi(
this
);
29
30
mAzimuthSpinBox->setClearValue( 315.0 );
31
mAltitudeSpinBox->setClearValue( 45.0 );
32
33
connect( mAzimuthSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this
, [
this
](
double
value ) {
34
whileBlocking
( mDialAzimuth )->setValue(
static_cast<
int
>
( value * 10 + 1800 ) % 3600 );
35
emit
directionChanged
();
36
} );
37
38
connect( mDialAzimuth, &QDial::valueChanged,
this
, [
this
](
int
value ) {
39
whileBlocking
( mAzimuthSpinBox )->setValue( std::fmod( value / 10.0 + 180, 360.0 ) );
40
emit
directionChanged
();
41
} );
42
43
connect( mAltitudeSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ),
this
, [
this
](
double
value ) {
44
whileBlocking
( mAltitudeSlider )->setValue(
static_cast<
int
>
( value * 10 ) );
45
emit
directionChanged
();
46
} );
47
48
connect( mAltitudeSlider, &QSlider::valueChanged,
this
, [
this
](
int
value ) {
49
whileBlocking
( mAltitudeSpinBox )->setValue( value / 10.0 );
50
emit
directionChanged
();
51
} );
52
}
53
54
QgsDirectionalLightWidget::~QgsDirectionalLightWidget
()
55
{}
56
57
void
QgsDirectionalLightWidget::setAzimuth
(
double
azimuth
)
58
{
59
mAzimuthSpinBox->setValue(
azimuth
);
60
}
61
62
double
QgsDirectionalLightWidget::azimuth
()
const
63
{
64
return
mAzimuthSpinBox->value();
65
}
66
67
void
QgsDirectionalLightWidget::setAltitude
(
double
altitude
)
68
{
69
mAltitudeSpinBox->setValue(
altitude
);
70
}
71
72
double
QgsDirectionalLightWidget::altitude
()
const
73
{
74
return
mAltitudeSpinBox->value();
75
}
76
77
void
QgsDirectionalLightWidget::setEnableAzimuth
(
bool
enable )
78
{
79
mAzimuthSpinBox->setEnabled( enable );
80
mDialAzimuth->setEnabled( enable );
81
}
QgsDirectionalLightWidget::setEnableAzimuth
void setEnableAzimuth(bool enable)
Sets whether the azimut can be changed, for example, when using multidirectional light.
Definition
qgsdirectionallightwidget.cpp:77
QgsDirectionalLightWidget::altitude
double altitude() const
Returns the altitude value (degree).
Definition
qgsdirectionallightwidget.cpp:72
QgsDirectionalLightWidget::directionChanged
void directionChanged()
Emitted when the direction is changed.
QgsDirectionalLightWidget::setAzimuth
void setAzimuth(double azimuth)
Sets the azimuth value (degree).
Definition
qgsdirectionallightwidget.cpp:57
QgsDirectionalLightWidget::setAltitude
void setAltitude(double altitude)
Sets the altitude value (degree).
Definition
qgsdirectionallightwidget.cpp:67
QgsDirectionalLightWidget::azimuth
double azimuth() const
Returns the azimuth value (degree).
Definition
qgsdirectionallightwidget.cpp:62
QgsDirectionalLightWidget::~QgsDirectionalLightWidget
~QgsDirectionalLightWidget() override
Definition
qgsdirectionallightwidget.cpp:54
QgsDirectionalLightWidget::QgsDirectionalLightWidget
QgsDirectionalLightWidget(QWidget *parent=nullptr)
Constructor.
Definition
qgsdirectionallightwidget.cpp:25
qgis.h
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition
qgis.h:7637
qgsdirectionallightwidget.h
Generated on
for QGIS API Documentation by
1.17.0