zoukankan      html  css  js  c++  java
  • 常用方法

    一,获取Mxd地图文档的路径
    /// <summary>
            /// 获取Mxd地图文档的路径
            /// </summary>
            /// <param name="MapControl"></param>
            private string OpenMxFile()
            {
                string mxdFile = "" ;
     
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.InitialDirectory = @"D:Program Files (x86)ArcGISDeveloperKit10.2Samplesdata";
                ofd.Filter = "Map Documents(*.Mxd)|*.mxd";
     
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    mxdFile = ofd.FileName;
     
                }
     
                return mxdFile;
            }


    二,获取ShapeFile的路径
    /// <summary>
            /// 获取ShapeFile的路径
            /// </summary>
            /// <returns></returns>
            private string[] OpenShapeFile()
            { 
              string[] ShpFile = new string[2];
              OpenFileDialog ofd = new OpenFileDialog();
              ofd.Title = "打开shp文件";
              ofd.InitialDirectory = @"D:Program Files (x86)ArcGISDeveloperKit10.2Samplesdata";
              ofd.Filter = "Shp文件(*.shp)|*.shp";
     
              if (ofd.ShowDialog()== System.Windows.Forms.DialogResult.OK)
              {
                  string ShapePath = ofd.FileName;
                  
                  //利用"\"将文件路径分成两部分
                  int position = ShapePath.LastIndexOf("\");
                  string filePath = ShapePath.Substring(0,position);
                  string fileName = ShapePath.Substring(position+1);
                  ShpFile[0] = filePath;
                  ShpFile[1] = fileName;
     
              }
     
              return ShpFile;
            }


  • 相关阅读:
    2017-2018-1 20145237、20155205、20155218实验一 开发环境的熟悉
    作业三总结
    作业二总结
    作业总结1
    自我介绍
    计科16-4刘悦
    第九次作业
    作业八
    作业七
    作业六
  • 原文地址:https://www.cnblogs.com/Robert-huge/p/5855564.html
Copyright © 2011-2022 走看看