Skip to content
Permalink
Browse files

Feature #8725: Fast rendering of geom (v-OGR)

Implements fast rendering of LineStrings and Polygons pre-applying a
view threshold filter to the geometries to render in qgis. Also disable
'Antialiasing' when it is possible.

View Table of test results in 'http://hub.qgis.org/issues/8725'

(This version of branch implements the improvement in vector-providers)
  • Loading branch information
ahuarte47 committed Oct 18, 2013
1 parent cecfff0 commit db8eaf0c20090958bbf255b0399ee51b7064078c
@@ -202,5 +202,5 @@ class QgsFillSymbolLayerV2 : QgsSymbolLayerV2
protected:
QgsFillSymbolLayerV2( bool locked = false );
/**Default method to render polygon*/
void _renderPolygon( QPainter* p, const QPolygonF& points, const QList<QPolygonF>* rings );
void _renderPolygon( QPainter* p, const QPolygonF& points, const QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
};
@@ -81,6 +81,7 @@ SET(QGIS_CORE_SRCS
qgslabelattributes.cpp
qgslabelsearchtree.cpp
qgslogger.cpp
qgsmaprequest.cpp
qgsmaplayer.cpp
qgsmaplayerregistry.cpp
qgsmaprenderer.cpp
@@ -45,6 +45,9 @@ const unsigned char* QgsClipper::clippedLineWKB( const unsigned char* wkb, const

bool hasZValue = ( wkbType == QGis::WKBLineString25D );

int sizeOfDoubleX = sizeof(double);
int sizeOfDoubleY = hasZValue ? 2*sizeof(double) : sizeof(double);

double p0x, p0y, p1x = 0.0, p1y = 0.0; //original coordinates
double p1x_c, p1y_c; //clipped end coordinates
double lastClipX = 0.0, lastClipY = 0.0; //last successfully clipped coords
@@ -56,29 +59,18 @@ const unsigned char* QgsClipper::clippedLineWKB( const unsigned char* wkb, const
{
if ( i == 0 )
{
memcpy( &p1x, wkb, sizeof( double ) );
wkb += sizeof( double );
memcpy( &p1y, wkb, sizeof( double ) );
wkb += sizeof( double );
if ( hasZValue ) // ignore Z value
{
wkb += sizeof( double );
}
memcpy( &p1x, wkb, sizeof( double ) ); wkb += sizeOfDoubleX;
memcpy( &p1y, wkb, sizeof( double ) ); wkb += sizeOfDoubleY;

continue;
}
else
{
p0x = p1x;
p0y = p1y;

memcpy( &p1x, wkb, sizeof( double ) );
wkb += sizeof( double );
memcpy( &p1y, wkb, sizeof( double ) );
wkb += sizeof( double );
if ( hasZValue ) // ignore Z value
{
wkb += sizeof( double );
}
memcpy( &p1x, wkb, sizeof( double ) ); wkb += sizeOfDoubleX;
memcpy( &p1y, wkb, sizeof( double ) ); wkb += sizeOfDoubleY;

p1x_c = p1x; p1y_c = p1y;
if ( clipLineSegment( clipExtent.xMinimum(), clipExtent.xMaximum(), clipExtent.yMinimum(), clipExtent.yMaximum(),
@@ -49,6 +49,8 @@ QgsFeatureRequest::QgsFeatureRequest( const QgsFeatureRequest &rh )

QgsFeatureRequest& QgsFeatureRequest::operator=( const QgsFeatureRequest & rh )
{
QgsMapRequest::operator=( rh );

mFlags = rh.mFlags;
mFilter = rh.mFilter;
mFilterRect = rh.mFilterRect;
@@ -17,6 +17,7 @@

#include <QFlags>

#include "qgsmaprequest.h"
#include "qgsfeature.h"
#include "qgsrectangle.h"
#include "qgsexpression.h"
@@ -53,15 +54,16 @@ typedef QList<int> QgsAttributeList;
* QgsFeatureRequest().setFilterFid(45)
*
*/
class CORE_EXPORT QgsFeatureRequest
class CORE_EXPORT QgsFeatureRequest : public QgsMapRequest
{
public:
enum Flag
{
NoFlags = 0,
NoGeometry = 1, //!< Geometry is not required. It may still be returned if e.g. required for a filter condition.
SubsetOfAttributes = 2, //!< Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
ExactIntersect = 4 //!< Use exact geometry intersection (slower) instead of bounding boxes
ExactIntersect = 4, //!< Use exact geometry intersection (slower) instead of bounding boxes
SimplifyGeometries = 8 //!< Simplify the geometry using the current map2pixel context
};
Q_DECLARE_FLAGS( Flags, Flag )

@@ -278,6 +278,10 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
//so must be false at every new render operation
mRenderContext.setRenderingStopped( false );

// Gets the configured Tolerance for simplify transformations between map coordinates and device coordinates
QSettings mySettings2;
mRenderContext.setMapToPixelTol( mySettings2.value( "Map/map2pixelTol", 1.0f ).toFloat() );

// set selection color
QgsProject* prj = QgsProject::instance();
int myRed = prj->readNumEntry( "Gui", "/SelectionColorRedPart", 255 );

0 comments on commit db8eaf0

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