[QGIS Commit] r11026 - branches/symbology-ng-branch/src/core/pal

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 5 07:38:02 EDT 2009


Author: wonder
Date: 2009-07-05 07:38:02 -0400 (Sun, 05 Jul 2009)
New Revision: 11026

Modified:
   branches/symbology-ng-branch/src/core/pal/layer.cpp
   branches/symbology-ng-branch/src/core/pal/layer.h
Log:
pal: registerFeature can return true/false to tell whether the registration was successful.


Modified: branches/symbology-ng-branch/src/core/pal/layer.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/pal/layer.cpp	2009-07-05 00:01:19 UTC (rev 11025)
+++ branches/symbology-ng-branch/src/core/pal/layer.cpp	2009-07-05 11:38:02 UTC (rev 11026)
@@ -305,9 +305,10 @@
 }
 #endif
 
-void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x, double label_y )
+bool Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x, double label_y )
 {
   int j;
+  int part = 0;
 
   if ( geom_id && label_x >= 0 && label_y >= 0 )
   {
@@ -318,7 +319,7 @@
     {
       modMutex->unlock();
       throw new PalException::FeatureExists();
-      return;
+      return false;
     }
 
     /* Split MULTI GEOM and Collection in simple geometries*/
@@ -328,7 +329,6 @@
     LinkedList<Feat*> *finalQueue = splitGeom( the_geom, geom_id, true );
 
     int nGeom = finalQueue->size();
-    int part = 0;
 
     bool first_feat = true;
 
@@ -409,6 +409,8 @@
     userGeom->releaseGeosGeometry( the_geom );
   }
   modMutex->unlock();
+
+  return (part > 0); // true if we've added something
 }
 
 

Modified: branches/symbology-ng-branch/src/core/pal/layer.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/layer.h	2009-07-05 00:01:19 UTC (rev 11025)
+++ branches/symbology-ng-branch/src/core/pal/layer.h	2009-07-05 11:38:02 UTC (rev 11026)
@@ -277,8 +277,10 @@
        * @param userGeom user's geometry that implements the PalGeometry interface
        *
        * @throws PalException::FeatureExists
+       *
+       * @return true on success (i.e. valid geometry)
        */
-      void registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x = -1, double label_y = -1 );
+      bool registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x = -1, double label_y = -1 );
 
       // TODO implement
       //void unregisterFeature (const char *geom_id);



More information about the QGIS-commit mailing list