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);
}
}