[QGIS Commit] r15754 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Apr 17 18:21:08 EDT 2011


Author: jef
Date: 2011-04-17 15:21:07 -0700 (Sun, 17 Apr 2011)
New Revision: 15754

Modified:
   trunk/qgis/src/core/qgscoordinatetransform.cpp
   trunk/qgis/src/core/qgsmaprenderer.cpp
   trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
fix #2426: dateline split

Modified: trunk/qgis/src/core/qgscoordinatetransform.cpp
===================================================================
--- trunk/qgis/src/core/qgscoordinatetransform.cpp	2011-04-17 21:39:50 UTC (rev 15753)
+++ trunk/qgis/src/core/qgscoordinatetransform.cpp	2011-04-17 22:21:07 UTC (rev 15754)
@@ -398,7 +398,8 @@
 
   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 @@
 
     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::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 );
 

Modified: trunk/qgis/src/core/qgsmaprenderer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaprenderer.cpp	2011-04-17 21:39:50 UTC (rev 15753)
+++ trunk/qgis/src/core/qgsmaprenderer.cpp	2011-04-17 22:21:07 UTC (rev 15754)
@@ -389,6 +389,8 @@
         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 @@
         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
       {

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2011-04-17 21:39:50 UTC (rev 15753)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2011-04-17 22:21:07 UTC (rev 15754)
@@ -785,6 +785,8 @@
     ++featureCount;
 #endif //Q_WS_MAC
   }
+
+  QgsDebugMsg( QString( "Total features processed %1" ).arg( featureCount ) );
 }
 
 void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bool labeling )
@@ -1106,6 +1108,8 @@
                    .arg( fet.typeName() ).arg( cse.what() ) );
       return false;
     }
+
+    QgsDebugMsg( QString( "Total features processed %1" ).arg( featureCount ) );
   }
   else
   {



More information about the QGIS-commit mailing list