From 6a273f0e893a0143c2df7a929014700a5a2250e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ko=C5=88a=C5=99=C3=ADk?= Date: Sat, 19 Oct 2024 20:47:27 +0200 Subject: [PATCH] Add test for Identify tool on VPC --- tests/src/app/testqgsidentify.cpp | 29 + .../virtual/sunshine-coast/0-0.copc.laz | Bin 0 -> 3806 bytes .../virtual/sunshine-coast/0-1.copc.laz | Bin 0 -> 3361 bytes .../virtual/sunshine-coast/1-0.copc.laz | Bin 0 -> 3667 bytes .../virtual/sunshine-coast/1-1.copc.laz | Bin 0 -> 3264 bytes .../virtual/sunshine-coast/combined.vpc | 853 ++++++++++++++++++ 6 files changed, 882 insertions(+) create mode 100644 tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz create mode 100644 tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz create mode 100644 tests/testdata/point_clouds/virtual/sunshine-coast/1-0.copc.laz create mode 100644 tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz create mode 100644 tests/testdata/point_clouds/virtual/sunshine-coast/combined.vpc diff --git a/tests/src/app/testqgsidentify.cpp b/tests/src/app/testqgsidentify.cpp index 951326b116a2..58392b46e1a9 100644 --- a/tests/src/app/testqgsidentify.cpp +++ b/tests/src/app/testqgsidentify.cpp @@ -72,6 +72,7 @@ class TestQgsIdentify : public QObject void testLineStringZ(); void testPolygonZ(); void identifyPointCloud(); + void identifyVirtualPointCloud(); private: void doAction(); @@ -1303,6 +1304,34 @@ void TestQgsIdentify::identifyPointCloud() #endif } +void TestQgsIdentify::identifyVirtualPointCloud() +{ +#ifdef HAVE_COPC + std::unique_ptr< QgsPointCloudLayer > pointCloud = std::make_unique< QgsPointCloudLayer >( QStringLiteral( TEST_DATA_DIR ) + "/point_clouds/virtual/sunshine-coast/combined.vpc", QStringLiteral( "pointcloud" ), QStringLiteral( "vpc" ) ); + QVERIFY( pointCloud->isValid() ); + pointCloud->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:28356" ) ) ); + QCOMPARE( pointCloud->crs3D().horizontalCrs().authid(), QStringLiteral( "EPSG:28356" ) ); + + for ( int i = 0; i < pointCloud->dataProvider()->subIndexes().size(); i++ ) + pointCloud->dataProvider()->loadSubIndex( i ); + + // set project CRS and ellipsoid + // Note that using a different CRS here (a world-wide WGS84-based one) caused + // problems on some machines due to insufficient precision in reprojection. + QgsProject::instance()->setCrs( pointCloud->crs() ); + canvas->setDestinationCrs( pointCloud->crs() ); + canvas->setExtent( QgsRectangle::fromCenterAndSize( QgsPointXY( 498065.5, 7050992.5 ), 1, 1 ) ); + + const QgsPointXY mapPoint = canvas->getCoordinateTransform()->transform( 498065.23, 7050992.90 ); + + std::unique_ptr< QgsMapToolIdentifyAction > action( new QgsMapToolIdentifyAction( canvas ) ); + QList result = action->identify( static_cast< int >( mapPoint.x() ), static_cast< int >( mapPoint.y() ), QList() << pointCloud.get() ); + QCOMPARE( result.length(), 1 ); + double z = result.at( 0 ).mDerivedAttributes[ QStringLiteral( "Z" )].toDouble(); + QGSCOMPARENEAR( z, 74.91, 0.001 ); +#endif +} + QGSTEST_MAIN( TestQgsIdentify ) #include "testqgsidentify.moc" diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/0-0.copc.laz new file mode 100644 index 0000000000000000000000000000000000000000..187f03a3c9ca92766d7da17895936e057ee242b7 GIT binary patch literal 3806 zcmcIm3s@6Z7M=hq58c9+6^jsKq`V60WRlDyg#r!FPap^sEl^}khA?ZG#3Z07AfT+S zLe+Mu4;DWQYF+%6s@SRv+g0#|T2w4PsWe?&0H}JLlf> zpL5Us=S<=wQlcTq6&fu(hos1e_|aDGa};A*NHdf`EP}b_k+~1==7fd3UONb~2euVH zPzF%!|7ZzTc-^^%dWMbGOWYfey_3U_XzTZHX}OUead*~!e#Oj`a4_Cc06U9=108#H z@dI{Ulaqt8+T}vMKJ-L#xOxB1}|9`bgr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{oSJOr`T|U~s(=ln|q^NQR0r z1VeF{Ku3~Aah!lfVi_Srz@HT3>&VRyCxF{bsxXOV!dOhR&2B^AS^Y`34mgr?!EF!BUVR3a$^# z07Vfgx1y|VI9+xpm!T|ghuO)l0l#F*MhGt6b8pyEKT9=jWcd zEHpQ}VDZRdgAs`c!^J3p5U@myz)~2zx+BL8MsN`fBQOl(Fpi03I09hUK#{b;^3y9? zOKQdjdl@pY@C;>8g;OLn#i#r+?tBn#$axnV)R+Q zW88|0G2k?tHs$70S{oetFW$&GFV06w;4mr`5%_RgEG36&Y+eK$0AB@0O&Zj}YN~*? zc6Ase_}+`LF<1r@giM5w(1;6eSw%#+4DbesT8ekxBp3g;}CRD^;< K+CEBg@qYl(powDu literal 0 HcmV?d00001 diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/0-1.copc.laz new file mode 100644 index 0000000000000000000000000000000000000000..c9790a104afc89b19b1f04795539b6ccd7f871d6 GIT binary patch literal 3361 zcmcIm3s4hR6x~Jqj8?_bst7`iPW^?L-DE#u7$k&GE!4zd#rkDU7P63RVzLpUMZ_sq zTPxOaM5T88U`0o9MxCiT;0G0Tv_h@lDi*C4#~<3Ml^NTn@8yFF1lx}7o7vpE_q}`X zx%Zv-HtCv-6a)!FIu0~cpQK6eXcfOF^Fltyvl2|M5S!cdQRw}i`Dk+pf^-A6PevgV zfPhcO5u=TKc!wM|v7=lxsOofLc9iDC^D))c_hx7wO*t4E_0|Q*=jejg7VeBkms5B%5@_p3ZrvXH5ID+8`tp9(d(PlS_GoZ+3M61(l zB^;k^lT1rDh$sE}psLi{383P^RjI|WV)(vLm63oTpe1(HFSkrQ=&w}b_v3Z8dG~U{ zG;~FD#8zvVuS5R1|5jKS=R(ddVR@s?#F`MKdYT-uFbnOhBU`e7ac~STbV>;6(Jd7I zB8Vr*2tj%yQGi5!kRDztr31>&)jMpttWn@>Jd)7M>-yRstG^?;pr+9K&bU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OoB^C@d*i(PY7{TEV8W7 zFj`5BAi%Z+sxSq1z+|7?UtYsE4XP|ko1C3W=?z-O+(F|zhl@=-kFgShKVsuaV2cqT zOwOmYN>cMe0L>|;sSR2=6|b=4NrH+1LL4+2kU)b9#&sstjaC%C$roanSSp391h+v8 zZ2)j8WhaE~2~Byzmik$$X$R#C6fsRsG7(IUl1e3+wnLp$sV65pv8^cv=Yn}$Vv_Ow4)4L(jf4|x1+CA`rIdDB=)bs- zE1wTXL`YGwgfApUQNfNJMPW9Awgw*qMnP&7JO!0cTZcIc0IqtzZwZQ{1cCFVWAohB rxy35rOGTDT57M71PR4(TBjSUZ`;5j0%D8YMzDWG+9dycY#l`;y%a2YA literal 0 HcmV?d00001 diff --git a/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz b/tests/testdata/point_clouds/virtual/sunshine-coast/1-1.copc.laz new file mode 100644 index 0000000000000000000000000000000000000000..e08a4a146bc9ded0adc7438873a9f51caaeb6bdc GIT binary patch literal 3264 zcmcImc~BEq7~h0LiXE?^mSV*;(1H$ZcQ@H1j7I_pQtm@MYLPYBgoUt)n++Bz)#%Xv z;Y_u)D0qz8DqyQpJ3_UBw$`IgZAYAroqDutOSNOQTCGP9>3g|YATV|uznSd!-uK@3 z`;PZ}yU8*XrXk2Eq`xSF^HL32{jKu(bU|9g3!Dl^F}c}4j#XS4wn%YVi6BA1_GT>d z0#LEw2P}OgG3D8-m#C;|{dG;mu4BpOXu}tO#&>jd&o%s(zc;!rvrrH0>Dj=()jlOW z73hicRwj3X^>vMn_u;-vi@^p(k^WBnyp@OQ3-rEV5h0!tj1O~x0`q~=KPQj%aXyVU zyHSp>KsF;Oxp^rnUNGBK#aRXNMeo=QBo|Z+DrEowzaMWY`XA^S9UR-;X^lWsWa)O)$0Uqsy}| z{Q6Cd?M(6I`!Ak5T(_qF@H6I`6=5@;`1JWVg3fk^hTpTga^8ul>e^M>89)4d)$1$T zk;q_b?SgyN#(R-Y3m>CxSQM8%lRo$|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