Skip to content

Commit

Permalink
[Fix][MapTool] Fix M support for circle map tool (#43722)
Browse files Browse the repository at this point in the history
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 48b0d62
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 108 deletions.
11 changes: 0 additions & 11 deletions src/app/qgsmaptooladdcircle.cpp
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions src/core/geometry/qgscircle.cpp
Expand Up @@ -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 ) )
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/app/CMakeLists.txt
Expand Up @@ -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
Expand Down

0 comments on commit 48b0d62

Please sign in to comment.