Skip to content
Permalink
Browse files
[Fix][MapTool] Fix M support for circle map tool (#43722)
Follow up #42812, #42986 and #43060

Co-authored-by: Antoine Facchini <antoine.facchini@oslandia.com>
  • Loading branch information
lbartoletti and Koyaani committed Aug 23, 2021
1 parent 298f368 commit 48b0d627e61d821e12bf943ed21b68039ea82859
@@ -39,18 +39,7 @@ void QgsMapToolAddCircle::deactivate()

mParentTool->clearCurve();

// keep z value from the first snapped point
std::unique_ptr<QgsCircularString> lineString( mCircle.toCircularString() );
for ( const QgsPoint &point : std::as_const( mPoints ) )
{
if ( QgsWkbTypes::hasZ( point.wkbType() ) &&
point.z() != defaultZValue() )
{
lineString->dropZValue();
lineString->addZValue( point.z() );
break;
}
}

mParentTool->addCurve( lineString.release() );
clean();
@@ -140,7 +140,7 @@ QgsCircle QgsCircle::from3Points( const QgsPoint &pt1, const QgsPoint &pt2, cons
const double aSlope = yDelta_a / xDelta_a;
const double bSlope = yDelta_b / xDelta_b;

// set z coordinate for center
// set z and m coordinate for center
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << p1 << p2 << p3, center );

if ( ( std::fabs( xDelta_a ) <= epsilon ) && ( std::fabs( yDelta_b ) <= epsilon ) )
@@ -418,10 +418,10 @@ void QgsCircle::setSemiMinorAxis( const double semiMinorAxis )
QVector<QgsPoint> QgsCircle::northQuadrant() const
{
QVector<QgsPoint> quad;
quad.append( QgsPoint( mCenter.x(), mCenter.y() + mSemiMajorAxis, mCenter.z() ) );
quad.append( QgsPoint( mCenter.x() + mSemiMajorAxis, mCenter.y(), mCenter.z() ) );
quad.append( QgsPoint( mCenter.x(), mCenter.y() - mSemiMajorAxis, mCenter.z() ) );
quad.append( QgsPoint( mCenter.x() - mSemiMajorAxis, mCenter.y(), mCenter.z() ) );
quad.append( QgsPoint( mCenter.x(), mCenter.y() + mSemiMajorAxis, mCenter.z(), mCenter.m() ) );
quad.append( QgsPoint( mCenter.x() + mSemiMajorAxis, mCenter.y(), mCenter.z(), mCenter.m() ) );
quad.append( QgsPoint( mCenter.x(), mCenter.y() - mSemiMajorAxis, mCenter.z(), mCenter.m() ) );
quad.append( QgsPoint( mCenter.x() - mSemiMajorAxis, mCenter.y(), mCenter.z(), mCenter.m() ) );

return quad;
}
@@ -24,10 +24,10 @@ set(TESTS
testqgsmaptoolrotatefeature.cpp
testqgsmaptoolscalefeature.cpp
testqgsmaptoolcircularstring.cpp
testqgsmaptoolcircle.cpp
testqgsmaptooleditmesh.cpp
testqgsmaptoolmovefeature.cpp
testqgsmaptoolellipse.cpp
testqgsmaptoolcircle.cpp
testqgsmaptoolrectangle.cpp
testqgsmaptoolregularpolygon.cpp
testqgsmaptoolsplitparts.cpp

0 comments on commit 48b0d62

Please sign in to comment.