Skip to content

Commit ccb5ed0

Browse files
committed
Disable offset curve if geos version < 3.3
1 parent 788c736 commit ccb5ed0

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/app/qgisapp.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,10 @@ void QgisApp::createActionGroups()
10181018
mMapToolGroup->addAction( mActionMeasureAngle );
10191019
mMapToolGroup->addAction( mActionAddFeature );
10201020
mMapToolGroup->addAction( mActionMoveFeature );
1021+
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
1022+
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
10211023
mMapToolGroup->addAction( mActionOffsetCurve );
1024+
#endif
10221025
mMapToolGroup->addAction( mActionReshapeFeatures );
10231026
mMapToolGroup->addAction( mActionSplitFeatures );
10241027
mMapToolGroup->addAction( mActionDeleteSelected );
@@ -1667,8 +1670,15 @@ void QgisApp::createCanvasTools()
16671670
mMapTools.mAddFeature->setAction( mActionAddFeature );
16681671
mMapTools.mMoveFeature = new QgsMapToolMoveFeature( mMapCanvas );
16691672
mMapTools.mMoveFeature->setAction( mActionMoveFeature );
1673+
//need at least geos 3.3 for OffsetCurve tool
1674+
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
1675+
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
16701676
mMapTools.mOffsetCurve = new QgsMapToolOffsetCurve( mMapCanvas );
16711677
mMapTools.mOffsetCurve->setAction( mActionOffsetCurve );
1678+
#else
1679+
mAdvancedDigitizeToolBar->removeAction( mActionOffsetCurve );
1680+
mEditMenu->removeAction( mActionOffsetCurve );
1681+
#endif //GEOS_VERSION
16721682
mMapTools.mReshapeFeatures = new QgsMapToolReshape( mMapCanvas );
16731683
mMapTools.mReshapeFeatures->setAction( mActionReshapeFeatures );
16741684
mMapTools.mSplitFeatures = new QgsMapToolSplitFeatures( mMapCanvas );

src/app/qgsmaptooloffsetcurve.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,16 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
352352
int joinStyle = s.value( "/qgis/digitizing/offset_join_style", 0 ).toInt();
353353
int quadSegments = s.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt();
354354
double mitreLimit = s.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble();
355-
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, quadSegments, joinStyle, mitreLimit, leftSide ? 1 : 0 );
355+
356+
GEOSGeometry* offsetGeom = 0;
357+
//need at least geos 3.3 for OffsetCurve tool
358+
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
359+
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
360+
GEOSGeometry* offsetGeom = GEOSOffsetCurve( geosGeom, ( leftSide > 0 ) ? offset : -offset, quadSegments, joinStyle, mitreLimit );
361+
#else
362+
return;
363+
#endif //GEOS_VERSION
364+
356365
if ( !offsetGeom )
357366
{
358367
deleteRubberBandAndGeometry();
@@ -365,9 +374,6 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
365374
return;
366375
}
367376

368-
//GEOS >= 3.3
369-
//GEOSGeometry* offsetGeom = GEOSOffsetCurve( geosGeom, (leftSide > 0) ? offset : -offset, quadSegments, joinStyle, mitreLimit );
370-
371377
if ( offsetGeom )
372378
{
373379
mModifiedGeometry.fromGeos( offsetGeom );

0 commit comments

Comments
 (0)