diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 4935fa1..77f4d13 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 4935fa1..77f4d13 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.vshost.exe.manifest b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 4935fa1..77f4d13 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.vshost.exe.manifest b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt index 1fc46d0..06a7613 100644 --- a/bin/x86/Debug/glVersion.txt +++ b/bin/x86/Debug/glVersion.txt Binary files differ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 4935fa1..77f4d13 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.vshost.exe.manifest b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt index 1fc46d0..06a7613 100644 --- a/bin/x86/Debug/glVersion.txt +++ b/bin/x86/Debug/glVersion.txt Binary files differ diff --git a/bin/x86/Debug/log.txt b/bin/x86/Debug/log.txt index 5603359..2b8dbfa 100644 --- a/bin/x86/Debug/log.txt +++ b/bin/x86/Debug/log.txt @@ -875,3 +875,92 @@ exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:53:19--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:53:49--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:54:25--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 10:33:08--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 10:38:52--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Void addLayerToGlobeControl(System.String) + + e.StackTrace: 在 Cyberpipe.Forms.FrmPipelineModelDB.addLayerToGlobeControl(String layerName) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 155 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 135 + + + + exception over ------------------------------------------------------------ diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 1bf12ed..ebd45ee 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/Forms/FrmPipelineModelDataBase.Designer.cs b/Forms/FrmPipelineModelDataBase.Designer.cs index 05f8ff1..1823476 100644 --- a/Forms/FrmPipelineModelDataBase.Designer.cs +++ b/Forms/FrmPipelineModelDataBase.Designer.cs @@ -72,6 +72,7 @@ this.comboBoxExHeight = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.buttonOpen = new DevComponents.DotNetBar.ButtonX(); ((System.ComponentModel.ISupportInitialize)(this.ComboboxRansparency)).BeginInit(); this.SuspendLayout(); // @@ -242,7 +243,7 @@ this.comboBoxExLayer.ItemHeight = 15; this.comboBoxExLayer.Location = new System.Drawing.Point(110, 9); this.comboBoxExLayer.Name = "comboBoxExLayer"; - this.comboBoxExLayer.Size = new System.Drawing.Size(377, 21); + this.comboBoxExLayer.Size = new System.Drawing.Size(312, 21); this.comboBoxExLayer.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.comboBoxExLayer.TabIndex = 87; this.comboBoxExLayer.SelectedIndexChanged += new System.EventHandler(this.comboBoxExLayer_SelectedIndexChanged); @@ -549,11 +550,24 @@ this.label18.TabIndex = 139; this.label18.Text = "沟道高:"; // + // buttonOpen + // + this.buttonOpen.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.buttonOpen.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.buttonOpen.Location = new System.Drawing.Point(433, 9); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(58, 23); + this.buttonOpen.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.buttonOpen.TabIndex = 140; + this.buttonOpen.Text = "打开"; + this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click); + // // FrmPipelineModelDB // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 350); + this.Controls.Add(this.buttonOpen); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.comboBoxExHeight); @@ -658,5 +672,6 @@ private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxExHeight; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; + private DevComponents.DotNetBar.ButtonX buttonOpen; } } \ No newline at end of file diff --git a/Forms/FrmPipelineModelDataBase.cs b/Forms/FrmPipelineModelDataBase.cs index 4cee1e9..a060afb 100644 --- a/Forms/FrmPipelineModelDataBase.cs +++ b/Forms/FrmPipelineModelDataBase.cs @@ -18,16 +18,17 @@ { public partial class FrmPipelineModelDB : Office2007Form { - private GeoScene.Globe.GSOGlobeControl ctl; + private GSOGlobeControl ctl; GSODataSource ds; - private Hashtable en_cns = new Hashtable(); - private Hashtable fields_types = new Hashtable(); public GSOLayer rukuLayer = null; - - public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds) + private GSOLayer shpLayer = null; + private bool isSh = false; + + public FrmPipelineModelDB(GSOGlobeControl _ctl, GSODataSource _ds,bool _isSh) { ctl = _ctl; ds = _ds; + isSh = _isSh; InitializeComponent(); } @@ -114,9 +115,12 @@ GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(Path.GetFileNameWithoutExtension( comboBoxExLayer.Text.ToString())); + if (isSh == true && !txtModelLayer.Text.StartsWith("SH")) + txtModelLayer.Text = "SH" + txtModelLayer.Text; + LineParam lineParam = new LineParam(); - lineParam.layerName = txtModelLayer.Text.ToString(); - lineParam.uniqueIdFieldName = cmbID.Text.ToString(); + lineParam.layerName = txtModelLayer.Text; + lineParam.uniqueIdFieldName = cmbID.Text; lineParam.startDepthFieldName = checkBoxDeep.Checked ? cmbFrom.Text : startH.Text; lineParam.endDepthFieldName = checkBoxDeep.Checked ? cmbTo.Text : endH.Text; lineParam.isRevert = chkDeep.Checked; @@ -126,8 +130,8 @@ lineParam.transparency=Convert.ToByte(ComboboxRansparency.Value); lineParam.cornerSliceAngle = Convert.ToDouble(textBoxCornerSliceAngle.Text); lineParam.sliceNum=Convert.ToInt32(txtSlice.Text); - lineParam.channelWidth = comboBoxExWidth.Text.ToString(); - lineParam.channelHeight = comboBoxExHeight.Text.ToString(); + lineParam.channelWidth = comboBoxExWidth.Text; + lineParam.channelHeight = comboBoxExHeight.Text; lineBuilder.build(layer, checkBoxAdd.Checked ? EnumUpdateMode.Append : EnumUpdateMode.Update, checkBoxDeep.Checked ? EnumBuildMode.Depth : EnumBuildMode.Alititude, lineParam); @@ -142,11 +146,15 @@ LogHelper.WriteLog(typeof(FrmPipelineModelDB), ex.Message); } } - + private void addLayerToGlobeControl(string layerName) { - ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + - Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + if (isSh == false) + ds =ctl.Globe.DataManager.OpenOracleDataSource(FrmDatabaseParaSetting.dbIp + "/" + FrmDatabaseParaSetting.database, + "", "", FrmDatabaseParaSetting.user, FrmDatabaseParaSetting.pass); + else + ds = ctl.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, + "", "", Utility.sgdbuser, Utility.sgdbpwd); GSOLayer layerRuku = ctl.Globe.Layers.Add(ds.GetDatasetByName(layerName)); rukuLayer = layerRuku; @@ -208,6 +216,7 @@ string layerName = Path.GetFileNameWithoutExtension(comboBoxExLayer.Text.ToString()); GSOLayer layer = ctl.Globe.Layers.GetLayerByCaption(layerName); + shpLayer = isSh == true ? layer : null; GSOFeatures features = layer.GetAllFeatures(); if (features.Length == 0) @@ -217,7 +226,7 @@ for (int i = 0; i < features[0].GetFieldCount(); i++) { - GeoScene.Data.GSOFieldDefn fielddef = (GeoScene.Data.GSOFieldDefn)(features[0].GetFieldDefn(i)); + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); addComboboxParam(fielddef.Name); } for (int i = 0; i < pipelineTypeCbo.Items.Count; i++) @@ -246,6 +255,9 @@ /// private void FrmPipelineModelDB_FormClosing(object sender, FormClosingEventArgs e) { + pipelineTypeCbo.Items.Clear(); + if (shpLayer != null) + ctl.Globe.Layers.Remove(shpLayer); ctl.Globe.Refresh(); } @@ -326,5 +338,36 @@ endH.SelectedItem = "终止" + cmbReference.Text.ToString() + "高程"; } + private void buttonOpen_Click(object sender, EventArgs e) + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "*.shp|*.shp"; + dlg.Multiselect = false; + if (dlg.ShowDialog() == DialogResult.OK) + { + GSOLayer layer = ctl.Globe.Layers.Add(dlg.FileName); + + comboBoxExLayer.Items.Add(Path.GetFileName(dlg.FileName)); + comboBoxExLayer.SelectedItem = Path.GetFileName(dlg.FileName); + + GSOFeatures features = layer.GetAllFeatures(); + if (features.Length == 0) + return; + + clearComboboxParam(); + for (int i = 0; i < features[0].GetFieldCount(); i++) + { + GSOFieldDefn fielddef = (GSOFieldDefn)(features[0].GetFieldDefn(i)); + addComboboxParam(fielddef.Name); + } + initComboboxParam(); + } + + txtModelLayer.Text = "SH" + Path.GetFileNameWithoutExtension(comboBoxExLayer.Text) + + DateTime.Now.ToString("yyyyMMdd"); + + + } + } } \ No newline at end of file diff --git a/FrmDatabaseParaSetting.cs b/FrmDatabaseParaSetting.cs index bef12ac..39a4e4f 100644 --- a/FrmDatabaseParaSetting.cs +++ b/FrmDatabaseParaSetting.cs @@ -1,15 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; - -using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; -using System.Data.SqlClient; using System.IO; using System.Xml; @@ -25,8 +18,9 @@ private GSOGlobeControl ctl; string filenameDbconfig = Application.StartupPath + "\\databaseConfig.xml"; - List listDb = new List(); + public static GSODataSource ds = null; + List listDb = new List(); public FrmDatabaseParaSetting(GSOGlobeControl _ctl) { @@ -40,7 +34,6 @@ /// private void FrmDatabaseParaSetting_Load(object sender, EventArgs e) { - //ReadXML(); #region 读取 database "databaseConfig.xml" if (File.Exists(filenameDbconfig)) { @@ -69,7 +62,7 @@ } catch (Exception ex) { - //LogError.PublishError(ex); + LogError.PublishError(ex); } } else @@ -84,8 +77,6 @@ dbCombo.Items.Add(dblist[i].title); } } - - public static GeoScene.Engine.GSODataSource ds = null; /// /// 确定按钮事件处理 /// @@ -122,14 +113,6 @@ return; } - /* - if (!Utility.isNetworkConnectionSuccess(dbIp.Trim())) - { - MessageBox.Show("网络连接失败!", "提示"); - return; - } - */ - ds = ctl.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (ds == null) { @@ -141,8 +124,6 @@ MessageBox.Show("数据库连接成功!", "提示"); } - //WriteXML(); - } else { @@ -154,131 +135,6 @@ this.Close(); } /// - /// 从配置文件读取数据库连接参数配置 - /// - private void ReadXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - if (!File.Exists(strFileName)) - { - return; - } - - //初始化XML文档操作类 - XmlDocument myDoc = new XmlDocument(); - { - //加载XML文件 - try - { - myDoc.Load(strFileName); - } - catch (System.Exception e) - { - LogError.PublishError(e); - return; - } - //搜索指定的节点 - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - XmlNodeList nodes = null; - if (serverRootNode != null) - { - nodes = myDoc.SelectSingleNode("LocaSpace").ChildNodes; - } - if (nodes != null) - { - XmlNode bRecordNode = serverRootNode.SelectSingleNode("IsRecordedSql"); - bool bRecorded = false; - if (bRecordNode != null) - { - bool.TryParse(bRecordNode.InnerText, out bRecorded); - cbbRecordDatabaseConfig.Checked = bRecorded; - } - if (bRecorded) - { - foreach (System.Xml.XmlNode xn in nodes) - { - if (xn.Name == "sqlIP") - { - textBoxIP.Text = xn.InnerText; - } - else if (xn.Name == "database") - { - textBoxDB.Text = xn.InnerText; - } - else if (xn.Name == "userName") - { - textBoxUser.Text = xn.InnerText; - } - else if (xn.Name == "password") - { - textBoxPsw.Text = xn.InnerText; - } - } - } - } - - } - } - /// - /// 向配置文件写入数据库参数配置 - /// - private void WriteXML() - { - string strFileName = Application.StartupPath + "/databaseConfig.xml"; - File.WriteAllText(strFileName, " "); - XmlDocument myDoc = new XmlDocument(); - - //加载XML文件 - - // XmlElement serverRootNode = null; - try - { - myDoc.Load(strFileName); - - } - catch (System.Exception e) - { - LogError.PublishError(e); - File.Delete(strFileName); - File.WriteAllText(strFileName, " "); - } - XmlNode serverRootNode = myDoc.SelectSingleNode("LocaSpace"); - if (serverRootNode == null) - { - serverRootNode = myDoc.CreateElement("LocaSpace"); - } - XmlElement ele0 = myDoc.CreateElement("IsRecordedSql"); - ele0.InnerText = cbbRecordDatabaseConfig.Checked.ToString(); - serverRootNode.AppendChild(ele0); - - - XmlElement ele1 = myDoc.CreateElement("sqlIP"); - ele1.InnerText = dbIp; - serverRootNode.AppendChild(ele1); - - XmlElement ele2 = myDoc.CreateElement("database"); - ele2.InnerText = database; - serverRootNode.AppendChild(ele2); - - XmlElement ele3 = myDoc.CreateElement("userName"); - ele3.InnerText = user; - serverRootNode.AppendChild(ele3); - - - XmlElement ele4 = myDoc.CreateElement("password"); - ele4.InnerText = pass; - serverRootNode.AppendChild(ele4); - try - { - myDoc.Save(strFileName); - } - catch (Exception exp) - { - LogError.PublishError(exp); - } - } - - /// /// 取消按钮事件处理 /// /// diff --git a/LineBuilder.cs b/LineBuilder.cs index 1052a6a..766f767 100644 --- a/LineBuilder.cs +++ b/LineBuilder.cs @@ -11,14 +11,16 @@ namespace Cyberpipe { - public class LineBuilder:ModelBuilder + public class LineBuilder : ModelBuilder { - public LineBuilder(GSODataSource ds):base(ds) - { - + public LineBuilder(GSODataSource ds) + : base(ds) + { + } - public override bool validate(GSOLayer layer) { + public override bool validate(GSOLayer layer) + { return true; } @@ -32,7 +34,6 @@ EnumBuildMode buildMode, BaseParam param) { - LineParam lineParam = param as LineParam; GSOFeatureDataset newFeatureSet = ds.GetDatasetByName(lineParam.layerName) as GSOFeatureDataset; if (newFeatureSet == null) @@ -47,7 +48,6 @@ GSOGeoPolyline3D lineeee = f.Geometry as GSOGeoPolyline3D; if (lineeee == null || lineeee.GetSpaceLength(true, 6378137) == 0) { - continue; //TODO LIST:判断是否会出现部署数据无法入库情况,Log2Net } @@ -82,7 +82,8 @@ return true; } - private double getRadius(LineParam lineParam, GSOFeature f) { + private double getRadius(LineParam lineParam, GSOFeature f) + { double radius = 0; GSOFieldDefn field = (GSOFieldDefn)(f.GetFieldDefn(lineParam.diameterFieldName)); if (field.Type == EnumFieldType.Text) @@ -134,12 +135,14 @@ } } - private GSOGeometry updateGemotry(GSOFeature f,LineParam lineParam,double radius, EnumBuildMode buildMode){ + private GSOGeometry updateGemotry(GSOFeature f, LineParam lineParam, double radius, EnumBuildMode buildMode) + { f.Geometry.AltitudeMode = (buildMode.Equals(EnumBuildMode.Alititude)) ? EnumAltitudeMode.RelativeToGround : EnumAltitudeMode.Absolute; GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; - if (line == null) { + if (line == null) + { return null; //log4net 记录错误处理 } @@ -147,10 +150,10 @@ double deep2 = f.GetFieldAsDouble(lineParam.endDepthFieldName); deep1 = lineParam.isRevert ? -deep1 : deep1; deep2 = lineParam.isRevert ? -deep2 : deep2; - + //根据相对模式进行深度修改 - deep1 = lineParam.relativeMode==1?deep1+radius*2:deep1-radius*2; - deep2 = lineParam.relativeMode==1?deep2+radius*2:deep2-radius*2; + deep1 = lineParam.relativeMode == 1 ? deep1 + radius * 2 : deep1 - radius * 2; + deep2 = lineParam.relativeMode == 1 ? deep2 + radius * 2 : deep2 - radius * 2; GSOPoint3ds pt3ds = new GSOPoint3ds(); for (int n = 0; n < line[0].Count; n++) @@ -180,7 +183,7 @@ } line[0] = pt3ds; - // getPipeLineRectStyle(line, lineParam, f); + // getPipeLineRectStyle(line, lineParam, f); return line; } diff --git a/MainFrm.cs b/MainFrm.cs index 5e77983..279ead1 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1,28 +1,18 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Text; using System.Windows.Forms; using System.IO; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; using System.Runtime.InteropServices; -using DevComponents.DotNetBar.Rendering; using DevComponents.DotNetBar; using System.Xml; using System.Collections; -using System.Data.SqlClient; -using System.Diagnostics; -using Microsoft.Win32; using System.Threading; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using MySql.Data.MySqlClient; using System.Data.OracleClient; -using Cyberpipe.PATM_Forms; using Cyberpipe.Forms; namespace Cyberpipe @@ -5787,7 +5777,7 @@ { GSODataset dataset = layer.Dataset; CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); + //CheckDatasetGeoReference(layer.Dataset, strDataPath); TreeNode node = new TreeNode(); node.Tag = layer; node.Text = layer.Dataset.Caption; @@ -5802,26 +5792,36 @@ } else { - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - objRes = layer; - if (layer != null) + try { - GSODataset dataset = layer.Dataset; + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - CheckDatasetGeoReference(layer.Dataset, strDataPath); - //CheckDatasetGeoReference(dataset); - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); + MessageBox.Show(strDataPath); + + objRes = layer; + if (layer != null) + { + CheckDatasetGeoReference(layer.Dataset, strDataPath); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + // 注意用insert不要用add,因为后加入的图层在上层 + //layerManagerNode.Nodes.Add(node); + layerManagerNode.Nodes.Insert(0, node); + } + else + { + MessageBox.Show("layer is null"); + } + newlayername = layer.Caption; } - newlayername = layer.Caption; + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } } return objRes; } @@ -6927,7 +6927,6 @@ try { - string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; @@ -6937,7 +6936,8 @@ { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9241,137 +9241,6 @@ FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); frm.Show(this); } - #region 数据管理-导入文件 - ///// - ///// 数据管理-导入本地坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_1_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_1.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - - ///// - ///// 数据管理-导入其他坐标系文件 - ///// - ///// - ///// - //private void buttonItemSJGL1_2_Click(object sender, EventArgs e) - //{ - // //日志记录 - // LogManager.saveLog(Utility.userName, this.buttonItemSJGL1_2.Text); - - // OpenFileDialog dlg = new OpenFileDialog(); - // dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - // //dlg.Filter = "支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|其它格式(*.*)|*.*||"; - // dlg.Multiselect = true; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // //自定义lprj文件名,从程序中复制一lprj文件。 - // int bindex = dlg.FileName.Split('\\').Length; - // string lastname = dlg.FileName.Split('\\')[bindex - 1]; - // if (lastname.IndexOf(".dxf") != -1) - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".lprj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\sz.lprj"); - // if (!OFInfo.Exists) - // { - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - // } - // else if (lastname.IndexOf(".shp") != -1)//只能对苏州本地坐标系进行纠正 - // { - // string firstname = dlg.FileName.Substring(0, dlg.FileName.Length - lastname.Length); - // string filename = lastname.Substring(0, lastname.Length - 4) + ".prj"; - // //复制lprj - // string lprjfilepath = firstname + filename; - // FileInfo OFInfo = new FileInfo(lprjfilepath);//获取目标文件所在的路径 - // FileInfo SFInfo = new FileInfo(Application.StartupPath + "\\lprj\\xian80.prj"); - // SFInfo.CopyTo(lprjfilepath, true);//将文件复制到指定的路径中 - // } - - // for (int i = 0; i < dlg.FileNames.Length; i++) - // { - // AddLayerData(dlg.FileNames[i]); - // } - // layerManagerNode.Expand(); - - - // //放大到新导入的图层 - // GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - // if (newlayername != "") - // { - // GSOFeatures features = lyr.GetAllFeatures(); - // GSORect2d rd = lyr.LatLonBounds; - // GSOPoint2d rdcenter = rd.Center; - - // globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 1000); - - // globeControl1.Refresh(); - // } - // } - //} - #endregion /// /// 数据质量检查 /// @@ -9434,10 +9303,8 @@ } if (ds == null) return; - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); - - //frm.Show(); - + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -9850,15 +9717,6 @@ List listVectorNames = new List(); for (int i = 0; i < m_PipelineLayerNames.Count; i++) { - /* - if (m_PipelineLayerNames[i] == "移动" || m_PipelineLayerNames[i] == "联通" - || m_PipelineLayerNames[i] == "电信" || m_PipelineLayerNames[i] == "共通" - || m_PipelineLayerNames[i] == "有线电视" || m_PipelineLayerNames[i] == "交通信号" - || m_PipelineLayerNames[i] == "供电") - { - continue; - } - * */ if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) { listVectorNames.Add(m_PipelineLayerNames[i]); @@ -10049,34 +9907,43 @@ { //日志记录 LogManager.saveLog(Utility.userName, this.buttonItemSJGL1.Text); - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; - dlg.Multiselect = true; - if (dlg.ShowDialog() == DialogResult.OK) + try { - //自定义lprj文件名,从程序中复制一lprj文件。 - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = + "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) { - AddLayerData(dlg.FileNames[i]); + //自定义lprj文件名,从程序中复制一lprj文件。 + string filePath = dlg.FileName; + string lastname = Path.GetFileName(filePath); + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } } - layerManagerNode.Expand(); - - //放大到新导入的图层 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); - if (newlayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); - - globeControl1.Refresh(); - } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + LogError.PublishError(ex); } } @@ -10484,13 +10351,8 @@ private void buttonItem8_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItem8.Text); - - //FrmCompareFeature frmCompareFeature = new FrmCompareFeature(globeControl1, globeControl2, layerTemp, layerTemp2,m_PipelineLayerNames,sgPipeLayersNames); int width = this.Width; FrmCompareFeature.ShowForm(globeControl1, globeControl2, layerTemp, layerTemp2, m_PipelineLayerNames, sgPipeLayersNames,width); - //frmCompareFeature.Location = new Point((this.Width - frmCompareFeature.Width)/2,50); - //frmCompareFeature.Show(this); - } /// /// 红线审核导出图片 @@ -10503,11 +10365,7 @@ Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); Point pt2 = new Point(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - /*Point pt = getUpperLeftPoint(pt1, pt2); - Image myImg = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height))); - */ + int mapWidth = 0; int mapHeight = 0; Point pt = getUpperLeftPoint(pt1, pt2, out mapWidth, out mapHeight); @@ -10550,7 +10408,6 @@ { globeControl1.Globe.Action = EnumAction3D.ActionNull; FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1,null); - //FrmBSQStatis bsqStatis = new FrmBSQStatis(); bsqStatis.Show(this); } /// @@ -10564,231 +10421,6 @@ globeControl1.Globe.Action = EnumAction3D.TrackPolygon; } - #region 保存和加载审核库加载的图层 - /* - private void saveLayerList(TreeNodeCollection treeNodeList) - { - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - dbParams.RemoveAll(); - dbLayers.RemoveAll(); - layers.RemoveAll(); - - List listDS = new List(); - String shDatasourceName = Utility.sgdbip + "/" + Utility.sgdbname + "_" + Utility.sgdbuser; - bool flag = false; - - for (int i = 0; i < globeControl1.Globe.DataManager.DataSourceCount; i++) - { - GSODataSource ds = globeControl1.Globe.DataManager.GetDataSourceAt(i); - if (ds != null && ds.Type == EnumDataSourceType.SqlServer || ds.Type == EnumDataSourceType.Oracle) - { - if (ds.Name == shDatasourceName) - { - //防止因为多次连接同一个数据库 - if (flag == true) - { - break; - } - flag = true; - listDS.Add(ds); - GSODataSourceCnn conn = ds.GetConnectionInfo(); - - XmlElement dbparam = doc.CreateElement("shdbparam"); - XmlElement ip = doc.CreateElement("ship"); - ip.InnerText = conn.Server; - - XmlElement dbname = doc.CreateElement("shdbname"); - dbname.InnerText = conn.Database; - - XmlElement username = doc.CreateElement("shusername"); - username.InnerText = conn.User; - - XmlElement password = doc.CreateElement("shpassword"); - password.InnerText = conn.Password; - - XmlElement type = doc.CreateElement("shtype"); - if (ds.Type == EnumDataSourceType.SqlServer) - { - type.InnerText = "sqlserver"; - } - else - { - type.InnerText = "oracle"; - } - - dbparam.AppendChild(ip); - dbparam.AppendChild(dbname); - dbparam.AppendChild(username); - dbparam.AppendChild(password); - dbparam.AppendChild(type); - dbParams.AppendChild(dbparam); - } - - } - } - - for (int i = 0; i < treeNodeList.Count; i++) - { - GSOLayer layer = treeNodeList[i].Tag as GSOLayer; - if (Path.GetExtension(layer.Name) == "") - { - XmlElement dbLayer = doc.CreateElement("dblayer"); - XmlAttribute attri = doc.CreateAttribute("dbindex"); - for (int j = 0; j < listDS.Count; j++) - { - if (layer.Dataset.DataSource.Name == listDS[j].Name) - { - attri.Value = j.ToString(); - break; - } - } - dbLayer.Attributes.Append(attri); - dbLayer.InnerText = layer.Name; - - dbLayers.AppendChild(dbLayer); - } - else - { - XmlElement dbLayer = doc.CreateElement("layer"); - dbLayer.InnerText = layer.Name; - layers.AppendChild(dbLayer); - } - } - - doc.Save(configPath); - } - catch (Exception e) - { - - } - } - - private void openLayerList() - { - layerManagerNode.Nodes.Clear(); - - string configPath = Application.StartupPath + "\\configLayerList.xml"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(configPath); - XmlNode dbParams = doc.SelectSingleNode("Params/dbparams"); - XmlNode dbLayers = doc.SelectSingleNode("Params/dblayers"); - XmlNode layers = doc.SelectSingleNode("Params/layers"); - - List listDS = new List(); - for (int i = 0; i < dbParams.ChildNodes.Count; i++) - { - string ip = ""; - string dbname = ""; - string username = ""; - string password = ""; - string type = ""; - XmlNode node = dbParams.ChildNodes.Item(i); - for (int j = 0; j < node.ChildNodes.Count; j++) - { - XmlNode nodeChild = node.ChildNodes.Item(j); - - if (nodeChild != null && nodeChild.Name == "ship") - { - ip = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shdbname") - { - dbname = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shusername") - { - username = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shpassword") - { - password = nodeChild.InnerText; - } - else if (nodeChild != null && nodeChild.Name == "shtype") - { - type = nodeChild.InnerText; - } - } - - if (type == "sqlserver") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenSqlServerDataSource(ip, "", dbname, username, password); - listDS.Add(ds); - } - else if (type == "oracle") - { - GSODataSource ds = globeControl1.Globe.DataManager.OpenOracleDataSource(ip + "/" + dbname, "", "", username, password); - listDS.Add(ds); - } - } - - for (int i = 0; i < dbLayers.ChildNodes.Count; i++) - { - XmlNode node = dbLayers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - XmlAttribute attri = node.Attributes["dbindex"]; - if (attri != null) - { - int dbIndex = -1; - if (int.TryParse(attri.Value, out dbIndex)) - { - GSODataset dataset = listDS[dbIndex].GetDatasetByName(layerName); - globeControl1.Globe.Layers.Add(dataset); - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - // layerManagerNode.Expand(); - - - } - } - } - } - for (int i = 0; i < layers.ChildNodes.Count; i++) - { - XmlNode node = layers.ChildNodes.Item(i); - if (node != null) - { - string layerName = node.InnerText; - globeControl1.Globe.Layers.Add(layerName); - - //更新树节点 - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - TreeNode layerNode = new TreeNode(); - layerNode.Tag = layer; - layerNode.Text = layer.Dataset.Caption; - layerNode.ImageIndex = 0; - layerNode.SelectedImageIndex = 0; - layerNode.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, layerNode); - } - } - layerManagerNode.Expand(); - } - catch (Exception e) - { - - } - } - * */ - #endregion - private void btn_check_history_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.btn_check_history.Text); @@ -10891,18 +10523,6 @@ LogManager.saveLog(Utility.userName, this.btn_document_info.Text); - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //FormDocumentManager frm = new FormDocumentManager(); - //frm.ShowDialog(); - - //if (FormDocumentManager.IS_OPEN) - //{ - // return; - //} - //new FormDocumentManager().ShowDialog(); if (FormDocumentManager.IS_OPEN) { return; @@ -10930,56 +10550,9 @@ { for (int i = 0; i < dlg.FileNames.Length; i++) { - //this.Cursor = Cursors.WaitCursor; string strDataPath = dlg.FileNames[i]; - #region - //string strDataPathPrj = strDataPath.ToLower().Replace(".dwg", ".lprj"); - - //if (File.Exists(strDataPathPrj) == false) - //{ - // if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) - // { - // String strPath = Application.StartupPath + "\\Coordinate Systems"; - // OpenFileDialog dlgPrj = new OpenFileDialog(); - // dlgPrj.InitialDirectory = strPath; - // dlgPrj.RestoreDirectory = true; - // dlgPrj.Multiselect = false; - // dlg.Filter = "投影文件|*.prj"; - // if (dlg.ShowDialog() == DialogResult.OK) - // { - // this.Cursor = Cursors.WaitCursor; - // string proj4 = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); - // using (StreamWriter stream = new StreamWriter(strDataPathPrj, false)) - // { - // stream.WriteLine("0prj4" + proj4 + ""); - // } - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - - // this.Cursor = Cursors.Default; - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - // } - // else - // { - // AddLayerData(strDataPath); - // //globeControl1.Globe.Layers.Add(strDataPath); - // } - - //} - //else - //{ - // //globeControl1.Globe.Layers.Add(strDataPath); - // AddLayerData(strDataPath); - //} - #endregion AddLayerData(strDataPath); - //this.Cursor = Cursors.Default; } } @@ -11007,31 +10580,6 @@ FrmChangePassword frm = new FrmChangePassword(); frm.ShowDialog(); } - /// - /// 多孔管线入库 - /// - /// - /// - private void buttonItem9_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_2.Text); - - if (ds == null) - { - MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - ConnectDB(null, null); - } - if (ds == null) - return; - - FrmMultiPipelineModelDB frm = new FrmMultiPipelineModelDB(globeControl1, ds); - if (frm.ShowDialog() == DialogResult.OK) - { - addNodeToLayerManagerNode(frm.rukuLayer); - } - //frm.Show(); - } private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = layerNodeContexMenu.Tag as TreeNode; diff --git a/bin/x86/Debug/Cyberpipe.exe b/bin/x86/Debug/Cyberpipe.exe index e7980a2..a37517d 100644 --- a/bin/x86/Debug/Cyberpipe.exe +++ b/bin/x86/Debug/Cyberpipe.exe Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.pdb b/bin/x86/Debug/Cyberpipe.pdb index 4935fa1..77f4d13 100644 --- a/bin/x86/Debug/Cyberpipe.pdb +++ b/bin/x86/Debug/Cyberpipe.pdb Binary files differ diff --git a/bin/x86/Debug/Cyberpipe.vshost.exe.manifest b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest new file mode 100644 index 0000000..061c9ca --- /dev/null +++ b/bin/x86/Debug/Cyberpipe.vshost.exe.manifest @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt index 1fc46d0..06a7613 100644 --- a/bin/x86/Debug/glVersion.txt +++ b/bin/x86/Debug/glVersion.txt Binary files differ diff --git a/bin/x86/Debug/log.txt b/bin/x86/Debug/log.txt index 5603359..2b8dbfa 100644 --- a/bin/x86/Debug/log.txt +++ b/bin/x86/Debug/log.txt @@ -875,3 +875,92 @@ exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:53:19--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:53:49--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 9:54:25--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 10:33:08--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Boolean doBuild(Cyberpipe.EnumUpdateMode, Cyberpipe.EnumBuildMode, Cyberpipe.BaseParam) + + e.StackTrace: 在 Cyberpipe.LineBuilder.doBuild(EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\LineBuilder.cs:行号 38 + 在 Cyberpipe.ModelBuilder.build(GSOLayer layer, EnumUpdateMode updateMode, EnumBuildMode buildMode, BaseParam param) 位置 D:\GHFX\GHFX_REFACTOR\ModelBuilder.cs:行号 55 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 132 + + + + exception over ------------------------------------------------------------ + + exception begin -----------------2016/11/8 10:38:52--------------------- + + + + e.Message:未将对象引用设置到对象的实例。 + + e.Source:Cyberpipe + + e.TargetSite:Void addLayerToGlobeControl(System.String) + + e.StackTrace: 在 Cyberpipe.Forms.FrmPipelineModelDB.addLayerToGlobeControl(String layerName) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 155 + 在 Cyberpipe.Forms.FrmPipelineModelDB.btnCreateModel_Click(Object sender, EventArgs e) 位置 D:\GHFX\GHFX_REFACTOR\Forms\FrmPipelineModelDataBase.cs:行号 135 + + + + exception over ------------------------------------------------------------ diff --git a/bin/x86/Debug/log/2016/201611/20161108.txt b/bin/x86/Debug/log/2016/201611/20161108.txt new file mode 100644 index 0000000..b5c96c9 --- /dev/null +++ b/bin/x86/Debug/log/2016/201611/20161108.txt @@ -0,0 +1,40 @@ + + +��¼ʱ�䣺2016-11-08 09:53:20,836 +�߳�ID:[10] +��־���� ERROR +�����ࣺCyberpipe.Forms.FrmPipelineModelDB property: [(null)] - +����������δ�������������õ������ʵ���� + + + +��¼ʱ�䣺2016-11-08 09:53:49,986 +�߳�ID:[10] +��־���� ERROR +�����ࣺCyberpipe.Forms.FrmPipelineModelDB property: [(null)] - +����������δ�������������õ������ʵ���� + + + +��¼ʱ�䣺2016-11-08 09:54:25,364 +�߳�ID:[10] +��־���� ERROR +�����ࣺCyberpipe.Forms.FrmPipelineModelDB property: [(null)] - +����������δ�������������õ������ʵ���� + + + +��¼ʱ�䣺2016-11-08 10:33:09,418 +�߳�ID:[11] +��־���� ERROR +�����ࣺCyberpipe.Forms.FrmPipelineModelDB property: [(null)] - +����������δ�������������õ������ʵ���� + + + +��¼ʱ�䣺2016-11-08 10:38:53,638 +�߳�ID:[10] +��־���� ERROR +�����ࣺCyberpipe.Forms.FrmPipelineModelDB property: [(null)] - +����������δ�������������õ������ʵ���� +