示例#1
0
 public void SerializeToWgs84Test([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(
         @"TOWGS84[1,2,3,4,5,6,7]",
         serializer.Serialize(new Helmert7Transformation(
                                  new Vector3(1, 2, 3),
                                  new Vector3(4, 5, 6),
                                  7
                                  ))
         );
 }
示例#2
0
 public void SerializePrimerMeridianTest([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(
         @"PRIMEM[""ummm"",0.1,AUTHORITY[""PIGEOID"",""?!#$""]]",
         serializer.Serialize(new OgcPrimeMeridian(
                                  "ummm",
                                  0.1,
                                  new AuthorityTag("PIGEOID", "?!#$")
                                  ))
         );
 }
示例#3
0
 public void SerializeSpheroidTest([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(
         @"SPHEROID[""round"",12345,278,AUTHORITY[""PIGEOID"",""?!#$""]]",
         serializer.Serialize(new OgcSpheroid(
                                  new SpheroidEquatorialInvF(12345, 278),
                                  "round",
                                  OgcLinearUnit.DefaultMeter,
                                  new AuthorityTag("PIGEOID", "?!#$")
                                  ))
         );
 }
示例#4
0
 public void SerializeDatumTest([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(
         "VERT_DATUM[\"test\",2001,AUTHORITY[\"EPSG\",\"1234\"]]",
         Default.Serialize(new OgcDatum(
                               "test",
                               OgcDatumType.VerticalOrthometric,
                               new AuthorityTag("EPSG", "1234")
                               ))
         );
 }
示例#5
0
 public void SerializeNamedParameterTest([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(@"PARAMETER[""a"",1234]", serializer.Serialize(new NamedParameter <double>("a", 1234)));
     Assert.AreEqual(@"PARAMETER[""b"",""test""]", serializer.Serialize(new NamedParameter <string>("B", "test")));
     Assert.AreEqual(@"PARAMETER[""blank"",""""]", serializer.Serialize(new NamedParameter <object>("blank", null)));
 }
示例#6
0
 public void SerializeAuthorityTest([ValueSource("AllSerializers")] WktSerializer serializer)
 {
     Assert.AreEqual(@"AUTHORITY[""EPSG"",""9001""]", serializer.Serialize(new AuthorityTag("EPSG", "9001")));
     Assert.AreEqual(@"AUTHORITY[""AbC"",""""]", serializer.Serialize(new AuthorityTag("AbC", null)));
     Assert.AreEqual(@"AUTHORITY[""DEF"",""ghi""]", serializer.Serialize(new AuthorityTag("DEF", "ghi")));
 }
示例#7
0
        public void SerializePrettyConcatMathTransformTest()
        {
            var input = new ConcatenatedCoordinateOperationInfo(
                new[] {
                new CoordinateOperationInfo(
                    "Helmert 7 Parameter Transformation",
                    new INamedParameter[] {
                    new NamedParameter <double>("dx", 1),
                    new NamedParameter <double>("dy", 2),
                    new NamedParameter <double>("dz", 3),
                    new NamedParameter <double>("rx", 4),
                    new NamedParameter <double>("ry", 5),
                    new NamedParameter <double>("rz", 6),
                    new NamedParameter <double>("m", 7)
                }
                    ),
                new CoordinateOperationInfo(
                    "Thing 1",
                    new INamedParameter[] {
                    new NamedParameter <double>("semi major", 6378137),
                    new NamedParameter <double>("semi minor", 6356752.31414035)
                },
                    new OgcCoordinateOperationMethodInfo(
                        "Ellipsoid To Geocentric"
                        )
                    ),
                new CoordinateOperationInfo(
                    "Thing 3",
                    new INamedParameter[] {
                    new NamedParameter <double>("semi_major", 6378206.4),
                    new NamedParameter <double>("semi_minor", 6356583.8)
                },
                    new OgcCoordinateOperationMethodInfo(
                        "Ellipsoid_To_Geocentric"
                        )
                    ).GetInverse()
            }
                );
            var expectedPretty = String.Join(Environment.NewLine, new[] {
                "CONCAT_MT[",
                "\tPARAM_MT[\"Helmert_7_Parameter_Transformation\",",
                "\t\tPARAMETER[\"dx\",1],",
                "\t\tPARAMETER[\"dy\",2],",
                "\t\tPARAMETER[\"dz\",3],",
                "\t\tPARAMETER[\"rx\",4],",
                "\t\tPARAMETER[\"ry\",5],",
                "\t\tPARAMETER[\"rz\",6],",
                "\t\tPARAMETER[\"m\",7]],",
                "\tPARAM_MT[\"Ellipsoid_To_Geocentric\",",
                "\t\tPARAMETER[\"semi_major\",6378137],",
                "\t\tPARAMETER[\"semi_minor\",6356752.31414035]],",
                "\tINVERSE_MT[",
                "\t\tPARAM_MT[\"Ellipsoid_To_Geocentric\",",
                "\t\t\tPARAMETER[\"semi_major\",6378206.4],",
                "\t\t\tPARAMETER[\"semi_minor\",6356583.8]]]]"
            });
            var expectedDefault = expectedPretty.Replace(Environment.NewLine, "").Replace("\t", "");

            Assert.AreEqual(expectedDefault, Default.Serialize(input));
            Assert.AreEqual(expectedPretty, Pretty.Serialize(input));
        }