Skip to content
Permalink
Browse files

fix #2426: dateline split

git-svn-id: http://svn.osgeo.org/qgis/trunk@15754 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Apr 17, 2011
1 parent 4a1a963 commit 79c0c4701002787435f5e7a01b8ca4bd564acc3f
Showing with 17 additions and 11 deletions.
  1. +6 −5 src/core/qgscoordinatetransform.cpp
  2. +7 −6 src/core/qgsmaprenderer.cpp
  3. +4 −0 src/core/qgsvectorlayer.cpp
@@ -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() ) );
@@ -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
@@ -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 );

@@ -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;
@@ -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
{
@@ -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 )
@@ -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
{

0 comments on commit 79c0c47

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