Skip to content
Permalink
Browse files

Move QgsSymbolV2::OutputUnit enum to QgsUnitTypes

And rename to QgsUnitTypes::RenderUnits. This enum is used in
much more contexts than just symbols, so QgsUnitTypes is a
better fit for it.

All methods which previously accepted QgsSymbolV2::OutputUnit
parameters or QgsSymbolV2::OutputUnitList parameters now take
QgsUnitTypes::RenderUnit or QgsUnitTypes::RenderUnitList
parameters respectively.
  • Loading branch information
nyalldawson committed Jul 17, 2016
1 parent f6f5010 commit ce6bd6c973d06be3e122f43dfb27024eb27b3981
Showing with 838 additions and 822 deletions.
  1. +9 −0 doc/api_break.dox
  2. +1 −1 python/core/dxf/qgsdxfexport.sip
  3. +2 −2 python/core/effects/qgsgloweffect.sip
  4. +2 −2 python/core/effects/qgsshadoweffect.sip
  5. +2 −2 python/core/effects/qgstransformeffect.sip
  6. +2 −2 python/core/qgsdiagramrendererv2.sip
  7. +31 −0 python/core/qgsunittypes.sip
  8. +8 −8 python/core/symbology-ng/qgsarrowsymbollayer.sip
  9. +8 −8 python/core/symbology-ng/qgsellipsesymbollayerv2.sip
  10. +50 −50 python/core/symbology-ng/qgsfillsymbollayerv2.sip
  11. +2 −2 python/core/symbology-ng/qgsheatmaprenderer.sip
  12. +11 −11 python/core/symbology-ng/qgslinesymbollayerv2.sip
  13. +10 −10 python/core/symbology-ng/qgsmarkersymbollayerv2.sip
  14. +2 −2 python/core/symbology-ng/qgspointdisplacementrenderer.sip
  15. +16 −16 python/core/symbology-ng/qgssymbollayerv2.sip
  16. +11 −11 python/core/symbology-ng/qgssymbollayerv2utils.sip
  17. +7 −22 python/core/symbology-ng/qgssymbolv2.sip
  18. +4 −4 python/core/symbology-ng/qgsvectorfieldsymbollayer.sip
  19. +3 −3 python/gui/qgsunitselectionwidget.sip
  20. +4 −4 src/app/qgsdecorationcopyright.cpp
  21. +1 −1 src/app/qgsdecorationcopyrightdialog.cpp
  22. +1 −1 src/app/qgsdecorationitem.cpp
  23. +1 −1 src/app/qgsdecorationitem.h
  24. +4 −4 src/app/qgsdecorationnortharrow.cpp
  25. +1 −1 src/app/qgsdecorationnortharrowdialog.cpp
  26. +4 −4 src/app/qgsdecorationscalebar.cpp
  27. +1 −1 src/app/qgsdecorationscalebardialog.cpp
  28. +4 −4 src/app/qgsdiagramproperties.cpp
  29. +29 −29 src/app/qgslabelinggui.cpp
  30. +6 −6 src/app/qgsmaptooloffsetpointsymbol.cpp
  31. +1 −1 src/app/qgsmaptooloffsetpointsymbol.h
  32. +1 −1 src/core/diagram/qgsdiagram.cpp
  33. +11 −11 src/core/dxf/qgsdxfexport.cpp
  34. +2 −2 src/core/dxf/qgsdxfexport.h
  35. +1 −1 src/core/effects/qgsgloweffect.cpp
  36. +3 −3 src/core/effects/qgsgloweffect.h
  37. +1 −1 src/core/effects/qgsshadoweffect.cpp
  38. +3 −3 src/core/effects/qgsshadoweffect.h
  39. +1 −1 src/core/effects/qgstransformeffect.cpp
  40. +3 −3 src/core/effects/qgstransformeffect.h
  41. +1 −1 src/core/layertree/qgslayertreemodellegendnode.cpp
  42. +1 −1 src/core/qgsdiagramrendererv2.cpp
  43. +5 −5 src/core/qgsdiagramrendererv2.h
  44. +5 −5 src/core/qgspallabeling.cpp
  45. +15 −20 src/core/qgsunittypes.cpp
  46. +19 −9 src/core/qgsunittypes.h
  47. +5 −5 src/core/qgsvectorfilewriter.cpp
  48. +2 −2 src/core/qgsvectorfilewriter.h
  49. +1 −1 src/core/symbology-ng/qgs25drenderer.cpp
  50. +5 −5 src/core/symbology-ng/qgsarrowsymbollayer.cpp
  51. +12 −12 src/core/symbology-ng/qgsarrowsymbollayer.h
  52. +10 −10 src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
  53. +11 −11 src/core/symbology-ng/qgsellipsesymbollayerv2.h
  54. +48 −48 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  55. +69 −69 src/core/symbology-ng/qgsfillsymbollayerv2.h
  56. +7 −7 src/core/symbology-ng/qgsheatmaprenderer.cpp
  57. +3 −3 src/core/symbology-ng/qgsheatmaprenderer.h
  58. +12 −12 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  59. +14 −14 src/core/symbology-ng/qgslinesymbollayerv2.h
  60. +21 −21 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  61. +13 −13 src/core/symbology-ng/qgsmarkersymbollayerv2.h
  62. +2 −2 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  63. +5 −5 src/core/symbology-ng/qgspointdisplacementrenderer.h
  64. +11 −11 src/core/symbology-ng/qgssymbollayerv2.cpp
  65. +20 −20 src/core/symbology-ng/qgssymbollayerv2.h
  66. +50 −50 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  67. +11 −11 src/core/symbology-ng/qgssymbollayerv2utils.h
  68. +10 −10 src/core/symbology-ng/qgssymbolv2.cpp
  69. +8 −23 src/core/symbology-ng/qgssymbolv2.h
  70. +4 −4 src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp
  71. +5 −5 src/core/symbology-ng/qgsvectorfieldsymbollayer.h
  72. +3 −3 src/gui/effects/qgspainteffectwidget.cpp
  73. +3 −3 src/gui/qgshighlight.cpp
  74. +1 −1 src/gui/qgshighlight.h
  75. +16 −16 src/gui/qgsunitselectionwidget.cpp
  76. +4 −4 src/gui/qgsunitselectionwidget.h
  77. +5 −5 src/gui/symbology-ng/qgsarrowsymbollayerwidget.cpp
  78. +5 −5 src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
  79. +1 −1 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  80. +1 −1 src/gui/symbology-ng/qgsheatmaprendererwidget.cpp
  81. +1 −1 src/gui/symbology-ng/qgslayerpropertieswidget.cpp
  82. +1 −1 src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp
  83. +2 −2 src/gui/symbology-ng/qgsrendererv2widget.cpp
  84. +35 −35 src/gui/symbology-ng/qgssymbollayerv2widget.cpp
  85. +1 −1 src/gui/symbology-ng/qgssymbollevelsv2dialog.cpp
  86. +2 −2 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  87. +1 −1 src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
  88. +1 −1 src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp
  89. +2 −2 tests/src/core/testqgsdiagram.cpp
  90. +3 −3 tests/src/core/testqgslegendrenderer.cpp
  91. +5 −5 tests/src/core/testqgspainteffect.cpp
  92. +2 −2 tests/src/core/testqgsrasterfill.cpp
  93. +3 −3 tests/src/core/testqgsshapeburst.cpp
  94. +46 −46 tests/src/python/test_qgsmapunitscale.py
  95. +2 −1 tests/src/python/test_qgssymbollayerv2.py
  96. +12 −11 tests/src/python/test_qgssymbolv2.py
  97. +11 −12 tests/src/python/test_qgsunittypes.py
@@ -447,6 +447,15 @@ has improved sort capabilities including the ability to set custom sort values f
and for forcing certain items to always sort on top.</li>
</ul>

\subsection qgis_api_break_3_0_QgsSymbolV2 QgsSymbolV2

<ul>
<li>The OutputUnit enum, including QgsSymbolV2::MM, QgsSymbolV2::MapUnit, QgsSymbolV2::Mixed, QgsSymbolV2::Pixel and QgsSymbolV2::Percentage has been moved to QgsUnitTypes
and renamed to RenderUnit. QgsSymbolV2::OutputUnitList was renamed to QgsUnitTypes::RenderUnitList. All methods which previously accepted QgsSymbolV2::OutputUnit
parameters or QgsSymbolV2::OutputUnitList parameters now take QgsUnitTypes::RenderUnit or QgsUnitTypes::RenderUnitList parameters respectively.</li>
<li>subsetString() was made const. This has no effect on PyQGIS code, but c++ code implementing derived layer classes will need to update the signature of this method to match.</li>
</ul>

\subsection qgis_api_break_3_0_QgsTreeWidgetItem QgsTreeWidgetItem

<ul>
@@ -327,7 +327,7 @@ class QgsDxfExport
//! @note added in 2.15
void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor& color );

static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );

//! Return cleaned layer name for use in DXF
static QString dxfLayerName( const QString &name );
@@ -50,15 +50,15 @@ class QgsGlowEffect : QgsPaintEffect
* @see setSpread
* @see setSpreadMapUnitScale
*/
void setSpreadUnit( const QgsSymbolV2::OutputUnit unit );
void setSpreadUnit( const QgsUnitTypes::RenderUnit unit );

/** Returns the units used for the glow spread distance.
* @returns units for spread distance
* @see setSpreadUnit
* @see spread
* @see spreadMapUnitScale
*/
QgsSymbolV2::OutputUnit spreadUnit() const;
QgsUnitTypes::RenderUnit spreadUnit() const;

/** Sets the map unit scale used for the spread distance.
* @param scale map unit scale for spread distance
@@ -69,15 +69,15 @@ class QgsShadowEffect : QgsPaintEffect
* @see setOffsetDistance
* @see setOffsetMapUnitScale
*/
void setOffsetUnit( const QgsSymbolV2::OutputUnit unit );
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit );

/** Returns the units used for the shadow offset distance.
* @returns units for offset distance
* @see setOffsetUnit
* @see offsetDistance
* @see offsetMapUnitScale
*/
QgsSymbolV2::OutputUnit offsetUnit() const;
QgsUnitTypes::RenderUnit offsetUnit() const;

/** Sets the map unit scale used for the shadow offset distance.
* @param scale map unit scale for offset distance
@@ -71,7 +71,7 @@ class QgsTransformEffect : QgsPaintEffect
* @see setTranslateY
* @see setTranslateMapUnitScale
*/
void setTranslateUnit( const QgsSymbolV2::OutputUnit unit );
void setTranslateUnit( const QgsUnitTypes::RenderUnit unit );

/** Returns the units used for the transform translation.
* @returns units for translation
@@ -80,7 +80,7 @@ class QgsTransformEffect : QgsPaintEffect
* @see translateY
* @see translateMapUnitScale
*/
QgsSymbolV2::OutputUnit translateUnit() const;
QgsUnitTypes::RenderUnit translateUnit() const;

/** Sets the map unit scale used for the transform translation.
* @param scale map unit scale for translation
@@ -285,7 +285,7 @@ class QgsDiagramSettings

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

/** Diagram size unit scale
* @note added in 2.16
@@ -295,7 +295,7 @@ class QgsDiagramSettings
/** Line unit index
* @note added in 2.16
*/
QgsSymbolV2::OutputUnit lineSizeUnit;
QgsUnitTypes::RenderUnit lineSizeUnit;

/** Line unit scale
* @note added in 2.16
@@ -61,6 +61,19 @@ class QgsUnitTypes
UnknownAngleUnit, /*!< unknown angle unit */
};

//! List of render units
typedef QList<QgsUnitTypes::RenderUnit> RenderUnitList;

//! Rendering size units
enum RenderUnit
{
RenderMillimeters, //!< millimeters
RenderMapUnits, //!< map units
RenderPixels, //!< pixels
RenderPercentage, //!< percentage of another measurement (eg canvas size, feature size)
UnknownRenderUnit, //!< mixed or unknown units
};

/** Returns the type for a distance unit.
*/
static DistanceUnitType unitType( QgsUnitTypes::DistanceUnit unit );
@@ -181,5 +194,23 @@ class QgsUnitTypes
* @returns formatted angle string
*/
static QString formatAngle( double angle, int decimals, AngleUnit unit );

// RENDER UNITS

/** Encodes a render unit to a string.
* @param unit unit to encode
* @returns encoded string
* @see decodeRenderUnit()
*/
static QString encodeUnit( RenderUnit unit );

/** Decodes a render unit from a string.
* @param string string to decode
* @param ok optional boolean, will be set to true if string was converted successfully
* @returns decoded units
* @see encodeUnit()
*/
static RenderUnit decodeRenderUnit( const QString& string, bool *ok = 0 );

};

@@ -39,9 +39,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
/** Set the arrow width */
void setArrowWidth( double width );
/** Get the unit for the arrow width */
QgsSymbolV2::OutputUnit arrowWidthUnit() const;
QgsUnitTypes::RenderUnit arrowWidthUnit() const;
/** Set the unit for the arrow width */
void setArrowWidthUnit( QgsSymbolV2::OutputUnit unit );
void setArrowWidthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the arrow width */
QgsMapUnitScale arrowWidthUnitScale() const;
/** Set the scale for the arrow width */
@@ -52,9 +52,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
/** Set the arrow start width */
void setArrowStartWidth( double width );
/** Get the unit for the arrow start width */
QgsSymbolV2::OutputUnit arrowStartWidthUnit() const;
QgsUnitTypes::RenderUnit arrowStartWidthUnit() const;
/** Set the unit for the arrow start width */
void setArrowStartWidthUnit( QgsSymbolV2::OutputUnit unit );
void setArrowStartWidthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the arrow start width */
QgsMapUnitScale arrowStartWidthUnitScale() const;
/** Set the scale for the arrow start width */
@@ -65,9 +65,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
/** Set the arrow head length */
void setHeadLength( double length );
/** Get the unit for the head length */
QgsSymbolV2::OutputUnit headLengthUnit() const;
QgsUnitTypes::RenderUnit headLengthUnit() const;
/** Set the unit for the head length */
void setHeadLengthUnit( QgsSymbolV2::OutputUnit unit );
void setHeadLengthUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the head length */
QgsMapUnitScale headLengthUnitScale() const;
/** Set the scale for the head length */
@@ -78,9 +78,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
/** Set the arrow head height */
void setHeadThickness( double thickness );
/** Get the unit for the head height */
QgsSymbolV2::OutputUnit headThicknessUnit() const;
QgsUnitTypes::RenderUnit headThicknessUnit() const;
/** Set the unit for the head height */
void setHeadThicknessUnit( QgsSymbolV2::OutputUnit unit );
void setHeadThicknessUnit( QgsUnitTypes::RenderUnit unit );
/** Get the scale for the head height */
QgsMapUnitScale headThicknessUnitScale() const;
/** Set the scale for the head height */
@@ -51,26 +51,26 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
void setOutlineColor( const QColor& c );
QColor outlineColor() const;

void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit symbolWidthUnit() const;
void setSymbolWidthUnit( QgsUnitTypes::RenderUnit unit );
QgsUnitTypes::RenderUnit symbolWidthUnit() const;

void setSymbolWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& symbolWidthMapUnitScale() const;

void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit symbolHeightUnit() const;
void setSymbolHeightUnit( QgsUnitTypes::RenderUnit unit );
QgsUnitTypes::RenderUnit symbolHeightUnit() const;

void setSymbolHeightMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& symbolHeightMapUnitScale() const;

void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
QgsUnitTypes::RenderUnit outlineWidthUnit() const;

void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& outlineWidthMapUnitScale() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
QgsUnitTypes::RenderUnit outputUnit() const;

void setMapUnitScale( const QgsMapUnitScale& scale );
QgsMapUnitScale mapUnitScale() const;

0 comments on commit ce6bd6c

Please sign in to comment.
You can’t perform that action at this time.