Exemple #1
0
        //加载数据
        private void LoadData()
        {
            m_Workspace = new Workspace();
            SuperMap.Data.WorkspaceConnectionInfo WCI = new SuperMap.Data.WorkspaceConnectionInfo();
            //string strDataPath = @"E:\Workroom\w文化部\数据\中间数据\orcl_172.smwu";
            string strDataPath  = @"E:\Workroom\w文化部\数据\中间数据\changzhou.smwu";
            string strSceneName = "MAP";

            WCI.Server = strDataPath;
            if (System.IO.Path.GetExtension(strDataPath).Equals(".sxwu"))
            {
                WCI.Type = SuperMap.Data.WorkspaceType.SXWU;
            }
            else
            {
                WCI.Type = SuperMap.Data.WorkspaceType.SMWU;
            }
            WCI.Version = SuperMap.Data.WorkspaceVersion.UGC60;
            if (m_Workspace.Open(WCI))
            {
                m_MapControl = new MapControl();
                this.splitContainer1.Panel2.Controls.Add(m_MapControl);
                m_MapControl.Dock          = DockStyle.Fill;
                m_MapControl.Map.Workspace = m_Workspace;
                m_MapControl.Map.Open(strSceneName);
            }
            else
            {
                MessageBox.Show("打开工作空间失败!");
            }
        }
Exemple #2
0
 //加载数据
 private void LoadData()
 {
     try
     {
         Workspace wks = new Workspace();
         SuperMap.Data.WorkspaceConnectionInfo WCI = new SuperMap.Data.WorkspaceConnectionInfo();
         OpenFileDialog dlg = new OpenFileDialog();
         dlg.Filter = "超图工作空间文件|*.sxwu;*.smwu|所有文件|*.*";
         if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string strDataPath  = dlg.FileName;// @"E:\Workroom\w文化部\数据\马燕\文化主体地理数据0814\市场主体.smwu";
             string strSceneName = "MAP";
             if (File.Exists(strDataPath))
             {
                 WCI.Server = strDataPath;
                 if (System.IO.Path.GetExtension(strDataPath).Equals(".sxwu"))
                 {
                     WCI.Type = SuperMap.Data.WorkspaceType.SXWU;
                 }
                 else
                 {
                     WCI.Type = SuperMap.Data.WorkspaceType.SMWU;
                 }
                 //WCI.Version = SuperMap.Data.WorkspaceVersion.UGC70;
                 if (wks.Open(WCI))
                 {
                     m_Workspace  = wks;
                     m_MapControl = new MapControl();
                     this.splitContainer1.Panel2.Controls.Add(m_MapControl);
                     m_MapControl.Dock          = DockStyle.Fill;
                     m_MapControl.Map.Workspace = m_Workspace;
                     m_MapControl.Map.Open(strSceneName);
                 }
                 else
                 {
                     MessageBox.Show("打开工作空间失败!");
                 }
             }
         }
     }
     catch { }
 }
Exemple #3
0
        private void LoadData()
        {
            m_wrkSpace = new Workspace();
            SuperMap.Data.WorkspaceConnectionInfo WCI = new SuperMap.Data.WorkspaceConnectionInfo();
            string        strDir       = AppDomain.CurrentDomain.BaseDirectory;
            DirectoryInfo di           = new DirectoryInfo(strDir);
            string        strDataPath  = string.Format("{0}data\\china25w2.smwu", AppDomain.CurrentDomain.BaseDirectory);
            string        strSceneName = "china";

            WCI.Server = strDataPath;
            if (System.IO.Path.GetExtension(strDataPath).Equals(".sxwu"))
            {
                WCI.Type = SuperMap.Data.WorkspaceType.SXWU;
            }
            else
            {
                WCI.Type = SuperMap.Data.WorkspaceType.SMWU;
            }
            WCI.Version = SuperMap.Data.WorkspaceVersion.UGC60;

            if (m_wrkSpace.Open(WCI))
            {
                m_MapControl.Map.Workspace = m_wrkSpace;
                m_MapControl.Map.Opened   += Map_Opened;
                m_MapControl.Map.Open(strSceneName);
                Datasource dtSource = m_wrkSpace.Datasources[0];
                comboBox2.Items.Clear();
                for (int i = 0; i < dtSource.Datasets.Count; i++)
                {
                    if (dtSource.Datasets[i].Type == DatasetType.Line)
                    {
                        comboBox2.Items.Add(dtSource.Datasets[i].Name);
                    }
                }
            }
            else
            {
                MessageBox.Show("打开工作空间失败!");
            }
        }