예제 #1
0
        private void AddMatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmMatch frm = new FrmMatch();

            frm.Show();
        }
예제 #2
0
        //TODO :数据集中的下一步操作
        /// <summary>
        /// 下一步
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNext_Click(object sender, EventArgs e)
        {
            try
            {
                sourceDataAdd.buttonXNext_Click();
                targetDataAdd.buttonXNext_Click();

                IFeatureClass pSourceFeatCls = sourceDataAdd.InRowDic[0].Cells[1].Tag as IFeatureClass;
                IFeatureClass pTarFeatCls    = targetDataAdd.OutRowDic[0].Cells[1].Tag as IFeatureClass;
                //如果源图层和待匹配图层的类型不一样
                if (pSourceFeatCls.ShapeType != pTarFeatCls.ShapeType)
                {
                    FrmDifShape frmDifShape = new FrmDifShape();
                    frmDifShape.InRowDic     = sourceDataAdd.InRowDic;
                    frmDifShape.OutRowDic    = targetDataAdd.OutRowDic;
                    frmDifShape.PreviousForm = this;
                    this.Visible             = false;
                    frmDifShape.ShowDialog();
                }
                //如果源图层和待匹配图层的类型一样
                else
                {
                    if (pSourceFeatCls.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        //不同尺度下的匹配更新
                        if (!ClsDeclare.g_SameScaleMatch && ClsDeclare.g_DifScaleMatch)
                        {
                            // 20170906
                            //Dictionary<string, string> strDic = new Dictionary<string, string>();
                            //strDic.Add("1:500", "0.5k");
                            //strDic.Add("1:2000", "2K");
                            //strDic.Add("1:10000", "10K");
                            //string temStrF = strDic[ClsDeclare.strFrom];
                            //string temStrT = strDic[ClsDeclare.strTo];
                            //test
                            //string test = sourceDataAdd.InRowDic[0].Cells[1].Value.ToString();
                            //string test2 = targetDataAdd.OutRowDic[0].Cells[1].Value.ToString();

                            //////20170504 注释掉
                            //if (!sourceDataAdd.InRowDic[0].Cells[1].Value.ToString().Contains(temStrF))
                            //{
                            //    MessageBoxEx.Show("请选择正确的尺度数据!");
                            //    return;
                            //}
                            //if (!updataDataAdd.OutRowDic[0].Cells[1].Value.ToString().Contains(temStrT))
                            //{
                            //    MessageBoxEx.Show("请选择正确的尺度数据!");
                            //    return;
                            //}

                            FrmMatchPolygonDif frmMatchPolygonDif = new FrmMatchPolygonDif();
                            frmMatchPolygonDif.InRowDic     = sourceDataAdd.InRowDic;
                            frmMatchPolygonDif.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMatchPolygonDif.PreviousForm = this;
                            this.Visible = false;
                            frmMatchPolygonDif.ShowDialog();
                        }
                        //同尺度下的匹配更新(同比例尺下的匹配更新)
                        if (ClsDeclare.g_SameScaleMatch && !ClsDeclare.g_DifScaleMatch)
                        {
                            FrmMatch frmMatch = new FrmMatch();
                            frmMatch.InRowDic     = sourceDataAdd.InRowDic;
                            frmMatch.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMatch.PreviousForm = this;
                            this.Visible          = false;
                            frmMatch.ShowDialog();
                        }
                    }
                    else if (pSourceFeatCls.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        if (ClsDeclare.g_SameScaleMatch && !ClsDeclare.g_DifScaleMatch)
                        {
                            FrmMatchLineDif frmMathLineDif = new FrmMatchLineDif();
                            frmMathLineDif.InRowDic     = sourceDataAdd.InRowDic;
                            frmMathLineDif.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMathLineDif.PreviousForm = this;
                            this.Visible = false;
                            frmMathLineDif.ShowDialog();
                        }
                        //不同比例尺下的
                        else if (!ClsDeclare.g_SameScaleMatch && ClsDeclare.g_DifScaleMatch)
                        {
                            FrmMatchLineDif frmMathLineDif = new FrmMatchLineDif();
                            frmMathLineDif.InRowDic     = sourceDataAdd.InRowDic;
                            frmMathLineDif.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMathLineDif.PreviousForm = this;
                            this.Visible = false;
                            frmMathLineDif.ShowDialog();

                            //FrmMatchPolylineParaDifScale frmMatchPolylineParaDifScale = new FrmMatchPolylineParaDifScale();
                            //frmMatchPolylineParaDifScale.DGVCell = cell;
                            //frmMatchPolylineParaDifScale.WorkspacePath = ClsDeclare.g_WorkspacePath;
                            //frmMatchPolylineParaDifScale.TUFeatCls = pTUFeatCls;
                            //frmMatchPolylineParaDifScale.TEFeatCls = pTEFeatCls;
                            //frmMatchPolylineParaDifScale.MatchedFCName = fileName;
                            //frmMatchPolylineParaDifScale.ShowDialog();
                        }
                    }
                    else if (pSourceFeatCls.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        //同比例尺下匹配
                        if (ClsDeclare.g_SameScaleMatch && !ClsDeclare.g_DifScaleMatch)
                        {
                            FrmMatchPointDif frmMathLine = new FrmMatchPointDif();
                            frmMathLine.InRowDic     = sourceDataAdd.InRowDic;
                            frmMathLine.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMathLine.PreviousForm = this;
                            this.Visible             = false;
                            frmMathLine.ShowDialog();
                        }
                        //不同比例尺下匹配
                        else if (!ClsDeclare.g_SameScaleMatch && ClsDeclare.g_DifScaleMatch)
                        {
                            FrmMatchPointDif frmMatchPointDif = new FrmMatchPointDif();
                            frmMatchPointDif.InRowDic     = sourceDataAdd.InRowDic;
                            frmMatchPointDif.OutRowDic    = targetDataAdd.OutRowDic;
                            frmMatchPointDif.PreviousForm = this;
                            this.Visible = false;
                            frmMatchPointDif.ShowDialog();
                        }
                    }
                }
                #region 以前注释
                //int sourceLayerCount = 0;
                //int updataLayerCount = 0;
                //for (int i = 0; i < dgvSource.Rows.Count; i++)
                //{
                //    DataGridViewCheckBoxCell ckb = dgvSource.Rows[i].Cells[0] as DataGridViewCheckBoxCell;
                //    if (Convert.ToBoolean(ckb))
                //    {
                //        sourceLayerCount++;
                //    }
                //}
                //for (int i = 0; i < dgvUpdata.Rows.Count; i++)
                //{
                //    DataGridViewCheckBoxCell ckb = dgvUpdata.Rows[i].Cells[0] as DataGridViewCheckBoxCell;
                //    if (Convert.ToBoolean(ckb))
                //    {
                //        updataLayerCount++;
                //    }
                //}
                //if (sourceLayerCount != 1)
                //{
                //    MessageBoxEx.Show("源数据选择图层为0或两个以上,请重新勾选。", "提示");
                //    return;
                //}
                //if (updataLayerCount != 1)
                //{
                //    MessageBoxEx.Show("更新数据选择图层为0或两个以上,请重新勾选。", "提示");
                //    return;
                //}
                #endregion
            }
            catch (Exception ex)
            {
                this.Visible = true;
                MessageBox.Show(ex.StackTrace);
                MessageBoxEx.Show("请将更新数据放入GDB中再添加!");
            }
        }