Skip to content

Commit

Permalink
pal: registerFeature can return true/false to tell whether the regist…
Browse files Browse the repository at this point in the history
…ration was successful.

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11026 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 5, 2009
1 parent 5aa616d commit 01a2b38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/core/pal/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,10 @@ namespace pal
}
#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 )
{
Expand All @@ -318,7 +319,7 @@ void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double
{
modMutex->unlock();
throw new PalException::FeatureExists();
return;
return false;
}

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

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

bool first_feat = true;

Expand Down Expand Up @@ -409,6 +409,8 @@ void Layer::registerFeature( const char *geom_id, PalGeometry *userGeom, double
userGeom->releaseGeosGeometry( the_geom );
}
modMutex->unlock();

return (part > 0); // true if we've added something
}


Expand Down
4 changes: 3 additions & 1 deletion src/core/pal/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ namespace pal
* @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);
Expand Down

0 comments on commit 01a2b38

Please sign in to comment.