private void symbolsListView1_OnDeleteItem(string key) { if (_renderer == null || _fc == null) { return; } if (key.Contains(":")) { int pos = key.IndexOf(":"); int index; if (int.TryParse(key.Substring(0, pos), out index)) { if (index > 0 && index <= _renderer.QuantityClasses.Count) { QuantityRenderer.QuantityClass qClass = _renderer.QuantityClasses[index - 1]; _renderer.RemoveClass(qClass); } else if (index == 0) { _renderer.DefaultSymbol = new NullSymbol(_fc.GeometryType); } } BuildList(); } }
private void btnOK_Click(object sender, EventArgs e) { if (Math.Abs(numMin.Double - numMax.Double) < 1e-10) { return; } if (_renderer == null) { return; } foreach (QuantityRenderer.QuantityClass qC in _renderer.QuantityClasses) { _renderer.RemoveClass(qC); } double stepWidth = numStepWidth.Double; if (btnFixStepCount.Checked) { stepWidth = (numMax.Double - numMin.Double) / Math.Max(numStepCount.Double, 1); } double x; ISymbol symbol; QuantityRenderer.QuantityClass qClass; for (x = numMin.Double; x < numMax.Double - stepWidth; x += stepWidth) { symbol = AlternateSymbol(_minSymbol, _maxSymbol, (x - numMin.Double) / (numMax.Double - numMin.Double)); if (symbol == null) { continue; } if (symbol is ILegendItem) { ((ILegendItem)symbol).LegendLabel = x.ToString() + " - " + (x + stepWidth).ToString(); } qClass = new QuantityRenderer.QuantityClass( x, x + stepWidth, symbol); try { _renderer.AddClass(qClass); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } symbol = _maxSymbol.Clone() as ISymbol; if (symbol is ILegendItem) { ((ILegendItem)symbol).LegendLabel = x.ToString() + " - " + (numMax.Double).ToString(); } qClass = new QuantityRenderer.QuantityClass( x, numMax.Double, symbol); try { _renderer.AddClass(qClass); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }