public void TestConstructor()
        {
            var css = new CoordinateSystemServices(new CoordinateSystemFactory(Encoding.UTF8),
                new CoordinateTransformationFactory());

            Assert.IsNotNull(css.GetCoordinateSystem(4326));
            Assert.IsNotNull(css.GetCoordinateSystem(3857));
        }
        public void TestConstructor()
        {
            var css = new CoordinateSystemServices(new CoordinateSystemFactory(),
                                                   new CoordinateTransformationFactory());

            Assert.IsNotNull(css.GetCoordinateSystem(4326));
            Assert.IsNotNull(css.GetCoordinateSystem(3857));
        }
        public void TestConstructorLoadXml(string xmlPath)
        {
            if (!File.Exists(xmlPath))
                throw new IgnoreException("Specified file not found");

            var css = new CoordinateSystemServices(new CoordinateSystemFactory(Encoding.UTF8),
                new CoordinateTransformationFactory(), LoadXml(xmlPath));

            Assert.IsNotNull(css.GetCoordinateSystem(4326));
            Assert.IsNotNull(css.GetCoordinateSystem("EPSG", 4326));
            Assert.IsTrue(ReferenceEquals(css.GetCoordinateSystem("EPSG", 4326), css.GetCoordinateSystem(4326)));

        }
Exemple #4
0
        /// <summary>
        /// Static constructor to perform 1-time initialisation.
        /// </summary>
        static MapRenderer()
        {
            Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            GeometryServiceProvider.Instance = new NtsGeometryServices();
            var coordFactory = new CoordinateSystemFactory(System.Text.Encoding.Unicode);
            var css          = new CoordinateSystemServices(coordFactory, new CoordinateTransformationFactory());

            css.AddCoordinateSystem(3857, coordFactory.CreateFromWkt("PROJCS[\"WGS 84 / Pseudo-Mercator\", GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\", SPHEROID[\"WGS 84\", 6378137, 298.257223563, AUTHORITY[\"EPSG\", \"7030\"]], AUTHORITY[\"EPSG\", \"6326\"]], PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.0174532925199433, AUTHORITY[\"EPSG\", \"9122\"]], AUTHORITY[\"EPSG\", \"4326\"]], UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]], PROJECTION[\"Mercator_1SP\"], PARAMETER[\"latitude_of_origin\", 0], PARAMETER[\"central_meridian\", 0], PARAMETER[\"scale_factor\", 1], PARAMETER[\"false_easting\", 0], PARAMETER[\"false_northing\", 0], AUTHORITY[\"EPSG\", \"3857\"]]"));
            css.AddCoordinateSystem(4326, coordFactory.CreateFromWkt("GEOGCS[\"WGS 84\", DATUM[\"WGS_1984\", SPHEROID[\"WGS 84\", 6378137, 298.257223563, AUTHORITY[\"EPSG\", \"7030\"]], AUTHORITY[\"EPSG\", \"6326\"]], PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.0174532925199433, AUTHORITY[\"EPSG\", \"9122\"]], AUTHORITY[\"EPSG\", \"4326\"]]"));
            Session.Instance.SetGeometryServices(GeoAPI.GeometryServiceProvider.Instance)
            .SetCoordinateSystemServices(css)
            .SetCoordinateSystemRepository(css);
        }
Exemple #5
0
        public void FixtureSetUp()
        {
            var gss = new NtsGeometryServices();
            var css = new CoordinateSystemServices(
                new CoordinateSystemFactory(),
                new CoordinateTransformationFactory(),
                SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

            GeoAPI.GeometryServiceProvider.Instance = gss;
            Session.Instance
            .SetGeometryServices(gss)
            .SetCoordinateSystemServices(css)
            .SetCoordinateSystemRepository(css);
        }
        public void TestConstructorLoadXml(string xmlPath)
        {
            if (!File.Exists(xmlPath))
            {
                throw new IgnoreException("Specified file not found");
            }

            var css = new CoordinateSystemServices(new CoordinateSystemFactory(),
                                                   new CoordinateTransformationFactory(), LoadXml(xmlPath));

            Assert.IsNotNull(css.GetCoordinateSystem(4326));
            Assert.IsNotNull(css.GetCoordinateSystem("EPSG", 4326));
            Assert.IsTrue(ReferenceEquals(css.GetCoordinateSystem("EPSG", 4326), css.GetCoordinateSystem(4326)));
        }
        public void TestConstructorLoadCsv(string csvPath)
        {
            if (!string.IsNullOrWhiteSpace(csvPath))
            {
                if (!File.Exists(csvPath))
                {
                    throw new IgnoreException("Specified file not found");
                }
            }

            var css = new CoordinateSystemServices(new CoordinateSystemFactory(),
                                                   new CoordinateTransformationFactory(), LoadCsv(csvPath));

            Assert.IsNotNull(css.GetCoordinateSystem(4326));
            Assert.IsNotNull(css.GetCoordinateSystem("EPSG", 4326));
            Assert.IsTrue(ReferenceEquals(css.GetCoordinateSystem("EPSG", 4326), css.GetCoordinateSystem(4326)));
            Thread.Sleep(1000);
        }