Beispiel #1
0
        private void initialClassify()
        {
            if (layer2Symbolize == null)
            {
                return;
            }
            IFeatureClass   featureClass    = layer2Symbolize.FeatureClass;
            ITable          pTable          = (ITable)featureClass;
            ITableHistogram pTableHistogram = new BasicTableHistogramClass();
            IBasicHistogram pHistogram      = (IBasicHistogram)pTableHistogram;

            pTableHistogram.Field = strRendererField;
            if (strNormalizeField.ToLower() != "none")
            {
                pTableHistogram.NormField = strNormalizeField;
            }
            pTableHistogram.Table = pTable;
            object dataFrequency;
            object dataValues;

            pHistogram.GetHistogram(out dataValues, out dataFrequency);

            IClassifyGEN pClassify         = null;
            int          numDesiredClasses = classCount;

            pClassify = new EqualIntervalClass();
            pClassify.Classify(dataValues, dataFrequency, ref numDesiredClasses);
            double[] clsbreaks   = (double[])pClassify.ClassBreaks;
            double   dblInterval = clsbreaks[1] - clsbreaks[0];

            txtInterval.Text = dblInterval.ToString();
        }
Beispiel #2
0
    public Classifier(IServerContext mapContext, double [] values, int [] counts, String classifierType, int breaks)
    {
        m_classifier = (IClassifyGEN)mapContext.CreateObject("esriSystem." + classifierType);
        int b = breaks;

        m_classifier.Classify(values, counts, ref b);
        m_breaks = b;
    }
Beispiel #3
0
        /// <summary>
        /// Returns breaks based on the given arguments.
        /// </summary>
        /// <param name="method">The classification method</param>
        /// <param name="featureClass">The featureClass with the data</param>
        /// <param name="field">The field to specify the data</param>
        /// <param name="numberOfClasses">The number of classes</param>
        /// <returns>An array of breaks. NOTE: the first value in the array is the smallest and not part of the breaks. Find more at: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IClassifyGEN_Interface/0042000000m2000000/ </returns>
        public static double[] Classify(IClassifyGEN method, IFeatureClass featureClass, IField field, int numberOfClasses)
        {
            double[] data;
            int[]    freq;

            var numberClasses = numberOfClasses;

            Histogram(featureClass, field, out data, out freq);

            method.Classify(data, freq, numberOfClasses);

            return(method.ClassBreaks as double[]);
        }
Beispiel #4
0
 public Thematic(IMapControl3 mapControl)
 {
     if (mapControl != null)
     {
         this._mapControl = mapControl;
     }
     _renderer = new ClassBreaksRendererClass();
     _classify = new QuantileClass();
     _tableHistogram = new BasicTableHistogramClass();
     _colorFrom = new HsvColorClass();
     _colorTo = new HsvColorClass();
     _algClrRamp = new AlgorithmicColorRampClass();
 }
Beispiel #5
0
        public static void classifyRender(IFeatureLayer featLayer, string classMethod, string fieldName, IColorRamp colorRamp, int count)
        {
            try
            {
                //值分级
                IBasicHistogram pBasicHis = new BasicTableHistogramClass();
                ITableHistogram pTabHis   = (ITableHistogram)pBasicHis;
                IClassifyGEN    pClassify = null;
                switch (classMethod)
                {
                case "等间距分级":
                    pClassify = new EqualIntervalClass();
                    break;

                case "自然断点分级":
                    pClassify = new NaturalBreaksClass();
                    break;
                }
                pTabHis.Field = fieldName;
                ILayer Layer = (ILayer)featLayer;
                ITable pTab  = (ITable)Layer;
                pTabHis.Table = pTab;
                object doubleArrVal, longArrFreq;
                pBasicHis.GetHistogram(out doubleArrVal, out longArrFreq);

                int nDes = count;
                pClassify.Classify(doubleArrVal, longArrFreq, ref nDes);
                double[] ClassNum;
                ClassNum = (double[])pClassify.ClassBreaks;
                int ClassCountResult         = ClassNum.GetUpperBound(0);
                IClassBreaksRenderer pRender = new ClassBreaksRendererClass();
                pRender.BreakCount = ClassCountResult;
                pRender.Field      = fieldName;
                ISimpleFillSymbol pSym;
                IColor            pColor;
                for (int j = 0; j < ClassCountResult; j++)
                {
                    pColor = colorRamp.get_Color(j * (colorRamp.Size - 1) / (ClassCountResult - 1));
                    pRender.set_Symbol(j, getISymbolByGeomType(featLayer, pColor));
                    pRender.set_Break(j, ClassNum[j + 1]);
                    pRender.set_Label(j, ClassNum[j].ToString("0.00") + " - " + ClassNum[j + 1].ToString("0.00"));
                }

                IGeoFeatureLayer pGeoLyr = (IGeoFeatureLayer)Layer;
                pGeoLyr.Renderer = (IFeatureRenderer)pRender;
            }
            catch {
                XtraMessageBox.Show("嗯,哪个,就一个值,别分级了好不好^_^");
            }
        }
Beispiel #6
0
        private void InitializeClassificationArguments()
        {
            var quantileClass = new QuantileClass();

            _selectedClassificationMethod = quantileClass;

            ListOfClassificationMethod = new BindingList <IClassifyGEN>
            {
                new NaturalBreaksClass(),
                quantileClass,
                new EqualIntervalClass(),
                new GeometricalIntervalClass()
            };

            NumberOfClasses = new BindingList <int>(Enumerable.Range(2, 19).ToList());

            _selectedNumberOfClasses = 5;
        }
Beispiel #7
0
        private void RendererContainerToView()
        {
            if (!IsFieldToRenderSelected)
            {
                return;
            }

            if (_selectedFieldToRender.Renderer == Renderer.None)
            {
                return;
            }

            if (_selectedFieldToRender.Renderer == Renderer.ClassBreaksRenderer)
            {
                _selectedClassificationMethod  = ListOfClassificationMethod.FirstOrDefault(m => m.MethodName.Equals(_selectedFieldToRender.ClassBreaksRendererContainer.ClassificationMethod.MethodName));
                _selectedNumberOfClasses       = _selectedFieldToRender.ClassBreaksRendererContainer.NumberOfClasses;
                _classBreaksRendererStartColor = _selectedFieldToRender.ClassBreaksRendererContainer.StartColor;
                _classBreaksRendererEndColor   = _selectedFieldToRender.ClassBreaksRendererContainer.EndColor;
                _bins = _selectedFieldToRender.ClassBreaksRendererContainer.Bins;

                PropertyChanged.Notify(() => SelectedClassificationMethod);
                PropertyChanged.Notify(() => SelectedNumberOfClasses);
                PropertyChanged.Notify(() => ClassBreaksRendererStartColor);
                PropertyChanged.Notify(() => ClassBreaksRendererEndColor);
                PropertyChanged.Notify(() => Bins);
            }

            if (_selectedFieldToRender.Renderer == Renderer.BiPolarRenderer)
            {
                _biPolarRendererStartColor   = _selectedFieldToRender.BiPolarRendererContainer.NegativColor;
                _biPolarRenderEndColor       = _selectedFieldToRender.BiPolarRendererContainer.PositivColor;
                _biPolarRendererNeutralColor = _selectedFieldToRender.BiPolarRendererContainer.NeutralColor;
                _biPolarColorSliderValue     = _selectedFieldToRender.BiPolarRendererContainer.NeutralColorPosition;

                PropertyChanged.Notify(() => BiPolarRendererStartColor);
                PropertyChanged.Notify(() => BiPolarRendererNeutralColor);
                PropertyChanged.Notify(() => BiPolarRendererEndColor);
                PropertyChanged.Notify(() => BiPolarColorSliderValue);
            }
        }
        public void LayerRender()
        {
            try
            {
                //值分级
                IBasicHistogram pBasicHis = new BasicTableHistogramClass();
                ITableHistogram pTabHis   = (ITableHistogram)pBasicHis;
                IClassifyGEN    pClassify = null;
                switch (classname)
                {
                case "自然断点分级":
                    pClassify = new NaturalBreaksClass();
                    break;

                case "等间距分级":
                    pClassify = new EqualIntervalClass();
                    break;
                }
                pTabHis.Field = FiledName;
                //IGeoFeatureLayer geolayer = (IGeoFeatureLayer)Layer;
                ITable pTab = (ITable)Layer;
                pTabHis.Table = pTab;
                object doubleArrVal, longArrFreq;
                pBasicHis.GetHistogram(out doubleArrVal, out longArrFreq);

                int nDes = count;
                pClassify.Classify(doubleArrVal, longArrFreq, ref nDes);
                object   classes = pClassify.ClassBreaks;
                double[] ClassNum;
                ClassNum = (double[])pClassify.ClassBreaks;
                int ClassCountResult         = ClassNum.GetUpperBound(0);
                IClassBreaksRenderer pRender = new ClassBreaksRendererClass();
                pRender.BreakCount = ClassCountResult;
                pRender.Field      = FiledName;
                ISimpleFillSymbol pSym;
                IColor            pColor;
                for (int j = 0; j < ClassCountResult; j++)
                {
                    pColor     = ramp.get_Color(j * (ramp.Size / ClassCountResult));
                    pSym       = new SimpleFillSymbolClass();
                    pSym.Color = pColor;
                    pRender.set_Symbol(j, (ISymbol)pSym);
                    pRender.set_Break(j, ClassNum[j + 1]);
                    if (ClassNum[j].ToString().Contains("."))
                    {
                        pRender.set_Label(j, ClassNum[j].ToString("0.000") + " - " + ClassNum[j + 1].ToString("0.000"));
                    }
                    else
                    {
                        pRender.set_Label(j, ClassNum[j].ToString() + " - " + ClassNum[j + 1].ToString());
                    }
                }

                IGeoFeatureLayer pGeoLyr = (IGeoFeatureLayer)Layer;
                pGeoLyr.Renderer = (IFeatureRenderer)pRender;
                axmapcontrol.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                axtoccontrol.Update();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Beispiel #9
0
        private IClassBreaksRenderer CreateClassBreaksRenderer(IFeatureClass featureClass, string breakMethod)
        {
            ITable pTable = (ITable)featureClass;

            //从pTable的strRendererField字段中得到信息给datavalues和datafrequency两个数组
            ITableHistogram pTableHistogram = new BasicTableHistogramClass();
            IBasicHistogram pHistogram      = (IBasicHistogram)pTableHistogram;

            pTableHistogram.Field = strRendererField;
            if (strNormalizeField.ToLower() != "none")
            {
                pTableHistogram.NormField = strNormalizeField;
            }
            pTableHistogram.Table = pTable;
            object dataFrequency;
            object dataValues;

            pHistogram.GetHistogram(out dataValues, out dataFrequency);

            //下面是分级方法,用于根据获得的值计算得出符合要求的数据
            //根据条件计算出Classes和ClassesCount,numDesiredClasses为预定的分级数目
            IClassifyGEN pClassify         = null;
            int          numDesiredClasses = classCount;

            switch (breakMethod)
            {
            case "等间隔":
                pClassify = new EqualIntervalClass();
                break;

            case "已定义的间隔":
                pClassify = new DefinedIntervalClass();
                IIntervalRange2 intervalRange = pClassify as IIntervalRange2;
                intervalRange.IntervalRange = dblDefinedInterval;
                break;

            case "分位数":
                pClassify = new QuantileClass();
                break;

            case "自然裂点":
                pClassify = new NaturalBreaksClass();
                break;

            case "标准差":
                pClassify = new StandardDeviationClass();
                IStatisticsResults pStatRes = pHistogram as IStatisticsResults;
                IDeviationInterval pStdDev  = pClassify as IDeviationInterval;
                pStdDev.Mean              = pStatRes.Mean;
                pStdDev.StandardDev       = pStatRes.StandardDeviation;
                pStdDev.DeviationInterval = dblStdDevInterval;
                break;

            default:
                break;
            }

            if (pClassify == null)
            {
                return(null);
            }
            pClassify.Classify(dataValues, dataFrequency, ref numDesiredClasses);
            //返回一个数组
            double[] classBreaks  = (double[])pClassify.ClassBreaks;
            int      ClassesCount = classBreaks.GetUpperBound(0);

            nudClassCount.Value = ClassesCount;
            IClassBreaksRenderer pClassBreaksRenderer = new ClassBreaksRendererClass();

            pClassBreaksRenderer.Field = strRendererField;
            if (strNormalizeField.ToLower() != "none")
            {
                pClassBreaksRenderer.NormField = strNormalizeField;
            }
            //设置着色对象的分级数目
            pClassBreaksRenderer.BreakCount           = ClassesCount;
            pClassBreaksRenderer.SortClassesAscending = true;
            if (colorRamp == null)
            {
                MessageBox.Show("请先选择色带!!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(null);
            }
            //通过色带设置各级分类符号的颜色
            colorRamp.Size = ClassesCount;
            bool createRamp;

            colorRamp.CreateRamp(out createRamp);
            IEnumColors enumColors = colorRamp.Colors;

            enumColors.Reset();
            IColor  pColor = null;
            ISymbol symbol = null;

            if (gloabalSymbol == null)
            {
                MessageBox.Show("请选择符号...", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(null);
            }
            //需要注意的是分级着色对象中的symbol和break的下标都是从0开始
            for (int i = 0; i < ClassesCount; i++)
            {
                pColor = enumColors.Next();
                switch (featureClass.ShapeType)
                {
                case esriGeometryType.esriGeometryPoint:
                    IMarkerSymbol markerSymbol = gloabalSymbol as IMarkerSymbol;
                    markerSymbol.Color = pColor;
                    symbol             = markerSymbol as ISymbol;
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    ILineSymbol lineSymbol = gloabalSymbol as ILineSymbol;
                    lineSymbol.Color = pColor;
                    symbol           = lineSymbol as ISymbol;
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    IFillSymbol fillSymbol = gloabalSymbol as IFillSymbol;
                    fillSymbol.Color = pColor;
                    symbol           = fillSymbol as ISymbol;
                    break;

                default:
                    break;
                }
                pClassBreaksRenderer.set_Symbol(i, symbol);
                pClassBreaksRenderer.set_Break(i, classBreaks[i + 1]);
            }
            return(pClassBreaksRenderer);
        }
Beispiel #10
0
        private void lblClassificationMethod_Click(object sender, EventArgs e)
        {
            if (layer2Symbolize == null)
            {
                return;
            }
            IFeatureClass featureClass = layer2Symbolize.FeatureClass;
            ITable        pTable       = (ITable)featureClass;

            ITableHistogram pTableHistogram2 = new BasicTableHistogramClass();
            IBasicHistogram pHistogram2      = (IBasicHistogram)pTableHistogram2;

            pTableHistogram2.Field = strRendererField;
            if (strNormalizeField.ToLower() != "none")
            {
                pTableHistogram2.NormField = strNormalizeField;
            }
            pTableHistogram2.Table = pTable;
            object dataFrequency;
            object dataValues;

            pHistogram2.GetHistogram(out dataValues, out dataFrequency);

            //下面是分级方法,用于根据获得的值计算得出符合要求的数据
            //根据条件计算出Classes和ClassesCount,numDesiredClasses为预定的分级数目
            IClassifyGEN pClassify = null;

            pClassify = new NaturalBreaksClass();
            int numDesiredClasses = gClassCount;

            pClassify.Classify(dataValues, dataFrequency, ref numDesiredClasses);

            UID pUid;

            pUid = new UIDClass();
            pUid = pClassify.ClassID;
            IClassificationDialog pClassDialog;

            pClassDialog = new ClassificationDialogClass();
            pClassDialog.Classification = pUid;
            pClassDialog.SetHistogramData(pHistogram2 as IHistogram);
            pClassDialog.ClassBreaks = pClassify.ClassBreaks;
            bool ok = pClassDialog.DoModal(0);

            if (ok == false)
            {
                return;
            }

            pUid         = pClassDialog.Classification;
            gClassbreaks = (double[])pClassDialog.ClassBreaks;
            switch (pUid.Value.ToString())
            {
            case "{62144BE1-E05E-11D1-AAAE-00C04FA334B3}":
                lblClassificationMethod.Text = "等间隔";
                break;

            case "{62144BE8-E05E-11D1-AAAE-00C04FA334B3}":
                lblClassificationMethod.Text = "已定义的间隔";
                break;

            case "{62144BE9-E05E-11D1-AAAE-00C04FA334B3}":
                lblClassificationMethod.Text = "分位数";
                break;

            case "{62144BEA-E05E-11D1-AAAE-00C04FA334B3}":
                lblClassificationMethod.Text = "自然裂点";
                break;

            case "{DC6D8015-49C2-11D2-AAFF-00C04FA334B3}":
                lblClassificationMethod.Text = "标准差";
                break;

            default:
                break;
            }
        }
Beispiel #11
0
        private void DrawCCMaps()
        {
            m_intClassNumber = Convert.ToInt32(nudGCNClasses.Value);
            IFeatureClass pFClass = pFLayer.FeatureClass;

            //Determine Class Breaks for variable
            int intValueFldIdx = pFClass.FindField(strVarFldName);

            ITable       pTable       = (ITable)pFClass;
            IClassifyGEN pClassifyGEN = null;

            switch (cboGCClassify.Text)
            {
            case "Equal Interval":
                pClassifyGEN = new EqualIntervalClass();
                break;

            case "Geometrical Interval":
                pClassifyGEN = new GeometricalInterval();
                break;

            case "Natural Breaks":
                pClassifyGEN = new NaturalBreaksClass();
                break;

            case "Quantile":
                pClassifyGEN = new QuantileClass();
                break;

            case "StandardDeviation":
                pClassifyGEN = new StandardDeviationClass();
                break;

            default:
                pClassifyGEN = new NaturalBreaksClass();
                break;
            }


            ITableHistogram pTableHistogram = new BasicTableHistogramClass();

            pTableHistogram.Field = strVarFldName;
            pTableHistogram.Table = pTable;
            //IHistogram pHistogram = (IHistogram)pTableHistogram2;
            IBasicHistogram pHistogram = (IBasicHistogram)pTableHistogram;

            ////Not working in ArcGIS 10.5 022417 HK
            //ITableHistogram pTableHistogram = new TableHistogramClass();
            //pTableHistogram.Field = strVarFldName;
            //pTableHistogram.Table = pTable;
            //IHistogram pHistogram = (IHistogram)pTableHistogram;

            object xVals, frqs;

            pHistogram.GetHistogram(out xVals, out frqs);
            pClassifyGEN.Classify(xVals, frqs, m_intClassNumber);
            double[] cb = (double[])pClassifyGEN.ClassBreaks;

            //Class Determinations for vertical and horizontal axis

            if (m_VerticalBreaks == null)
            {
                pClassifyGEN          = new QuantileClass(); //Using Quatile
                pTableHistogram       = new BasicTableHistogramClass();
                pTableHistogram.Field = strVerConFldName;
                pTableHistogram.Table = pTable;
                pHistogram            = (IBasicHistogram)pTableHistogram;

                pHistogram.GetHistogram(out xVals, out frqs);
                pClassifyGEN.Classify(xVals, frqs, intVerCnt);
                m_VerticalBreaks = (double[])pClassifyGEN.ClassBreaks;
            }

            if (m_HorizontalBreaks == null)
            {
                pClassifyGEN          = new QuantileClass(); //Using Quatile
                pTableHistogram       = new BasicTableHistogramClass();
                pTableHistogram.Field = strHorConFldName;
                pTableHistogram.Table = pTable;
                pHistogram            = (IBasicHistogram)pTableHistogram;

                pHistogram.GetHistogram(out xVals, out frqs);
                pClassifyGEN.Classify(xVals, frqs, intHorCnt);
                m_HorizontalBreaks = (double[])pClassifyGEN.ClassBreaks;
            }

            //Create Renderer
            IClassBreaksRenderer pRender = new ClassBreaksRenderer();

            pRender.Field        = strVarFldName;
            pRender.BreakCount   = m_intClassNumber;
            pRender.MinimumBreak = cb[0];

            string strColorRamp = cboColorRamp.Text;

            IEnumColors pEnumColors = MultiPartColorRamp(strColorRamp, "CIE Lab", m_intClassNumber);

            pEnumColors.Reset();

            int[,] arrColors = new int[m_intClassNumber, 3];

            for (int k = 0; k < m_intClassNumber; k++)
            {
                IColor    pColor    = pEnumColors.Next();
                IRgbColor pRGBColor = new RgbColorClass();
                pRGBColor.RGB = pColor.RGB;

                arrColors[k, 0] = pRGBColor.Red;
                arrColors[k, 1] = pRGBColor.Green;
                arrColors[k, 2] = pRGBColor.Blue;
            }

            pEnumColors.Reset();
            IRgbColor pColorOutline = new RgbColor();

            //Can Change the color in here!
            pColorOutline = m_pSnippet.getRGB(picOutlineColor.BackColor.R, picOutlineColor.BackColor.G, picOutlineColor.BackColor.B);

            double dblGCOutlineSize = Convert.ToDouble(nudOutlinewidth.Value);

            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();

            double dblAdding = Math.Pow(0.1, m_intRounding);

            for (int j = 0; j < m_intClassNumber; j++)
            {
                pRender.Break[j] = cb[j + 1];

                if (j == 0)
                {
                    pRender.Label[j] = Math.Round(cb[j], m_intRounding).ToString("N" + m_intRounding.ToString()) + " - " + Math.Round(cb[j + 1], 2).ToString("N" + m_intRounding.ToString());
                }
                else
                {
                    pRender.Label[j] = Math.Round(cb[j] + dblAdding, m_intRounding).ToString("N" + m_intRounding.ToString()) + " - " + Math.Round(cb[j + 1], 2).ToString("N" + m_intRounding.ToString());
                }

                pUIProperties.LowBreak[j] = cb[j];

                pSimpleFillSym = new SimpleFillSymbolClass();
                IRgbColor pRGBColor = m_pSnippet.getRGB(arrColors[j, 0], arrColors[j, 1], arrColors[j, 2]);
                pSimpleFillSym.Color   = (IColor)pRGBColor;
                pSimpleFillSym.Outline = pOutLines;
                pRender.Symbol[j]      = (ISymbol)pSimpleFillSym;
            }

            //Background Layer
            ISimpleRenderer   pSimpleRender = new SimpleRendererClass();
            ISimpleFillSymbol pBGSymbol     = new SimpleFillSymbolClass();

            pBGSymbol.Color = (IColor)m_pSnippet.getRGB(picBGColor.BackColor.R, picBGColor.BackColor.G, picBGColor.BackColor.B);

            ICartographicLineSymbol pBGOutLines = new CartographicLineSymbol();

            pBGOutLines.Width = 0;
            pBGOutLines.Color = m_pSnippet.getRGB(255, 255, 255);
            pBGSymbol.Outline = pBGOutLines;

            pSimpleRender.Symbol = (ISymbol)pBGSymbol;

            IFeatureLayer pflBG = new FeatureLayerClass();

            pflBG.FeatureClass = pFClass;

            IGeoFeatureLayer pGeoBG = (IGeoFeatureLayer)pflBG;

            pGeoBG.Renderer   = (IFeatureRenderer)pSimpleRender;
            pGeoBG.Selectable = false;

            //Feature Count for each map
            m_intsFeatureCnts = new int[intVerCnt * intHorCnt];

            int l = 0;

            for (int i = 0; i < intVerCnt; i++)
            {
                for (int j = 0; j < intHorCnt; j++)
                {
                    IFeatureLayer pflOutput = new FeatureLayerClass();
                    pflOutput.FeatureClass = pFClass;

                    IGeoFeatureLayer pGeofeatureLayer = (IGeoFeatureLayer)pflOutput;

                    pGeofeatureLayer.Renderer = (IFeatureRenderer)pRender;

                    IFeatureLayerDefinition2 pFDefinition = (IFeatureLayerDefinition2)pGeofeatureLayer;
                    string strWhereClause = null;

                    if (i == 0 && j == 0)
                    {
                        strWhereClause = strVerConFldName + " >= " + m_VerticalBreaks[i].ToString() + " AND " +
                                         strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " +
                                         strHorConFldName + " >= " + m_HorizontalBreaks[j].ToString() + " AND " +
                                         strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString();
                    }
                    else if (i != 0 && j == 0)
                    {
                        strWhereClause = strVerConFldName + " > " + m_VerticalBreaks[i].ToString() + " AND " +
                                         strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " +
                                         strHorConFldName + " >= " + m_HorizontalBreaks[j].ToString() + " AND " +
                                         strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString();
                    }
                    else if (i == 0 && j != 0)
                    {
                        strWhereClause = strVerConFldName + " >= " + m_VerticalBreaks[i].ToString() + " AND " +
                                         strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " +
                                         strHorConFldName + " > " + m_HorizontalBreaks[j].ToString() + " AND " +
                                         strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString();
                    }
                    else
                    {
                        strWhereClause = strVerConFldName + " > " + m_VerticalBreaks[i].ToString() + " AND " +
                                         strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " +
                                         strHorConFldName + " > " + m_HorizontalBreaks[j].ToString() + " AND " +
                                         strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString();
                    }

                    pFDefinition.DefinitionExpression = strWhereClause;

                    IQueryFilter pQfilter = new QueryFilterClass();
                    pQfilter.WhereClause = strWhereClause;

                    m_intsFeatureCnts[l] = pGeofeatureLayer.FeatureClass.FeatureCount(pQfilter);
                    m_axMapControls[l].ActiveView.FocusMap.ClearLayers();
                    m_axMapControls[l].ActiveView.FocusMap.AddLayer(pGeoBG);
                    m_axMapControls[l].ActiveView.FocusMap.AddLayer(pGeofeatureLayer);
                    m_axMapControls[l].ActiveView.Extent = m_axMapControls[l].ActiveView.FullExtent;
                    m_axMapControls[l].ActiveView.Refresh();
                    l++;
                }
            }

            lblVariable.Text = "Selected Variable: " + strVarFldName;
            UpdateRange(lvSymbol, m_intClassNumber, cb, arrColors, m_intRounding);

            if (m_blnAddBoxes)
            {
                UpdateTextBoxes();
            }
            else
            {
                AddTextBoxes();
            }

            UpdateLabels();
            UpdateHorVerLabels();
        }
        private void btRender_Click(object sender, EventArgs e)
        {
            int number = 0;

            if (cbColorRamp.SelectedIndex == -1)
            {
                if (lang == Language.Chinese)
                {
                    MessageBox.Show("请先选择一种色带");
                }
                else if (lang == Language.English)
                {
                    MessageBox.Show("Please choose a color ribbon first");
                }
                return;
            }
            try
            {
                number = int.Parse(txtNumber.Text);
                if (number <= 1)
                {
                    if (lang == Language.Chinese)
                    {
                        MessageBox.Show("类别数量只能为>1的正整数");
                    }
                    else if (lang == Language.English)
                    {
                        MessageBox.Show("The class number can only be a positive integer of >1");
                    }
                }
            }
            catch
            {
                if (lang == Language.Chinese)
                {
                    MessageBox.Show("类别数量只能为整数");
                }
                else if (lang == Language.English)
                {
                    MessageBox.Show("The class number can only be an integer");
                }
            }
            IRasterClassifyColorRampRenderer pRasterClassifyRenderer = new RasterClassifyColorRampRendererClass();
            IRasterRenderer          pRasterRenderer = pRasterClassifyRenderer as IRasterRenderer;
            IUniqueValues            uniVal          = new UniqueValuesClass();
            IRasterCalcUniqueValues2 calValues       = new RasterCalcUniqueValuesClass();

            calValues.MaxUniqueValueCount = 10000000;
            calValues.AddFromRaster(rasterLayer.Raster, cbSelectedBand.SelectedIndex, uniVal);
            object vValues, vFrequences;

            uniVal.GetHistogram(out vValues, out vFrequences);
            double[] doubleArray = (double[])vValues;
            int[]    longArray   = (int[])vFrequences;
            int      order       = SortTool.CheckInOrder(doubleArray, doubleArray.Length);

            if (order == 0)
            {
                SortTool.QuickSort3(doubleArray, 0, doubleArray.Length - 1, longArray);
            }
            else if (order == -1)
            {
                SortTool.Reverse(doubleArray, doubleArray.Length, longArray);
            }
            IClassifyGEN classify = GetMethod(cbMethod.Text);

            classify.Classify((double[])vValues, (int[])vFrequences, ref number);
            double[] classes = classify.ClassBreaks as double[];

            pRasterRenderer.Raster             = rasterLayer.Raster;
            pRasterClassifyRenderer.ClassCount = number;
            for (int i = 0; i < classes.Length; i++)
            {
                pRasterClassifyRenderer.set_Break(i, classes[i]);
            }
            pRasterRenderer.Update();

            IStyleGalleryItem galleryItem = symbol.GetItem(cbColorRamp.SelectedIndex);
            IColorRamp        colorRamp   = galleryItem.Item as IColorRamp;
            IFillSymbol       fill        = new SimpleFillSymbolClass() as IFillSymbol;
            int increase = colorRamp.Size / (number - 1);

            for (int i = 0; i < pRasterClassifyRenderer.ClassCount - 1; i++)
            {
                fill.Color = colorRamp.get_Color(i * increase);
                pRasterClassifyRenderer.set_Symbol(i, fill as ISymbol);
                pRasterClassifyRenderer.set_Label(i, pRasterClassifyRenderer.get_Break(i).ToString() + "-" + pRasterClassifyRenderer.get_Break(i + 1).ToString());
            }
            fill.Color = colorRamp.get_Color(colorRamp.Size - 1);
            pRasterClassifyRenderer.set_Symbol(pRasterClassifyRenderer.ClassCount - 1, fill as ISymbol);
            pRasterClassifyRenderer.set_Label(pRasterClassifyRenderer.ClassCount - 1, pRasterClassifyRenderer.get_Break(pRasterClassifyRenderer.ClassCount - 1).ToString() + "-" + pRasterClassifyRenderer.get_Break(pRasterClassifyRenderer.ClassCount).ToString());
            rasterLayer.Renderer = pRasterRenderer;
            succeed = true;
            this.Close();
        }