Skip to content

Commit 01a2b38

Browse files
author
wonder
committedJul 5, 2009
pal: registerFeature can return true/false to tell whether the registration was successful.
git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11026 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
 

‎src/core/pal/layer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ namespace pal
305305
}
306306
#endif
307307

308-
void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x, double label_y )
308+
bool Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x, double label_y )
309309
{
310310
int j;
311+
int part = 0;
311312

312313
if ( geom_id && label_x >= 0 && label_y >= 0 )
313314
{
@@ -318,7 +319,7 @@ void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double
318319
{
319320
modMutex->unlock();
320321
throw new PalException::FeatureExists();
321-
return;
322+
return false;
322323
}
323324

324325
/* Split MULTI GEOM and Collection in simple geometries*/
@@ -328,7 +329,6 @@ void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double
328329
LinkedList<Feat*> *finalQueue = splitGeom( the_geom, geom_id, true );
329330

330331
int nGeom = finalQueue->size();
331-
int part = 0;
332332

333333
bool first_feat = true;
334334

@@ -409,6 +409,8 @@ void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double
409409
userGeom->releaseGeosGeometry( the_geom );
410410
}
411411
modMutex->unlock();
412+
413+
return (part > 0); // true if we've added something
412414
}
413415

414416

‎src/core/pal/layer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ namespace pal
277277
* @param userGeom user's geometry that implements the PalGeometry interface
278278
*
279279
* @throws PalException::FeatureExists
280+
*
281+
* @return true on success (i.e. valid geometry)
280282
*/
281-
void registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x = -1, double label_y = -1 );
283+
bool registerFeature( const char *geom_id, PalGeometry *userGeom, double label_x = -1, double label_y = -1 );
282284

283285
// TODO implement
284286
//void unregisterFeature (const char *geom_id);

0 commit comments

Comments
 (0)
Please sign in to comment.