Skip to content
Permalink
Browse files

Fix unit choice for ellipse symbol layer type

  • Loading branch information
nyalldawson committed Aug 25, 2014
1 parent 8766cd1 commit 8224a16f11b3b9a0215d4f3fc7819bae18bbe749
@@ -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" );
@@ -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();
@@ -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();
}
}
@@ -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 )
@@ -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();

0 comments on commit 8224a16

Please sign in to comment.