예제 #1
0
        /// <summary>
        /// 从另一张表复制数据
        /// </summary>
        /// <param name="ZFClass"></param>
        /// <param name="clear">是否清空原数据</param>
        public void CopyFrom(ZFeatureClass ZFClass, bool clear = false)
        {
            if (clear)
            {
                Delete();
            }
            ZFeatureCursor cursor = ZFClass.Search();

            CopyFrom(cursor);
        }
예제 #2
0
 /// <summary>
 /// 重命名FeatureClass
 /// </summary>
 /// <param name="oldName"></param>
 /// <param name="newName"></param>
 /// <returns></returns>
 public bool ReName(string oldName, string newName)
 {
     try
     {
         ZFeatureClass fc = OpenFeatureClass(oldName);
         fc.ReName(newName);
     }
     catch {
         return(false);
     }
     return(true);
 }
예제 #3
0
        /// <summary>
        /// 复制图层
        /// </summary>
        /// <param name="oldName"></param>
        /// <param name="newName"></param>
        /// <param name="copyReords">思否复制记录</param>
        public ZFeatureClass CopyFeatureClass(string oldName, string newName, bool copyReords = false)
        {
            ZFeatureClass oldFClass = OpenFeatureClass(oldName);

            if (oldFClass != null)
            {
                ZFields       fields    = oldFClass.zFields.Clone();
                ZFeatureClass newFClass = CreateFeatureClass(newName, fields, oldFClass.FeatureType, oldFClass.ShapeFieldName);
                if (copyReords)
                {
                    newFClass.CopyFrom(oldFClass);
                }
                return(newFClass);
            }
            return(null);
        }