Skip to content

Commit

Permalink
Followup 31d7be
Browse files Browse the repository at this point in the history
Tweak some API and docs, and fix overlapping UI widgets
  • Loading branch information
nyalldawson committed Apr 5, 2016
1 parent fe54a78 commit 8948607
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 142 deletions.
24 changes: 19 additions & 5 deletions python/core/qgsdiagramrendererv2.sip
Expand Up @@ -260,6 +260,8 @@ class QgsDiagramSettings
#include <qgsdiagramrendererv2.h>
%End
public:

//! @deprecated use QgsSymbolV2::OutputUnit instead
enum SizeType
{
MM,
Expand Down Expand Up @@ -289,14 +291,26 @@ class QgsDiagramSettings
//! @note added in 2.10
QList< QString > categoryLabels;
QSizeF size; //size
//! Diagram size unit index (mm, map units, or pixels)

/** Diagram size unit
*/
QgsSymbolV2::OutputUnit sizeType;
//! Diagram size unit scale

/** Diagram size unit scale
* @note added in 2.16
*/
QgsMapUnitScale sizeScale;
//! Line unit index (mm, map units, or pixels)
QgsSymbolV2::OutputUnit lineSizeType;
//! Line unit scale

/** Line unit index
* @note added in 2.16
*/
QgsSymbolV2::OutputUnit lineSizeUnit;

/** Line unit scale
* @note added in 2.16
*/
QgsMapUnitScale lineSizeScale;

QColor backgroundColor;
QColor penColor;
double penWidth;
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsdiagramproperties.cpp
Expand Up @@ -266,7 +266,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
mScaleVisibilityGroupBox->setChecked( settingList.at( 0 ).scaleBasedVisibility );
mDiagramUnitComboBox->setUnit( settingList.at( 0 ).sizeType );
mDiagramUnitComboBox->setMapUnitScale( settingList.at( 0 ).sizeScale );
mDiagramLineUnitComboBox->setUnit( settingList.at( 0 ).lineSizeType );
mDiagramLineUnitComboBox->setUnit( settingList.at( 0 ).lineSizeUnit );
mDiagramLineUnitComboBox->setMapUnitScale( settingList.at( 0 ).lineSizeScale );

if ( settingList.at( 0 ).labelPlacementMethod == QgsDiagramSettings::Height )
Expand Down Expand Up @@ -699,7 +699,7 @@ void QgsDiagramProperties::apply()
ds.size = QSizeF( mDiagramSizeSpinBox->value(), mDiagramSizeSpinBox->value() );
ds.sizeType = mDiagramUnitComboBox->unit();
ds.sizeScale = mDiagramUnitComboBox->getMapUnitScale();
ds.lineSizeType = mDiagramLineUnitComboBox->unit();
ds.lineSizeUnit = mDiagramLineUnitComboBox->unit();
ds.lineSizeScale = mDiagramLineUnitComboBox->getMapUnitScale();
ds.labelPlacementMethod = static_cast<QgsDiagramSettings::LabelPlacementMethod>( mLabelPlacementComboBox->itemData( mLabelPlacementComboBox->currentIndex() ).toInt() );
ds.scaleByArea = mScaleDependencyComboBox->itemData( mScaleDependencyComboBox->currentIndex() ).toBool();
Expand Down
2 changes: 1 addition & 1 deletion src/core/diagram/qgsdiagram.cpp
Expand Up @@ -70,7 +70,7 @@ QgsExpression *QgsDiagram::getExpression( const QString &expression, const QgsEx

void QgsDiagram::setPenWidth( QPen& pen, const QgsDiagramSettings& s, const QgsRenderContext& c )
{
pen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( c, s.penWidth, s.lineSizeType, s.lineSizeScale ) );
pen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( c, s.penWidth, s.lineSizeUnit, s.lineSizeScale ) );
}


Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsdiagramrendererv2.cpp
Expand Up @@ -194,7 +194,7 @@ void QgsDiagramSettings::readXML( const QDomElement& elem, const QgsVectorLayer*
sizeScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( elem.attribute( "sizeScale" ) );

//line width unit type and scale
lineSizeType = QgsSymbolLayerV2Utils::decodeOutputUnit( elem.attribute( "lineSizeType" ) );
lineSizeUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( elem.attribute( "lineSizeType" ) );
lineSizeScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( elem.attribute( "lineSizeScale" ) );

//label placement method
Expand Down Expand Up @@ -310,7 +310,7 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc,
categoryElem.setAttribute( "sizeScale", QgsSymbolLayerV2Utils::encodeMapUnitScale( sizeScale ) );

//line width unit type and scale
categoryElem.setAttribute( "lineSizeType", QgsSymbolLayerV2Utils::encodeOutputUnit( lineSizeType ) );
categoryElem.setAttribute( "lineSizeType", QgsSymbolLayerV2Utils::encodeOutputUnit( lineSizeUnit ) );
categoryElem.setAttribute( "lineSizeScale", QgsSymbolLayerV2Utils::encodeMapUnitScale( lineSizeScale ) );

// label placement method (text diagram)
Expand Down
16 changes: 11 additions & 5 deletions src/core/qgsdiagramrendererv2.h
Expand Up @@ -298,6 +298,8 @@ class CORE_EXPORT QgsDiagramLayerSettings
class CORE_EXPORT QgsDiagramSettings
{
public:

//! @deprecated use QgsSymbolV2::OutputUnit instead
enum SizeType
{
MM,
Expand All @@ -322,7 +324,7 @@ class CORE_EXPORT QgsDiagramSettings
QgsDiagramSettings()
: enabled( true )
, sizeType( QgsSymbolV2::MM )
, lineSizeType( QgsSymbolV2::MM )
, lineSizeUnit( QgsSymbolV2::MM )
, penWidth( 0.0 )
, labelPlacementMethod( QgsDiagramSettings::Height )
, diagramOrientation( QgsDiagramSettings::Up )
Expand All @@ -342,22 +344,26 @@ class CORE_EXPORT QgsDiagramSettings
//! @note added in 2.10
QList< QString > categoryLabels;
QSizeF size; //size
/** Diagram size unit index (mm, map units, or pixels)
* @note added in 2.16

/** Diagram size unit
*/
QgsSymbolV2::OutputUnit sizeType;

/** Diagram size unit scale
* @note added in 2.16
*/
QgsMapUnitScale sizeScale;
/** Line unit index (mm, map units, or pixels)

/** Line unit index
* @note added in 2.16
*/
QgsSymbolV2::OutputUnit lineSizeType;
QgsSymbolV2::OutputUnit lineSizeUnit;

/** Line unit scale
* @note added in 2.16
*/
QgsMapUnitScale lineSizeScale;

QColor backgroundColor;
QColor penColor;
double penWidth;
Expand Down

0 comments on commit 8948607

Please sign in to comment.