Пример #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Set passed file to variable
            string[] arguments = Environment.GetCommandLineArgs();
            if (arguments.Length == 1)
            {
                MessageBox.Show("No filename passed", "CAD Fileviewer");
                this.Close();
                return;
            }

            string workspacePath = System.IO.Path.GetDirectoryName(arguments[1]);
            string fileName      = System.IO.Path.GetFileName(arguments[1]);

            //Add passed file to MapControl
            ICadDrawingDataset cadDrawingDataset = GetCadDataset(workspacePath, fileName);

            if (cadDrawingDataset == null)
            {
                return;
            }
            ICadLayer cadLayer = new CadLayerClass();

            cadLayer.CadDrawingDataset = cadDrawingDataset;
            cadLayer.Name = fileName;
            axMapControl1.AddLayer(cadLayer, 0);
        }
Пример #2
0
 /// <summary>
 /// 加载地图服务
 /// </summary>
 /// <param name="RestURL"></param>
 public void LoadMapService(string RestURL)
 {
     try
     {
         IMapServerRESTLayer pRestLayer;
         pRestLayer = new MapServerRESTLayer();
         pRestLayer.Connect(RestURL);
         mapControl.AddLayer(pRestLayer as ILayer);
         mapControl.Refresh();
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }