[QGIS Commit] r14352 - trunk/qgis/src/core/pal

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Oct 7 02:30:51 EDT 2010


Author: mhugent
Date: 2010-10-07 06:30:51 +0000 (Thu, 07 Oct 2010)
New Revision: 14352

Modified:
   trunk/qgis/src/core/pal/layer.cpp
   trunk/qgis/src/core/pal/pal.cpp
Log:
Fix for dateline labeling problems

Modified: trunk/qgis/src/core/pal/layer.cpp
===================================================================
--- trunk/qgis/src/core/pal/layer.cpp	2010-10-07 01:26:28 UTC (rev 14351)
+++ trunk/qgis/src/core/pal/layer.cpp	2010-10-07 06:30:51 UTC (rev 14352)
@@ -236,7 +236,9 @@
     if ( hashtable->find( geom_id ) )
     {
       modMutex->unlock();
-      throw new PalException::FeatureExists();
+      //A feature with this id already exists. Don't throw an exception as sometimes,
+      //the same feature is added twice (dateline split with otf-reprojection)
+      return false;
     }
 
     // Split MULTI GEOM and Collection in simple geometries

Modified: trunk/qgis/src/core/pal/pal.cpp
===================================================================
--- trunk/qgis/src/core/pal/pal.cpp	2010-10-07 01:26:28 UTC (rev 14351)
+++ trunk/qgis/src/core/pal/pal.cpp	2010-10-07 06:30:51 UTC (rev 14352)
@@ -167,8 +167,6 @@
 
   Layer * Pal::addLayer( const char *lyrName, double min_scale, double max_scale, Arrangement arrangement, Units label_unit, double defaultPriority, bool obstacle, bool active, bool toLabel )
   {
-
-
     Layer *lyr;
     lyrsMutex->lock();
 
@@ -183,7 +181,9 @@
       if ( strcmp(( *it )->name, lyrName ) == 0 )   // if layer already known
       {
         lyrsMutex->unlock();
-        throw new PalException::LayerExists();
+        //There is already a layer with this name, so we just return the existing one.
+        //Sometimes the same layer is added twice (e.g. datetime split with otf-reprojection)
+        return *it;
       }
     }
 



More information about the QGIS-commit mailing list