Beispiel #1
0
 private static void FromEnumeration(CoordinateSystemServices css,
                                     IEnumerable <KeyValuePair <int, ICoordinateSystem> > enumeration)
 {
     foreach (var sridCs in enumeration)
     {
         css.AddCoordinateSystem(sridCs.Key, sridCs.Value);
     }
 }
Beispiel #2
0
    static MapHelper()
    {
        var gss = GeoAPI.GeometryServiceProvider.Instance;
        var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
            new ProjNet.CoordinateSystems.CoordinateSystemFactory(System.Text.Encoding.ASCII),
            new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
            SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

        GeoAPI.GeometryServiceProvider.Instance = gss;
        SharpMap.Session.Instance
        .SetGeometryServices(gss)
        .SetCoordinateSystemServices(css)
        .SetCoordinateSystemRepository(css);
    }
Beispiel #3
0
        public frmGeoMap()
        {
            InitializeComponent();

            var gss = GeoAPI.GeometryServiceProvider.Instance;
            var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
                new ProjNet.CoordinateSystems.CoordinateSystemFactory(),
                new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory(),
                SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

            GeoAPI.GeometryServiceProvider.Instance = gss;
            SharpMap.Session.Instance
            .SetGeometryServices(gss)
            .SetCoordinateSystemServices(css)
            .SetCoordinateSystemRepository(css);
        }
        /// <summary>
        /// Creates a CoordinateSystemServices built with all the values coming from the SpatialRefSys.xml
        /// </summary>
        /// <param name="coordinateSystemFactory">A coordinate system factory</param>
        /// <param name="coordinateTransformationFactory">A coordinate transformation factory</param>
        /// <returns>A coordinate system services instance.</returns>
        /// <exception cref="ArgumentNullException">Thrown, if either <paramref name="coordinateSystemFactory"/> or <paramref name="coordinateTransformationFactory"/> is null.</exception>
        public static ICoordinateSystemServices FromSpatialRefSys(ICoordinateSystemFactory coordinateSystemFactory, ICoordinateTransformationFactory coordinateTransformationFactory)
        {
            if (coordinateSystemFactory == null)
            {
                throw new ArgumentNullException("coordinateSystemFactory");
            }

            if (coordinateTransformationFactory == null)
            {
                throw new ArgumentNullException("coordinateTransformationFactory");
            }

            var css = new CoordinateSystemServices(coordinateSystemFactory, coordinateTransformationFactory);

            css.AddCoordinateSystems(SpatialReference.GetAllReferenceSystems());

            return(css);
        }
Beispiel #5
0
        private static void Main()
        {
            var gss = new NtsGeometryServices();
            var css = new SharpMap.CoordinateSystems.CoordinateSystemServices(
                new CoordinateSystemFactory(Encoding.ASCII),
                new CoordinateTransformationFactory(),
                SharpMap.Converters.WellKnownText.SpatialReference.GetAllReferenceSystems());

            GeoAPI.GeometryServiceProvider.Instance = gss;
            SharpMap.Session.Instance
            .SetGeometryServices(gss)
            .SetCoordinateSystemServices(css)
            .SetCoordinateSystemRepository(css);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new DlgSamplesMenu());
        }
Beispiel #6
0
 private static void FromEnumeration(CoordinateSystemServices css,
                                     IEnumerable <KeyValuePair <int, string> > enumeration)
 {
     FromEnumeration(css, CreateCoordinateSystems(css._coordinateSystemFactory, enumeration));
 }
Beispiel #7
0
 /// <summary>
 /// Method to set the coordinate system services class
 /// </summary>
 /// <param name="coordinateSystemServices">The coordinate system services class</param>
 /// <returns>A reference to this session</returns>
 public ISession SetCoordinateSystemServices(CoordinateSystems.CoordinateSystemServices coordinateSystemServices)
 {
     CoordinateSystemServices = coordinateSystemServices;
     return(this);
 }