diff --git a/FrmLoading.Designer.cs b/FrmLoading.Designer.cs new file mode 100644 index 0000000..da0d483 --- /dev/null +++ b/FrmLoading.Designer.cs @@ -0,0 +1,46 @@ +namespace Cyberpipe +{ + partial class FrmLoading + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // FrmLoading + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(616, 76); + this.Name = "FrmLoading"; + this.Text = "FrmLoading"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/FrmLoading.Designer.cs b/FrmLoading.Designer.cs new file mode 100644 index 0000000..da0d483 --- /dev/null +++ b/FrmLoading.Designer.cs @@ -0,0 +1,46 @@ +namespace Cyberpipe +{ + partial class FrmLoading + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // FrmLoading + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(616, 76); + this.Name = "FrmLoading"; + this.Text = "FrmLoading"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/FrmLoading.cs b/FrmLoading.cs new file mode 100644 index 0000000..9501246 --- /dev/null +++ b/FrmLoading.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Cyberpipe +{ + public partial class FrmLoading : Form + { + public FrmLoading() + { + InitializeComponent(); + } + + } +} diff --git a/FrmLoading.Designer.cs b/FrmLoading.Designer.cs new file mode 100644 index 0000000..da0d483 --- /dev/null +++ b/FrmLoading.Designer.cs @@ -0,0 +1,46 @@ +namespace Cyberpipe +{ + partial class FrmLoading + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // FrmLoading + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(616, 76); + this.Name = "FrmLoading"; + this.Text = "FrmLoading"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/FrmLoading.cs b/FrmLoading.cs new file mode 100644 index 0000000..9501246 --- /dev/null +++ b/FrmLoading.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Cyberpipe +{ + public partial class FrmLoading : Form + { + public FrmLoading() + { + InitializeComponent(); + } + + } +} diff --git a/FrmLoading.resx b/FrmLoading.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/FrmLoading.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FrmLoading.Designer.cs b/FrmLoading.Designer.cs new file mode 100644 index 0000000..da0d483 --- /dev/null +++ b/FrmLoading.Designer.cs @@ -0,0 +1,46 @@ +namespace Cyberpipe +{ + partial class FrmLoading + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // FrmLoading + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(616, 76); + this.Name = "FrmLoading"; + this.Text = "FrmLoading"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/FrmLoading.cs b/FrmLoading.cs new file mode 100644 index 0000000..9501246 --- /dev/null +++ b/FrmLoading.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Cyberpipe +{ + public partial class FrmLoading : Form + { + public FrmLoading() + { + InitializeComponent(); + } + + } +} diff --git a/FrmLoading.resx b/FrmLoading.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/FrmLoading.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MainFrm.cs b/MainFrm.cs index b965a6f..9301949 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -474,9 +474,11 @@ //加载两个地球数据 private void loadData() { - Thread t1 = new Thread(doLoadDataForGlobalControl); - t1.IsBackground = true; - t1.Start(); + //Thread t1 = new Thread(doLoadDataForGlobalControl); + //t1.IsBackground = true; + //t1.Name = "doLoadDataForGlobalControl"; + //t1.Start(); + doLoadDataForGlobalControl(); } private void connectServer() @@ -495,7 +497,10 @@ { try { + FrmLoading frmLoading = new FrmLoading(); + frmLoading.Show(); + frmLoading.Text = "加载lrc文件"; String lrcMap = Application.StartupPath + "\\lrc\\tianditu.lrc"; String lrcBz = Application.StartupPath + "\\lrc\\biaozhu.lrc"; String lrcDl = Application.StartupPath + "\\lrc\\daolu.lrc"; @@ -512,28 +517,39 @@ globeControl1.Globe.Layers.MoveDown(10000); //加载实测管线数据 + frmLoading.Text = "加载实测管线数据"; + Debug.WriteLine("加载实测管线数据"); Utility.dataSource = globeControl1.Globe.DataManager.OpenOracleDataSource( Utility.DBServer.Trim() + "/" + Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); - - if (Utility.dataSource != null) + try { - for (int j = 0; j < Utility.dataSource.DatasetCount; j++) + if (Utility.dataSource != null) { - GSODataset dataset = Utility.dataSource.GetDatasetAt(j); - - if (dataset != null && Utility.layerNameSet.Contains(dataset.Caption)) + for (int j = 0; j < Utility.dataSource.DatasetCount; j++) { - dataset.Caption = dataset.Name; - globeControl1.Globe.Layers.Add(dataset); + GSODataset dataset = Utility.dataSource.GetDatasetAt(j); + + if (dataset != null && Utility.layerNameSet.Contains(dataset.Caption)) + { + dataset.Caption = dataset.Name; + Debug.WriteLine(dataset.Name); + frmLoading.Text = "加载"+ dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + } } } } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } //隐藏红线图层 GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); if (layer != null) layer.Visible = false; - + frmLoading.Text = "加载规划数据"; + Debug.WriteLine("加载规划数据"); //globleControl1中加载规划数据 GSODataSource ghDS = globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.ghdbip + "/" + Utility.ghdbname, "", "", @@ -547,11 +563,13 @@ { dataset.Caption = dataset.Name; globeControl1.Globe.Layers.Add(dataset); + Debug.WriteLine(dataset.Name); + frmLoading.Text = "加载" + dataset.Name; globeControl1.Globe.Layers[0].Visible = false; } } } - + Debug.WriteLine("加载施工数据"); //globeControl1,globeControl2中加载施工数据 GSODataSource sgDS = globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, "", "", @@ -565,6 +583,8 @@ Utility.layerNameSet.Contains(dataset.Caption)) { dataset.Caption = dataset.Name; + Debug.WriteLine(dataset.Name); + frmLoading.Text = "加载" + dataset.Name; globeControl1.Globe.Layers.Add(dataset); globeControl1.Globe.Layers[0].Visible = false; @@ -577,8 +597,7 @@ { connectServer(); }); - - + frmLoading.Close(); } catch (Exception ex) { @@ -1486,7 +1505,14 @@ GSOFeature feature1 = globeControl1.Globe.HitTest(e.X, e.Y, out templayer, out point, false, true, 0); if (point.X == 0 && point.Y == 0 && point.Z == 0) { - point = globeControl1.Globe.ScreenToScene(e.X, e.Y); + try + { + point = globeControl1.Globe.ScreenToScene(e.X, e.Y); + } + catch (AccessViolationException ex) + { + MessageBox.Show(ex.Message); + } } GSOGeoPoint3D pt = new GSOGeoPoint3D(); pt.X = point.X; @@ -7581,6 +7607,8 @@ return pt; } + + private void ribbonBar21_ItemClick(object sender, EventArgs e) {