コード例 #1
0
ファイル: RasterUtility.cs プロジェクト: secondii/Yutai
        public static IRasterCatalog createCatalog(IRasterWorkspaceEx irasterWorkspaceEx_0, string string_0,
                                                   string string_1, string string_2, ISpatialReference ispatialReference_0,
                                                   ISpatialReference ispatialReference_1, bool bool_0, IFields ifields_0, string string_3)
        {
            if (ifields_0 == null)
            {
                ifields_0 = createFields(string_1, string_2, bool_0, ispatialReference_0, ispatialReference_1);
            }
            if (string_3.Length == 0)
            {
                string_3 = "DEFAULTS";
            }
            IRasterCatalog catalog = null;

            try
            {
                catalog = irasterWorkspaceEx_0.CreateRasterCatalog(string_0, ifields_0, string_2, string_1, string_3);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            return(catalog);
        }
コード例 #2
0
ファイル: FrmCreateRasterDB.cs プロジェクト: siszoey/geosufan
        /// <summary>
        /// 在Geodatabase中创建栅格数据编目
        /// </summary>
        /// <param name="pRasterWSEx">目标Geodatabase工作区</param>
        /// <param name="pCatalogName">栅格编目的名称</param>
        /// <param name="pRasterFielsName">栅格列的名称</param>
        /// <param name="pShapeFieldName">几何要素列名称(Shape)</param>
        /// <param name="pRasterSpatialRef">几何要素列空间参考</param>
        /// <param name="pGeoSpatialRef">栅格列空间参考</param>
        /// <param name="pKeyword"> 栅格编目表的字段</param>
        /// <param name="eError">ArcSDE 适用, 表示configuration keyword</param>
        /// <returns></returns>
        private IRasterCatalog CreateCatalog(IRasterWorkspaceEx pRasterWSEx, string pCatalogName, string pRasterFielsName, string pShapeFieldName, ISpatialReference pRasterSpatialRef, ISpatialReference pGeoSpatialRef, string pKeyword, bool ismanaged, out Exception eError)
        {
            eError = null;
            IRasterCatalog pRasterCat = null;

            try
            {
                #region 创建字段
                IFields     pFields     = new FieldsClass();
                IFieldsEdit pFeildsEdit = pFields as IFieldsEdit;
                IField      pField      = null;

                pField = CreateCommonField("Name", esriFieldType.esriFieldTypeString);
                if (pField == null)
                {
                    eError = new Exception("创建'name'字段出错!");
                    return(null);
                }
                pFeildsEdit.AddField(pField);

                IField2 pField2 = CreateRasterField(pRasterFielsName, pRasterSpatialRef, ismanaged);
                if (pField == null)
                {
                    eError = new Exception("创建栅格字段出错!");
                    return(null);
                }
                pFeildsEdit.AddField(pField2);
                pField = CreateShapeField(pShapeFieldName, pGeoSpatialRef);
                if (pField == null)
                {
                    eError = new Exception("创建几何字段出错!");
                    return(null);
                }
                pFeildsEdit.AddField(pField);
                pField = CreateOIDField("OBJECTID");
                if (pField == null)
                {
                    eError = new Exception("创建OID字段出错!");
                    return(null);
                }
                pFeildsEdit.AddField(pField);
                pField = null;
                if (pKeyword.Trim() == "")
                {
                    pKeyword = "defaults";
                }
                pFields = pFeildsEdit as IFields;

                //创建用户自定义字段
                #endregion

                pRasterCat = pRasterWSEx.CreateRasterCatalog(pCatalogName, pFields, pShapeFieldName, pRasterFielsName, pKeyword);

                return(pRasterCat);
            }
            catch (System.Exception ex)
            {
                //*******************************************************************
                //guozheng added
                if (ModData.SysLog != null)
                {
                    ModData.SysLog.Write(ex, null, DateTime.Now);
                }
                else
                {
                    ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog();
                    ModData.SysLog.Write(ex, null, DateTime.Now);
                }
                //********************************************************************

                eError = new Exception("创建栅格编目出错!\n" + ex.Message);
                return(null);
            }
        }