Skip to content

Commit

Permalink
Fix unit choice for ellipse symbol layer type
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 25, 2014
1 parent 8766cd1 commit 8224a16
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
35 changes: 27 additions & 8 deletions src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLay
{
setupUi( this );

mSymbolWidthUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
mSymbolHeightUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
mOutlineWidthUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );
mOffsetUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), 1 );

btnChangeColorFill->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColorFill->setColorDialogTitle( tr( "Select fill color" ) );
btnChangeColorFill->setContext( "symbology" );
Expand Down Expand Up @@ -90,6 +95,8 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mOutlineWidthUnitWidget->setMapUnitScale( mLayer->outlineWidthMapUnitScale() );
mSymbolHeightUnitWidget->setUnit( mLayer->symbolHeightUnit() );
mSymbolHeightUnitWidget->setMapUnitScale( mLayer->symbolHeightMapUnitScale() );
mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
}

QPointF offsetPt = mLayer->offset();
Expand Down Expand Up @@ -187,38 +194,46 @@ void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorFill_colorChanged( const QC
emit changed();
}

void QgsEllipseSymbolLayerV2Widget::on_mSymbolWidthUnitComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerV2Widget::on_mSymbolWidthUnitWidget_changed()
{
if ( mLayer )
{
mLayer->setSymbolWidthUnit(( QgsSymbolV2::OutputUnit ) index );
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mSymbolWidthUnitWidget->getUnit() );
mLayer->setSymbolWidthUnit( unit );
mLayer->setSymbolWidthMapUnitScale( mSymbolWidthUnitWidget->getMapUnitScale() );
emit changed();
}
}

void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthUnitComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthUnitWidget_changed()
{
if ( mLayer )
{
mLayer->setOutlineWidthUnit(( QgsSymbolV2::OutputUnit ) index );
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mOutlineWidthUnitWidget->getUnit() );
mLayer->setOutlineWidthUnit( unit );
mLayer->setOutlineWidthMapUnitScale( mOutlineWidthUnitWidget->getMapUnitScale() );
emit changed();
}
}

void QgsEllipseSymbolLayerV2Widget::on_mSymbolHeightUnitComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerV2Widget::on_mSymbolHeightUnitWidget_changed()
{
if ( mLayer )
{
mLayer->setSymbolHeightUnit(( QgsSymbolV2::OutputUnit ) index );
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mSymbolHeightUnitWidget->getUnit() );
mLayer->setSymbolHeightUnit( unit );
mLayer->setSymbolHeightMapUnitScale( mSymbolHeightUnitWidget->getMapUnitScale() );
emit changed();
}
}

void QgsEllipseSymbolLayerV2Widget::on_mOffsetUnitComboBox_currentIndexChanged( int index )
void QgsEllipseSymbolLayerV2Widget::on_mOffsetUnitWidget_changed()
{
if ( mLayer )
{
mLayer->setOffsetUnit(( QgsSymbolV2::OutputUnit ) index );
QgsSymbolV2::OutputUnit unit = static_cast<QgsSymbolV2::OutputUnit>( mOffsetUnitWidget->getUnit() );
mLayer->setOffsetUnit( unit );
mLayer->setOffsetMapUnitScale( mOffsetUnitWidget->getMapUnitScale() );
emit changed();
}
}
Expand All @@ -230,6 +245,10 @@ void QgsEllipseSymbolLayerV2Widget::blockComboSignals( bool block )
mSymbolHeightUnitWidget->blockSignals( block );
mHorizontalAnchorComboBox->blockSignals( block );
mVerticalAnchorComboBox->blockSignals( block );
mSymbolWidthUnitWidget->blockSignals( block );
mOutlineWidthUnitWidget->blockSignals( block );
mSymbolHeightUnitWidget->blockSignals( block );
mOffsetUnitWidget->blockSignals( block );
}

void QgsEllipseSymbolLayerV2Widget::on_mHorizontalAnchorComboBox_currentIndexChanged( int index )
Expand Down
8 changes: 4 additions & 4 deletions src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class GUI_EXPORT QgsEllipseSymbolLayerV2Widget: public QgsSymbolLayerV2Widget, p
void on_btnChangeColorBorder_colorChanged( const QColor& newColor );
void on_btnChangeColorFill_colorChanged( const QColor& newColor );

void on_mSymbolWidthUnitComboBox_currentIndexChanged( int index );
void on_mOutlineWidthUnitComboBox_currentIndexChanged( int index );
void on_mSymbolHeightUnitComboBox_currentIndexChanged( int index );
void on_mOffsetUnitComboBox_currentIndexChanged( int index );
void on_mSymbolWidthUnitWidget_changed();
void on_mOutlineWidthUnitWidget_changed();
void on_mSymbolHeightUnitWidget_changed();
void on_mOffsetUnitWidget_changed();
void on_mHorizontalAnchorComboBox_currentIndexChanged( int index );
void on_mVerticalAnchorComboBox_currentIndexChanged( int index );
void on_mDataDefinedPropertiesButton_clicked();
Expand Down

0 comments on commit 8224a16

Please sign in to comment.