Пример #1
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.com_jointype.Text))
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请选择一个接边类型!");
                return;
            }
            if (string.IsNullOrEmpty(this.com_MergeAtrSet.Text))
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请选择要素融合属性数据处理类型!");
                return;
            }
            double      dDisTo     = this.con_DisTo.Value;;
            double      dSeacherTo = this.con_SearchTo.Value;
            double      dAngleTo   = this.con_AngleTo.Value;
            double      dLengthTo  = this.con_LengthTo.Value;
            XmlDocument XmlDoc     = new XmlDocument();

            XmlDoc.Load(ModData.v_JoinSettingXML);
            if (null == XmlDoc)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取接边参数配置文件失败!");
                return;
            }
            XmlElement ele = XmlDoc.SelectSingleNode(".//接边设置") as XmlElement;

            ele.SetAttribute("距离容差", dDisTo.ToString());
            ele.SetAttribute("搜索容差", dSeacherTo.ToString());
            ele.SetAttribute("角度容差", dAngleTo.ToString());
            ele.SetAttribute("长度容差", dLengthTo.ToString());
            ele.SetAttribute("接边类型", this.com_jointype.Text.Trim());
            if (this.check_RemovePoPnt.Checked == true)
            {
                ele.SetAttribute("删除多边形多余点", "Y");
            }
            else
            {
                ele.SetAttribute("删除多边形多余点", "N");
            }

            if (this.check_Simplify.Checked == true)
            {
                ele.SetAttribute("简单化要素", "Y");
            }
            else
            {
                ele.SetAttribute("简单化要素", "N");
            }

            XmlElement ele2 = XmlDoc.SelectSingleNode(".//融合设置") as XmlElement;

            if (this.com_MergeAtrSet.Text.Trim() == "添加到源要素")
            {
                ele2.SetAttribute("属性覆盖", "N");
            }
            else
            {
                ele2.SetAttribute("属性覆盖", "Y");
            }
            XmlElement ele3 = XmlDoc.SelectSingleNode(".//日志设置") as XmlElement;

            if (this.logcheck.Checked == true)
            {
                if (!string.IsNullOrEmpty(this.label_LogPath.Text))
                {
                    ele3.SetAttribute("日志路径", this.label_LogPath.Text.Trim());
                }
            }
            else
            {
                ele3.SetAttribute("日志路径", string.Empty);
            }

            try
            {
                XmlDoc.Save(ModData.v_JoinSettingXML);
            }
            catch (Exception er)
            {
                //*******************************************************************
                //guozheng added
                if (ModData.SysLog != null)
                {
                    ModData.SysLog.Write(er, null, DateTime.Now);
                }
                else
                {
                    ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                    ModData.SysLog.Write(er, null, DateTime.Now);
                }
                //********************************************************************
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "接边配置文件参数写入失败!\n 请确认文件是否只读:\n" + ModData.v_JoinSettingXML);
                return;
            }
            if (this.logcheck.Checked == true)
            {
                IJoinLOG  JoinLog = new ClsJoinLog();
                Exception ex      = null;
                JoinLog.InitialLog(out ex);
                if (null != ex)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
                    return;
                }
            }
            this.Close();
        }