Skip to content

Commit

Permalink
fix #2426: dateline split
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15754 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 17, 2011
1 parent 4a1a963 commit 79c0c47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re

for ( int i = 0; i < numP * numP; i++ )
{
bb_rect.combineExtentWith( x[i], y[i] );
if ( qIsFinite( x[i] ) && qIsFinite( y[i] ) )
bb_rect.combineExtentWith( x[i], y[i] );
}

QgsDebugMsg( "Projected extent: " + QString(( bb_rect.toString() ).toLocal8Bit().data() ) );
Expand Down Expand Up @@ -488,7 +489,7 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d

QgsDebugMsg( "throwing exception" );

throw QgsCsException( msg );
throw QgsCsException( msg );
}

// if the result is lat/long, convert the results from radians back
Expand Down Expand Up @@ -529,13 +530,13 @@ bool QgsCoordinateTransform::readXML( QDomNode & theNode )
bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc )
{
QDomElement myNodeElement = theNode.toElement();
QDomElement myTransformElement = theDoc.createElement( "coordinatetransform" );
QDomElement myTransformElement = theDoc.createElement( "coordinatetransform" );

QDomElement mySourceElement = theDoc.createElement( "sourcesrs" );
QDomElement mySourceElement = theDoc.createElement( "sourcesrs" );
mSourceCRS.writeXML( mySourceElement, theDoc );
myTransformElement.appendChild( mySourceElement );

QDomElement myDestElement = theDoc.createElement( "destinationsrs" );
QDomElement myDestElement = theDoc.createElement( "destinationsrs" );
mDestCRS.writeXML( myDestElement, theDoc );
myTransformElement.appendChild( myDestElement );

Expand Down
13 changes: 7 additions & 6 deletions src/core/qgsmaprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ void QgsMapRenderer::render( QPainter* painter )
split = splitLayersExtent( ml, r1, r2 );
ct = new QgsCoordinateTransform( ml->crs(), *mDestCRS );
mRenderContext.setExtent( r1 );
QgsDebugMsg( " extent 1: " + r1.toString() );
QgsDebugMsg( " extent 2: " + r2.toString() );
if ( !r1.isFinite() || !r2.isFinite() ) //there was a problem transforming the extent. Skip the layer
{
continue;
Expand Down Expand Up @@ -715,16 +717,15 @@ bool QgsMapRenderer::splitLayersExtent( QgsMapLayer* layer, QgsRectangle& extent
QgsPoint ur = tr.transform( extent.xMaximum(), extent.yMaximum(),
QgsCoordinateTransform::ReverseTransform );

extent = tr.transformBoundingBox( extent, QgsCoordinateTransform::ReverseTransform );

if ( ll.x() > ur.x() )
{
extent.set( ll, QgsPoint( splitCoord, ur.y() ) );
r2.set( QgsPoint( -splitCoord, ll.y() ), ur );
r2 = extent;
extent.setXMinimum( splitCoord );
r2.setXMaximum( splitCoord );
split = true;
}
else // no need to split
{
extent = tr.transformBoundingBox( extent, QgsCoordinateTransform::ReverseTransform );
}
}
else // can't cross 180
{
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,8 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
++featureCount;
#endif //Q_WS_MAC
}

QgsDebugMsg( QString( "Total features processed %1" ).arg( featureCount ) );
}

void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bool labeling )
Expand Down Expand Up @@ -1106,6 +1108,8 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
.arg( fet.typeName() ).arg( cse.what() ) );
return false;
}

QgsDebugMsg( QString( "Total features processed %1" ).arg( featureCount ) );
}
else
{
Expand Down

0 comments on commit 79c0c47

Please sign in to comment.