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

C# SharpMap.Map类代码示例

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

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



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

示例1: InitializeMap

        public static SharpMap.Map InitializeMap(float angle)
        {
            var dataSource = new SharpMap.Data.Providers.ShapeFile(
                string.Format("{0}/roads.shp", ShapefileSample.PathOsm), true);
            
            var fds = new SharpMap.Data.FeatureDataSet();
            dataSource.Open();
            dataSource.ExecuteIntersectionQuery(dataSource.GetExtents(), fds);
            dataSource.Close();

            var gfp = new SharpMap.Data.Providers.GeometryFeatureProvider(fds.Tables[0]);
            var vl = new SharpMap.Layers.VectorLayer("roads", gfp)
                         {
                             CoordinateTransformation = LayerTools.Dhdn2ToWgs84
                         };
            var ll = new SharpMap.Layers.LabelLayer("labels")
                         {
                             DataSource = gfp,
                             CoordinateTransformation = LayerTools.Dhdn2ToWgs84,
                             LabelColumn = "name",
                             MultipartGeometryBehaviour =
                                 SharpMap.Layers.LabelLayer.MultipartGeometryBehaviourEnum.Largest,
                         };
            ll.Style.Halo = new System.Drawing.Pen(System.Drawing.Color.Red);
            //ll.Style.IgnoreLength = true;

            var map = new SharpMap.Map();
            map.Layers.Add(vl);
            map.Layers.Add(ll);

            map.Layers.Add(vl);
            map.ZoomToExtents();
            return map;
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:34,代码来源:GeometryFeatureProviderSample.cs


示例2: render2d

        public void render2d(Project project, PictureBox picBox)
        {

            SharpMap.Map myMap = new SharpMap.Map();

            foreach (BuildLayer layer in project.getLayers())
            {
                Source source = layer.getSource();

                BoundingBox envelope = new BoundingBox(-1000.0, -1000.0, 1000.0, 1000.0);//TODO
                FeatureDataSet ds = new FeatureDataSet();
                source.DataSource.Open();
                source.DataSource.ExecuteIntersectionQuery(envelope, ds);
                source.DataSource.Close();

                FeatureDataTable features = (FeatureDataTable)ds.Tables[0];

                string label = "Trace test:\n";

                foreach (FeatureDataRow row in features)
                {
                    foreach (Object item in row.ItemArray)
                        label += " - " + item;
                    label += "\n";
                }

                setLabel(label);

                //Show map

                //Filters
                FilterGraph graph = project.getFilterGraph(source.getName());
                if (graph != null)
                {
                    foreach (FeatureFilter filter in graph.getFilters())
                    {
                        //aplicar filtro segun el tipo
                        Mogre.DefaultSceneManagerFactory dsmf = new DefaultSceneManagerFactory();
                        Mogre.SceneManager sm = dsmf.CreateInstance("scenemanager");
                        FilterEnv env = new FilterEnv(sm, "env");
                        foreach (MogreGis.Resource resource in project.getResources())
                        {
                            env.getSession().Resources.addResource(resource);
                        }
                        FeatureList list = Feature.DataTableToList(features);
                        filter.process(list, env);
                        //falta devolver la lista y procesarla ***************************************
                    }
                }

                SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer(layer.getName());
                myLayer.DataSource = source.DataSource;
                myMap.Layers.Add(myLayer);
            }

            myMap.Size = new Size(picBox.Width, picBox.Height);
            myMap.ZoomToExtents();
            picBox.Image = myMap.GetMap();
            this.map = myMap;
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:60,代码来源:RenderProject.cs


示例3: TestCharacterPointSymbolizer

        public void TestCharacterPointSymbolizer()
        {
            var fdt = TestData.CreatingData.CreatePointFeatureDataTableFromArrays(
                TestData.CreatingData.GetRandomOrdinates(50, -180, 180), TestData.CreatingData.GetRandomOrdinates(50, -90, 90), null);
            var geometryFeatureProvider = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);
            var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
            var cps  = new SharpMap.Rendering.Symbolizer.CharacterPointSymbolizer
                                              {
                                                  Halo = 1,
                                                  HaloBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Wheat),
                                                  //Font = new System.Drawing.Font("Arial", 12),
                                                  CharacterIndex = 0xcc,
                                              };
            layer.Style.PointSymbolizer = cps;
            var map = new SharpMap.Map(new System.Drawing.Size(720, 360));

            map.Layers.Add(layer);
            map.ZoomToExtents();
            map.GetMap().Save("CharacterPointSymbolizer1.bmp");

            cps.Rotation = -30;
            cps.Offset = new System.Drawing.PointF(4, 4);
            map.GetMap().Save("CharacterPointSymbolizer2.bmp");

            cps.Font = new System.Drawing.Font("Arial", 12);
            cps.Text = "ABC";
            cps.Offset = System.Drawing.PointF.Empty;
            cps.Rotation = -90;
            map.GetMap().Save("CharacterPointSymbolizer3.bmp");
        }
开发者ID:junglewithyou,项目名称:SharpMap,代码行数:30,代码来源:PointSymbolizerTest.cs


示例4: TestListPointSymbolizer

        public void TestListPointSymbolizer()
        {
            var fdt = TestData.CreatingData.CreatePointFeatureDataTableFromArrays(
                TestData.CreatingData.GetRandomOrdinates(50, -180, 180), TestData.CreatingData.GetRandomOrdinates(50, -90, 90), null);
            var geometryFeatureProvider = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt);
            var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
            var pps =
                SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateSquare(new System.Drawing.Pen(System.Drawing.Color.Red, 2),
                                                                    new System.Drawing.SolidBrush(
                                                                        System.Drawing.Color.DodgerBlue), 20);

            var cps = new SharpMap.Rendering.Symbolizer.CharacterPointSymbolizer
            {
                Halo = 1,
                HaloBrush = new System.Drawing.SolidBrush(System.Drawing.Color.WhiteSmoke),
                Foreground = new System.Drawing.SolidBrush(System.Drawing.Color.Black),
                Font = new System.Drawing.Font("Arial", 12),
                CharacterIndex = 65
            };

            var lps = new SharpMap.Rendering.Symbolizer.ListPointSymbolizer { pps, cps };

            layer.Style.PointSymbolizer = lps;
            var map = new SharpMap.Map(new System.Drawing.Size(720, 360));
            map.Layers.Add(layer);
            map.ZoomToExtents();
            map.GetMap().Save("ListPointSymbolizer1.bmp");
        }
开发者ID:junglewithyou,项目名称:SharpMap,代码行数:28,代码来源:PointSymbolizerTest.cs


示例5: Example2

        public static void Example2()
        {
            var map = new SharpMap.Map(new Size(1280, 1084));

            SharpMap.Data.Providers.IProvider provider =
                new SharpMap.Data.Providers.ShapeFile(
                    @"C:\temp\Data\niedersachsen.shp\railways.shp");

            var style = new SharpMap.Styles.VectorStyle();
            style.Line.Brush = Brushes.White;
            style.Line.DashPattern = new float[] { 4f, 4f };
            style.Line.Width = 4;
            style.EnableOutline = true;
            style.Outline.Brush = Brushes.Black;
            style.Outline.Width = 6;

            var vl = new SharpMap.Layers.VectorLayer("Railways", provider)
                         {Style = style};


            map.Layers.Add(vl);

            var env = vl.Envelope;
            env.ExpandBy(-0.45f *env.Width, -0.45 * env.Height);
            
            map.ZoomToBox(env);

            var mapImage = map.GetMap();
            mapImage.Save("Example2.png",
                System.Drawing.Imaging.ImageFormat.Png);
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:31,代码来源:Examples.cs


示例6: TestSymbolSelectionTheming

        public void TestSymbolSelectionTheming()
        {
            //Create a map
            SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(720, 360));

            //Create some random sample data
            SharpMap.Data.FeatureDataTable fdt =
                cd.CreatePointFeatureDataTableFromArrays(cd.GetRandomOrdinates(80, -180, 180),
                                                         cd.GetRandomOrdinates(80, -90, 90), null);

            //Add rotation column and fill with random rotation values
            fdt.Columns.Add("Symbol", typeof(System.Byte[]));
            foreach (SharpMap.Data.FeatureDataRow row in fdt.Rows)
                row["Symbol"] = RandomSymbol((int)System.Math.Floor(cd.RandomNumberGenerator.NextDouble() * 360d));

            //Create layer and datasource
            SharpMap.Layers.VectorLayer vl = new SharpMap.Layers.VectorLayer("Points", new SharpMap.Data.Providers.GeometryFeatureProvider(fdt));

            //Create default style
            SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle();
            defaultStyle.Symbol = new System.Drawing.Bitmap(@"..\..\..\DemoWinForm\Resources\flag.png");
            defaultStyle.SymbolScale = 0.5f;

            //Create theming class and apply to layer
            SymbolFromFeatureDataRowTheming srt = new SymbolFromFeatureDataRowTheming("Symbol", defaultStyle);
            vl.Theme = new SharpMap.Rendering.Thematics.CustomTheme(srt.GetRotatedSymol);

            map.Layers.Add(vl);
            map.ZoomToExtents();
            System.Drawing.Image mapImage = map.GetMap();
            mapImage.Save("SymbolFromFDR.bmp");
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:32,代码来源:Theming.cs


示例7: MainWindow

        public MainWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            try
            {
                GeoAPI.GeometryServiceProvider.Instance = new NtsGeometryServices();

                Build();

                Size mapSize = new Size(800, 500);
                myMap = new SharpMap.Map(mapSize);

                SharpMap.Styles.VectorStyle style = new SharpMap.Styles.VectorStyle();
                style.Outline = new Pen(Color.Green, 1);
                style.EnableOutline = true;
                SharpMap.Layers.VectorLayer layWorld = new SharpMap.Layers.VectorLayer("States");
                layWorld.DataSource =
                    new SharpMap.Data.Providers.ShapeFile(
                        @"data" + System.IO.Path.DirectorySeparatorChar + @"states.shp", true);
                layWorld.Style = style;

                myMap.Layers.Add(layWorld);
                myMap.MaximumZoom = 360;
                myMap.BackColor = Color.LightBlue;
                myMap.Center = new GeoAPI.Geometries.Coordinate(0, 0);
                myMap.Zoom = 360;

                Bitmap img = (Bitmap)myMap.GetMap();
                image3.Pixbuf = ImageToPixbuf(img);
            }
            catch (Exception ex)
            {
                label1.Text = ex.Message;
            }
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:35,代码来源:MainWindow.cs


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


示例9: TestPathPointSymbolizer

        public void TestPathPointSymbolizer()
        {
            var fdt = CreatingData.CreatePointFeatureDataTableFromArrays(
                CreatingData.GetRandomOrdinates(50, -180, 180), CreatingData.GetRandomOrdinates(50, -90, 90), null);
            var geometryFeatureProvider = new SharpMap.Data.Providers.FeatureProvider(fdt);
            var layer = new SharpMap.Layers.VectorLayer("randompoints", geometryFeatureProvider);
            var pps =
                SharpMap.Rendering.Symbolizer.PathPointSymbolizer.CreateSquare(new System.Drawing.Pen(System.Drawing.Color.Red, 2),
                                                                    new System.Drawing.SolidBrush(
                                                                        System.Drawing.Color.DodgerBlue), 20);
            layer.Style.PointSymbolizer = pps;
            var map = new SharpMap.Map(new System.Drawing.Size(720, 360));
            map.Layers.Add(layer);
            map.ZoomToExtents();
            map.GetMap().Save("PathPointSymbolizer1.bmp");

            pps.Rotation = -30;
            map.GetMap().Save("PathPointSymbolizer2.bmp");

            pps.Rotation = 0f;
            pps.Offset = new System.Drawing.PointF(4, 4);
            map.GetMap().Save("PathPointSymbolizer3.bmp");

            var gpTriangle1 = new System.Drawing.Drawing2D.GraphicsPath();
            gpTriangle1.AddPolygon(new [] { new System.Drawing.Point(0, 0), new System.Drawing.Point(5, 10), new System.Drawing.Point(10, 0), new System.Drawing.Point(0, 0), });
            var gpTriangle2 = new System.Drawing.Drawing2D.GraphicsPath();
            gpTriangle2.AddPolygon(new[] { new System.Drawing.Point(0, 0), new System.Drawing.Point(-5, -10), new System.Drawing.Point(-10, 0), new System.Drawing.Point(0, 0), });
            pps = new
                SharpMap.Rendering.Symbolizer.PathPointSymbolizer(new[]
                                                        {
                                                            new SharpMap.Rendering.Symbolizer.PathPointSymbolizer.PathDefinition
                                                                {
                                                                    Path = gpTriangle1,
                                                                    Line =
                                                                        new System.Drawing.Pen(
                                                                        System.Drawing.Color.Red, 2),
                                                                    Fill =
                                                                        new System.Drawing.SolidBrush(
                                                                        System.Drawing.Color.DodgerBlue)
                                                                },
                                                            new SharpMap.Rendering.Symbolizer.PathPointSymbolizer.PathDefinition
                                                                {
                                                                    Path = gpTriangle2,
                                                                    Line =
                                                                        new System.Drawing.Pen(
                                                                        System.Drawing.Color.DodgerBlue, 2),
                                                                    Fill =
                                                                        new System.Drawing.SolidBrush(
                                                                        System.Drawing.Color.Red)
                                                                }

                                                        }){ Rotation = 45 };

            layer.Style.PointSymbolizer = pps;
            map.GetMap().Save("PathPointSymbolizer4.bmp");
            pps.Rotation = 180;
            map.GetMap().Save("PathPointSymbolizer5.bmp");

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


示例10: InitializeMapOsm

        private static SharpMap.Map InitializeMapOsm()
        {
            var map = new SharpMap.Map();

            var tileLayer = new SharpMap.Layers.TileAsyncLayer(new BruTile.Web.OsmTileSource(), "TileLayer - OSM");
            map.BackgroundLayer.Add(tileLayer);
            map.ZoomToBox(tileLayer.Envelope);
            
            return map;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:10,代码来源:TileLayerSample.cs


示例11: OnInvokeSharpMapLayerDialog

        private void OnInvokeSharpMapLayerDialog(object sender, EventArgs e)
        {
            var map = new SharpMap.Map();
            var ts = new BruTile.Web.OsmTileSource();
            var tl = new SharpMap.Layers.TileLayer(ts, "OSM");
            map.Layers.Add(tl);

            var sml = new SharpMapLayer(map);
            App.Map.Layers.Add(sml);
        }
开发者ID:haoas,项目名称:DotSpatial.Plugins,代码行数:10,代码来源:SharpMapLayerPlugin.cs


示例12: GetLayerByName_Indexer

        public void GetLayerByName_Indexer()
        {
            SharpMap.Map map = new SharpMap.Map();
            map.Layers.Add(new SharpMap.Layers.VectorLayer("Layer 1"));
            map.Layers.Add(new SharpMap.Layers.VectorLayer("Layer 3"));
            map.Layers.Add(new SharpMap.Layers.VectorLayer("Layer 2"));

            SharpMap.Layers.ILayer layer = map.Layers["Layer 2"];
            Assert.IsNotNull(layer);
            Assert.AreEqual("Layer 2", layer.LayerName);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:MapTest.cs


示例13: WorldToImage

		public void WorldToImage()
		{
			SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(1000, 500));
			map.Zoom = 360;
			map.Center = new SharpMap.Geometries.Point(0, 0);
			Assert.AreEqual(new System.Drawing.PointF(500, 250), map.WorldToImage(new SharpMap.Geometries.Point(0, 0)));
			Assert.AreEqual(new System.Drawing.PointF(0, 0), map.WorldToImage(new SharpMap.Geometries.Point(-180, 90)));
			Assert.AreEqual(new System.Drawing.PointF(0, 500), map.WorldToImage(new SharpMap.Geometries.Point(-180, -90)));
			Assert.AreEqual(new System.Drawing.PointF(1000, 0), map.WorldToImage(new SharpMap.Geometries.Point(180, 90)));
			Assert.AreEqual(new System.Drawing.PointF(1000, 500), map.WorldToImage(new SharpMap.Geometries.Point(180, -90)));
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:MapTest.cs


示例14: WorldToImage

		public void WorldToImage()
		{
			SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(1000, 500));
			map.Zoom = 360;
			map.Center = GeometryFactory.CreateCoordinate(0, 0);
			Assert.AreEqual(new System.Drawing.PointF(500, 250), map.WorldToImage(GeometryFactory.CreateCoordinate(0, 0)));
			Assert.AreEqual(new System.Drawing.PointF(0, 0), map.WorldToImage(GeometryFactory.CreateCoordinate(-180, 90)));
			Assert.AreEqual(new System.Drawing.PointF(0, 500), map.WorldToImage(GeometryFactory.CreateCoordinate(-180, -90)));
			Assert.AreEqual(new System.Drawing.PointF(1000, 0), map.WorldToImage(GeometryFactory.CreateCoordinate(180, 90)));
			Assert.AreEqual(new System.Drawing.PointF(1000, 500), map.WorldToImage(GeometryFactory.CreateCoordinate(180, -90)));
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:11,代码来源:MapTest.cs


示例15: MapImage

		/// <summary>
		/// Initializes a new map
		/// </summary>
		public MapImage()
		{
			_Map = new SharpMap.Map(base.Size);
			_Activetool = Tools.None;
			base.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MapImage_MouseMove);
			base.MouseUp += new System.Windows.Forms.MouseEventHandler(this.MapImage_MouseUp);
			base.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MapImage_MouseDown);
			base.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.MapImage_Wheel);
			this.Cursor = Cursors.Cross;
			this.DoubleBuffered = true;
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:MapImage.cs


示例16: InitializeMap

        public static SharpMap.Map InitializeMap(int angle, string[] filenames)
        {
            var map = new SharpMap.Map();
            for (int i = 0; i < filenames.Length; i++)
                map.Layers.Add(new SharpMap.Layers.GdalRasterLayer(System.IO.Path.GetFileName(filenames[i]), filenames[i]));

            System.Drawing.Drawing2D.Matrix mat = new System.Drawing.Drawing2D.Matrix();
            mat.RotateAt(angle, map.WorldToImage(map.Center));
            map.MapTransform = mat;
            map.ZoomToExtents();
            return map;
        }
开发者ID:PedroMaitan,项目名称:sharpmap,代码行数:12,代码来源:GdalSample.cs


示例17: Initalize_MapInstance

		public void Initalize_MapInstance()
		{
			SharpMap.Map map = new SharpMap.Map(new System.Drawing.Size(2,1));
			Assert.IsNotNull(map);
			Assert.IsNotNull(map.Layers);
			Assert.AreEqual(2f, map.Size.Width);
			Assert.AreEqual(1f, map.Size.Height);
			Assert.AreEqual(System.Drawing.Color.Transparent, map.BackColor);
			Assert.AreEqual(double.MaxValue, map.MaximumZoom);
			Assert.AreEqual(0, map.MinimumZoom);
			Assert.AreEqual(new SharpMap.Geometries.Point(0, 0), map.Center, "map.Center should be initialized to (0,0)");
			Assert.AreEqual(1, map.Zoom, "Map zoom should be initialized to 1.0");
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:MapTest.cs


示例18: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            // set up sharpmap
            // Note: The process must run as 32-bit! The data source for map&market and AM use Access with OleDB.

            // create sharp map
            map = new SharpMap.Map(pictureBox1.ClientSize);

            // add background layer
            map.Layers.Add(new XMapServerLayer("Background", Properties.Settings.Default.XMapServerUrl, XMapServerMode.BackGround)
            {
                User = "xtok", Password = Properties.Settings.Default.XMapToken
            });

            // create vector layer
            SharpMap.Layers.VectorLayer districts = new SharpMap.Layers.VectorLayer("Dístricts");
            
            // initialize data source
            districtsData = new Ptv.Controls.Map.MapMarket.MMProviderStatic(
                 @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +  System.AppDomain.CurrentDomain.BaseDirectory + @"\Data\Districts.mdb",
                 "KRE", "GID", "XMIN", "YMIN", "XMAX", "YMAX", "WKB_GEOMETRY");
            districts.DataSource = districtsData;

            // set style
            districts.Theme = new SharpMap.Rendering.Thematics.CustomTheme(GetCountryStyle);

            // insert into sharp map
            map.Layers.Add(districts);

            // add label layer
            map.Layers.Add(new XMapServerLayer("Labels", Properties.Settings.Default.XMapServerUrl, XMapServerMode.Overlay)
            {
                User = "xtok",
                Password = Properties.Settings.Default.XMapToken
            });

            // insert address monitor layers
            var rootPath = System.AppDomain.CurrentDomain.BaseDirectory + "Data";
            var bitmapPath = rootPath + "\\Bitmaps";
            string[] poiFiles = System.IO.Directory.GetFiles(rootPath, "*.poi");
            foreach (string poiFile in poiFiles)
            {
                var layer = AMLayerFactory.CreateLayer(poiFile, bitmapPath);
                layer.MaxVisible = 9999999999; // override the automatic display threshold
                map.Layers.Add(layer);
            }

            // set map extends
            ZoomToBox();
        }
开发者ID:oliverheilig,项目名称:SharpMap.Ptv,代码行数:50,代码来源:Form1.cs


示例19: TestWarpedLineSymbolizer

        public void TestWarpedLineSymbolizer()
        {
            var p = new SharpMap.Data.Providers.ShapeFile(@"d:\\daten\GeoFabrik\\Aurich\\roads.shp", false);

            var l = new SharpMap.Layers.VectorLayer("roads", p);
            var cls = new SharpMap.Rendering.Symbolizer.CachedLineSymbolizer();
            cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.PlainLineSymbolizeHandler { Line = new System.Drawing.Pen(System.Drawing.Color.Gold, 2) });
            cls.LineSymbolizeHandlers.Add(new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander { Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetGreaterSeries(3, 3), Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1) });
            l.Style.LineSymbolizer = cls;

            var m = new SharpMap.Map(new System.Drawing.Size(720, 540)) {BackColor = System.Drawing.Color.Cornsilk};
            m.Layers.Add(l);

            m.ZoomToExtents();

            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            var bmp = m.GetMap();
            sw.Stop();
            System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
            bmp.Save("AurichRoads1.bmp");

            cls.LineSymbolizeHandlers[1] = new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander
            {
                Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetTriangleSeries(4, 7),
                Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1),
                Fill = new System.Drawing.SolidBrush(System.Drawing.Color.Firebrick)
            };
            sw.Start();
            bmp = m.GetMap();
            sw.Stop();
            System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
            bmp.Save("AurichRoads2.bmp");

            //cls.LineSymbolizeHandlers[0] = cls.LineSymbolizeHandlers[1];
            cls.LineSymbolizeHandlers[1] = new SharpMap.Rendering.Symbolizer.WarpedLineSymbolizeHander
                                               {
                                                   Pattern = SharpMap.Rendering.Symbolizer.WarpedLineSymbolizer.GetZigZag(4, 4),
                                                   Line = new System.Drawing.Pen(System.Drawing.Color.Firebrick, 1),
                                                   //Fill = new System.Drawing.SolidBrush(System.Drawing.Color.Firebrick)
                                               };
            sw.Start();
            bmp = m.GetMap();
            sw.Stop();
            System.Console.WriteLine(string.Format("Rendering new method: {0}ms", sw.ElapsedMilliseconds));
            bmp.Save("AurichRoads3.bmp");

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


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Sheet类代码示例发布时间:2022-05-24
下一篇:
C# SharpMap类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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