mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Translate brushs of image fills relativ to geometry bbox upper left point if rendering a map tile. Therefore it is assured, that the image pattern matches for adjacent tiles of the same scale
This commit is contained in:
parent
614c84f2c6
commit
15a8bc9f0b
@ -107,6 +107,8 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
QgsDebugMsg( "Read project CRSID: " + QString::number( mProjectSrsId ) );
|
||||
projectionSelector->setSelectedCrsId( mProjectSrsId );
|
||||
|
||||
mMapTileRenderingCheckBox->setChecked( mMapCanvas->mapSettings().testFlag( QgsMapSettings::RenderMapTile ) );
|
||||
|
||||
// see end of constructor for updating of projection selector
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -661,6 +663,8 @@ void QgsProjectProperties::apply()
|
||||
mMapCanvas->setMapUnits( mapUnit );
|
||||
mMapCanvas->setCrsTransformEnabled( cbxProjectionEnabled->isChecked() );
|
||||
|
||||
mMapCanvas->enableMapTileRendering( mMapTileRenderingCheckBox->isChecked() );
|
||||
|
||||
// Only change the projection if there is a node in the tree
|
||||
// selected that has an srid. This prevents error if the user
|
||||
// selects a top-level node rather than an actual coordinate
|
||||
|
@ -596,6 +596,13 @@ void QgsMapSettings::readXML( QDomNode& theNode )
|
||||
setRotation( rot );
|
||||
}
|
||||
|
||||
//render map tile
|
||||
QDomElement renderMapTileElem = theNode.firstChildElement( "rendermaptile" );
|
||||
if ( !renderMapTileElem.isNull() )
|
||||
{
|
||||
setFlag( QgsMapSettings::RenderMapTile, renderMapTileElem.text() == "1" ? true : false );
|
||||
}
|
||||
|
||||
mDatumTransformStore.readXML( theNode );
|
||||
}
|
||||
|
||||
@ -626,5 +633,11 @@ void QgsMapSettings::writeXML( QDomNode& theNode, QDomDocument& theDoc )
|
||||
theNode.appendChild( srsNode );
|
||||
destinationCrs().writeXML( srsNode, theDoc );
|
||||
|
||||
//render map tile
|
||||
QDomElement renderMapTileElem = theDoc.createElement( "rendermaptile" );
|
||||
QDomText renderMapTileText = theDoc.createTextNode( testFlag( QgsMapSettings::RenderMapTile ) ? "1" : "0" );
|
||||
renderMapTileElem.appendChild( renderMapTileText );
|
||||
theNode.appendChild( renderMapTileElem );
|
||||
|
||||
mDatumTransformStore.writeXML( theNode, theDoc );
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ class CORE_EXPORT QgsMapSettings
|
||||
UseRenderingOptimization = 0x20, //!< Enable vector simplification and other rendering optimizations
|
||||
DrawSelection = 0x40, //!< Whether vector selections should be shown in the rendered map
|
||||
DrawSymbolBounds = 0x80, //!< Draw bounds of symbols (for debugging/testing)
|
||||
RenderMapTile = 0x100, //!< Draw map such that there are no problems between adjacent tiles
|
||||
// TODO: ignore scale-based visibility (overview)
|
||||
};
|
||||
Q_DECLARE_FLAGS( Flags, Flag )
|
||||
|
@ -81,6 +81,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet
|
||||
ctx.setSelectionColor( mapSettings.selectionColor() );
|
||||
ctx.setFlag( DrawSelection, mapSettings.testFlag( QgsMapSettings::DrawSelection ) );
|
||||
ctx.setFlag( DrawSymbolBounds, mapSettings.testFlag( QgsMapSettings::DrawSymbolBounds ) );
|
||||
ctx.setFlag( RenderMapTile, mapSettings.testFlag( QgsMapSettings::RenderMapTile ) );
|
||||
ctx.setRasterScaleFactor( 1.0 );
|
||||
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
|
||||
ctx.setRendererScale( mapSettings.scale() );
|
||||
|
@ -58,6 +58,7 @@ class CORE_EXPORT QgsRenderContext
|
||||
UseRenderingOptimization = 0x08, //!< Enable vector simplification and other rendering optimizations
|
||||
DrawSelection = 0x10, //!< Whether vector selections should be shown in the rendered map
|
||||
DrawSymbolBounds = 0x20, //!< Draw bounds of symbols (for debugging/testing)
|
||||
RenderMapTile = 0x40, //!< Draw map such that there are no problems between adjacent tiles
|
||||
};
|
||||
Q_DECLARE_FLAGS( Flags, Flag )
|
||||
|
||||
|
@ -1571,6 +1571,16 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
|
||||
applyDataDefinedSettings( context );
|
||||
|
||||
p->setPen( QPen( Qt::NoPen ) );
|
||||
|
||||
if ( context.renderContext().testFlag( QgsRenderContext::RenderMapTile ) )
|
||||
{
|
||||
//transform brush to upper left corner of geometry bbox
|
||||
QPointF leftCorner = points.boundingRect().topLeft();
|
||||
QTransform leftCornerTransform = QTransform::fromTranslate( leftCorner.x(), leftCorner.y() );
|
||||
mBrush.setTransform( leftCornerTransform );
|
||||
}
|
||||
|
||||
|
||||
if ( context.selected() )
|
||||
{
|
||||
QColor selColor = context.renderContext().selectionColor();
|
||||
|
@ -689,6 +689,8 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
bool deleteSegmentizedGeometry = false;
|
||||
context.setGeometry( geom->geometry() );
|
||||
|
||||
bool tileMapRendering = context.testFlag( QgsRenderContext::RenderMapTile );
|
||||
|
||||
//convert curve types to normal point/line/polygon ones
|
||||
if ( geom->geometry()->hasCurvedSegments() )
|
||||
{
|
||||
@ -734,7 +736,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
QgsDebugMsg( "linestring can be drawn only with line symbol!" );
|
||||
break;
|
||||
}
|
||||
_getLineString( pts, context, segmentizedGeometry->asWkb(), clipFeaturesToExtent() );
|
||||
_getLineString( pts, context, segmentizedGeometry->asWkb(), !tileMapRendering && clipFeaturesToExtent() );
|
||||
static_cast<QgsLineSymbolV2*>( this )->renderPolyline( pts, &feature, context, layer, selected );
|
||||
}
|
||||
break;
|
||||
@ -747,7 +749,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
QgsDebugMsg( "polygon can be drawn only with fill symbol!" );
|
||||
break;
|
||||
}
|
||||
_getPolygon( pts, holes, context, segmentizedGeometry->asWkb(), clipFeaturesToExtent() );
|
||||
_getPolygon( pts, holes, context, segmentizedGeometry->asWkb(), !tileMapRendering && clipFeaturesToExtent() );
|
||||
static_cast<QgsFillSymbolV2*>( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
|
||||
}
|
||||
break;
|
||||
@ -797,7 +799,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
{
|
||||
context.setGeometry( geomCollection->geometryN( i ) );
|
||||
}
|
||||
ptr = QgsConstWkbPtr( _getLineString( pts, context, ptr, clipFeaturesToExtent() ) );
|
||||
ptr = QgsConstWkbPtr( _getLineString( pts, context, ptr, !tileMapRendering && clipFeaturesToExtent() ) );
|
||||
static_cast<QgsLineSymbolV2*>( this )->renderPolyline( pts, &feature, context, layer, selected );
|
||||
}
|
||||
}
|
||||
@ -828,7 +830,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
{
|
||||
context.setGeometry( geomCollection->geometryN( i ) );
|
||||
}
|
||||
ptr = _getPolygon( pts, holes, context, ptr, clipFeaturesToExtent() );
|
||||
ptr = _getPolygon( pts, holes, context, ptr, !tileMapRendering && clipFeaturesToExtent() );
|
||||
static_cast<QgsFillSymbolV2*>( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : nullptr ), &feature, context, layer, selected );
|
||||
}
|
||||
break;
|
||||
|
@ -314,6 +314,11 @@ void QgsMapCanvas::enableAntiAliasing( bool theFlag )
|
||||
mMapOverview->enableAntiAliasing( theFlag );
|
||||
} // anti aliasing
|
||||
|
||||
void QgsMapCanvas::enableMapTileRendering( bool theFlag )
|
||||
{
|
||||
mSettings.setFlag( QgsMapSettings::RenderMapTile, theFlag );
|
||||
}
|
||||
|
||||
void QgsMapCanvas::useImageToRender( bool theFlag )
|
||||
{
|
||||
Q_UNUSED( theFlag );
|
||||
@ -1818,6 +1823,7 @@ void QgsMapCanvas::readProject( const QDomDocument & doc )
|
||||
setExtent( tmpSettings.extent() );
|
||||
setRotation( tmpSettings.rotation() );
|
||||
mSettings.datumTransformStore() = tmpSettings.datumTransformStore();
|
||||
enableMapTileRendering( tmpSettings.testFlag( QgsMapSettings::RenderMapTile ) );
|
||||
|
||||
clearExtentHistory(); // clear the extent history on project load
|
||||
}
|
||||
|
@ -344,6 +344,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
|
||||
//! true if antialising is enabled
|
||||
bool antiAliasingEnabled() const { return mSettings.testFlag( QgsMapSettings::Antialiasing ); }
|
||||
|
||||
//! sets map tile rendering flag
|
||||
void enableMapTileRendering( bool theFlag );
|
||||
|
||||
//! Select which Qt class to render with
|
||||
//! @deprecated since 2.4 - does nothing because now we always render to QImage
|
||||
Q_DECL_DEPRECATED void useImageToRender( bool theFlag );
|
||||
|
@ -42,16 +42,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -197,16 +188,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -222,16 +204,7 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="mProjOpts_01">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -247,8 +220,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>779</height>
|
||||
<width>696</width>
|
||||
<height>793</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@ -267,33 +240,6 @@
|
||||
<string notr="true">projgeneral</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_26">
|
||||
<item row="3" column="2" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="cbxAbsolutePath">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>absolute</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>relative</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
@ -455,6 +401,40 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="cbxAbsolutePath">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>absolute</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>relative</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mMapTileRenderingCheckBox">
|
||||
<property name="text">
|
||||
<string>Render map tile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -645,16 +625,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -827,16 +798,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mProjOpts_02">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -852,8 +814,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>779</height>
|
||||
<width>246</width>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -886,16 +848,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mProjOpts_03">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -911,8 +864,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>779</height>
|
||||
<width>98</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
@ -967,16 +920,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mProjOpts_04">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -992,8 +936,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>779</height>
|
||||
<width>311</width>
|
||||
<height>509</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
@ -1392,16 +1336,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mProjOpts_05">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1416,9 +1351,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-854</y>
|
||||
<width>667</width>
|
||||
<height>1633</height>
|
||||
<y>0</y>
|
||||
<width>399</width>
|
||||
<height>1508</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
@ -2262,16 +2197,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mProjOpts_06">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_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">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -2287,8 +2213,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<height>779</height>
|
||||
<width>129</width>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
@ -2324,16 +2250,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="mTabRelations">
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
@ -2379,16 +2296,7 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user