Skip to content
Permalink
Browse files

min-max map unit scale support

  • Loading branch information
manisandro committed May 7, 2014
1 parent 620220d commit 53ac67517aedafe77f1791c7dd3f33da36914f16
Showing with 3,003 additions and 1,319 deletions.
  1. +3 −0 python/core/core.sip
  2. +27 −0 python/core/qgsmapunitscale.sip
  3. +14 −0 python/core/symbology-ng/qgsellipsesymbollayerv2.sip
  4. +68 −0 python/core/symbology-ng/qgsfillsymbollayerv2.sip
  5. +31 −1 python/core/symbology-ng/qgslinesymbollayerv2.sip
  6. +8 −0 python/core/symbology-ng/qgsmarkersymbollayerv2.sip
  7. +19 −1 python/core/symbology-ng/qgssymbollayerv2.sip
  8. +5 −3 python/core/symbology-ng/qgssymbollayerv2utils.sip
  9. +9 −1 python/core/symbology-ng/qgssymbolv2.sip
  10. +8 −0 python/core/symbology-ng/qgsvectorfieldsymbollayer.sip
  11. +21 −19 python/gui/symbology-ng/qgssymbollayerv2widget.sip
  12. +3 −1 python/gui/symbology-ng/qgssymbolslistwidget.sip
  13. +17 −16 python/qsci_apis/PyQGIS-2.0.api
  14. +66 −33 src/app/qgslabelinggui.cpp
  15. +4 −2 src/app/qgslabelinggui.h
  16. +1 −0 src/core/CMakeLists.txt
  17. +65 −0 src/core/qgsmapunitscale.h
  18. +79 −29 src/core/qgspallabeling.cpp
  19. +20 −5 src/core/qgspallabeling.h
  20. +69 −12 src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
  21. +22 −5 src/core/symbology-ng/qgsellipsesymbollayerv2.h
  22. +325 −54 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  23. +144 −49 src/core/symbology-ng/qgsfillsymbollayerv2.h
  24. +111 −20 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  25. +44 −9 src/core/symbology-ng/qgslinesymbollayerv2.h
  26. +101 −19 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  27. +26 −6 src/core/symbology-ng/qgsmarkersymbollayerv2.h
  28. +5 −3 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  29. +57 −20 src/core/symbology-ng/qgssymbollayerv2.cpp
  30. +35 −8 src/core/symbology-ng/qgssymbollayerv2.h
  31. +39 −17 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  32. +15 −9 src/core/symbology-ng/qgssymbollayerv2utils.h
  33. +56 −25 src/core/symbology-ng/qgssymbolv2.cpp
  34. +16 −6 src/core/symbology-ng/qgssymbolv2.h
  35. +66 −9 src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp
  36. +11 −2 src/core/symbology-ng/qgsvectorfieldsymbollayer.h
  37. +3 −0 src/gui/CMakeLists.txt
  38. +9 −3 src/gui/qgsscalecombobox.cpp
  39. +122 −0 src/gui/qgsunitselectionwidget.cpp
  40. +81 −0 src/gui/qgsunitselectionwidget.h
  41. +16 −11 src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
  42. +263 −151 src/gui/symbology-ng/qgssymbollayerv2widget.cpp
  43. +34 −32 src/gui/symbology-ng/qgssymbollayerv2widget.h
  44. +17 −11 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  45. +8 −6 src/gui/symbology-ng/qgssymbolslistwidget.h
  46. +11 −8 src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp
  47. +425 −241 src/ui/qgslabelingguibase.ui
  48. +98 −0 src/ui/qgsmapunitscaledialog.ui
  49. +74 −0 src/ui/qgsunitselectionwidget.ui
  50. +17 −56 src/ui/symbollayer/widget_ellipse.ui
  51. +9 −25 src/ui/symbollayer/widget_fontmarker.ui
  52. +17 −13 src/ui/symbollayer/widget_gradientfill.ui
  53. +20 −25 src/ui/symbollayer/widget_linepatternfill.ui
  54. +11 −36 src/ui/symbollayer/widget_markerline.ui
  55. +22 −49 src/ui/symbollayer/widget_pointpatternfill.ui
  56. +9 −40 src/ui/symbollayer/widget_shapeburstfill.ui
  57. +14 −30 src/ui/symbollayer/widget_simplefill.ui
  58. +17 −56 src/ui/symbollayer/widget_simpleline.ui
  59. +16 −38 src/ui/symbollayer/widget_simplemarker.ui
  60. +18 −25 src/ui/symbollayer/widget_svgfill.ui
  61. +10 −37 src/ui/symbollayer/widget_svgmarker.ui
  62. +31 −21 src/ui/symbollayer/widget_symbolslist.ui
  63. +21 −21 src/ui/symbollayer/widget_vectorfield.ui
@@ -52,6 +52,7 @@
%Include qgsmaprendererjob.sip
%Include qgsmapsettings.sip
%Include qgsmaptopixel.sip
%Include qgsmapunitscale.sip
%Include qgsmessagelog.sip
%Include qgsmessageoutput.sip
%Include qgsmimedatautils.sip
@@ -217,3 +218,5 @@
%Include symbology-ng/qgssymbologyv2conversion.sip

%Include dxf/qgsdxfexport.sip


@@ -0,0 +1,27 @@
/*!
* \class QgsMapUnitScale
* \brief Struct for storing maximum and minimum scales for measurements in map units
*
* For measurements in map units, a minimum and a maximum scale can be defined.
* Outside this range, the measurements aren't scaled anymore proportionally to
* the map scale.
*/

class QgsMapUnitScale
{
%TypeHeaderCode
#include <qgsmapunitscale.h>
%End
public:
QgsMapUnitScale();

/** The minimum scale, or 0.0 if unset */
double minScale;
/** The maximum scale, or 0.0 if unset */
double maxScale;

double computeMapUnitsPerPixel(const QgsRenderContext& c) const;
};



@@ -46,13 +46,27 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2

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

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

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

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

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

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

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

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


@@ -70,12 +70,21 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2

void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit borderWidthUnit() const;

void setBorderWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& borderWidthMapUnitScale() const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

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

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

double estimateMaxBleed() const;

@@ -199,6 +208,15 @@ class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2
/**Units for gradient fill offset*/
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

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

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

};

@@ -400,6 +418,9 @@ class QgsShapeburstFillSymbolLayerV2 : QgsFillSymbolLayerV2
* @see setOffsetUnit
*/
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

};

@@ -420,6 +441,15 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2

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

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

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

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

virtual double estimateMaxBleed() const;

@@ -472,9 +502,15 @@ class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer

void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit patternWidthUnit() const;

void setPatternWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& patternWidthMapUnitScale() const;

void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const;

void setSvgOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& svgOutlineWidthMapUnitScale() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
@@ -525,15 +561,27 @@ class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer

void setDistanceUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceUnit() const;

void setDistanceMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& distanceMapUnitScale() const;

void setLineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit lineWidthUnit() const;

void setLineWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& lineWidthMapUnitScale() const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

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

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

bool setSubSymbol( QgsSymbolV2* symbol );
QgsSymbolV2* subSymbol();
@@ -584,18 +632,33 @@ class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer

void setDistanceXUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceXUnit() const;

void setDistanceXMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& distanceXMapUnitScale() const;

void setDistanceYUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceYUnit() const;

void setDistanceYMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& distanceYMapUnitScale() const;

void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit displacementXUnit() const;

void setDisplacementXMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& displacementXMapUnitScale() const;

void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit displacementYUnit() const;

void setDisplacementYMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& displacementYMapUnitScale() const;

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

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

virtual QSet<QString> usedAttributes() const;

@@ -641,6 +704,11 @@ class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2

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

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

virtual QSet<QString> usedAttributes() const;
};


@@ -34,6 +34,9 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2

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

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

double estimateMaxBleed() const;

@@ -51,14 +54,20 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
double offset() const;
void setOffset( double offset );

QgsSymbolV2::OutputUnit offsetUnit() const;
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

bool useCustomDashPattern() const;
void setUseCustomDashPattern( bool b );

QgsSymbolV2::OutputUnit customDashPatternUnit() const;
void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit );

const QgsMapUnitScale& customDashPatternMapUnitScale() const;
void setCustomDashPatternMapUnitScale( const QgsMapUnitScale& scale);

QVector<qreal> customDashVector() const;
void setCustomDashVector( const QVector<qreal>& vector );
@@ -180,15 +189,34 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
* @see setOffsetAlongLine
*/
void setOffsetAlongLineUnit( QgsSymbolV2::OutputUnit unit );

/**Returns the map unit scale used for calculating the offset in map units along line for markers.
* @returns Offset along line map unit scale.
*/
const QgsMapUnitScale& offsetAlongLineMapUnitScale() const;

/**Sets the map unit scale used for calculating the offset in map units along line for markers.
* @param scale Offset along line map unit scale.
*/
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale& scale);

QgsSymbolV2::OutputUnit intervalUnit() const;
void setIntervalUnit( QgsSymbolV2::OutputUnit unit );

void setIntervalMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& intervalMapUnitScale() const;

QgsSymbolV2::OutputUnit offsetUnit() const;
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

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

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

protected:

@@ -197,3 +225,5 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderContext& context );
double markerAngle( const QPolygonF& points, bool isRing, int vertex );
};


@@ -63,6 +63,9 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2

QgsSymbolV2::OutputUnit outlineWidthUnit() const;
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit u );

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

bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;

@@ -124,6 +127,9 @@ class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2

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

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

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
@@ -173,3 +179,5 @@ class QgsFontMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
QChar character() const;
void setCharacter( QChar ch );
};


@@ -110,6 +110,9 @@ class QgsSymbolLayerV2

virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
virtual QgsSymbolV2::OutputUnit outputUnit() const;

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

// used only with rending with symbol levels is turned on (0 = first pass, 1 = second, ...)
void setRenderingPass( int renderingPass );
@@ -197,12 +200,21 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& offsetMapUnitScale() const;

void setSizeUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit sizeUnit() const;

void setSizeMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& sizeMapUnitScale() const;

virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
virtual QgsSymbolV2::OutputUnit outputUnit() const;

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

void setHorizontalAnchorPoint( HorizontalAnchorPoint h );
HorizontalAnchorPoint horizontalAnchorPoint() const;
@@ -219,7 +231,8 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
//! @note available in python bindings as markerOffset2
void markerOffset( const QgsSymbolV2RenderContext& context, double width, double height,
QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::OutputUnit heightUnit,
double& offsetX, double& offsetY ) const /PyName=markerOffset2/;
double& offsetX, double& offsetY,
const QgsMapUnitScale& widthMapUnitScale, const QgsMapUnitScale& heightMapUnitScale ) const /PyName=markerOffset2/;

static QPointF _rotatedOffset( const QPointF& offset, double angle );
};
@@ -241,6 +254,9 @@ class QgsLineSymbolLayerV2 : QgsSymbolLayerV2

void setWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit widthUnit() const;

void setWidthMapUnitScale( const QgsMapUnitScale& scale);
const QgsMapUnitScale& widthMapUnitScale() const;

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );

@@ -269,3 +285,5 @@ class QgsFillSymbolLayerV2 : QgsSymbolLayerV2
/**Default method to render polygon*/
void _renderPolygon( QPainter* p, const QPolygonF& points, const QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
};


0 comments on commit 53ac675

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