当前位置: 首页>>代码示例>>C#>>正文


C# SharpMap.Map.GetExtents方法代码示例

本文整理汇总了C#中SharpMap.Map.GetExtents方法的典型用法代码示例。如果您正苦于以下问题:C# SharpMap.Map.GetExtents方法的具体用法?C# SharpMap.Map.GetExtents怎么用?C# SharpMap.Map.GetExtents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharpMap.Map的用法示例。


在下文中一共展示了SharpMap.Map.GetExtents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeMap

        public static SharpMap.Map InitializeMap(float angle)
        {
            using (var ofn = new System.Windows.Forms.OpenFileDialog())
            {
                ofn.Filter = "All files|*.*";
                ofn.FilterIndex = 0;

                if (ofn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var m = new SharpMap.Map();
                    var l = new SharpMap.Layers.GdiImageLayer(ofn.FileName);
                    m.Layers.Add(l);

                    m.ZoomToExtents();

                    var mat = new System.Drawing.Drawing2D.Matrix();
                    mat.RotateAt(angle, m.WorldToImage(m.Center));
                    m.MapTransform = mat;
                    m.MaximumExtents = m.GetExtents();
                    m.EnforceMaximumExtents = true;
                    return m;
                }
            }
            return null;

        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:26,代码来源:GdiImageLayerSample.cs

示例2: TestRealData

        public void TestRealData()
        {
            var fdt = GetRealFeatureDataTable();
            FillRealDataTable(fdt);

            var p = new SharpMap.Data.Providers.FeatureProvider(fdt);


            var m = new SharpMap.Map(new Size(640, 640));
            m.Layers.Add(new TileLayer(
                new OsmTileSource(new OsmRequest(KnownTileServers.Mapnik) /*, 
                                  new FileCache(@"d:\temp\OSM", "png")*/), "OSM"));

            var l = new HeatLayer(p, "Data", 0.001f);
            l.LayerName = "HEAT";
            m.Layers.Add(l);
#if DotSpatialProjections
            l.CoordinateTransformation = new DotSpatial.Projections.CoordinateTransformation
            {
                Source = ProjectionInfo.FromEpsgCode(4326), 
                Target = ProjectionInfo.FromEpsgCode(3857)
            };
#else
            var ctfac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            l.CoordinateTransformation =
                ctfac.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84,
                                                  ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
#endif
            l.ZoomMin = 0;// 0.01 * m.GetExtents().Width;
            l.ZoomMax = /*0.9 * */m.GetExtents().Width;
            l.OpacityMax = 1;
            l.OpacityMin = 0.3f;

            m.ZoomToBox(l.Envelope);
            for (var i = 0; i < 5; i++)
            {
                using (var img = m.GetMap())
                {
                    img.Save("RealDataHeat" + i + ".png");
                }
                m.Zoom /= 2;
            }
            m.ZoomToExtents();
            using (var img = m.GetMap())
            {
                img.Save("RealDataHeat.png");
            }

        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:49,代码来源:HeatLayerExample.cs

示例3: InitializeMap

        public static SharpMap.Map InitializeMap(float angle)
        {
            var fdt = GetRealFeatureDataTable();
            FillRealDataTable(fdt);

            var p = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);


            var m = new SharpMap.Map();
            m.BackgroundLayer.Add(new SharpMap.Layers.TileAsyncLayer(
                new BruTile.Web.OsmTileSource(
                                  new BruTile.Web.OsmRequest(KnownTileSource.OpenStreetMap),
                                  new BruTile.Cache.FileCache(@"d:\temp\OSM", "png")), "OSM"));
            m.BackgroundLayer[0].LayerName = "TileLayer with HeatLayer";

            //var l = new SharpMap.Layers.HeatLayer(p, r => 0.02f) { LayerName = "HEAT" };
            var l = new SharpMap.Layers.HeatLayer(p, "Data", 0.00025f) { LayerName = "HEAT" };
            m.Layers.Add(l);

#if DotSpatialProjections
            l.CoordinateTransformation = new DotSpatial.Projections.CoordinateTransformation
            {
                Source = DotSpatial.Projections.ProjectionInfo.FromEpsgCode(4326),
                Target = DotSpatial.Projections.ProjectionInfo.FromEpsgCode(3857)
            };
#else
            var ctfac = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            l.CoordinateTransformation =
                ctfac.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84,
                                                  ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
#endif

            l.ZoomMin = 0;// 0.01 * m.GetExtents().Width;
            l.ZoomMax = /*0.9 * */m.GetExtents().Width;
            l.OpacityMax = 0.5f;
            l.OpacityMin = 0.9f;

            l.HeatColorBlend = SharpMap.Layers.HeatLayer.Classic;

            var env = l.Envelope;
            GeoAPI.Geometries.GeoAPIEx.Grow(env, env.Width * 0.05, env.Height * 0.05);
            //m.EnforceMaximumExtents = true;
            //m.MaximumExtents = env;
            m.ZoomToBox(env);

            return m;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:47,代码来源:HeatLayerSample.cs

示例4: GetExtents_ValidDatasource

		public void GetExtents_ValidDatasource()
		{
			SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(400, 200));
			SharpMap.Layers.VectorLayer vLayer = new SharpMap.Layers.VectorLayer("Geom layer", CreateDatasource());
			map.Layers.Add(vLayer);
			SharpMap.Geometries.BoundingBox box = map.GetExtents();
			Assert.AreEqual(new SharpMap.Geometries.BoundingBox(0, 0, 50, 346.3493254), box);
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:8,代码来源:MapTest.cs


注:本文中的SharpMap.Map.GetExtents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。