Skip to content

Commit

Permalink
Do not add polygon with less than 3 nodes.
Browse files Browse the repository at this point in the history
REVIEW: 121967
  • Loading branch information
EgorMatirov committed Jan 10, 2015
1 parent 40a9b85 commit e7e87ff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/render/annotate/EditPolygonDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// Marble
#include "GeoDataStyle.h"
#include "GeoDataTypes.h"


namespace Marble {
Expand Down Expand Up @@ -183,6 +184,15 @@ void EditPolygonDialog::checkFields()
QMessageBox::warning( this,
tr( "No name specified" ),
tr( "Please specify a name for this polygon." ) );
} else {
if ( d->m_placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType ) {
GeoDataPolygon *polygon = static_cast<GeoDataPolygon*>( d->m_placemark->geometry() );
if( polygon->outerBoundary().size() < 3 ) {
QMessageBox::warning( this,
tr( "Not enough nodes specified." ),
tr( "Please specify at least 3 nodes for the polygon by clicking on the map." ) );
}
}
}
}

Expand Down

0 comments on commit e7e87ff

Please sign in to comment.