mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[FEATURE] Add option to map unit scaling for limiting size in mm
Previously only the option to limit the scale range of the scaling was available. Now you can also choose to limit the corresponding rendered size in mm.
This commit is contained in:
parent
b6930204c5
commit
586d59a432
@ -25,6 +25,15 @@ class QgsMapUnitScale
|
||||
/** The maximum scale, or 0.0 if unset */
|
||||
double maxScale;
|
||||
|
||||
/** Whether the minimum size in mm should be respected */
|
||||
bool minSizeMMEnabled;
|
||||
/** The minimum size in millimeters, or 0.0 if unset */
|
||||
double minSizeMM;
|
||||
/** Whether the maximum size in mm should be respected */
|
||||
bool maxSizeMMEnabled;
|
||||
/** The maximum size in millimeters, or 0.0 if unset */
|
||||
double maxSizeMM;
|
||||
|
||||
/** Computes a map units per pixel scaling factor, respecting the minimum and maximum scales
|
||||
* set for the object.
|
||||
* @param c render context
|
||||
|
@ -311,8 +311,27 @@ class QgsSymbolLayerV2Utils
|
||||
*/
|
||||
static QColor parseColorWithAlpha( const QString colorStr, bool &containsAlpha, bool strictEval = false );
|
||||
|
||||
/** Returns the line width scale factor depending on the unit and the paint device*/
|
||||
/** Returns the line width scale factor depending on the unit and the paint device.
|
||||
* Consider using convertToPainterUnits() instead, as convertToPainterUnits() respects the size limits specified by the scale
|
||||
* parameter.
|
||||
* @param c render context
|
||||
* @param u units to convert from
|
||||
* @param scale map unit scale, specifying limits for the map units to convert from
|
||||
* @see convertToPainterUnits()
|
||||
*/
|
||||
static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Converts a size from the specied units to painter units. The conversion respects the limits
|
||||
* specified by the optional scale parameter.
|
||||
* @param c render context
|
||||
* @param size size to convert
|
||||
* @param unit units for specified size
|
||||
* @param scale map unit scale
|
||||
* @note added in QGIS 2.12
|
||||
* @see lineWidthScaleFactor
|
||||
*/
|
||||
static double convertToPainterUnits( const QgsRenderContext&c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Returns scale factor painter units -> pixel dimensions*/
|
||||
static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
/** Returns scale factor painter units -> map units*/
|
||||
|
@ -321,7 +321,7 @@ QSizeF QgsSymbolV2LegendNode::drawSymbol( const QgsLegendSettings& settings, Ite
|
||||
if ( QgsMarkerSymbolV2* markerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( s ) )
|
||||
{
|
||||
// allow marker symbol to occupy bigger area if necessary
|
||||
size = markerSymbol->size() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context, s->outputUnit(), s->mapUnitScale() ) / context.scaleFactor();
|
||||
size = QgsSymbolLayerV2Utils::convertToPainterUnits( context, markerSymbol->size(), s->outputUnit(), s->mapUnitScale() ) / context.scaleFactor();
|
||||
height = size;
|
||||
width = size;
|
||||
if ( width < settings.symbolSize().width() )
|
||||
|
@ -38,13 +38,29 @@ class CORE_EXPORT QgsMapUnitScale
|
||||
* @param minScale minimum allowed scale, or 0.0 if no minimum scale set
|
||||
* @param maxScale maximum allowed scale, or 0.0 if no maximum scale set
|
||||
*/
|
||||
QgsMapUnitScale( double minScale = 0.0, double maxScale = 0.0 ) : minScale( minScale ), maxScale( maxScale ) {}
|
||||
QgsMapUnitScale( double minScale = 0.0, double maxScale = 0.0 )
|
||||
: minScale( minScale )
|
||||
, maxScale( maxScale )
|
||||
, minSizeMMEnabled( false )
|
||||
, minSizeMM( 0.0 )
|
||||
, maxSizeMMEnabled( false )
|
||||
, maxSizeMM( 0.0 )
|
||||
{}
|
||||
|
||||
/** The minimum scale, or 0.0 if unset */
|
||||
double minScale;
|
||||
/** The maximum scale, or 0.0 if unset */
|
||||
double maxScale;
|
||||
|
||||
/** Whether the minimum size in mm should be respected */
|
||||
bool minSizeMMEnabled;
|
||||
/** The minimum size in millimeters, or 0.0 if unset */
|
||||
double minSizeMM;
|
||||
/** Whether the maximum size in mm should be respected */
|
||||
bool maxSizeMMEnabled;
|
||||
/** The maximum size in millimeters, or 0.0 if unset */
|
||||
double maxSizeMM;
|
||||
|
||||
/** Computes a map units per pixel scaling factor, respecting the minimum and maximum scales
|
||||
* set for the object.
|
||||
* @param c render context
|
||||
@ -67,12 +83,16 @@ class CORE_EXPORT QgsMapUnitScale
|
||||
|
||||
bool operator==( const QgsMapUnitScale& other ) const
|
||||
{
|
||||
return minScale == other.minScale && maxScale == other.maxScale;
|
||||
return minScale == other.minScale && maxScale == other.maxScale
|
||||
&& minSizeMMEnabled == other.minSizeMMEnabled
|
||||
&& minSizeMM == other.minSizeMM
|
||||
&& maxSizeMMEnabled == other.maxSizeMMEnabled
|
||||
&& maxSizeMM == other.maxSizeMM;
|
||||
}
|
||||
|
||||
bool operator!=( const QgsMapUnitScale& other ) const
|
||||
{
|
||||
return minScale != other.minScale || maxScale != other.maxScale;
|
||||
return !operator==( other );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -208,7 +208,7 @@ void QgsEllipseSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Rend
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH ) )
|
||||
{
|
||||
double width = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
|
||||
width *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale );
|
||||
width = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), width, mOutlineWidthUnit, mOutlineWidthMapUnitScale );
|
||||
mPen.setWidthF( width );
|
||||
}
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE ) )
|
||||
@ -295,7 +295,7 @@ void QgsEllipseSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
|
||||
}
|
||||
mPen.setColor( mOutlineColor );
|
||||
mPen.setStyle( mOutlineStyle );
|
||||
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOutlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mBrush.setColor( mFillColor );
|
||||
prepareExpressions( context );
|
||||
}
|
||||
@ -476,7 +476,7 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
|
||||
{
|
||||
*scaledWidth = width;
|
||||
}
|
||||
width *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( ct, mSymbolWidthUnit, mSymbolHeightMapUnitScale );
|
||||
width = QgsSymbolLayerV2Utils::convertToPainterUnits( ct, width, mSymbolWidthUnit, mSymbolHeightMapUnitScale );
|
||||
|
||||
double height = 0;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_HEIGHT ) ) //1. priority: data defined setting on symbol layer level
|
||||
@ -495,7 +495,7 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
|
||||
{
|
||||
*scaledHeight = height;
|
||||
}
|
||||
height *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( ct, mSymbolHeightUnit, mSymbolHeightMapUnitScale );
|
||||
height = QgsSymbolLayerV2Utils::convertToPainterUnits( ct, height, mSymbolHeightUnit, mSymbolHeightMapUnitScale );
|
||||
|
||||
if ( symbolName == "circle" )
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ void QgsSimpleFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH_BORDER ) )
|
||||
{
|
||||
double width = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH_BORDER, context, mBorderWidth ).toDouble();
|
||||
width *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mBorderWidthUnit, mBorderWidthMapUnitScale );
|
||||
width = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), width, mBorderWidthUnit, mBorderWidthMapUnitScale );
|
||||
pen.setWidthF( width );
|
||||
selPen.setWidthF( width );
|
||||
}
|
||||
@ -247,7 +247,7 @@ void QgsSimpleFillSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
|
||||
mPen = QPen( borderColor );
|
||||
mSelPen = QPen( selPenColor );
|
||||
mPen.setStyle( mBorderStyle );
|
||||
mPen.setWidthF( mBorderWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mBorderWidthUnit, mBorderWidthMapUnitScale ) );
|
||||
mPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mBorderWidth, mBorderWidthUnit, mBorderWidthMapUnitScale ) );
|
||||
mPen.setJoinStyle( mPenJoinStyle );
|
||||
prepareExpressions( context );
|
||||
}
|
||||
@ -273,8 +273,8 @@ void QgsSimpleFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList<Q
|
||||
QPointF offset;
|
||||
if ( !mOffset.isNull() )
|
||||
{
|
||||
offset.setX( mOffset.x() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( mOffset.y() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setX( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.x(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.y(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
p->translate( offset );
|
||||
}
|
||||
|
||||
@ -831,8 +831,8 @@ void QgsGradientFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList
|
||||
QPointF offset;
|
||||
if ( !mOffset.isNull() )
|
||||
{
|
||||
offset.setX( mOffset.x() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( mOffset.y() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setX( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.x(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.y(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
p->translate( offset );
|
||||
}
|
||||
|
||||
@ -1118,8 +1118,8 @@ void QgsShapeburstFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QLi
|
||||
QPointF offset;
|
||||
if ( !mOffset.isNull() )
|
||||
{
|
||||
offset.setX( mOffset.x() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( mOffset.y() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setX( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.x(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.y(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
p->translate( offset );
|
||||
}
|
||||
_renderPolygon( p, points, rings, context );
|
||||
@ -1238,8 +1238,8 @@ void QgsShapeburstFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QLi
|
||||
QPointF offset;
|
||||
if ( !mOffset.isNull() )
|
||||
{
|
||||
offset.setX( mOffset.x() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( mOffset.y() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setX( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.x(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.y(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
p->translate( offset );
|
||||
}
|
||||
|
||||
@ -1888,7 +1888,7 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFileP
|
||||
else
|
||||
{
|
||||
bool fitsInCache = true;
|
||||
double outlineWidth = svgOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), svgOutlineWidthUnit, svgOutlineWidthMapUnitScale );
|
||||
double outlineWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), svgOutlineWidth, svgOutlineWidthUnit, svgOutlineWidthMapUnitScale );
|
||||
const QImage& patternImage = QgsSvgCache::instance()->svgAsImage( svgFilePath, size, svgFillColor, svgOutlineColor, outlineWidth,
|
||||
context.renderContext().scaleFactor(), context.renderContext().rasterScaleFactor(), fitsInCache );
|
||||
if ( !fitsInCache )
|
||||
@ -3561,8 +3561,8 @@ void QgsRasterFillSymbolLayer::renderPolygon( const QPolygonF &points, QList<QPo
|
||||
QPointF offset;
|
||||
if ( !mOffset.isNull() )
|
||||
{
|
||||
offset.setX( mOffset.x() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( mOffset.y() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setX( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.x(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
offset.setY( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOffset.y(), mOffsetUnit, mOffsetMapUnitScale ) );
|
||||
p->translate( offset );
|
||||
}
|
||||
if ( mCoordinateMode == Feature )
|
||||
|
@ -190,7 +190,7 @@ void QgsSimpleLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
|
||||
QColor penColor = mColor;
|
||||
penColor.setAlphaF( mColor.alphaF() * context.alpha() );
|
||||
mPen.setColor( penColor );
|
||||
double scaledWidth = mWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit, mWidthMapUnitScale );
|
||||
double scaledWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
mPen.setWidthF( scaledWidth );
|
||||
if ( mUseCustomDashPattern && scaledWidth != 0 )
|
||||
{
|
||||
@ -211,7 +211,7 @@ void QgsSimpleLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
|
||||
for ( ; it != mCustomDashVector.constEnd(); ++it )
|
||||
{
|
||||
//the dash is specified in terms of pen widths, therefore the division
|
||||
scaledVector << ( *it ) * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mCustomDashPatternUnit, mCustomDashPatternMapUnitScale ) / dashWidthDiv;
|
||||
scaledVector << QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), ( *it ), mCustomDashPatternUnit, mCustomDashPatternMapUnitScale ) / dashWidthDiv;
|
||||
}
|
||||
mPen.setDashPattern( scaledVector );
|
||||
}
|
||||
@ -321,7 +321,7 @@ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
|
||||
}
|
||||
else
|
||||
{
|
||||
double scaledOffset = offset * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale );
|
||||
double scaledOffset = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), offset, mOffsetUnit, mOffsetMapUnitScale );
|
||||
QList<QPolygonF> mline = ::offsetLine( points, scaledOffset, context.feature() ? context.feature()->constGeometry()->type() : QGis::Line );
|
||||
for ( int part = 0; part < mline.count(); ++part )
|
||||
p->drawPolyline( mline[ part ] );
|
||||
@ -457,7 +457,7 @@ QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2::createFromSld( QDomElement &elemen
|
||||
|
||||
void QgsSimpleLineSymbolLayerV2::applySizeScale( QgsSymbolV2RenderContext& context, QPen& pen, QPen& selPen )
|
||||
{
|
||||
double scaledWidth = mWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit, mWidthMapUnitScale );
|
||||
double scaledWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
pen.setWidthF( scaledWidth );
|
||||
selPen.setWidthF( scaledWidth );
|
||||
}
|
||||
@ -471,8 +471,9 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
|
||||
bool hasStrokeWidthExpression = false;
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH ) )
|
||||
{
|
||||
double scaledWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, context, mWidth ).toDouble()
|
||||
* QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit, mWidthMapUnitScale );
|
||||
double scaledWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(),
|
||||
evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, context, mWidth ).toDouble(),
|
||||
mWidthUnit, mWidthMapUnitScale );
|
||||
pen.setWidthF( scaledWidth );
|
||||
selPen.setWidthF( scaledWidth );
|
||||
hasStrokeWidthExpression = true;
|
||||
@ -496,7 +497,7 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
|
||||
//dash dot vector
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_CUSTOMDASH ) )
|
||||
{
|
||||
double scaledWidth = mWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit, mWidthMapUnitScale );
|
||||
double scaledWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
double dashWidthDiv = mPen.widthF();
|
||||
|
||||
if ( hasStrokeWidthExpression )
|
||||
@ -521,7 +522,7 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
|
||||
QStringList::const_iterator dashIt = dashList.constBegin();
|
||||
for ( ; dashIt != dashList.constEnd(); ++dashIt )
|
||||
{
|
||||
dashVector.push_back( dashIt->toDouble() * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mCustomDashPatternUnit, mCustomDashPatternMapUnitScale ) / dashWidthDiv );
|
||||
dashVector.push_back( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), dashIt->toDouble(), mCustomDashPatternUnit, mCustomDashPatternMapUnitScale ) / dashWidthDiv );
|
||||
}
|
||||
pen.setDashPattern( dashVector );
|
||||
}
|
||||
@ -586,7 +587,7 @@ double QgsSimpleLineSymbolLayerV2::dxfWidth( const QgsDxfExport& e, const QgsSym
|
||||
}
|
||||
else if ( context.renderHints() & QgsSymbolV2::DataDefinedSizeScale )
|
||||
{
|
||||
width = mWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mWidthUnit, mWidthMapUnitScale );
|
||||
width = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
}
|
||||
|
||||
return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), widthUnit(), e.mapUnits() );
|
||||
@ -854,7 +855,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
|
||||
else
|
||||
{
|
||||
context.renderContext().setGeometry( 0 ); //always use segmented geometry with offset
|
||||
QList<QPolygonF> mline = ::offsetLine( points, offset * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale ), context.feature() ? context.feature()->constGeometry()->type() : QGis::Line );
|
||||
QList<QPolygonF> mline = ::offsetLine( points, QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), offset, mOffsetUnit, mOffsetMapUnitScale ), context.feature() ? context.feature()->constGeometry()->type() : QGis::Line );
|
||||
|
||||
for ( int part = 0; part < mline.count(); ++part )
|
||||
{
|
||||
@ -920,8 +921,8 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineInterval( const QPolygonF& points
|
||||
offsetAlongLine = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET_ALONG_LINE, context, mOffsetAlongLine ).toDouble();
|
||||
}
|
||||
|
||||
double painterUnitInterval = interval * QgsSymbolLayerV2Utils::lineWidthScaleFactor( rc, mIntervalUnit, mIntervalMapUnitScale );
|
||||
lengthLeft = painterUnitInterval - offsetAlongLine * QgsSymbolLayerV2Utils::lineWidthScaleFactor( rc, mIntervalUnit, mIntervalMapUnitScale );
|
||||
double painterUnitInterval = QgsSymbolLayerV2Utils::convertToPainterUnits( rc, interval, mIntervalUnit, mIntervalMapUnitScale );
|
||||
lengthLeft = painterUnitInterval - QgsSymbolLayerV2Utils::convertToPainterUnits( rc, offsetAlongLine, mIntervalUnit, mIntervalMapUnitScale );
|
||||
|
||||
for ( int i = 1; i < points.count(); ++i )
|
||||
{
|
||||
@ -996,7 +997,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineVertex( const QPolygonF& points,
|
||||
if ( offsetAlongLine != 0 )
|
||||
{
|
||||
//scale offset along line
|
||||
offsetAlongLine *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( rc, mOffsetAlongLineUnit, mOffsetAlongLineMapUnitScale );
|
||||
offsetAlongLine = QgsSymbolLayerV2Utils::convertToPainterUnits( rc, offsetAlongLine, mOffsetAlongLineUnit, mOffsetAlongLineMapUnitScale );
|
||||
}
|
||||
|
||||
if ( offsetAlongLine == 0 && context.renderContext().geometry()
|
||||
|
@ -167,7 +167,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
|
||||
mBrush = QBrush( brushColor );
|
||||
mPen = QPen( penColor );
|
||||
mPen.setStyle( mOutlineStyle );
|
||||
mPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOutlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
|
||||
QColor selBrushColor = context.renderContext().selectionColor();
|
||||
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor;
|
||||
@ -179,7 +179,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
|
||||
mSelBrush = QBrush( selBrushColor );
|
||||
mSelPen = QPen( selPenColor );
|
||||
mSelPen.setStyle( mOutlineStyle );
|
||||
mSelPen.setWidthF( mOutlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mSelPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mOutlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
|
||||
bool hasDataDefinedRotation = context.renderHints() & QgsSymbolV2::DataDefinedRotation || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_ANGLE );
|
||||
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale || hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_SIZE );
|
||||
@ -216,7 +216,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
|
||||
// scale the shape (if the size is not going to be modified)
|
||||
if ( !hasDataDefinedSize )
|
||||
{
|
||||
double scaledSize = mSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale );
|
||||
double scaledSize = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mSize, mSizeUnit, mSizeMapUnitScale );
|
||||
if ( mUsingCache )
|
||||
scaledSize *= context.renderContext().rasterScaleFactor();
|
||||
double half = scaledSize / 2.0;
|
||||
@ -255,7 +255,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
|
||||
|
||||
bool QgsSimpleMarkerSymbolLayerV2::prepareCache( QgsSymbolV2RenderContext& context )
|
||||
{
|
||||
double scaledSize = mSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale );
|
||||
double scaledSize = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mSize, mSizeUnit, mSizeMapUnitScale );
|
||||
|
||||
// calculate necessary image size for the cache
|
||||
double pw = (( mPen.widthF() == 0 ? 1 : mPen.widthF() ) + 1 ) / 2 * 2; // make even (round up); handle cosmetic pen
|
||||
@ -564,7 +564,7 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
|
||||
// resize if necessary
|
||||
if ( hasDataDefinedSize || createdNewPath )
|
||||
{
|
||||
double s = scaledSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale );
|
||||
double s = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), scaledSize, mSizeUnit, mSizeMapUnitScale );
|
||||
double half = s / 2.0;
|
||||
transform.scale( half, half );
|
||||
}
|
||||
@ -592,8 +592,8 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
|
||||
double outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, QVariant(), &ok ).toDouble();
|
||||
if ( ok )
|
||||
{
|
||||
mPen.setWidthF( outlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mSelPen.setWidthF( outlineWidth * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
mSelPen.setWidthF( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale ) );
|
||||
}
|
||||
}
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_STYLE ) )
|
||||
@ -847,7 +847,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
||||
}
|
||||
}
|
||||
|
||||
size *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context->renderContext(), mSizeUnit, mSizeMapUnitScale );
|
||||
size = QgsSymbolLayerV2Utils::convertToPainterUnits( context->renderContext(), size, mSizeUnit, mSizeMapUnitScale );
|
||||
}
|
||||
if ( mSizeUnit == QgsSymbolV2::MM )
|
||||
{
|
||||
@ -1229,7 +1229,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
|
||||
}
|
||||
}
|
||||
|
||||
double size = scaledSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale );
|
||||
double size = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), scaledSize, mSizeUnit, mSizeMapUnitScale );
|
||||
|
||||
//don't render symbols with size below one or above 10,000 pixels
|
||||
if (( int )size < 1 || 10000.0 < size )
|
||||
@ -1710,7 +1710,7 @@ QString QgsFontMarkerSymbolLayerV2::layerType() const
|
||||
void QgsFontMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
|
||||
{
|
||||
mFont = QFont( mFontFamily );
|
||||
mFont.setPixelSize( mSize * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mSizeUnit, mSizeMapUnitScale ) );
|
||||
mFont.setPixelSize( QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mSize, mSizeUnit, mSizeMapUnitScale ) );
|
||||
delete mFontMetrics;
|
||||
mFontMetrics = new QFontMetrics( mFont );
|
||||
mChrOffset = QPointF( mFontMetrics->width( mChr ) / 2.0, -mFontMetrics->ascent() / 2.0 );
|
||||
|
@ -156,15 +156,15 @@ void QgsPointDisplacementRenderer::drawGroup( const DisplacementGroup& group, Qg
|
||||
|
||||
//draw symbol
|
||||
double diagonal = 0;
|
||||
double currentWidthFactor; //scale symbol size to map unit and output resolution
|
||||
|
||||
QList<QgsMarkerSymbolV2*>::const_iterator it = symbolList.constBegin();
|
||||
for ( ; it != symbolList.constEnd(); ++it )
|
||||
{
|
||||
if ( *it )
|
||||
{
|
||||
currentWidthFactor = QgsSymbolLayerV2Utils::lineWidthScaleFactor( context, ( *it )->outputUnit(), ( *it )->mapUnitScale() );
|
||||
double currentDiagonal = sqrt( 2 * (( *it )->size() * ( *it )->size() ) ) * currentWidthFactor;
|
||||
double currentDiagonal = QgsSymbolLayerV2Utils::convertToPainterUnits( context,
|
||||
sqrt( 2 * (( *it )->size() * ( *it )->size() ) ),
|
||||
( *it )->outputUnit(), ( *it )->mapUnitScale() );
|
||||
if ( currentDiagonal > diagonal )
|
||||
{
|
||||
diagonal = currentDiagonal;
|
||||
|
@ -553,8 +553,8 @@ void QgsMarkerSymbolLayerV2::markerOffset( const QgsSymbolV2RenderContext& conte
|
||||
offsetY = offset.y();
|
||||
}
|
||||
|
||||
offsetX *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale );
|
||||
offsetY *= QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit, mOffsetMapUnitScale );
|
||||
offsetX = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), offsetX, mOffsetUnit, mOffsetMapUnitScale );
|
||||
offsetY = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), offsetY, mOffsetUnit, mOffsetMapUnitScale );
|
||||
|
||||
HorizontalAnchorPoint horizontalAnchorPoint = mHorizontalAnchorPoint;
|
||||
VerticalAnchorPoint verticalAnchorPoint = mVerticalAnchorPoint;
|
||||
@ -573,8 +573,8 @@ void QgsMarkerSymbolLayerV2::markerOffset( const QgsSymbolV2RenderContext& conte
|
||||
return;
|
||||
}
|
||||
|
||||
double anchorPointCorrectionX = width * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), widthUnit, widthMapUnitScale ) / 2.0;
|
||||
double anchorPointCorrectionY = height * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), heightUnit, heightMapUnitScale ) / 2.0;
|
||||
double anchorPointCorrectionX = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), width, widthUnit, widthMapUnitScale ) / 2.0;
|
||||
double anchorPointCorrectionY = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), height, heightUnit, heightMapUnitScale ) / 2.0;
|
||||
if ( horizontalAnchorPoint == Left )
|
||||
{
|
||||
offsetX += anchorPointCorrectionX;
|
||||
|
@ -328,15 +328,31 @@ QPointF QgsSymbolLayerV2Utils::decodePoint( QString str )
|
||||
|
||||
QString QgsSymbolLayerV2Utils::encodeMapUnitScale( const QgsMapUnitScale& mapUnitScale )
|
||||
{
|
||||
return QString( "%1,%2" ).arg( mapUnitScale.minScale ).arg( mapUnitScale.maxScale );
|
||||
return QString( "%1,%2,%3,%4,%5,%6" ).arg( mapUnitScale.minScale ).arg( mapUnitScale.maxScale )
|
||||
.arg( mapUnitScale.minSizeMMEnabled ? 1 : 0 )
|
||||
.arg( mapUnitScale.minSizeMM )
|
||||
.arg( mapUnitScale.maxSizeMMEnabled ? 1 : 0 )
|
||||
.arg( mapUnitScale.maxSizeMM );
|
||||
}
|
||||
|
||||
QgsMapUnitScale QgsSymbolLayerV2Utils::decodeMapUnitScale( const QString& str )
|
||||
{
|
||||
QStringList lst = str.split( ',' );
|
||||
if ( lst.count() != 2 )
|
||||
if ( lst.count() < 2 )
|
||||
return QgsMapUnitScale();
|
||||
return QgsMapUnitScale( lst[0].toDouble(), lst[1].toDouble() );
|
||||
|
||||
if ( lst.count() < 6 )
|
||||
{
|
||||
// old format
|
||||
return QgsMapUnitScale( lst[0].toDouble(), lst[1].toDouble() );
|
||||
}
|
||||
|
||||
QgsMapUnitScale s( lst[0].toDouble(), lst[1].toDouble() );
|
||||
s.minSizeMMEnabled = lst[2].toInt();
|
||||
s.minSizeMM = lst[3].toDouble();
|
||||
s.maxSizeMMEnabled = lst[4].toInt();
|
||||
s.maxSizeMM = lst[5].toDouble();
|
||||
return s;
|
||||
}
|
||||
|
||||
QString QgsSymbolLayerV2Utils::encodeOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
@ -3292,6 +3308,23 @@ double QgsSymbolLayerV2Utils::lineWidthScaleFactor( const QgsRenderContext& c, Q
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
double QgsSymbolLayerV2Utils::convertToPainterUnits( const QgsRenderContext &c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale &scale )
|
||||
{
|
||||
double conversionFactor = lineWidthScaleFactor( c, unit, scale );
|
||||
double convertedSize = size * conversionFactor;
|
||||
|
||||
if ( unit == QgsSymbolV2::MapUnit )
|
||||
{
|
||||
//check max/min size
|
||||
if ( scale.minSizeMMEnabled )
|
||||
convertedSize = qMax( convertedSize, scale.minSizeMM * c.scaleFactor() );
|
||||
if ( scale.maxSizeMMEnabled )
|
||||
convertedSize = qMin( convertedSize, scale.maxSizeMM * c.scaleFactor() );
|
||||
}
|
||||
|
||||
return convertedSize;
|
||||
}
|
||||
|
||||
double QgsSymbolLayerV2Utils::pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale )
|
||||
{
|
||||
switch ( u )
|
||||
|
@ -363,12 +363,33 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
|
||||
*/
|
||||
static QColor parseColorWithAlpha( const QString colorStr, bool &containsAlpha, bool strictEval = false );
|
||||
|
||||
/** Returns the line width scale factor depending on the unit and the paint device*/
|
||||
/** Returns the line width scale factor depending on the unit and the paint device.
|
||||
* Consider using convertToPainterUnits() instead, as convertToPainterUnits() respects the size limits specified by the scale
|
||||
* parameter.
|
||||
* @param c render context
|
||||
* @param u units to convert from
|
||||
* @param scale map unit scale, specifying limits for the map units to convert from
|
||||
* @see convertToPainterUnits()
|
||||
*/
|
||||
static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Converts a size from the specied units to painter units. The conversion respects the limits
|
||||
* specified by the optional scale parameter.
|
||||
* @param c render context
|
||||
* @param size size to convert
|
||||
* @param unit units for specified size
|
||||
* @param scale map unit scale
|
||||
* @note added in QGIS 2.12
|
||||
* @see lineWidthScaleFactor
|
||||
*/
|
||||
static double convertToPainterUnits( const QgsRenderContext&c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Returns scale factor painter units -> pixel dimensions*/
|
||||
static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Returns scale factor painter units -> map units*/
|
||||
static double mapUnitScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Creates a render context for a pixel based device*/
|
||||
static QgsRenderContext createRenderContext( QPainter* p );
|
||||
|
||||
|
@ -508,7 +508,7 @@ QgsSymbolV2RenderContext::~QgsSymbolV2RenderContext()
|
||||
|
||||
double QgsSymbolV2RenderContext::outputLineWidth( double width ) const
|
||||
{
|
||||
return width * QgsSymbolLayerV2Utils::lineWidthScaleFactor( mRenderContext, mOutputUnit, mMapUnitScale );
|
||||
return QgsSymbolLayerV2Utils::convertToPainterUnits( mRenderContext, width, mOutputUnit, mMapUnitScale );
|
||||
}
|
||||
|
||||
double QgsSymbolV2RenderContext::outputPixelSize( double size ) const
|
||||
|
@ -177,17 +177,17 @@ void QgsVectorFieldSymbolLayer::renderPoint( const QPointF& point, QgsSymbolV2Re
|
||||
switch ( mVectorFieldType )
|
||||
{
|
||||
case Cartesian:
|
||||
xComponent = xVal * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
|
||||
yComponent = yVal * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
|
||||
xComponent = QgsSymbolLayerV2Utils::convertToPainterUnits( ctx, xVal, mDistanceUnit, mDistanceMapUnitScale );
|
||||
yComponent = QgsSymbolLayerV2Utils::convertToPainterUnits( ctx, yVal, mDistanceUnit, mDistanceMapUnitScale );
|
||||
break;
|
||||
case Polar:
|
||||
convertPolarToCartesian( xVal, yVal, xComponent, yComponent );
|
||||
xComponent = xComponent * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
|
||||
yComponent = yComponent * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
|
||||
xComponent = QgsSymbolLayerV2Utils::convertToPainterUnits( ctx, xComponent, mDistanceUnit, mDistanceMapUnitScale );
|
||||
yComponent = QgsSymbolLayerV2Utils::convertToPainterUnits( ctx, yComponent, mDistanceUnit, mDistanceMapUnitScale );
|
||||
break;
|
||||
case Height:
|
||||
xComponent = 0;
|
||||
yComponent = yVal * QgsSymbolLayerV2Utils::lineWidthScaleFactor( ctx, mDistanceUnit, mDistanceMapUnitScale );
|
||||
yComponent = QgsSymbolLayerV2Utils::convertToPainterUnits( ctx, yVal, mDistanceUnit, mDistanceMapUnitScale );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -24,10 +24,15 @@ QgsMapUnitScaleDialog::QgsMapUnitScaleDialog( QWidget* parent )
|
||||
setupUi( this );
|
||||
mComboBoxMinScale->setScale( 0.0000001 );
|
||||
mComboBoxMaxScale->setScale( 1 );
|
||||
mSpinBoxMinSize->setShowClearButton( false );
|
||||
mSpinBoxMaxSize->setShowClearButton( false );
|
||||
connect( mCheckBoxMinScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMinComboBox() ) );
|
||||
connect( mCheckBoxMaxScale, SIGNAL( toggled( bool ) ), this, SLOT( configureMaxComboBox() ) );
|
||||
connect( mComboBoxMinScale, SIGNAL( scaleChanged() ), this, SLOT( configureMaxComboBox() ) );
|
||||
connect( mComboBoxMaxScale, SIGNAL( scaleChanged() ), this, SLOT( configureMinComboBox() ) );
|
||||
|
||||
connect( mCheckBoxMinSize, SIGNAL( toggled( bool ) ), mSpinBoxMinSize, SLOT( setEnabled( bool ) ) );
|
||||
connect( mCheckBoxMaxSize, SIGNAL( toggled( bool ) ), mSpinBoxMaxSize, SLOT( setEnabled( bool ) ) );
|
||||
}
|
||||
|
||||
void QgsMapUnitScaleDialog::setMapUnitScale( const QgsMapUnitScale &scale )
|
||||
@ -38,6 +43,14 @@ void QgsMapUnitScaleDialog::setMapUnitScale( const QgsMapUnitScale &scale )
|
||||
mComboBoxMaxScale->setScale( scale.maxScale > 0.0 ? scale.maxScale : 1.0 );
|
||||
mCheckBoxMaxScale->setChecked( scale.maxScale > 0.0 );
|
||||
mComboBoxMaxScale->setEnabled( scale.maxScale > 0.0 );
|
||||
|
||||
mCheckBoxMinSize->setChecked( scale.minSizeMMEnabled );
|
||||
mSpinBoxMinSize->setEnabled( scale.minSizeMMEnabled );
|
||||
mSpinBoxMinSize->setValue( scale.minSizeMM );
|
||||
|
||||
mCheckBoxMaxSize->setChecked( scale.maxSizeMMEnabled );
|
||||
mSpinBoxMaxSize->setEnabled( scale.maxSizeMMEnabled );
|
||||
mSpinBoxMaxSize->setValue( scale.maxSizeMM );
|
||||
}
|
||||
|
||||
void QgsMapUnitScaleDialog::setMapCanvas( QgsMapCanvas *canvas )
|
||||
@ -71,10 +84,13 @@ QgsMapUnitScale QgsMapUnitScaleDialog::getMapUnitScale() const
|
||||
QgsMapUnitScale scale;
|
||||
scale.minScale = mCheckBoxMinScale->isChecked() ? mComboBoxMinScale->scale() : 0;
|
||||
scale.maxScale = mCheckBoxMaxScale->isChecked() ? mComboBoxMaxScale->scale() : 0;
|
||||
scale.minSizeMMEnabled = mCheckBoxMinSize->isChecked();
|
||||
scale.minSizeMM = mSpinBoxMinSize->value();
|
||||
scale.maxSizeMMEnabled = mCheckBoxMaxSize->isChecked();
|
||||
scale.maxSizeMM = mSpinBoxMaxSize->value();
|
||||
return scale;
|
||||
}
|
||||
|
||||
|
||||
QgsUnitSelectionWidget::QgsUnitSelectionWidget( QWidget *parent )
|
||||
: QWidget( parent )
|
||||
{
|
||||
@ -167,7 +183,7 @@ void QgsUnitSelectionWidget::showDialog()
|
||||
else
|
||||
{
|
||||
QgsMapUnitScale newScale = mUnitScaleDialog->getMapUnitScale();
|
||||
if ( scale.minScale != newScale.minScale || scale.maxScale != newScale.maxScale )
|
||||
if ( scale != newScale )
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
|
@ -14,7 +14,16 @@
|
||||
<string>Layer labeling settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -35,7 +44,16 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_23">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -314,10 +332,19 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_17">
|
||||
<property name="horizontalSpacing">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -494,11 +521,20 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="mLabelStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mLabelPage_Text">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -524,7 +560,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>341</width>
|
||||
<width>346</width>
|
||||
<height>388</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -556,7 +592,16 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="9" column="1" colspan="2">
|
||||
@ -769,7 +814,16 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1158,7 +1212,16 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="mFontFamilyFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1218,7 +1281,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Formatting">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1428,7 +1500,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mDirectSymbolsFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_33">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -1494,7 +1575,16 @@ font-style: italic;</string>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1596,7 +1686,16 @@ font-style: italic;</string>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1641,7 +1740,16 @@ font-style: italic;</string>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFrame" name="mDirectSymbPlacementFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1818,7 +1926,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Buffer">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1844,7 +1961,7 @@ font-style: italic;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>298</width>
|
||||
<width>301</width>
|
||||
<height>257</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1998,7 +2115,16 @@ font-style: italic;</string>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -2179,7 +2305,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Background">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -2205,7 +2340,7 @@ font-style: italic;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>362</width>
|
||||
<width>454</width>
|
||||
<height>697</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2410,7 +2545,16 @@ font-style: italic;</string>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QFrame" name="mShapeRotationFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_36">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
@ -2733,7 +2877,16 @@ font-style: italic;</string>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QFrame" name="mShapeSVGPathFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -2982,7 +3135,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Shadow">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -3008,7 +3170,7 @@ font-style: italic;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>325</width>
|
||||
<width>330</width>
|
||||
<height>424</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -3463,7 +3625,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Placement">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -3489,7 +3660,7 @@ font-style: italic;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>427</width>
|
||||
<width>578</width>
|
||||
<height>829</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -3521,7 +3692,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -3537,7 +3717,16 @@ font-style: italic;</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="pagePoint">
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -3567,7 +3756,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLine">
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
@ -3610,7 +3808,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pagePolygon">
|
||||
<layout class="QGridLayout" name="gridLayout_18">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -3694,7 +3901,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -3769,7 +3985,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_25">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -3849,12 +4074,21 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_27">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QgsDoubleSpinBox" name="mLineDistanceSpnBx">
|
||||
<property name="decimals">
|
||||
@ -3907,7 +4141,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mPlacementQuadrantFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_19">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
@ -3920,7 +4163,16 @@ font-style: italic;</string>
|
||||
<item row="0" column="1" rowspan="3">
|
||||
<widget class="QFrame" name="mPlacementFixedQuadrantFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@ -4188,12 +4440,21 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_15">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QgsDoubleSpinBox" name="mPointOffsetYSpinBox">
|
||||
<property name="sizePolicy">
|
||||
@ -4298,7 +4559,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_26">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@ -4358,12 +4628,21 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_24">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
@ -4410,12 +4689,21 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mPlacementMaxCharAngleFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_22">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_19">
|
||||
<property name="orientation">
|
||||
@ -4652,7 +4940,16 @@ font-style: italic;</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="mCoordAlignmentFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_27">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -4793,7 +5090,16 @@ font-style: italic;</string>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mLabelPage_Rendering">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -4818,7 +5124,7 @@ font-style: italic;</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-401</y>
|
||||
<y>0</y>
|
||||
<width>578</width>
|
||||
<height>764</height>
|
||||
</rect>
|
||||
@ -5142,7 +5448,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -5240,7 +5555,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mUpsidedownFrame">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -5343,7 +5667,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mLimitLabelFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_20">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -5400,7 +5733,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mMinSizeFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_21">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
@ -5448,7 +5790,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -5520,7 +5871,16 @@ font-style: italic;</string>
|
||||
<item>
|
||||
<widget class="QFrame" name="mObstaclePriorityFrame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -5581,7 +5941,16 @@ font-style: italic;</string>
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -5635,7 +6004,16 @@ font-style: italic;</string>
|
||||
<item row="6" column="0">
|
||||
<widget class="QFrame" name="frameLabelWith">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>329</width>
|
||||
<height>155</height>
|
||||
<width>443</width>
|
||||
<height>291</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -18,45 +18,57 @@
|
||||
<normaloff>:/images/themes/default/mActionOptions.png</normaloff>:/images/themes/default/mActionOptions.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMaxScale">
|
||||
<property name="text">
|
||||
<string>Maximum scale:</string>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Size range</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMinSize">
|
||||
<property name="text">
|
||||
<string>Minimum size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMaxSize">
|
||||
<property name="text">
|
||||
<string>Maximum size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QgsDoubleSpinBox" name="mSpinBoxMinSize">
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QgsDoubleSpinBox" name="mSpinBoxMaxSize">
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Scale only within the following size range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMinScale">
|
||||
<property name="text">
|
||||
<string>Minimum scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QgsScaleWidget" name="mComboBoxMaxScale" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QgsScaleWidget" name="mComboBoxMinScale" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Scale only within the following map unit scale range:</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="mButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -66,6 +78,66 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Scale range</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QgsScaleWidget" name="mComboBoxMinScale" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Scale only within the following map unit scale range:</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMinScale">
|
||||
<property name="text">
|
||||
<string>Minimum scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QgsScaleWidget" name="mComboBoxMaxScale" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="mCheckBoxMaxScale">
|
||||
<property name="text">
|
||||
<string>Maximum scale:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -74,13 +146,21 @@
|
||||
<extends>QWidget</extends>
|
||||
<header>qgsscalewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>qgsdoublespinbox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>mCheckBoxMaxScale</tabstop>
|
||||
<tabstop>mComboBoxMaxScale</tabstop>
|
||||
<tabstop>mCheckBoxMinScale</tabstop>
|
||||
<tabstop>mComboBoxMinScale</tabstop>
|
||||
<tabstop>mButtonBox</tabstop>
|
||||
<tabstop>mCheckBoxMaxScale</tabstop>
|
||||
<tabstop>mComboBoxMaxScale</tabstop>
|
||||
<tabstop>mCheckBoxMinSize</tabstop>
|
||||
<tabstop>mSpinBoxMinSize</tabstop>
|
||||
<tabstop>mCheckBoxMaxSize</tabstop>
|
||||
<tabstop>mSpinBoxMaxSize</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
@ -35,17 +35,41 @@ class PyQgsMapUnitScale(TestCase):
|
||||
#test equality operator
|
||||
|
||||
c1 = QgsMapUnitScale(0.0001, 0.005)
|
||||
c1.minSizeMMEnabled = True
|
||||
c1.minSizeMM = 3
|
||||
c1.maxSizeMMEnabled = True
|
||||
c1.maxSizeMM = 8
|
||||
c2 = QgsMapUnitScale(0.0001, 0.005)
|
||||
c2.minSizeMMEnabled = True
|
||||
c2.minSizeMM = 3
|
||||
c2.maxSizeMMEnabled = True
|
||||
c2.maxSizeMM = 8
|
||||
self.assertEqual(c1, c2)
|
||||
|
||||
c2.minScale = 0.0004
|
||||
self.assertNotEqual(c1, c2)
|
||||
|
||||
c2.minScale = 0.0001
|
||||
|
||||
c2.maxScale = 0.007
|
||||
self.assertNotEqual(c1, c2)
|
||||
|
||||
c2.maxScale = 0.005
|
||||
|
||||
c2.minSizeMMEnabled = False
|
||||
self.assertNotEqual(c1, c2)
|
||||
c2.minSizeMMEnabled = True
|
||||
|
||||
c2.maxSizeMMEnabled = False
|
||||
self.assertNotEqual(c1, c2)
|
||||
c2.maxSizeMMEnabled = True
|
||||
|
||||
c2.minSizeMM = 1
|
||||
self.assertNotEqual(c1, c2)
|
||||
c2.minSizeMM = 3
|
||||
|
||||
c2.maxSizeMM = 100
|
||||
self.assertNotEqual(c1, c2)
|
||||
c2.maxSizeMM = 8
|
||||
|
||||
self.assertEqual(c1, c2)
|
||||
|
||||
def testMapUnitsPerPixel(self):
|
||||
@ -139,6 +163,50 @@ class PyQgsMapUnitScale(TestCase):
|
||||
sf = QgsSymbolLayerV2Utils.lineWidthScaleFactor(r, QgsSymbolV2.Pixel, c)
|
||||
self.assertAlmostEqual(sf, 1.0, places=5)
|
||||
|
||||
def testConvertToPainterUnits(self):
|
||||
#test QgsSymbolLayerV2Utils::convertToPainterUnits() using QgsMapUnitScale
|
||||
|
||||
ms = QgsMapSettings()
|
||||
ms.setExtent(QgsRectangle(0, 0, 100, 100))
|
||||
ms.setOutputSize(QSize(100, 50))
|
||||
ms.setOutputDpi(300)
|
||||
r = QgsRenderContext.fromMapSettings(ms)
|
||||
|
||||
#renderer scale should be about 1:291937841
|
||||
|
||||
#start with no min/max scale
|
||||
c = QgsMapUnitScale()
|
||||
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MapUnit, c)
|
||||
self.assertAlmostEqual(size, 1.0, places=5)
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MM, c)
|
||||
self.assertAlmostEqual(size, 23.622047, places=5)
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.Pixel, c)
|
||||
self.assertAlmostEqual(size, 2.0, places=5)
|
||||
|
||||
#minimum size greater than the calculated size, so size should be limited to minSizeMM
|
||||
c.minSizeMM = 5
|
||||
c.minSizeMMEnabled = True
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MapUnit, c)
|
||||
self.assertAlmostEqual(size, 59.0551181, places=5)
|
||||
#only conversion from mapunits should be affected
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MM, c)
|
||||
self.assertAlmostEqual(size, 23.622047, places=5)
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.Pixel, c)
|
||||
self.assertAlmostEqual(size, 2.0, places=5)
|
||||
c.minSizeMMEnabled = False
|
||||
|
||||
#maximum size less than the calculated size, so size should be limited to maxSizeMM
|
||||
c.maxSizeMM = 0.1
|
||||
c.maxSizeMMEnabled = True
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MapUnit, c)
|
||||
self.assertAlmostEqual(size, 1.0, places=5)
|
||||
#only conversion from mapunits should be affected
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.MM, c)
|
||||
self.assertAlmostEqual(size, 23.622047, places=5)
|
||||
size = QgsSymbolLayerV2Utils.convertToPainterUnits(r, 2, QgsSymbolV2.Pixel, c)
|
||||
self.assertAlmostEqual(size, 2.0, places=5)
|
||||
|
||||
def testPixelSizeScaleFactor(self):
|
||||
#test QgsSymbolLayerV2Utils::pixelSizeScaleFactor() using QgsMapUnitScale
|
||||
|
||||
@ -200,6 +268,31 @@ class PyQgsMapUnitScale(TestCase):
|
||||
sf = QgsSymbolLayerV2Utils.mapUnitScaleFactor(r, QgsSymbolV2.Pixel, c)
|
||||
self.assertAlmostEqual(sf, 2.0, places=5)
|
||||
|
||||
def testEncodeDecode(self):
|
||||
# test encoding and decoding QgsMapUnitScale
|
||||
|
||||
s = QgsMapUnitScale()
|
||||
s.minScale = 50
|
||||
s.maxScale = 100
|
||||
s.minSizeMMEnabled = True
|
||||
s.minSizeMM = 3
|
||||
s.maxSizeMMEnabled = False
|
||||
s.maxSizeMM = 99
|
||||
|
||||
encode = QgsSymbolLayerV2Utils.encodeMapUnitScale(s)
|
||||
r = QgsSymbolLayerV2Utils.decodeMapUnitScale(encode)
|
||||
self.assertEqual(s, r)
|
||||
|
||||
# check old style encoding
|
||||
encode = '9,78.3'
|
||||
r = QgsSymbolLayerV2Utils.decodeMapUnitScale(encode)
|
||||
self.assertEqual(r.minScale, 9)
|
||||
self.assertEqual(r.maxScale, 78.3)
|
||||
self.assertFalse(r.minSizeMMEnabled)
|
||||
self.assertEqual(r.minSizeMM, 0)
|
||||
self.assertFalse(r.maxSizeMMEnabled)
|
||||
self.assertEqual(r.maxSizeMM, 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user