• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SharpMap.Map类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MapSridEqualsFactorySrid

 public void MapSridEqualsFactorySrid()
 {
     var m = new Map();
     Assert.AreEqual(m.SRID, m.Factory.SRID);
     m.SRID = 10;
     Assert.AreEqual(m.SRID, m.Factory.SRID);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:MapTest.cs


示例2: Default

        internal static Map Default()
        {       
            string currdir = Directory.GetCurrentDirectory();
            Trace.WriteLine(String.Format("Current directory: {0}", currdir));

            Map map = new Map(new Size(1, 1));
            IDictionary<string, LayerData> dict = Nyc;
            foreach (string layer in dict.Keys)
            {
                string format = String.Format(@"WMS\Server\data\{0}", layer);                
                string path = Path.Combine(currdir, format);
                if (!File.Exists(path))
                    throw new FileNotFoundException("file not found", path);

                string name = Path.GetFileNameWithoutExtension(layer);
                LayerData data = dict[layer];
                ShapeFile source = new ShapeFile(path, true);
                VectorLayer item = new VectorLayer(name, source)
                {
                    SRID = 4326,
                    Style = (VectorStyle)data.Style,
                    SmoothingMode = Smoothing.AntiAlias
                };
                map.Layers.Add(item);
            }
            return map;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:27,代码来源:Helper.cs


示例3: CreateMap

    public static Map CreateMap()
    {
      const string getCapabilitiesURI = "http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?request=GetCapabilities&service=WFS&VERSION=1.0.0";

      Map demoMap = new SharpMap.Map(new Size(600, 600));
      demoMap.MinimumZoom = 0.005;
      demoMap.BackColor = Color.White;

      SharpMap.Layers.VectorLayer layer1 = new SharpMap.Layers.VectorLayer("prov_land");
      WFS prov1 = new WFS(getCapabilitiesURI, "", "prov_land", WFS.WFSVersionEnum.WFS1_1_0);
      layer1.Style.Fill = new SolidBrush(Color.IndianRed);    // States
      //// Options 
      // Defaults: MultiGeometries: true, QuickGeometries: false, GetFeatureGETRequest: false
      // Render with validation...
      prov1.QuickGeometries = false;
      // Important when connecting to an UMN MapServer
      //!!!prov1.GetFeatureGETRequest = true;
      // Ignore multi-geometries...
      prov1.MultiGeometries = false;
      layer1.DataSource = prov1;
      demoMap.Layers.Add(layer1);

      demoMap.ZoomToBox(new SharpMap.Geometries.BoundingBox(-3546709.473205, -869773.355764, 4444893.074820, 3923457.184829));

      return demoMap;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:26,代码来源:WfsMapServerSample.cs


示例4: InitializeMap

        public static Map InitializeMap(float angle)
        {
            string wmsUrl = "http://dev:8080/geoserver/ows?service=wms&version=1.1.1&request=GetCapabilities";

            Map map = new Map();

            WmsLayer layWms = new WmsLayer("Demis Map", wmsUrl);

            layWms.AddLayer("sf:roads");
            //layWms.AddLayer("Topography");
            //layWms.AddLayer("Hillshading");

            layWms.SetImageFormat(layWms.OutputFormats[0]);
            layWms.ContinueOnError = true;
                //Skip rendering the WMS Map if the server couldn't be requested (if set to false such an event would crash the app)
            layWms.TimeOut = 5000; //Set timeout to 5 seconds
            layWms.SRID = 4326;
            map.Layers.Add(layWms);

            //limit the zoom to 360 degrees width
            map.MaximumZoom = 360;
            map.BackColor = Color.LightBlue;

            map.Zoom = 360;
            map.Center = new Point(0, 0);

            Matrix mat = new Matrix();
            mat.RotateAt(angle, map.WorldToImage(map.Center));
            map.MapTransform = mat;

            map.ZoomToExtents();
            return map;
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:33,代码来源:WmsSample.cs


示例5: setup

 public void setup()
 {
     Desc = Helper.Description();
     Assert.That(Desc, Is.Not.Null);
     Map = Helper.Default();
     Assert.That(Map, Is.Not.Null);
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:7,代码来源:AbstractFixture.cs


示例6: Page_Load

	protected void Page_Load(object sender, EventArgs e)
	{
		//Set up the map. We use the method in the App_Code folder for initializing the map
		myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value,(int)imgMap.Height.Value));
		//Set a gradient theme on the countries layer, based on Population density
		SharpMap.Rendering.Thematics.CustomTheme iTheme = new SharpMap.Rendering.Thematics.CustomTheme(GetCountryStyle);
		SharpMap.Styles.VectorStyle defaultstyle = new SharpMap.Styles.VectorStyle();
		defaultstyle.Fill = Brushes.Gray;
		iTheme.DefaultStyle = defaultstyle;
		(myMap.Layers[0] as SharpMap.Layers.VectorLayer).Theme = iTheme;
		//Turn off the river layer and label-layers
		myMap.Layers[1].Enabled = false;
		myMap.Layers[3].Enabled = false;
		myMap.Layers[4].Enabled = false;
		
		if (Page.IsPostBack) 
		{
			//Page is post back. Restore center and zoom-values from viewstate
			myMap.Center = (ICoordinate)ViewState["mapCenter"];
			myMap.Zoom = (double)ViewState["mapZoom"];
		}
		else
		{
			//This is the initial view of the map. Zoom to the extents of the map:
			//myMap.ZoomToExtents();
            myMap.Center = GeometryFactory.CreateCoordinate(0, 0);
			myMap.Zoom = 360;
			//Create the map
			GenerateMap();
		}
	}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:31,代码来源:Bins.aspx.cs


示例7: InitializeMap

    public static Map InitializeMap()
    {
      string wmsUrl = "http://www2.demis.nl/mapserver/request.asp";
            
      SharpMap.Map map = new SharpMap.Map();

      SharpMap.Layers.WmsLayer layWms = new SharpMap.Layers.WmsLayer("Demis Map", wmsUrl);
      layWms.SpatialReferenceSystem = "EPSG:4326";

      layWms.AddLayer("Bathymetry");
      layWms.AddLayer("Topography");
      layWms.AddLayer("Hillshading");
      
      layWms.SetImageFormat(layWms.OutputFormats[0]);
      layWms.ContinueOnError = true; //Skip rendering the WMS Map if the server couldn't be requested (if set to false such an event would crash the app)
      layWms.TimeOut = 5000; //Set timeout to 5 seconds
      layWms.SRID = 4326;
      map.Layers.Add(layWms);
      
      //limit the zoom to 360 degrees width
      map.MaximumZoom = 360;
      map.BackColor = Color.LightBlue;

      map.Zoom = 360;
      map.Center = new SharpMap.Geometries.Point(0, 0);

      return map;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:WmsSample.cs


示例8: InitializeMap

        public static Map InitializeMap()
        {
            Map map = new Map();

            //string url = "http://labs.metacarta.com/wms-c/tilecache.py?version=1.1.1&amp;request=GetCapabilities&amp;service=wms-c";
            string url = "http://dev:8080/geoserver/gwc/service/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=getcapabilities&TILED=true";
            //string url = "http://dev:8080/geoserver/ows?service=wms&version=1.3.0&request=GetCapabilities&tiled=true";
            //TiledWmsLayer tiledWmsLayer = new TiledWmsLayer("Metacarta", url);
            //tiledWmsLayer.TileSetsActive.Add(tiledWmsLayer.TileSets["avalon"].Name);
            //map.Layers.Add(tiledWmsLayer);
            //map.ZoomToBox(new BoundingBox(-180.0, -90.0, 180.0, 90.0));

            //WmscRequest req;
            //ITileSource tileSource;
            TileAsyncLayer tileLayer;
            //BruTile.Web.TmsTileSource source2 = new TmsTileSource(url);

            var source = new List<ITileSource>(WmscTileSource.CreateFromWmscCapabilties(new System.Uri(url)));

            //            foreach (ITileSource src in source)
            //            {
                tileLayer = new TileAsyncLayer(source[16], "tileLayer" + source[16]);
                tileLayer.MapNewTileAvaliable += map.MapNewTileAvaliableHandler;
                map.BackgroundLayer.Add(tileLayer);
            //            }
            map.ZoomToExtents();

            return map;
        }
开发者ID:junglewithyou,项目名称:SharpMap,代码行数:29,代码来源:TiledWmsSample.cs


示例9: InitializeMap

    public static Map InitializeMap()
    {
      const string getCapabilitiesURI = "http://steven:8080/eWaterWfsConnector/wfs";

      Map map = new SharpMap.Map(new System.Drawing.Size(600, 600));
      map.MinimumZoom = 0.005;
      map.BackColor = System.Drawing.Color.White;

      SharpMap.Layers.VectorLayer layer1 = new SharpMap.Layers.VectorLayer("test");
      
      WFS prov1 = new WFS(getCapabilitiesURI, "", "Well", WFS.WFSVersionEnum.WFS1_0_0);

      prov1.QuickGeometries = false;
      // Important when connecting to an UMN MapServer
      prov1.GetFeatureGETRequest = true;
      // Ignore multi-geometries...
      prov1.MultiGeometries = false;

      layer1.DataSource = prov1;
      map.Layers.Add(layer1);

      map.ZoomToBox(new SharpMap.Geometries.BoundingBox(574290, 4275299, 702273, 4386402));

      return map;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:WfsGeusSample.cs


示例10: OnRenderInternal

 protected override void OnRenderInternal(Map map, IPolygon polygon, IGraphics g)
 {
     IPoint pt = polygon.Centroid;
     Point renderingOrigin = Point.Truncate(Transform.WorldtoMap(pt.Coordinate, map));
     g.RenderingOrigin = new PointStruct(renderingOrigin.X, renderingOrigin.Y);
     base.OnRenderInternal(map, polygon, g);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:PolygonSymbolizerTest.cs


示例11: MagnifierTool

        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        public MagnifierTool(MapBox parentMapBox) 
            : base("Magnifier", "A tool to magnify the portion of the map below the cursor")
        {
            _parentMapBox = parentMapBox;
            _parentMapBox.MapChanged += HandleMapChanged;
            Map = _parentMapBox.Map;

            MagnificationFactor = 1.10;

            Offset = new Size(5,5);

            _magnified = new PictureBox();
            _magnified.Size = new Size(75, 75);
            _magnified.BorderStyle = BorderStyle.FixedSingle;
            _magnified.Visible = false;

            _parentMapBox.Controls.Add(_magnified);

            Map = _parentMapBox.Map;
            _map = Map.Clone();
            _map.Size = _magnified.Size;
            _map.Zoom = _map.Size.Width*(Map.Envelope.Width/Map.Size.Width) / _magnification;
            _map.Center = _map.Center;
            _magnified.Image = _map.GetMap();

            Enabled = true;

            var ms = Assembly.GetExecutingAssembly().GetManifestResourceStream("WinFormSamples.Magnifier.cur");
            if (ms != null)
                Cursor = new Cursor(ms);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:34,代码来源:MagnifierTool.cs


示例12: InitializeGoogleMap

    public static SharpMap.Map InitializeGoogleMap(GoogleMapType mt)
    {
        SharpMap.Map map = new SharpMap.Map();

        GoogleRequest req;
        ITileSource tileSource;
        TileAsyncLayer tileLayer;

        if (mt == (GoogleMapType.GoogleSatellite | GoogleMapType.GoogleLabels))
        {
            req = new GoogleRequest(GoogleMapType.GoogleSatellite);
            tileSource = new GoogleTileSource(req);
            tileLayer = new TileAsyncLayer(tileSource, "TileLayer - " + GoogleMapType.GoogleSatellite);
            map.Layers.Add(tileLayer);
            req = new GoogleRequest(GoogleMapType.GoogleLabels);
            tileSource = new GoogleTileSource(req);
            mt = GoogleMapType.GoogleLabels;
        }
        else
        {
            req = new GoogleRequest(mt);
            tileSource = new GoogleTileSource(req);
        }

        tileLayer = new TileAsyncLayer(tileSource, "TileLayer - " + mt);
        map.BackgroundLayer.Add(tileLayer);
        map.ZoomToBox(tileLayer.Envelope);
        return map;
    }
开发者ID:vz0,项目名称:custom-gis-server,代码行数:29,代码来源:MapHelper.cs


示例13: InitializeDXF

        private static Map InitializeDXF(float angle)
        {
            Map map = new Map();
            //Set the datasource to a shapefile in the App_data folder
            Ogr provider;
            try
            {
                provider = new Ogr("GeoData/SampleDXF.dxf",0);
            }
            catch (TypeInitializationException ex)
            {
                if (ex.Message == "The type initializer for 'OSGeo.OGR.Ogr' threw an exception.")
                {
                    throw new Exception(
                        String.Format(
                            "The application threw a PINVOKE exception. You probably need to copy the unmanaged dll's to your bin directory. They are a part of fwtools {0}. You can download it from: http://home.gdal.org/fwtools/",
                            GdalRasterLayer.FWToolsVersion));
                }
                throw;
            }
            VectorLayer lay = new VectorLayer("SampleDXF", provider);
            map.Layers.Add(lay);
            map.ZoomToExtents();
            Matrix mat = new Matrix();
            mat.RotateAt(angle, map.WorldToImage(map.Center));
            map.MapTransform = mat;

            _ogrSampleDataset = "SampleDXF";
            return map;

        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:31,代码来源:OgrSample.cs


示例14: CreateMap

    public static Map CreateMap()
    {
      const string getCapabilitiesURI = "http://192.168.25.120:8080/deegree-wfs/services";

      Map map = new SharpMap.Map(new Size(600, 600));
      map.MinimumZoom = 0.005;
      map.BackColor = Color.White;

      SharpMap.Layers.VectorLayer layer1 = new SharpMap.Layers.VectorLayer("Springs");

      WFS prov1 = new WFS(getCapabilitiesURI, "app1", "Springs", WFS.WFSVersionEnum.WFS1_1_0);

      prov1.QuickGeometries = false;
      // Important when connecting to an UMN MapServer
      prov1.GetFeatureGETRequest = true;
      // Ignore multi-geometries...
      prov1.MultiGeometries = false;

      layer1.DataSource = prov1;
      map.Layers.Add(layer1);

      map.ZoomToBox(new SharpMap.Geometries.BoundingBox(574290, 4275299, 702273, 4386402));
      
      return map;
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:WfsDeegreeSample.cs


示例15: 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


示例16: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //Set up the map. We use the method in the App_Code folder for initializing the map and alter it afterwards
        myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value, (int)imgMap.Height.Value));
        //Remove the river layer and label-layers
        myMap.Layers.RemoveAt(4);
        myMap.Layers.RemoveAt(3);
        myMap.Layers.RemoveAt(1);

        //Create Pie Layer
        SharpMap.Layers.VectorLayer pieLayer = new SharpMap.Layers.VectorLayer("Pie charts");
        pieLayer.DataSource = (myMap.Layers[0] as SharpMap.Layers.VectorLayer).DataSource;
        CustomTheme<IVectorStyle> iTheme = new CustomTheme<IVectorStyle>(GetCountryStyle);
        pieLayer.Theme = iTheme;
        myMap.Layers.Add(pieLayer);

        if (Page.IsPostBack)
        {
            //Page is post back. Restore center and zoom-values from viewstate
            myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
            myMap.Zoom = (double)ViewState["mapZoom"];
        }
        else
        {
            //This is the initial view of the map. Zoom to the extents of the map:
            //myMap.ZoomToExtents();
            myMap.Center = new SharpMap.Geometries.Point(10, 50);
            myMap.Zoom = 60;
            //Create the map
            GenerateMap();
        }
    }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:PieCharts.aspx.cs


示例17: HandleMapChanged

 private void HandleMapChanged(object sender, EventArgs e)
 {
     _map = Map.Clone();
     _map.Size = _magnified.Size;
     _map.Zoom = _map.Size.Width * (Map.Envelope.Width / Map.Size.Width) / _magnification;
     _map.Center = _map.Center;
     //_magnified.Image = _map.GetMap();
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:8,代码来源:MagnifierTool.cs


示例18: OnRender

 protected override void OnRender(IGraphics g, Map map)
 {
     Brush brush = new SolidBrush(OpacityColor(Color.Red));
     RectangleF rect = g.Clip;
     g.FillRectangle(brush, 
         (int) rect.X, (int) rect.Y, 
         (int) rect.Width, (int) rect.Height);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:8,代码来源:MapDecorationTest.cs


示例19: 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


示例20: MapBox

 /// <summary>
 /// Initializes a new mapControl
 /// </summary>
 public MapBox()
 {
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
     DoubleBuffered = true;
     _Map = new SharpMap.Map(ClientSize);
     m_ActiveTool = Tools.None;
     LostFocus += new EventHandler(MapBox_LostFocus);
     _legend = new MapLegend(this);
 }
开发者ID:kehh,项目名称:biolink,代码行数:12,代码来源:MapBox.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WellKnownText.WktStreamTokenizer类代码示例发布时间:2022-05-26
下一篇:
C# LuaTypes.LuaTable类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap