Skip to content

Commit

Permalink
remove qwt
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and nyalldawson committed Oct 21, 2020
1 parent 5130559 commit 55ee533
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
21 changes: 4 additions & 17 deletions src/app/3d/qgslightswidget.cpp
Expand Up @@ -21,9 +21,6 @@

#include <QMessageBox>

#include "qwt_compass.h"
#include "qwt_dial_needle.h"

QgsLightsWidget::QgsLightsWidget( QWidget *parent )
: QWidget( parent )
{
Expand All @@ -32,17 +29,7 @@ QgsLightsWidget::QgsLightsWidget( QWidget *parent )
btnAddLight->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
btnRemoveLight->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.svg" ) ) );

mDirectionCompass = new QwtCompass( this );
QwtCompassScaleDraw *scaleDraw = new QwtCompassScaleDraw();
scaleDraw->enableComponent( QwtAbstractScaleDraw::Ticks, true );
scaleDraw->enableComponent( QwtAbstractScaleDraw::Backbone, false );
scaleDraw->setTickLength( QwtScaleDiv::MinorTick, 0 );
scaleDraw->setTickLength( QwtScaleDiv::MediumTick, 0 );
scaleDraw->setTickLength( QwtScaleDiv::MajorTick, 4 );
QwtScaleDiv scaleDiv = scaleDraw->scaleDiv();
mDirectionCompass->setScaleDraw( scaleDraw );
mDirectionCompass->setNeedle( new QwtDialSimpleNeedle( QwtDialSimpleNeedle::Ray, true, Qt::darkYellow, Qt::gray ) );
directionLightLayout->insertWidget( 3, mDirectionCompass );
dialAzimuth->setMaximum( 359 );

connect( btnAddLight, &QToolButton::clicked, this, &QgsLightsWidget::onAddLight );
connect( btnRemoveLight, &QToolButton::clicked, this, &QgsLightsWidget::onRemoveLight );
Expand Down Expand Up @@ -70,7 +57,7 @@ QgsLightsWidget::QgsLightsWidget( QWidget *parent )
connect( spinDirectionalIntensity, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsLightsWidget::updateCurrentDirectionalLightParameters );
connect( btnDirectionalColor, &QgsColorButton::colorChanged, this, &QgsLightsWidget::updateCurrentDirectionalLightParameters );

connect( mDirectionCompass, &QwtCompass::valueChanged, spinBoxAzimuth, &QgsDoubleSpinBox::setValue );
connect( dialAzimuth, &QSlider::valueChanged, [this]( int value ) {spinBoxAzimuth->setValue( ( value + 180 ) % 360 );} );
connect( spinBoxAzimuth, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsLightsWidget::onSpinBoxAzimuthChange );
connect( spinBoxAltitude, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsLightsWidget::onSpinBoxAltitudeChange );
connect( sliderAltitude, &QSlider::valueChanged, spinBoxAltitude, &QgsDoubleSpinBox::setValue );
Expand Down Expand Up @@ -251,7 +238,7 @@ void QgsLightsWidget::onSpinBoxDirectionChanged()
}


mDirectionCompass->setValue( azimuthAngle );
dialAzimuth->setValue( int( azimuthAngle + 180 ) % 360 );
spinBoxAzimuth->setValue( azimuthAngle );

if ( horizontalVectorMagnitude == 0 )
Expand All @@ -275,7 +262,7 @@ void QgsLightsWidget::onSpinBoxAzimuthChange()
x = -horizontalVectorMagnitude * sin( azimuthValue / 180 * M_PI );
z = horizontalVectorMagnitude * cos( azimuthValue / 180 * M_PI );

whileBlocking( mDirectionCompass )->setValue( azimuthValue );
whileBlocking( dialAzimuth )->setValue( int( azimuthValue + 180 ) % 360 );
whileBlocking( spinDirectionX )->setValue( x );
whileBlocking( spinDirectionZ )->setValue( z );

Expand Down
4 changes: 1 addition & 3 deletions src/app/3d/qgslightswidget.h
Expand Up @@ -23,8 +23,6 @@
#include "qgspointlightsettings.h"
#include "qgsdirectionallightsettings.h"

class QwtCompass;

/**
* Widget for configuration of lights in 3D map scene
* \since QGIS 3.6
Expand Down Expand Up @@ -64,7 +62,7 @@ class QgsLightsWidget : public QWidget, private Ui::QgsLightsWidget
private:
QList<QgsPointLightSettings> mPointLights;
QList<QgsDirectionalLightSettings> mDirectionalLights;
QwtCompass *mDirectionCompass = nullptr;
// QwtCompass *mDirectionCompass = nullptr;
};

#endif // QGSLIGHTSWIDGET_H
26 changes: 24 additions & 2 deletions src/ui/3d/qgslightswidget.ui
Expand Up @@ -312,7 +312,7 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Light direction</string>
<string>Light Direction</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -361,6 +361,28 @@
<item>
<widget class="QWidget" name="directionCmpassWidget" native="true"/>
</item>
<item>
<widget class="QDial" name="dialAzimuth">
<property name="minimum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="sliderPosition">
<number>0</number>
</property>
<property name="wrapping">
<bool>true</bool>
</property>
<property name="notchTarget">
<double>10.000000000000000</double>
</property>
<property name="notchesVisible">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="altitudeSpinBox">
<property name="text">
Expand Down Expand Up @@ -396,7 +418,7 @@
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>2</number>
Expand Down

0 comments on commit 55ee533

Please sign in to comment.