Exemplo n.º 1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                if (cboUncernFld.Text == "" || cboValueField.Text == "")
                {
                    MessageBox.Show("Please assign proper fields");
                    return;
                }
                pSnippet.AddRenderInfo(mForm, pFLayer, cboValueField.Text, cboUncernFld.Text, cb, arrColors, strClassificationMethod);

                IRgbColor pColorOutline = new RgbColor();
                //Can Change the color in here!
                pColorOutline = pSnippet.getRGB(picGCLineColor.BackColor.R, picGCLineColor.BackColor.G, picGCLineColor.BackColor.B);
                if (pColorOutline == null)
                {
                    return;
                }
                double dblGCOutlineSize = Convert.ToDouble(nudGCLinewidth.Value);

                //Previous Methods 020416
                //ICartographicLineSymbol pOutLines = new CartographicLineSymbol();
                //pOutLines.Width = dblGCOutlineSize;
                //pOutLines.Color = (IColor)pColorOutline;

                ////' use this interface to set dialog properties
                //IClassBreaksUIProperties pUIProperties = (IClassBreaksUIProperties)pRender;
                //pUIProperties.ColorRamp = "Custom";
                //ISimpleFillSymbol pSimpleFillSym;

                //pEnumColors.Reset();
                ////' be careful, indices are different for the diff lists
                //for (int j = 0; j < intGCBreakeCount; j++)
                //{
                //    pRender.Break[j] = cb[j + 1];
                //    pRender.Label[j] = arrLabel[j];
                //    pUIProperties.LowBreak[j] = cb[j];
                //    pSimpleFillSym = new SimpleFillSymbolClass();
                //    IRgbColor pRGBColor = pSnippet.getRGB(arrColors[j, 0], arrColors[j, 1], arrColors[j, 2]);
                //    if (pRGBColor == null)
                //        return;
                //    pSimpleFillSym.Color = (IColor)pRGBColor;
                //    pSimpleFillSym.Outline = pOutLines;
                //    pRender.Symbol[j] = (ISymbol)pSimpleFillSym;
                //}

                //IGeoFeatureLayer pGeofeatureLayer = (IGeoFeatureLayer)pFLayer;

                //pGeofeatureLayer.Renderer = (IFeatureRenderer)pRender;

                //New Method
                IClassSeparabilityRenderer pClassSeparabilityRenderer = new ClassSeparabilityRenderer();
                pClassSeparabilityRenderer.strValueFldName  = cboValueField.Text;
                pClassSeparabilityRenderer.arrClassBrks     = cb;
                pClassSeparabilityRenderer.arrColors        = arrColors;
                pClassSeparabilityRenderer.arrSeparability  = dblpValue;
                pClassSeparabilityRenderer.arrSepLineColors = RedToBlueColorRamps();
                //pClassSeparabilityRenderer.arrValue = arrEst;
                pClassSeparabilityRenderer.dblLineWidth      = dblGCOutlineSize;
                pClassSeparabilityRenderer.intRoundingDigits = intRounding;
                pClassSeparabilityRenderer.m_pLineRgb        = pColorOutline;
                pClassSeparabilityRenderer.strHeading        = "Estimate and Separability";
                pClassSeparabilityRenderer.CreateLegend();

                IGeoFeatureLayer pGeofeatureLayer = (IGeoFeatureLayer)pFLayer;

                pGeofeatureLayer.Renderer = (IFeatureRenderer)pClassSeparabilityRenderer;
                mForm.axMapControl1.ActiveView.Refresh();
                mForm.axTOCControl1.Update();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.Handle.ToString() + " Error:" + ex.Message);
                return;
            }
        }