示例#1
0
        private void BrushingToScatterPlot(frmScatterPlotResults pfrmPointsPlot, IFeatureLayer pFLayer, IFeatureSelection featureSelection)
        {
            try
            {
                if (pfrmPointsPlot.m_pFLayer == pFLayer)
                {
                    IFeatureClass pFeatureClass = pFLayer.FeatureClass;
                    int           intVar1Idx    = pFeatureClass.Fields.FindField(pfrmPointsPlot.strVar1Name);
                    int           intVar2Idx    = pFeatureClass.Fields.FindField(pfrmPointsPlot.strVar2Name);

                    ICursor pCursor = null;
                    featureSelection.SelectionSet.Search(null, false, out pCursor);

                    IRow pRow = pCursor.NextRow();
                    //IFeature pFeature = pFCursor.NextFeature();

                    int dblOriPtsSize = pfrmPointsPlot.pChart.Series[0].MarkerSize;

                    System.Drawing.Color pMarkerColor = System.Drawing.Color.Red;
                    var seriesPts = new System.Windows.Forms.DataVisualization.Charting.Series
                    {
                        Name              = "SelPoints",
                        Color             = pMarkerColor,
                        BorderColor       = pMarkerColor,
                        IsVisibleInLegend = false,
                        IsXValueIndexed   = false,
                        ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point,
                        MarkerStyle       = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle,
                        MarkerSize        = dblOriPtsSize * 2
                    };

                    var checkDup = pfrmPointsPlot.pChart.Series.FindByName("SelPoints");
                    if (checkDup != null)
                    {
                        pfrmPointsPlot.pChart.Series.RemoveAt(2);
                    }

                    pfrmPointsPlot.pChart.Series.Add(seriesPts);

                    while (pRow != null)
                    {
                        //Add Pts
                        seriesPts.Points.AddXY(pRow.get_Value(intVar1Idx), pRow.get_Value(intVar2Idx));
                        pRow = pCursor.NextRow();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception:" + ex.Message);
                return;
            }
        }
示例#2
0
        private void btnScatterplot_Click(object sender, EventArgs e)
        {
            //try
            //{
            //REngine pEngine = m_pForm.pEngine;

            string strTargetLayerName = cboTargetLayer.Text;
            string strVar1Name        = cboVariable1.Text;
            string strVar2Name        = cboVariable2.Text;

            int intTargetIndex   = m_pSnippet.GetIndexNumberFromLayerName(m_pActiveView, strTargetLayerName);
            int intNFeatureCount = 0;

            ILayer pTargetLayer = m_pForm.axMapControl1.get_Layer(intTargetIndex);

            IFeatureLayer pTargetFLayer = (IFeatureLayer)pTargetLayer;

            ////Extract geometry from selected feature
            IFeatureCursor pFCursor = null;

            //Draw scatter plot for only entire features 030117 HK
            //IFeatureSelection pFeatureSelection = pTargetFLayer as IFeatureSelection;
            //intNFeatureCount = pFeatureSelection.SelectionSet.Count;
            //if (intNFeatureCount > 0 && chkUseSelected.Checked == true)
            //{
            //    ICursor pCursor = null;

            //    pFeatureSelection.SelectionSet.Search(null, true, out pCursor);
            //    pFCursor = (IFeatureCursor)pCursor;

            //}
            //else if (intNFeatureCount == 0 && chkUseSelected.Checked == true)
            //{
            //    MessageBox.Show("Select at least one feature");
            //    return;
            //}
            //else
            //{
            //    pFCursor = pTargetFLayer.Search(null, true);
            //    intNFeatureCount = pTargetFLayer.FeatureClass.FeatureCount(null);
            //}

            pFCursor         = pTargetFLayer.Search(null, true);
            intNFeatureCount = pTargetFLayer.FeatureClass.FeatureCount(null);
            IFeature pFeature = pFCursor.NextFeature();

            //Source and Group Field Index
            int intVar1Idx = pTargetFLayer.FeatureClass.Fields.FindField(strVar1Name);
            int intVar2Idx = pTargetFLayer.FeatureClass.Fields.FindField(strVar2Name);

            double[] adblVar1 = new double[intNFeatureCount];
            double[] adblVar2 = new double[intNFeatureCount];


            //Scatter Plot
            frmScatterPlotResults pfrmScatterPlotResult = new frmScatterPlotResults();

            pfrmScatterPlotResult.Text = "Scatter Plot of " + pTargetFLayer.Name;
            pfrmScatterPlotResult.pChart.Series.Clear();
            System.Drawing.Color pMarkerColor = System.Drawing.Color.Blue;
            var seriesPts = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "Points",
                Color             = pMarkerColor,
                BorderColor       = pMarkerColor,
                IsVisibleInLegend = false,
                IsXValueIndexed   = false,
                ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point,
                MarkerStyle       = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle
            };

            pfrmScatterPlotResult.pChart.Series.Add(seriesPts);

            //Manually Calculate Regression Coefficients

            double sumOfX        = 0;
            double sumOfY        = 0;
            double sumOfXSq      = 0;
            double sumOfYSq      = 0;
            double ssX           = 0;
            double ssY           = 0;
            double sumCodeviates = 0;
            double sCo           = 0;

            //Feature Value to Array
            int i = 0;

            while (pFeature != null)
            {
                double x = Convert.ToDouble(pFeature.get_Value(intVar1Idx));
                double y = Convert.ToDouble(pFeature.get_Value(intVar2Idx));

                adblVar1[i] = x;
                adblVar2[i] = y;
                //Add Pts
                seriesPts.Points.AddXY(x, y);

                sumCodeviates += x * y;
                sumOfX        += x;
                sumOfY        += y;
                sumOfXSq      += x * x;
                sumOfYSq      += y * y;

                i++;
                pFeature = pFCursor.NextFeature();
            }

            //Manually Calculate Regression Coefficients
            double count = Convert.ToDouble(intNFeatureCount);

            ssX = sumOfXSq - ((sumOfX * sumOfX) / count);
            ssY = sumOfYSq - ((sumOfY * sumOfY) / count);
            double RNumerator = (count * sumCodeviates) - (sumOfX * sumOfY);
            double RDenom     = (count * sumOfXSq - (sumOfX * sumOfX))
                                * (count * sumOfYSq - (sumOfY * sumOfY));

            sCo = sumCodeviates - ((sumOfX * sumOfY) / count);

            double meanX = sumOfX / count;
            double meanY = sumOfY / count;
            //double dblR = RNumerator / Math.Sqrt(RDenom);
            //double rsquared = dblR * dblR;
            double yintercept = meanY - ((sCo / ssX) * meanX);
            double slope      = sCo / ssX;

            ////Array to R vector.
            //NumericVector vecVar1 = pEngine.CreateNumericVector(adblVar1);
            //NumericVector vecVar2 = pEngine.CreateNumericVector(adblVar2);
            //pEngine.SetSymbol(strVar1Name, vecVar1);
            //pEngine.SetSymbol(strVar2Name, vecVar2);
            //////pEngine.Evaluate("library(car)");
            ////string strCommand = "scatterplot(" + strVar2Name + "~" + strVar1Name + ", smoother=F);";
            ////string strCommand = "plot(" + strVar1Name + ", " + strVar2Name + ");";
            ////string strTitle = "Scatterplot";

            ////pSnippet.drawPlottoForm(strTitle, strCommand);
            //NumericVector vecCoeff = pEngine.Evaluate("lm(" + strVar2Name + "~" + strVar1Name + ")$coefficients").AsNumeric();

            var seriesLine = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name  = "Line",
                Color = System.Drawing.Color.Red,
                //BorderColor = System.Drawing.Color.Black,
                IsVisibleInLegend = false,
                IsXValueIndexed   = false,
                ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line
            };

            pfrmScatterPlotResult.pChart.Series.Add(seriesLine);

            seriesLine.Points.AddXY(adblVar1.Min(), adblVar1.Min() * slope + yintercept);
            seriesLine.Points.AddXY(adblVar1.Max(), adblVar1.Max() * slope + yintercept);

            pfrmScatterPlotResult.pChart.ChartAreas[0].AxisX.Title = strVar1Name;
            pfrmScatterPlotResult.pChart.ChartAreas[0].AxisY.Title = strVar2Name;

            //Define min and max for y axis
            double dblYmin   = adblVar2.Min();
            double dblYMax   = adblVar2.Max();
            double dblOffset = (dblYMax - dblYmin) / 20;

            if (dblYmin > 0 && dblYmin < dblOffset)
            {
                pfrmScatterPlotResult.pChart.ChartAreas[0].AxisY.Minimum = 0;
            }
            else
            {
                pfrmScatterPlotResult.pChart.ChartAreas[0].AxisY.Minimum = dblYmin - dblOffset;
            }

            pfrmScatterPlotResult.pChart.ChartAreas[0].AxisY.Maximum = dblYMax + dblOffset;
            //For Presentation 030118 HK
            pfrmScatterPlotResult.pChart.ChartAreas[0].AxisY.LabelStyle.Format = "#.####";
            pfrmScatterPlotResult.pChart.ChartAreas[0].AxisX.LabelStyle.Format = "#.####";

            ////pfrmTemp.dblBreaks = dblBreaks;
            //pfrmScatterPlotResult.intGraphType = 1;
            pfrmScatterPlotResult.adblVar1      = adblVar1;
            pfrmScatterPlotResult.adblVar2      = adblVar2;
            pfrmScatterPlotResult.strVar1Name   = strVar1Name;
            pfrmScatterPlotResult.strVar2Name   = strVar2Name;
            pfrmScatterPlotResult.m_pForm       = m_pForm;
            pfrmScatterPlotResult.m_pActiveView = m_pActiveView;
            pfrmScatterPlotResult.m_pFLayer     = pTargetFLayer;
            //pfrmPtsPlot.Text = strTitle;
            pfrmScatterPlotResult.pMakerColor        = pMarkerColor;
            pfrmScatterPlotResult.lblRegression.Text = strVar2Name + " = " + slope.ToString("N3") + " * " + strVar1Name + " + " + yintercept.ToString("N3");
            //pfrmTemp.strFieldName = strFieldName;
            pfrmScatterPlotResult.Show();
            //this.Close();
            //}
            //catch (Exception ex)
            //{
            //    frmErrorLog pfrmErrorLog = new frmErrorLog();pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
            //    return;
            //}
        }
示例#3
0
        public string RemoveWarningByBrushingTechnique(IFeatureLayer pFLayer)
        {
            //try
            //{
            FormCollection pFormCollection = System.Windows.Forms.Application.OpenForms;
            //IActiveView pActiveView = mForm.axMapControl1.ActiveView;
            string strRelatedPlotName = string.Empty;

            for (int j = 0; j < pFormCollection.Count; j++)
            {
                if (pFormCollection[j].Name == "frmHistResults")//Brushing to Histogram
                {
                    frmHistResults pfrmHistResults = pFormCollection[j] as frmHistResults;
                    if (pfrmHistResults.pFLayer == pFLayer)
                    {
                        strRelatedPlotName += "Histogram, ";
                    }
                }
                if (pFormCollection[j].Name == "frmScatterPlotResults") //Brushing to Scatterplot
                {
                    frmScatterPlotResults pfrmPointsPlot = pFormCollection[j] as frmScatterPlotResults;
                    if (pfrmPointsPlot.m_pFLayer == pFLayer)
                    {
                        strRelatedPlotName += "Scatter plot, ";
                    }
                }
                if (pFormCollection[j].Name == "frmQQPlotResults") //Brushing to QQPlot
                {
                    frmQQPlotResults pfrmQQPlotResult = pFormCollection[j] as frmQQPlotResults;
                    if (pfrmQQPlotResult.m_pFLayer == pFLayer)
                    {
                        strRelatedPlotName += "QQ-plot, ";
                    }
                }
                //if (pFormCollection[j].Name == "frmAttributeTable")//Brushing to AttributeTable
                //{
                //    frmAttributeTable pfrmAttTable = pFormCollection[j] as frmAttributeTable;
                //    BrushingToAttTable(pfrmAttTable, pFLayer, featureSelection);
                //}
                if (pFormCollection[j].Name == "frmBoxPlotResults")//Brushing to AttributeTable
                {
                    frmBoxPlotResults pfrmBoxPlotResult = pFormCollection[j] as frmBoxPlotResults;
                    if (pfrmBoxPlotResult.pFLayer == pFLayer)
                    {
                        strRelatedPlotName += "Boxplot, ";
                    }
                }
                //if (pFormCollection[j].Name == "frmClassificationGraph")//Brushing to Optiize Graph
                //{
                //    frmClassificationGraph pfrmClassGraph = pFormCollection[j] as frmClassificationGraph;
                //    BrushingToOptimizeGraph(pfrmClassGraph, pFLayer, featureSelection);
                //}
                //if (pFormCollection[j].Name == "frmCSDesign")//Brushing to CS Graph
                //{
                //    frmCSDesign pfrmCSDesign = pFormCollection[j] as frmCSDesign;
                //    if (pfrmCSDesign.pFLayer == pFLayer)
                //        strRelatedPlotName += "Uncertainty Classification, ";
                //}
                if (pFormCollection[j].Name == "frmMScatterResults")//Brushing to Moran ScatterPlot
                {
                    frmMScatterResults pfrmMScatterPlot = pFormCollection[j] as frmMScatterResults;
                    if (pfrmMScatterPlot.m_pFLayer == pFLayer)
                    {
                        strRelatedPlotName += "Moran Scatter Plot, ";
                    }
                }
            }
            if (strRelatedPlotName != string.Empty)
            {
                strRelatedPlotName = strRelatedPlotName.Remove(strRelatedPlotName.Length - 2);
            }
            return(strRelatedPlotName);
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Exception:" + ex.Message);
            //    return;
            //}
        }
示例#4
0
        public void BrushingToOthers(IFeatureLayer pFLayer, IntPtr intPtrParent)
        {
            try
            {
                FormCollection pFormCollection = System.Windows.Forms.Application.OpenForms;
                //IActiveView pActiveView = mForm.axMapControl1.ActiveView;

                if (pFLayer.Visible)
                {
                    //Brushing to Mapcontrol
                    string            ShapeFieldName   = pFLayer.FeatureClass.ShapeFieldName;
                    IFeatureSelection featureSelection = (IFeatureSelection)pFLayer;


                    for (int j = 0; j < pFormCollection.Count; j++)
                    {
                        if (pFormCollection[j].Handle != intPtrParent)       // Brushing to Others
                        {
                            if (pFormCollection[j].Name == "frmHistResults") //Brushing to Histogram
                            {
                                frmHistResults pfrmHistResults = pFormCollection[j] as frmHistResults;
                                BrushingToHistogram(pfrmHistResults, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmScatterPlotResults") //Brushing to Scatterplot
                            {
                                frmScatterPlotResults pfrmPointsPlot = pFormCollection[j] as frmScatterPlotResults;
                                BrushingToScatterPlot(pfrmPointsPlot, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmQQPlotResults") //Brushing to QQPlot
                            {
                                frmQQPlotResults pfrmQQPlotResult = pFormCollection[j] as frmQQPlotResults;
                                BrushingToQQPlot(pfrmQQPlotResult, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmAttributeTable")//Brushing to AttributeTable
                            {
                                frmAttributeTable pfrmAttTable = pFormCollection[j] as frmAttributeTable;
                                BrushingToAttTable(pfrmAttTable, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmBoxPlotResults")//Brushing to AttributeTable
                            {
                                frmBoxPlotResults pfrmBoxPlotResult = pFormCollection[j] as frmBoxPlotResults;
                                BrushingToBoxPlot(pfrmBoxPlotResult, pFLayer, featureSelection);
                            }
                            //if (pFormCollection[j].Name == "frmClassificationGraph")//Brushing to Optiize Graph
                            //{
                            //    frmClassificationGraph pfrmClassGraph = pFormCollection[j] as frmClassificationGraph;
                            //    BrushingToOptimizeGraph(pfrmClassGraph, pFLayer, featureSelection);
                            //}
                            //if (pFormCollection[j].Name == "frmCSDesign")//Brushing to CS Graph
                            //{
                            //    frmCSDesign pfrmCSDesign = pFormCollection[j] as frmCSDesign;
                            //    BrushingToClassSepGraph(pfrmCSDesign, pFLayer, featureSelection);
                            //}
                            if (pFormCollection[j].Name == "frmMScatterResults")//Brushing to Moran ScatterPlot
                            {
                                frmMScatterResults pfrmMScatterPlot = pFormCollection[j] as frmMScatterResults;
                                BrushingToMScatterPlot(pfrmMScatterPlot, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmCCMapsResults")//Brushing to Moran ScatterPlot
                            {
                                frmCCMapsResults pfrmCCMApsResults = pFormCollection[j] as frmCCMapsResults;
                                BrushingToCCMaps(pfrmCCMApsResults, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmBoxCox")//Brushing to Box-Cox transformation tool
                            {
                                frmBoxCox pfrmBoxCox = pFormCollection[j] as frmBoxCox;
                                BrushingToBoxCox(pfrmBoxCox, pFLayer, featureSelection);
                            }
                            if (pFormCollection[j].Name == "frmCorrelogram_local")//Brushing to Correlogram
                            {
                                frmCorrelogram_local pfrmCorrelogram = pFormCollection[j] as frmCorrelogram_local;
                                BrushingToCorrelogram(pfrmCorrelogram, pFLayer, featureSelection);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception:" + ex.Message);
                return;
            }
        }
示例#5
0
        public void CloseAllRelatedPlots(IFeatureLayer pFLayer)
        {
            //try
            //{
            FormCollection pFormCollection = System.Windows.Forms.Application.OpenForms;
            List <int>     lstPlotIdx      = new List <int>();

            for (int j = 0; j < pFormCollection.Count; j++)
            {
                if (pFormCollection[j].Name == "frmHistResults")//Brushing to Histogram
                {
                    frmHistResults pfrmHistResults = pFormCollection[j] as frmHistResults;
                    if (pfrmHistResults.pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                if (pFormCollection[j].Name == "frmScatterPlotResults") //Brushing to Scatterplot
                {
                    frmScatterPlotResults pfrmPointsPlot = pFormCollection[j] as frmScatterPlotResults;
                    if (pfrmPointsPlot.m_pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                if (pFormCollection[j].Name == "frmQQPlotResults") //Brushing to QQPlot
                {
                    frmQQPlotResults pfrmQQPlotResult = pFormCollection[j] as frmQQPlotResults;
                    if (pfrmQQPlotResult.m_pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                if (pFormCollection[j].Name == "frmAttributeTable")//Brushing to AttributeTable
                {
                    frmAttributeTable pfrmAttTable = pFormCollection[j] as frmAttributeTable;
                    if (pfrmAttTable.m_pLayer == (ILayer)pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                if (pFormCollection[j].Name == "frmBoxPlotResults")//Brushing to AttributeTable
                {
                    frmBoxPlotResults pfrmBoxPlotResult = pFormCollection[j] as frmBoxPlotResults;
                    if (pfrmBoxPlotResult.pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                //if (pFormCollection[j].Name == "frmClassificationGraph")//Brushing to Optiize Graph
                //{
                //    frmClassificationGraph pfrmClassGraph = pFormCollection[j] as frmClassificationGraph;
                //    BrushingToOptimizeGraph(pfrmClassGraph, pFLayer, featureSelection);
                //}
                //if (pFormCollection[j].Name == "frmCSDesign")//Brushing to CS Graph
                //{
                //    frmCSDesign pfrmCSDesign = pFormCollection[j] as frmCSDesign;
                //    if (pfrmCSDesign.pFLayer == pFLayer)
                //        lstPlotIdx.Add(j);
                //}
                if (pFormCollection[j].Name == "frmMScatterResults")//Brushing to Moran ScatterPlot
                {
                    frmMScatterResults pfrmMScatterPlot = pFormCollection[j] as frmMScatterResults;
                    if (pfrmMScatterPlot.m_pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
                if (pFormCollection[j].Name == "frmCorrelogram_local")//Brushing to Correlogram
                {
                    frmCorrelogram_local pfrmCorrelogram = pFormCollection[j] as frmCorrelogram_local;
                    if (pfrmCorrelogram.m_pFLayer == pFLayer)
                    {
                        lstPlotIdx.Add(j);
                    }
                }
            }

            lstPlotIdx.Sort();
            for (int j = lstPlotIdx.Count - 1; j >= 0; j--)
            {
                pFormCollection[lstPlotIdx[j]].Close();
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Exception:" + ex.Message);
            //    return;
            //}
        }
示例#6
0
        public int RemoveBrushing(MainForm mForm, IFeatureLayer pFLayer)
        {
            try
            {
                FormCollection pFormCollection = System.Windows.Forms.Application.OpenForms;
                IActiveView    pActiveView     = mForm.axMapControl1.ActiveView;
                int            intFormCnt      = 0;
                if (pFLayer.Visible)
                {
                    //Brushing to Mapcontrol
                    string ShapeFieldName = pFLayer.FeatureClass.ShapeFieldName;
                    //IFeatureSelection featureSelection = (IFeatureSelection)pFLayer;


                    for (int j = 0; j < pFormCollection.Count; j++)
                    {
                        if (pFormCollection[j].Name == "frmHistResults")//Brushing to Histogram
                        {
                            frmHistResults pfrmHistResults = pFormCollection[j] as frmHistResults;
                            if (pfrmHistResults.pFLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                        if (pFormCollection[j].Name == "frmScatterPlotResults") //Brushing to Scatterplot
                        {
                            frmScatterPlotResults pfrmPointsPlot = pFormCollection[j] as frmScatterPlotResults;
                            if (pfrmPointsPlot.m_pFLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                        if (pFormCollection[j].Name == "frmQQPlotResults") //Brushing to QQPlot
                        {
                            frmQQPlotResults pfrmQQPlotResult = pFormCollection[j] as frmQQPlotResults;
                            if (pfrmQQPlotResult.m_pFLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                        if (pFormCollection[j].Name == "frmAttributeTable")//Brushing to AttributeTable
                        {
                            frmAttributeTable pfrmAttTable = pFormCollection[j] as frmAttributeTable;
                            if ((IFeatureLayer)pfrmAttTable.m_pLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                        if (pFormCollection[j].Name == "frmBoxPlotResults")//Brushing to AttributeTable
                        {
                            frmBoxPlotResults pfrmBoxPlotResult = pFormCollection[j] as frmBoxPlotResults;
                            if (pfrmBoxPlotResult.pFLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                        //if (pFormCollection[j].Name == "frmClassificationGraph")//Brushing to Optiize Graph
                        //{
                        //    frmClassificationGraph pfrmClassGraph = pFormCollection[j] as frmClassificationGraph;
                        //    if (pfrmClassGraph.m_pFLayer == pFLayer)
                        //        intFormCnt++;
                        //}
                        if (pFormCollection[j].Name == "frmMScatterResults")//Brushing to Moran ScatterPlot
                        {
                            frmMScatterResults pfrmMScatterPlot = pFormCollection[j] as frmMScatterResults;
                            if (pfrmMScatterPlot.m_pFLayer == pFLayer)
                            {
                                intFormCnt++;
                            }
                        }
                    }
                    return(intFormCnt);
                }
                else
                {
                    return(-1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception:" + ex.Message);
                return(-1);
            }
        }