private void Btchangethematic_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null) { return; } GISLayer layer = Document.getLayer(listBox1.SelectedItem.ToString()); //唯一值地图 if (comboBox2.SelectedIndex == 0) { layer.MakeUnifiedValueMap(); GISThematic Thematic = layer.Thematics[layer.ThematicType]; Thematic.InsideColor = btfillcolor.BackColor; Thematic.OutsideColor = btboundcolor.BackColor; Thematic.Size = (tbdrawsize.Text == "") ? Thematic.Size : Int32.Parse(tbdrawsize.Text); } //独立值地图 else if (comboBox2.SelectedIndex == 1) { layer.MakeUniqueValueMap(comboBox3.SelectedIndex); } //分层设色地图 else if (comboBox2.SelectedIndex == 2) { if (layer.MakeGradualColor(comboBox3.SelectedIndex, Int32.Parse(tblevelnumber.Text)) == false) { MessageBox.Show("基于该属性无法绘制分层设色地图!!"); return; } } //更新地图绘制 Mapwindow.UpdateMap(); }
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { //用以应对listbox选择改变的情况 更改相应的项 if (listBox1.SelectedItem == null) { return; } GISLayer layer = Document.getLayer(listBox1.SelectedItem.ToString());//根据选中情况获取对应的layer checkBox1.Checked = layer.Selectable; checkBox2.Checked = layer.Visible; checkBox3.Checked = layer.DrawAttributeOrNot; comboBox1.Items.Clear(); for (int i = 0; i < layer.Fields.Count; i++) { comboBox1.Items.Add(layer.Fields[i].name); comboBox3.Items.Add(layer.Fields[i].name); } comboBox1.SelectedIndex = (layer.Fields.Count > 0) ? layer.LabelIndex : -1; comboBox3.SelectedIndex = (layer.Fields.Count > 0) ? layer.ThematicFieldIndex : -1; fileaddr.Text = layer.Path; textBox1.Text = layer.Name; if (layer.ThematicType == THEMATICTYPE.UnifiedValue) { comboBox2.SelectedIndex = 0; GISThematic Thematic = layer.Thematics[layer.ThematicType]; btfillcolor.BackColor = Thematic.InsideColor; tbdrawsize.Text = Thematic.Size.ToString(); btboundcolor.BackColor = Thematic.OutsideColor; } else if (layer.ThematicType == THEMATICTYPE.UniqueValue) { comboBox2.SelectedIndex = 1; } else if (layer.ThematicType == THEMATICTYPE.GradualColor) { comboBox2.SelectedIndex = 2; tblevelnumber.Text = layer.Thematics.Count.ToString(); } }