Exemplo n.º 1
0
        /// <summary>
        /// 通过数据库的类型与ID,获取其连接信息的XML cyf 20110614 modify:
        /// </summary>
        /// <param name="lDBTypeID">数据库类型ID</param>
        /// <param name="lDBID">数据库ID</param>
        /// <returns>XmlElement</returns>
        private XmlElement GetDBConInfoEle(long lDBTypeID, long lDBID)
        {
            //cyf 20110614 modify
            XmlDocument DOC      = new XmlDocument();
            string      sXmlFile = string.Empty;

            if (lDBTypeID.ToString() == enumInterDBType.框架要素数据库.GetHashCode().ToString())
            {
                sXmlFile = ModuleData.v_feaProjectXML;
            }
            else if (lDBTypeID.ToString() == enumInterDBType.影像数据库.GetHashCode().ToString())
            {
                //cyf 20110608 modify
                //sXmlFile = ModuleData.v_ImageProjectXml;
                sXmlFile = ModuleData.v_feaProjectXML;
            }
            //end
            else if (lDBTypeID.ToString() == enumInterDBType.高程数据库.GetHashCode().ToString())
            {
                //cyf 20110608 modify
                //sXmlFile = ModuleData.v_DEMProjectXml;
                sXmlFile = ModuleData.v_feaProjectXML;
            }
            //end
            else
            {
                return(null);/////////////其他库体待实现
            }
            try
            {
                DOC.Load(sXmlFile);
                XmlElement DBConnectinfo = ProjectXml.GetProjectInfo(DOC, lDBID);
                return(DBConnectinfo);
            }
            catch (Exception eError)
            {
                if (null == ModuleData.v_SysLog)
                {
                    ModuleData.v_SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                }
                ModuleData.v_SysLog.Write(eError);
                return(null);
            }
        }
Exemplo n.º 2
0
        public override void OnClick()
        {
            ///////////第一步:获取数据库的ID以及数据库类型名,平台名//////////////////
            DevComponents.AdvTree.Node CurProNode = this.m_Hook.ProjectTree.SelectedNode;
            string sDBType    = string.Empty;
            string sDBFormate = string.Empty;
            long   iDBId      = -1;

            if (CurProNode == null)
            {
                return;
            }
            XmlElement DbInfoEle = CurProNode.Tag as XmlElement;

            if (DbInfoEle == null)
            {
                return;
            }
            try
            {
                Exception eError = null;
                iDBId      = (long)CurProNode.DataKey;
                sDBType    = DbInfoEle.GetAttribute("数据库类型");
                sDBFormate = DbInfoEle.GetAttribute("数据库平台");
                if (!sDBFormate.StartsWith("ARCGIS"))
                {
                    return;                                  /////////////////////不是ARCGIS平台的数据暂时不处理
                }
                XmlElement DBConnectinfo = null;
                if (sDBType == "框架要素数据库")
                {
                    /////////////////加载框架要素数据库///////////////////
                    #region 加载框架要素数据库
                    XmlDocument Doc = new XmlDocument();
                    Doc.Load(ModuleData.v_feaProjectXML);
                    DBConnectinfo = ProjectXml.GetProjectInfo(Doc, iDBId);
                    //////////////////////进行加载/////////////////////////
                    ClsArcGisLayerOper.AddFeaLayer(this.m_Hook, DBConnectinfo, "", out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "加载数据发生异常:" + eError.Message);
                        return;
                    }
                    else
                    {
                        ////符号化////
                        //符号化
                        GeoUtilities.ControlsRenderLayerByMxd RenderLayerByMxd = new GeoUtilities.ControlsRenderLayerByMxd();
                        RenderLayerByMxd.OnCreate(m_Hook);
                        RenderLayerByMxd.OnClick();
                    }
                    #endregion
                }
                else if (sDBType == "高程数据库" || sDBType == "影像数据库")
                {
                    #region 加载栅格数据库
                    ///////////////加载栅格数据库////////////////////////
                    XmlDocument Doc = new XmlDocument();
                    if (sDBType == "高程数据库")
                    {
                        Doc.Load(ModuleData.v_DEMProjectXml);
                    }
                    else
                    {
                        Doc.Load(ModuleData.v_ImageProjectXml);
                    }
                    DBConnectinfo = ProjectXml.GetProjectInfo(Doc, iDBId);
                    ///////////////////////进行加载//////////////////////
                    ClsArcGisLayerOper.AddRasterLayer(this.m_Hook, DBConnectinfo, out eError);
                    if (eError != null)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "加载数据发生异常:" + eError.Message);
                        return;
                    }
                    #endregion
                }
                else
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "不能加载的数据库图层");
                    return;
                }
            }
            catch
            {
            }
        }