SuperMap.Connector.Map.GetMapImage C# (CSharp) Method

GetMapImage() public method

根据地图参数、图片输出设置获取地图图片。
public GetMapImage ( string mapName, MapParameter mapParameter, ImageOutputOption imageOutputOption ) : MapImage
mapName string 地图名称。
mapParameter SuperMap.Connector.Utility.MapParameter 地图参数。
imageOutputOption SuperMap.Connector.Utility.ImageOutputOption 图片输出设置。
return SuperMap.Connector.Utility.MapImage
        public MapImage GetMapImage(string mapName, MapParameter mapParameter, ImageOutputOption imageOutputOption)
        {
            return _mapProvider.GetMapImage(mapName, mapParameter, imageOutputOption, false);
        }

Same methods

Map::GetMapImage ( string mapName, MapParameter mapParameter, ImageOutputOption imageOutputOption, bool returnMapParameter ) : MapImage

Usage Example

コード例 #1
0
        public void GetMapImage_CreateThemeGraph()
        {
            ThemeGraph themeGraph = new ThemeGraph();
            themeGraph.Type = ThemeType.GRAPH;
            themeGraph.GraphType = ThemeGraphType.BAR3D;
            themeGraph.GraduatedMode = GraduatedMode.SQUAREROOT;
            themeGraph.AxesDisplayed = true;
            themeGraph.MaxGraphSize = 1;
            themeGraph.MinGraphSize = 0.35;
            themeGraph.GraphTextDisplayed = true;
            themeGraph.GraphTextFormat = GraphTextFormat.VALUE;
            themeGraph.BarWidth = 0.03;

            var item1 = new ThemeGraphItem();
            item1.Caption = "1";
            item1.GraphExpression = "Pop_Rate95";
            var style1 = new SuperMap.Connector.Utility.Style();
            style1.FillForeColor = new SuperMap.Connector.Utility.Color(211, 111, 240);
            item1.UniformStyle = style1;

            var item2 = new ThemeGraphItem();
            item2.Caption = "人口";
            item2.GraphExpression = "Pop_Rate99";
            var style2 = new SuperMap.Connector.Utility.Style();
            style2.FillForeColor = new SuperMap.Connector.Utility.Color(92, 73, 234);
            item2.UniformStyle = style2;

            themeGraph.Items = new ThemeGraphItem[] { item1, item2 };

            UGCThemeLayer themeLayer = new UGCThemeLayer();
            themeLayer.DatasetInfo = new DatasetInfo();
            themeLayer.DatasetInfo.DataSourceName = "Jingjin";
            themeLayer.DatasetInfo.Name = "BaseMap_R";
            themeLayer.DatasetInfo.Type = DatasetType.REGION;
            themeLayer.Description = "动态统计专题图";

            themeLayer.UgcLayerType = UGCLayerType.THEME;
            themeLayer.Type = LayerType.UGC;
            themeLayer.Visible = true;
            themeLayer.Theme = themeGraph;

            MapParameter mapParameter = new MapParameter();
            mapParameter.CacheEnabled = false;
            mapParameter.Center = new Point2D(116.755063, 39.803942);
            mapParameter.Scale = 1.0 / 1589406.44119042;
            mapParameter.RectifyType = RectifyType.BYCENTERANDMAPSCALE;
            mapParameter.Name = "动态统计专题图";
            mapParameter.ColorMode = MapColorMode.DEFAULT;

            mapParameter.Layers = new List<Layer>();
            mapParameter.Layers.Add(themeLayer);
            mapParameter.Viewer = new SuperMap.Connector.Utility.Rectangle(0, 0, 500, 400);

            Map map = new Map("http://" + ip + ":8090/iserver/services/map-jingjin/rest");
            ImageOutputOption imgageOutputOption = new ImageOutputOption();

            MapImage imageResult = map.GetMapImage("京津地区人口分布图_专题图", mapParameter, imgageOutputOption);
            using (MemoryStream memoryStream = new MemoryStream(imageResult.ImageData))
            {
                Bitmap bmp = new Bitmap(memoryStream);
                Assert.IsTrue(bmp.Width == 500);
                Assert.IsTrue(bmp.Height == 400);
                Assert.IsTrue(bmp.GetPixel(309, 293).R == 211);
                Assert.IsTrue(bmp.GetPixel(309, 293).G == 111);
                Assert.IsTrue(bmp.GetPixel(309, 293).B == 240);
            }
        }
All Usage Examples Of SuperMap.Connector.Map::GetMapImage