Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix offset side for polygons
  • Loading branch information
3nids committed Feb 13, 2018
1 parent 5d7eb19 commit 77f864b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/app/qgsmaptooloffsetcurve.cpp
Expand Up @@ -200,7 +200,7 @@ void QgsMapToolOffsetCurve::applyOffset( const double &offset, const Qt::Keyboar
mLayer->beginEditCommand( tr( "Offset curve" ) );

bool editOk;
if ( !mCtrlHeldOnFirstClick && !modifiers.testFlag( Qt::ControlModifier ) )
if ( !mCtrlHeldOnFirstClick && !( modifiers & Qt::ControlModifier ) )
{
editOk = mLayer->changeGeometry( mModifiedFeature, mModifiedGeometry );
}
Expand Down Expand Up @@ -240,7 +240,6 @@ void QgsMapToolOffsetCurve::cancel()
{
deleteUserInputWidget();
deleteRubberBandAndGeometry();
mCtrlHeldOnFirstClick = false;
mLayer = nullptr;
}

Expand Down Expand Up @@ -413,7 +412,7 @@ void QgsMapToolOffsetCurve::updateGeometryAndRubberBand( double offset )
}
else
{
offsetGeom = mManipulatedGeometry.buffer( offset, quadSegments, capStyle, joinStyle, miterLimit );
offsetGeom = mManipulatedGeometry.buffer( -offset, quadSegments, capStyle, joinStyle, miterLimit );
}

if ( !offsetGeom )
Expand All @@ -440,13 +439,15 @@ QgsOffsetUserWidget::QgsOffsetUserWidget( QWidget *parent )
{
setupUi( this );

mOffsetSpinBox->setDecimals( 6 );

// fill comboboxes
mJoinStyleComboBox->addItem( tr( "round" ), QgsGeometry::JoinStyleRound );
mJoinStyleComboBox->addItem( tr( "miter" ), QgsGeometry::JoinStyleMiter );
mJoinStyleComboBox->addItem( tr( "bevel" ), QgsGeometry::JoinStyleBevel );
mCapStyleComboBox->addItem( tr( "round" ), QgsGeometry::CapRound );
mCapStyleComboBox->addItem( tr( "flat" ), QgsGeometry::CapFlat );
mCapStyleComboBox->addItem( tr( "square" ), QgsGeometry::CapSquare );
mJoinStyleComboBox->addItem( tr( "Round" ), QgsGeometry::JoinStyleRound );
mJoinStyleComboBox->addItem( tr( "Miter" ), QgsGeometry::JoinStyleMiter );
mJoinStyleComboBox->addItem( tr( "Bevel" ), QgsGeometry::JoinStyleBevel );
mCapStyleComboBox->addItem( tr( "Round" ), QgsGeometry::CapRound );
mCapStyleComboBox->addItem( tr( "Flat" ), QgsGeometry::CapFlat );
mCapStyleComboBox->addItem( tr( "Square" ), QgsGeometry::CapSquare );

QgsSettings s;
QgsGeometry::JoinStyle joinStyle = static_cast< QgsGeometry::JoinStyle >( s.value( QStringLiteral( "/qgis/digitizing/offset_join_style" ), QgsGeometry::JoinStyleRound ).toInt() );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptooloffsetcurve.h
Expand Up @@ -77,7 +77,7 @@ class APP_EXPORT QgsMapToolOffsetCurve: public QgsMapToolEdit
//! Snapping indicators
std::unique_ptr<QgsSnapIndicator> mSnapIndicator;

//! The layer maniuplated
//! The layer being maniuplated
QgsVectorLayer *mLayer = nullptr;

//! Geometry to manipulate
Expand Down

0 comments on commit 77f864b

Please sign in to comment.