|
@@ -207,22 +207,22 @@ void TestQgsCadUtils::testCommonAngle() |
|
|
// without common angle |
|
|
QgsCadUtils::AlignMapPointOutput res0 = QgsCadUtils::alignMapPoint( QgsPointXY( 40, 20.1 ), context ); |
|
|
QVERIFY( res0.valid ); |
|
|
QCOMPARE( res0.softLockCommonAngle, -1 ); |
|
|
QCOMPARE( res0.softLockCommonAngle, -1.0 ); |
|
|
QCOMPARE( res0.finalMapPoint, QgsPointXY( 40, 20.1 ) ); |
|
|
|
|
|
// common angle |
|
|
context.commonAngleConstraint = QgsCadUtils::AlignMapPointConstraint( true, false, 90 ); |
|
|
QgsCadUtils::AlignMapPointOutput res1 = QgsCadUtils::alignMapPoint( QgsPointXY( 40, 20.1 ), context ); |
|
|
QVERIFY( res1.valid ); |
|
|
QCOMPARE( res1.softLockCommonAngle, 0 ); |
|
|
QCOMPARE( res1.softLockCommonAngle, 0.0 ); |
|
|
QCOMPARE( res1.finalMapPoint, QgsPointXY( 40, 20 ) ); |
|
|
|
|
|
// common angle + angle (make sure that angle constraint has priority) |
|
|
context.commonAngleConstraint = QgsCadUtils::AlignMapPointConstraint( true, false, 90 ); |
|
|
context.angleConstraint = QgsCadUtils::AlignMapPointConstraint( true, false, 45 ); |
|
|
QgsCadUtils::AlignMapPointOutput res2 = QgsCadUtils::alignMapPoint( QgsPointXY( 40, 20.1 ), context ); |
|
|
QVERIFY( res2.valid ); |
|
|
QCOMPARE( res2.softLockCommonAngle, -1 ); |
|
|
QCOMPARE( res2.softLockCommonAngle, -1.0 ); |
|
|
QCOMPARE( res2.finalMapPoint, QgsPointXY( 35.05, 25.05 ) ); |
|
|
|
|
|
// common angle rel |
|
@@ -231,7 +231,7 @@ void TestQgsCadUtils::testCommonAngle() |
|
|
context.cadPointList[1] = QgsPointXY( 40, 20 ); |
|
|
QgsCadUtils::AlignMapPointOutput res3 = QgsCadUtils::alignMapPoint( QgsPointXY( 50.1, 29.9 ), context ); |
|
|
QVERIFY( res3.valid ); |
|
|
QCOMPARE( res3.softLockCommonAngle, 90 ); |
|
|
QCOMPARE( res3.softLockCommonAngle, 90.0 ); |
|
|
QCOMPARE( res3.finalMapPoint, QgsPointXY( 50, 30 ) ); |
|
|
} |
|
|
|
|
@@ -242,7 +242,7 @@ void TestQgsCadUtils::testDistance() |
|
|
// without distance constraint |
|
|
QgsCadUtils::AlignMapPointOutput res0 = QgsCadUtils::alignMapPoint( QgsPointXY( 45, 20 ), context ); |
|
|
QVERIFY( res0.valid ); |
|
|
QCOMPARE( res0.softLockCommonAngle, -1 ); |
|
|
QCOMPARE( res0.softLockCommonAngle, -1.0 ); |
|
|
QCOMPARE( res0.finalMapPoint, QgsPointXY( 45, 20 ) ); |
|
|
|
|
|
// dist |
|
|