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


C# Map.ZoomToFit方法代码示例

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


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

示例1: HasDefaultEnvelopeSet

        public void HasDefaultEnvelopeSet()
        {
            var map = new Map();
            Assert.IsTrue(map.HasDefaultEnvelopeSet);

            map.ZoomToFit(new Envelope(0,50,0,50), false);
            Assert.IsFalse(map.HasDefaultEnvelopeSet);

            map.ZoomToFit(new Envelope(-500, 500, -500, 500), false);
            Assert.IsTrue(map.HasDefaultEnvelopeSet);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:MapTest.cs

示例2: ChangingEnvelopeAfterMapControlIsShownWorksCorrectly

        public void ChangingEnvelopeAfterMapControlIsShownWorksCorrectly()
        {
            var layer = new VectorLayer { DataSource = new DataTableFeatureProvider("POINT(1 1)") };
            var map = new Map { Layers = { layer } };

            var mapControl = new MapControl { Map = map, AllowDrop = false };

            var viewEnvelope = new Envelope(10000, 10010, 10000, 10010);

            WindowsFormsTestHelper.Show(mapControl,
                delegate
                    {
                        map.ZoomToFit(viewEnvelope);
                    });

            for (var i = 0; i < 10; i++)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }

            Assert.IsTrue(map.Envelope.Contains(viewEnvelope));

            WindowsFormsTestHelper.CloseAll();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:MapControlTest.cs

示例3: ZoomToBoxSetsMapHeight

        public void ZoomToBoxSetsMapHeight()
        {
            var map = new Map(new Size(400, 200));
            IEnvelope envelope = GeometryFactory.CreateEnvelope(20, 50, 100, 80);

            //action! zoom to box with margin
            map.ZoomToFit(envelope, false);

            //see the heigth has a 10% extra!
            Assert.AreEqual(20, map.Envelope.Height);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:MapTest.cs

示例4: ZoomToBoxWithMarginDoesNotMessUpGivenEnvelope

 public void ZoomToBoxWithMarginDoesNotMessUpGivenEnvelope()
 {
     var map = new Map(new Size(400, 200));
     IEnvelope envelope = GeometryFactory.CreateEnvelope(20, 50, 100, 80);
     
     //action! zoom to box with margin
     map.ZoomToFit(envelope,true);
     Assert.AreEqual(20,envelope.MinX);
     Assert.AreEqual(50,envelope.MaxX);
     Assert.AreEqual(80,envelope.MinY); 
     Assert.AreEqual(100,envelope.MaxY);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:MapTest.cs

示例5: ZoomToBox_WithAspectCorrection

 public void ZoomToBox_WithAspectCorrection()
 {
     var map = new Map(new Size(400, 200));
     map.ZoomToFit(GeometryFactory.CreateEnvelope(10, 20, 100, 180));
     Assert.AreEqual(GeometryFactory.CreateCoordinate(15, 140), map.Center);
     Assert.AreEqual(160d, map.Zoom);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:MapTest.cs

示例6: ZoomToBox_NoAspectCorrection

 public void ZoomToBox_NoAspectCorrection()
 {
     var map = new Map(new Size(400, 200));
     map.ZoomToFit(GeometryFactory.CreateEnvelope(20, 50, 100, 80));
     Assert.AreEqual(GeometryFactory.CreateCoordinate(35, 90), map.Center);
     Assert.AreEqual(40d, map.Zoom);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:MapTest.cs

示例7: NoExceptionShouldBeThrownWhenZoomLevelIsTooLarge

        public void NoExceptionShouldBeThrownWhenZoomLevelIsTooLarge()
        {
            var featureProvider = new DataTableFeatureProvider();
            featureProvider.Add(new WKTReader().Read("LINESTRING(0 0,80000000 0)"));
            featureProvider.Add(new WKTReader().Read("POINT(50000000 0)"));
            var layer = new VectorLayer { DataSource = featureProvider };
            var map = new Map { Layers = { layer }, Size = new Size(1000, 1000) };
            map.Render();
            map.ZoomToFit(new Envelope(50000000, 50000001, 0, 1));

            map.Render();
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:VectorLayerTest.cs


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