private void btnInsertValue_Click(object sender, EventArgs e) { if (_renderer == null || _fc == null) return; IField field = _fc.FindField(_renderer.ValueField); if (field == null) return; PropertyForm_QuantityRenderer_Dialog_InsertValue dlg = new PropertyForm_QuantityRenderer_Dialog_InsertValue(field); if (dlg.ShowDialog() == DialogResult.OK) { QuantityRenderer.QuantityClass qClass = new QuantityRenderer.QuantityClass( dlg.MinValue, dlg.MaxValue, RendererFunctions.CreateStandardSymbol(_renderer.GeometryType)); if (qClass.Symbol is ILegendItem) { ((ILegendItem)qClass.Symbol).LegendLabel = dlg.Label; } try { _renderer.AddClass(qClass); BuildList(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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); } }