Skip to content

Commit

Permalink
fix for #1169, added check for isle's area
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12678 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Jan 6, 2010
1 parent efee46c commit 513436c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/grass/qgsgrassedit.cpp
Expand Up @@ -892,10 +892,10 @@ int QgsGrassEdit::lineSymbFromMap( int line )

if ( !( mProvider->lineAreas( line, &left, &right ) ) ) return 0;

/* Count areas/isles on both sides */
/* Count areas on both sides */
nareas = 0;
if ( left != 0 ) nareas++;
if ( right != 0 ) nareas++;
if ( left > 0 || (left < 0 && mProvider->isleArea(-left) > 0 ) ) nareas++;
if ( right > 0 || (right < 0 && mProvider->isleArea(-right) > 0 ) ) nareas++;
if ( nareas == 0 ) return SYMB_BOUNDARY_0;
else if ( nareas == 1 ) return SYMB_BOUNDARY_1;
else return SYMB_BOUNDARY_2;
Expand Down
12 changes: 12 additions & 0 deletions src/providers/grass/qgsgrassprovider.cpp
Expand Up @@ -1749,6 +1749,18 @@ bool QgsGrassProvider::lineAreas( int line, int *left, int *right )
return true;
}

int QgsGrassProvider::isleArea( int isle )
{
QgsDebugMsgLevel( "entered.", 3 );

if ( !Vect_isle_alive( mMap, isle ) )
{
return 0;
}

return ( Vect_get_isle_area( mMap, isle ) );
}

int QgsGrassProvider::centroidArea( int centroid )
{
QgsDebugMsgLevel( "entered.", 3 );
Expand Down
6 changes: 6 additions & 0 deletions src/providers/grass/qgsgrassprovider.h
Expand Up @@ -280,6 +280,12 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
*/
bool lineAreas( int line, int *left, int *right );

/** Get isle area
* @param isle number
* @return area number
*/
int isleArea( int isle );

/** Get centroid area
* @param centroid line number
* @return area number (negative for island)
Expand Down

0 comments on commit 513436c

Please sign in to comment.