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


C# Map.GetExtents方法代码示例

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


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

示例1: TestMaps

        private static void TestMaps(string name, Map m, Map mD)
        {
            Assert.NotNull(mD);

            Assert.AreEqual(m.Size, mD.Size);
            Assert.AreEqual(m.Layers.Count, mD.Layers.Count);
            var c = new LayerTest.VectorLayerEqualityComparer();
            for (var i = 0; i < m.Layers.Count; i++)
            {
                Assert.IsTrue(c.Equals((VectorLayer)m.Layers[i], 
                                       (VectorLayer)mD.Layers[i]), 
                                       "Layer {0}, '{1}' Differs at {2}",
                                       i, m.Layers[i].LayerName, string.Join(", ", c.DifferAt));
            }

            Assert.AreEqual(m.PixelAspectRatio, mD.PixelAspectRatio);
            Assert.AreEqual(m.PixelHeight, mD.PixelHeight);
            Assert.AreEqual(m.PixelWidth, mD.PixelWidth);
            Assert.AreEqual(m.PixelSize, mD.PixelSize);

            Assert.AreEqual(m.BackColor, mD.BackColor);
            Assert.IsTrue(m.Center.Equals(mD.Center));
            Assert.IsTrue(m.GetExtents().Equals(mD.GetExtents()));
            Assert.IsTrue(m.Envelope.Equals(mD.Envelope));

            Assert.AreEqual(m.Decorations.Count, mD.Decorations.Count);
            Assert.AreEqual(m.SRID, mD.SRID);
            Assert.AreEqual(m.Zoom, mD.Zoom);

            Assert.DoesNotThrow(() => m.GetMap().Save(name + "-S.bmp"));
            Assert.DoesNotThrow(() => mD.GetMap().Save(name + "-D.bmp"));
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:MapTest.cs

示例2: GetExtents_ValidDatasource

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

示例3: InitializeMap


//.........这里部分代码省略.........
            var promLayer = new VectorLayer("Proms");
            promLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(@"~\App_Data\maps_lviv_new\LLVPROM.shp"), true);
            promLayer.Style.Outline = new Pen(colorLineDict["Proms"]);
            promLayer.Style.Fill = new SolidBrush(colorFill["Proms"]);
            promLayer.Style.EnableOutline = true;
            map.Layers.Add(promLayer);

            VectorLayer fuelStationLayer = new VectorLayer("FuelStations");
            fuelStationLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\FuelStationsLayers\LvivCityCorr\fuel_stations_lviv.shp"),
                true);
            fuelStationLayer.Style.Outline = new Pen(colorLineDict["FuelStations"]);
            fuelStationLayer.Style.Fill = new SolidBrush(colorFill["FuelStations"]);
            fuelStationLayer.Style.EnableOutline = true;
            //fuelStationLayer.Style.PointColor = Brushes.AliceBlue;
            SharpMap.Rendering.Thematics.CustomTheme myTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetFullStationStyle);
            fuelStationLayer.Theme = myTheme;
            map.Layers.Add(fuelStationLayer);

            //var tmp6 = new VectorLayer("Lviv"){DataSource = new ShapeFile(HttpContext.Current.Server.MapPath(@"~\App_Data\maps_lviv_new\LROAD12.shp"), true)};
            //tmp6.Style.Outline = waPen6;
            //tmp6.Style.Fill = new SolidBrush(Color.FromArgb(255, 234, 234, 234));
            //tmp6.Style.EnableOutline = true;
            //map.Layers.Add(tmp6);
        }
        else
        {
            var lvivRegioonLayer = new VectorLayer("Region");
            lvivRegioonLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\lv_line.shp"), true);
            lvivRegioonLayer.Style.Outline = blackPen2;
            lvivRegioonLayer.Style.Fill = new SolidBrush(Color.FromArgb(255, 234, 234, 234));
            lvivRegioonLayer.Style.EnableOutline = true;
            map.Layers.Add(lvivRegioonLayer);

            var territoryLayer = new VectorLayer("Regions");
            territoryLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\terrytor.shp"), true);
            territoryLayer.Style.Outline = darkGrayPenTransp;
            territoryLayer.Style.Fill = new SolidBrush(lightGoldenrodYellowPen.Color);
            territoryLayer.Style.EnableOutline = true;
            map.Layers.Add(territoryLayer);

            var lakesLayer = new VectorLayer("Lakes");
            lakesLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\vodoimy.shp"), true);
            lakesLayer.Style.Outline = blackPen;
            lakesLayer.Style.Fill = new SolidBrush(bluePen.Color);
            lakesLayer.Style.EnableOutline = true;
            map.Layers.Add(lakesLayer);

            var punkLayer = new VectorLayer("Punks");
            punkLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\nas_punk.shp"), true);
            punkLayer.Style.Outline = blackPen;
            punkLayer.Style.Fill = new SolidBrush(darkGrayPen.Color);
            punkLayer.Style.EnableOutline = true;
            map.Layers.Add(punkLayer);

            var railsLayer = new VectorLayer("Rails");
            railsLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\zal_kol.shp"), true);
            //map.Layers.Add(railsLayer);

            var fuelStationLayer = new VectorLayer("FuelStations");
            fuelStationLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\FuelStationsLayers\LvivObl\fuel_stations.shp"),
                true);
            fuelStationLayer.Style.PointColor = Brushes.AliceBlue;
            map.Layers.Add(fuelStationLayer);

            var roadsLayer = new VectorLayer("Roads");
            roadsLayer.Style.Outline = blackPen;
            roadsLayer.DataSource = new ShapeFile(
                HttpContext.Current.Server.MapPath(
                    @"~\App_Data\Lviv_Region_Romik\meregi.shp"), true);
            map.Layers.Add(roadsLayer);

        }

        GeoAPI.Geometries.Envelope mapExtents = map.GetExtents();
        //SharpMap.Geometries.BoundingBox mapExtents = map.GetExtents();
        map.Zoom = mapExtents.Width;
        map.MaximumZoom = mapExtents.Width;
        map.MinimumZoom = 2000;
        map.Center = mapExtents.Centre;
        map.BackColor = Color.White;
        map.ZoomToExtents();

        HttpContext.Current.Trace.Write("Map initialized");
        return map;
    }
开发者ID:vz0,项目名称:custom-gis-server,代码行数:101,代码来源:MapHelper.cs


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