示例#1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            frmProgress pfrmProgress = new frmProgress();

            pfrmProgress.lblStatus.Text    = "Processing:";
            pfrmProgress.pgbProgress.Style = ProgressBarStyle.Marquee;
            pfrmProgress.Show();
            IFeatureLayer pFlayer = new FeatureLayer();

            pFlayer.FeatureClass = m_pFClass;

            //Get the file path and name to create spatial weight matrix
            string strNameR = m_pSnippet.FilePathinRfromLayer(pFlayer);

            if (strNameR == null)
            {
                return;
            }

            int intSuccess = 0;

            //Create spatial weight matrix in R
            if (m_pFClass.ShapeType == esriGeometryType.esriGeometryPolygon)
            {
                m_pEngine.Evaluate("sample.shp <- readShapePoly('" + strNameR + "')");
                intSuccess = m_pSnippet.CreateSpatialWeightMatrix1(m_pEngine, m_pFClass, txtSWM.Text, pfrmProgress, Convert.ToDouble(nudAdvanced.Value), chkCumulate.Checked);
            }
            else if (m_pFClass.ShapeType == esriGeometryType.esriGeometryPoint)
            {
                m_pEngine.Evaluate("sample.shp <- readShapePoints('" + strNameR + "')");
                //intSuccess = m_pSnippet.ExploreSpatialWeightMatrix1(m_pEngine, m_pFClass, txtSWM.Text, pfrmProgress, Convert.ToDouble(nudAdvanced.Value), chkCumulate.Checked);
                intSuccess = m_pSnippet.CreateSpatialWeightMatrixPts(m_pEngine, m_pFClass, txtSWM.Text, pfrmProgress, Convert.ToDouble(nudAdvanced.Value), chkCumulate.Checked, m_pClippedPolygon);

                //chkCumulate.Visible = false;
            }
            else
            {
                MessageBox.Show("This geometry type is not supported");
                pfrmProgress.Close();
                this.Close();
            }

            if (intSuccess == 0)
            {
                return;
            }

            blnSWMCreation = true;
            pfrmProgress.Close();
            this.Close();
        }