Skip to content
Permalink
Browse files

Disable offset curve if geos version < 3.3

  • Loading branch information
mhugent committed Mar 1, 2012
1 parent 788c736 commit ccb5ed067f977e02bb8470c657139f9d0c295590
Showing with 20 additions and 4 deletions.
  1. +10 −0 src/app/qgisapp.cpp
  2. +10 −4 src/app/qgsmaptooloffsetcurve.cpp
@@ -1018,7 +1018,10 @@ void QgisApp::createActionGroups()
mMapToolGroup->addAction( mActionMeasureAngle );
mMapToolGroup->addAction( mActionAddFeature );
mMapToolGroup->addAction( mActionMoveFeature );
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
mMapToolGroup->addAction( mActionOffsetCurve );
#endif
mMapToolGroup->addAction( mActionReshapeFeatures );
mMapToolGroup->addAction( mActionSplitFeatures );
mMapToolGroup->addAction( mActionDeleteSelected );
@@ -1667,8 +1670,15 @@ void QgisApp::createCanvasTools()
mMapTools.mAddFeature->setAction( mActionAddFeature );
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
//need at least geos 3.3 for OffsetCurve tool
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
mMapTools.mOffsetCurve = new QgsMapToolOffsetCurve( mMapCanvas );
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
#else
mAdvancedDigitizeToolBar->removeAction( mActionOffsetCurve );
mEditMenu->removeAction( mActionOffsetCurve );
#endif //GEOS_VERSION
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
mMapTools.mReshapeFeatures->setAction( mActionReshapeFeatures );
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );
@@ -352,7 +352,16 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
int joinStyle = s.value( "/qgis/digitizing/offset_join_style", 0 ).toInt();
int quadSegments = s.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt();
double mitreLimit = s.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble();
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, quadSegments, joinStyle, mitreLimit, leftSide ? 1 : 0 );

GEOSGeometry* offsetGeom = 0;
//need at least geos 3.3 for OffsetCurve tool
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
GEOSGeometry* offsetGeom = GEOSOffsetCurve( geosGeom, ( leftSide > 0 ) ? offset : -offset, quadSegments, joinStyle, mitreLimit );
#else
return;
#endif //GEOS_VERSION

if ( !offsetGeom )
{
deleteRubberBandAndGeometry();
@@ -365,9 +374,6 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
return;
}

//GEOS >= 3.3
//GEOSGeometry* offsetGeom = GEOSOffsetCurve( geosGeom, (leftSide > 0) ? offset : -offset, quadSegments, joinStyle, mitreLimit );

if ( offsetGeom )
{
mModifiedGeometry.fromGeos( offsetGeom );

0 comments on commit ccb5ed0

Please sign in to comment.
You can’t perform that action at this time.