/// <summary> /// 添加分段标签专题图层 /// Add the theme of label range /// </summary> public void AddThemeLabelLayer() { m_pointDataset = m_workspace.Datasources[0].Datasets["BaseMap_P"] as DatasetVector; // 初始化构建子项对象属性的数组 // Initialize the array of property if (SuperMap.Data.Environment.CurrentCulture != "zh-CN") { m_itemNames = new String[4] { "First class city", "Second class city", "Third class city", "Fourth class city" }; } else { m_itemNames = new String[4] { "第一等级城市", "第二等级城市", "第三等级城市", "第四等级城市" }; } m_itemForeColors = new Color[4] { Color.Red, Color.Green, Color.Black, Color.Blue }; m_itemBackColors = new Color[4] { Color.FromArgb(255, 235, 189), Color.YellowGreen, Color.White, Color.LightGray }; try { // 创建分段标签专题图层,设置标签表达式和分段表达式 //Create the theme of label range, set the label expression and range expression ThemeLabel themeLabel = new ThemeLabel(); if (SuperMap.Data.Environment.CurrentCulture != "zh-CN") { themeLabel.LabelExpression = "name_en"; } else { themeLabel.LabelExpression = "name"; } themeLabel.RangeExpression = "ADCLASS"; for (Int32 i = 0; i < m_itemNames.Length; i++) { // 通过内部方法构建子项,并添加到标签专题图 // Create items and add them into the theme themeLabel.AddToTail(AddItemToThemeLabel(i)); } // 添加专题图层到地图 // Add the theme layer into the map Layer layer = m_mapControl.Map.Layers.Add(m_pointDataset, themeLabel, true); m_themeLayerName = layer.Name; } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
private void UiSettingsShow() { ThemeLabel.Show(); ForestButton.Show(); DesertButton.Show(); MountainsButton.Show(); CityButton.Show(); SunsetButton.Show(); mDivider1.Show(); LanguageLabel.Show(); RussianButton.Show(); EnglishButton.Show(); }
/// <summary> /// 设置专题图的属性,添加专题图图层到地图 /// Set the property of the theme and add the theme to the map /// </summary> public void AddUniformStyleThemeLabelLayer() { try { ThemeLabel themeLabel = new ThemeLabel(); TextStyle textStyle = new TextStyle(); textStyle.ForeColor = Color.FromArgb(115, 0, 74); textStyle.BackColor = Color.FromArgb(231, 227, 231); textStyle.Bold = true; textStyle.Outline = true; textStyle.FontHeight = 8; if (SuperMap.Data.Environment.CurrentCulture == "zh-CN") { themeLabel.LabelExpression = "Name"; } else { themeLabel.LabelExpression = "Name_en"; } // 设置统一风格 // Set the UniformStyle value themeLabel.UniformStyle = textStyle; // 将制作好的专题图添加到地图中显示 // Display the theme layer in the map Layer themeLayer = m_mapControl.Map.Layers.Add(m_dataset, themeLabel, true); m_themeLayerName = themeLayer.Name; m_mapControl.Map.Refresh(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }