页面载入中....  
页面载入中....
时 间 记 忆
页面载入中....
最 新 评 论
页面载入中....
专 题 分 类
页面载入中....
最 新 日 志
页面载入中....
最 新 留 言
页面载入中....
搜 索
用 户 登 录
页面载入中....
友 情 连 接
博 客 信 息
页面载入中....


 
原创:加载目录下所有shape文件
[ 2008-5-5 16:50:00 | By: luyuan-cyj ]
 

        private void addShapeToMap()
        {
            string[] filename;
            int index = 0;

            DirectoryInfo directory = new DirectoryInfo(strPath);           
            FileInfo[] files = directory.GetFiles();           
            filename = new string[files.Length];
            foreach (FileInfo file in files)
            {
                filename[index] = file.Name;
                index++;
            }

            if (strPath != "")
            {
                IFeatureLayer pfeatlyr;               
                for (int i = 0; i < filename.Length; i++)
                {
                    int loc = filename[i].LastIndexOf(".");
                    string strTemp = filename[i].Substring(loc);
                    if (strTemp == ".shp")                    {
                        pfeatlyr = m_MapFun.GetFeatLayerFrom(strPath, filename[i]);
                        pfeatlyr.Name = filename[i].Substring(0, filename[i].Length - loc-1);
                        m_AxMapContrl.AddLayer(pfeatlyr);
                    }
                }
            }       
        }

 
发表评论:
页面载入中....
Powered by Oblog.