@@ -591,7 +591,65 @@ public void test7405() {
591591
592592 final long code = 7405 ;
593593
594- // TODO
594+ String definition = "COMPOUNDCRS[\" OSGB36 / British National Grid + ODN height\" ,"
595+ + "PROJCRS[\" OSGB36 / British National Grid\" ,BASEGEOGCRS[\" OSGB36\" ,"
596+ + "DATUM[\" Ordnance Survey of Great Britain 1936\" ,"
597+ + "ELLIPSOID[\" Airy 1830\" ,6377563.396,299.3249646,LENGTHUNIT[\" metre\" ,1,ID[\" EPSG\" ,9001]],"
598+ + "ID[\" EPSG\" ,7001]],ID[\" EPSG\" ,6277]],ID[\" EPSG\" ,4277]],"
599+ + "CONVERSION[\" British National Grid\" ,METHOD[\" Transverse Mercator\" ,ID[\" EPSG\" ,9807]],"
600+ + "PARAMETER[\" Latitude of natural origin\" ,49,ANGLEUNIT[\" degree\" ,0.0174532925199433,ID[\" EPSG\" ,9102]]],"
601+ + "PARAMETER[\" Longitude of natural origin\" ,-2,ANGLEUNIT[\" degree\" ,0.0174532925199433,ID[\" EPSG\" ,9102]]],"
602+ + "PARAMETER[\" Scale factor at natural origin\" ,0.999601272,SCALEUNIT[\" unity\" ,1,ID[\" EPSG\" ,9201]]],"
603+ + "PARAMETER[\" False easting\" ,400000,LENGTHUNIT[\" metre\" ,1,ID[\" EPSG\" ,9001]]],"
604+ + "PARAMETER[\" False northing\" ,-100000,LENGTHUNIT[\" metre\" ,1,ID[\" EPSG\" ,9001]]],ID[\" EPSG\" ,19916]],"
605+ + "CS[Cartesian,2,ID[\" EPSG\" ,4400]],"
606+ + "AXIS[\" Easting (E)\" ,east],AXIS[\" Northing (N)\" ,north],"
607+ + "LENGTHUNIT[\" metre\" ,1,ID[\" EPSG\" ,9001]],ID[\" EPSG\" ,27700]],"
608+ + "VERTCRS[\" ODN height\" ,VDATUM[\" Ordnance Datum Newlyn\" ,ID[\" EPSG\" ,5101]],"
609+ + "CS[vertical,1,ID[\" EPSG\" ,6499]],"
610+ + "AXIS[\" Gravity-related height (H)\" ,up],"
611+ + "LENGTHUNIT[\" metre\" ,1,ID[\" EPSG\" ,9001]],ID[\" EPSG\" ,5701]],"
612+ + "ID[\" EPSG\" ,7405]]" ;
613+
614+ // projectionTestDerived(code, 27700, definition);
615+ Projection projection = ProjectionFactory
616+ .getProjectionByDefinition (definition );
617+ TestCase .assertNotNull (projection );
618+ TestCase .assertEquals (authority , projection .getAuthority ());
619+ TestCase .assertEquals (Long .toString (code ), projection .getCode ());
620+ TestCase .assertEquals (definition , projection .getDefinition ());
621+
622+ definition = "COMPD_CS[\" OSGB 1936 / British National Grid + ODN height\" ,"
623+ + "PROJCS[\" OSGB 1936 / British National Grid\" ,GEOGCS[\" OSGB 1936\" ,"
624+ + "DATUM[\" OSGB_1936\" ,"
625+ + "SPHEROID[\" Airy 1830\" ,6377563.396,299.3249646,"
626+ + "AUTHORITY[\" EPSG\" ,\" 7001\" ]],"
627+ + "TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-20.489],AUTHORITY[\" EPSG\" ,\" 6277\" ]],"
628+ + "PRIMEM[\" Greenwich\" ,0,AUTHORITY[\" EPSG\" ,\" 8901\" ]],"
629+ + "UNIT[\" degree\" ,0.0174532925199433,"
630+ + "AUTHORITY[\" EPSG\" ,\" 9122\" ]],"
631+ + "AUTHORITY[\" EPSG\" ,\" 4277\" ]],"
632+ + "PROJECTION[\" Transverse_Mercator\" ],"
633+ + "PARAMETER[\" latitude_of_origin\" ,49],"
634+ + "PARAMETER[\" central_meridian\" ,-2],"
635+ + "PARAMETER[\" scale_factor\" ,0.9996012717],"
636+ + "PARAMETER[\" false_easting\" ,400000],"
637+ + "PARAMETER[\" false_northing\" ,-100000],"
638+ + "UNIT[\" metre\" ,1,AUTHORITY[\" EPSG\" ,\" 9001\" ]],"
639+ + "AXIS[\" Easting\" ,EAST],AXIS[\" Northing\" ,NORTH],"
640+ + "AUTHORITY[\" EPSG\" ,\" 27700\" ]],"
641+ + "VERT_CS[\" ODN height\" ,VERT_DATUM[\" Ordnance Datum Newlyn\" ,2005,"
642+ + "AUTHORITY[\" EPSG\" ,\" 5101\" ]],"
643+ + "UNIT[\" metre\" ,1,AUTHORITY[\" EPSG\" ,\" 9001\" ]],"
644+ + "AXIS[\" Up\" ,UP],AUTHORITY[\" EPSG\" ,\" 5701\" ]],"
645+ + "AUTHORITY[\" EPSG\" ,\" 7405\" ]]" ;
646+
647+ // projectionTestDerived(code, 27700, definition);
648+ projection = ProjectionFactory .getProjectionByDefinition (definition );
649+ TestCase .assertNotNull (projection );
650+ TestCase .assertEquals (authority , projection .getAuthority ());
651+ TestCase .assertEquals (Long .toString (code ), projection .getCode ());
652+ TestCase .assertEquals (definition , projection .getDefinition ());
595653
596654 }
597655
@@ -767,6 +825,38 @@ private void projectionTestSpecified(long epsg, String definition) {
767825 projectionTestSpecified (epsg , definition , 0 );
768826 }
769827
828+ /**
829+ * Test projection creation and transformations with derived authority and
830+ * epsg
831+ *
832+ * @param epsg
833+ * EPSG code
834+ * @param compareEpsg
835+ * compareEPSG code
836+ * @param definition
837+ * WKT definition
838+ */
839+ private void projectionTestDerived (long epsg , long compareEpsg ,
840+ String definition ) {
841+ projectionTestDerived (epsg , compareEpsg , definition , 0 );
842+ }
843+
844+ /**
845+ * Test projection creation and transformations with specified authority and
846+ * epsg
847+ *
848+ * @param epsg
849+ * EPSG code
850+ * @param compareEpsg
851+ * compareEPSG code
852+ * @param definition
853+ * WKT definition
854+ */
855+ private void projectionTestSpecified (long epsg , long compareEpsg ,
856+ String definition ) {
857+ projectionTestSpecified (epsg , compareEpsg , definition , 0 );
858+ }
859+
770860 /**
771861 * Test projection creation and transformations with derived authority and
772862 * epsg
@@ -780,11 +870,7 @@ private void projectionTestSpecified(long epsg, String definition) {
780870 */
781871 private void projectionTestDerived (long epsg , String definition ,
782872 double delta ) {
783-
784- Projection projection = ProjectionFactory
785- .getProjectionByDefinition (definition );
786- projectionTest (epsg , definition , projection , delta );
787-
873+ projectionTestDerived (epsg , epsg , definition , delta );
788874 }
789875
790876 /**
@@ -800,24 +886,64 @@ private void projectionTestDerived(long epsg, String definition,
800886 */
801887 private void projectionTestSpecified (long epsg , String definition ,
802888 double delta ) {
889+ projectionTestSpecified (epsg , epsg , definition , delta );
890+ }
803891
892+ /**
893+ * Test projection creation and transformations with derived authority and
894+ * epsg
895+ *
896+ * @param epsg
897+ * EPSG code
898+ * @param compareEpsg
899+ * compareEPSG code
900+ * @param definition
901+ * WKT definition
902+ * @param delta
903+ * delta comparison
904+ */
905+ private void projectionTestDerived (long epsg , long compareEpsg ,
906+ String definition , double delta ) {
804907 Projection projection = ProjectionFactory
805- .getProjectionByDefinition (authority , epsg , definition );
806- projectionTest (epsg , definition , projection , delta );
908+ .getProjectionByDefinition (definition );
909+ projectionTest (epsg , compareEpsg , definition , projection , delta );
910+ }
807911
912+ /**
913+ * Test projection creation and transformations with specified authority and
914+ * epsg
915+ *
916+ * @param epsg
917+ * EPSG code
918+ * @param compareEpsg
919+ * compareEPSG code
920+ * @param definition
921+ * WKT definition
922+ * @param delta
923+ * delta comparison
924+ */
925+ private void projectionTestSpecified (long epsg , long compareEpsg ,
926+ String definition , double delta ) {
927+ Projection projection = ProjectionFactory
928+ .getProjectionByDefinition (authority , epsg , definition );
929+ projectionTest (epsg , compareEpsg , definition , projection , delta );
808930 }
809931
810932 /**
811933 * Test projection creation and transformations
812934 *
813935 * @param epsg
814936 * EPSG code
937+ * @param compareEpsg
938+ * compareEPSG code
815939 * @param definition
816940 * WKT definition
817941 * @param projection
818942 * projection
943+ * @param delta
944+ * delta comparison
819945 */
820- private void projectionTest (long epsg , String definition ,
946+ private void projectionTest (long epsg , long compareEpsg , String definition ,
821947 Projection projection , double delta ) {
822948
823949 TestCase .assertNotNull (projection );
@@ -827,9 +953,9 @@ private void projectionTest(long epsg, String definition,
827953
828954 clear ();
829955
830- Projection projection2 = ProjectionFactory .getProjection (epsg );
956+ Projection projection2 = ProjectionFactory .getProjection (compareEpsg );
831957
832- compare (projection , projection2 , delta );
958+ compare (projection , projection2 , compareEpsg , delta );
833959
834960 GeometryEnvelope range = new GeometryEnvelope ();
835961
@@ -967,11 +1093,18 @@ private void coordinateTest(ProjCoordinate coordinate, double delta,
9671093 * projection
9681094 * @param projection2
9691095 * projection 2
1096+ * @param compareEpsg
1097+ * compareEPSG code
9701098 * @param delta
9711099 * delta comparison
9721100 */
9731101 private void compare (Projection projection , Projection projection2 ,
974- double delta ) {
1102+ long compareEpsg , double delta ) {
1103+
1104+ if (Long .valueOf (projection .getCode ()) != compareEpsg ) {
1105+ projection2 = new Projection (projection2 .getAuthority (),
1106+ projection .getCode (), projection2 .getCrs ());
1107+ }
9751108
9761109 assertEquals (projection , projection2 );
9771110
0 commit comments