diff --git a/MainFrm.cs b/MainFrm.cs index 8e37fde..5e77983 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -190,6 +190,8 @@ MenuSet(); } + + /// /// 右屏中添加管纵图片 /// @@ -1423,30 +1425,7 @@ } #endregion - - /// - /// 每次gis服务加载时都会触发的 - /// - /// - /// - void globeControl2_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - //throw new NotImplementedException(); - - if (e.Layer != null) - { - if (e.Layer.Name.Contains("fttp:")) - { - if (e.Layer.Caption.Contains("180fd")) - { - - MessageBox.Show("afds==" + e.Layer.Caption); - } - // e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; - } - } - - } + Dictionary dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { @@ -1455,18 +1434,7 @@ e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; } } - - void ReadKmlToMemoryLayer(String kmlPath) - { - GSODataset dataset = globeControl1.Globe.DataManager.AddFileDataset(kmlPath); - GSOFeatureDataset fdataset = dataset as GSOFeatureDataset; - if (fdataset != null) - { - GSOFeatures features = fdataset.GetAllFeatures(); - AddFeaturesNodeToMyPlace(features); - } - } - + void AddFeaturesNodeToMyPlace(GSOFeatures features) { if (features == null || features.Length == 0) @@ -1537,274 +1505,7 @@ } } } - - private void configResource2() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - //string sql = "select ur.gid from casic_userroletest as ur,UserInfoTest as ui where ui.rid=ur.role and ui.username='" + userName + "'"; - string sql = "select casic_userroletest.\"GID\" from casic_userroletest,casic_userinfotest where casic_userroletest.\"ROLE\" = casic_userinfotest.\"RID\" and casic_userinfotest.\"USERNAME\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - - string rolename = ""; - if (dt != null && dt.Rows.Count > 0) - { - rolename = dt.Rows[0][0].ToString().Trim(); - } - setControlVisible(rolename); - } - } - - private void setControlVisible(string rolename) - { - string[] groupname = rolename.Split(','); //有何权限? - - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - //MessageBox.Show("i==" + i.ToString() + "==j==" + j.ToString() + "===" + ribbonStripResource.Items.Count.ToString() + "==" + ribbonStripResource.Items[j].Text); - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - - if (rolename == "all") - { - ribbonTabItemResource.Visible = true; - } - else - { - if (!isContainName(groupname, tabItemResourceName)) - { - //MessageBox.Show(tabItemResourceName); - ribbonTabItemResource.Visible = false; - } - } - - } - - } - - } - } - - } - #region 配置用户权限 - /// - /// 向数据库插入功能列表 - /// - private void insertControlToDatabase() - { - ArrayList listItem = new ArrayList(); - List subListItem = new List(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - - subListItem.Add(new Resource(tabItemResourceName, "NULL")); - - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, tabItemResourceName)); - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, ribbonBarResource.Name)); - - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(SubButtonItemResourceName, buttonItemResourceName)); - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - subListItem.Add(new Resource(sliderItemResource.Text.Trim(), ribbonBarResource.Name)); - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string subButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(subButtonItemResourceName, sliderItemResource.Text.Trim())); - } - } - } - } - } - } - } - } - } - } - if (subListItem.Count > 0) - { - foreach (Resource r in subListItem) - { - string pname = getRealName(r.resourceParentName); - string sql = "insert into casic_resc(\"name\",\"aid\",\"pname\") values('" + r.resourceName + "',1,'" + pname + "')"; - int rowCount = OledbHelper.sqlExecuteNonQuery(sql); - } - MessageBox.Show("插入成功", "提示"); - } - } - - private string getRealName(string name) - { - string realName = ""; - switch (name) - { - case "ribbonBar10": - realName = "文件"; - break; - case "ribbonBar21": - realName = "浏览"; - break; - case "ribbonBar4": - realName = "场景"; - break; - case "ribbonBar2": - realName = "查询"; - break; - case "ribbonBar11": - realName = "编辑"; - break; - case "ribbonBar5": - realName = "编辑"; - break; - case "ribbonBar6": - realName = "统计"; - break; - case "ribbonBar8": - realName = "统计"; - break; - case "ribbonBar14": - realName = "量算"; - break; - case "ribbonBar12": - realName = "标注"; - break; - case "ribbonBar1": - realName = "分析"; - break; - case "ribbonBarJJ": - realName = "净距分析"; - break; - case "ribbonBarTP": - realName = "拓扑分析"; - break; - case "ribbonBarSY": - realName = "视域分析"; - break; - case "ribbonBarKW": - realName = "开挖分析"; - break; - case "ribbonBarQY": - realName = "区域分析"; - break; - case "ribbonBarMN": - realName = "模拟分析"; - break; - case "ribbonBarDM": - realName = "断面分析"; - break; - case "ribbonBar13": - realName = "数据管理"; - break; - case "ribbonBar3": - realName = "数据管理"; - break; - case "ribbonBar9": - realName = "数据管理"; - break; - case "ribbonBar7": - realName = "飞行"; - break; - case "ribbonBar15": - realName = "用户管理"; - break; - case "ribbonBar16": - realName = "传感器"; - break; - default: - realName = name; - break; - } - return realName; - } - - private void configResource() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - string sql = "select casic_resc.\"name\" from casic_userstatus join casic_role on casic_userstatus.\"rid\" = casic_role.\"id\" join casic_perm on casic_role.\"pid\"=casic_perm.\"id\" join casic_permresc on casic_perm.\"id\"=casic_permresc.\"permid\" join casic_resc on casic_permresc.\"rescid\"=casic_resc.\"id\" where casic_userstatus.\"username\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - string[] sResourceName = new string[dt.Rows.Count]; - for (int i = 0; i < dt.Rows.Count; i++) - { - sResourceName[i] = dt.Rows[i][0].ToString().Trim(); - } - setControlVisilbe(sResourceName); - } - } - } + private bool isContainName(string[] array, string name) { @@ -1820,116 +1521,116 @@ return bl; } - private void setControlVisilbe(string[] resourceNames) - { - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - subListItem.Add(tabItemResourceName); - if (!isContainName(resourceNames, tabItemResourceName)) - { - ribbonTabItemResource.Visible = false; - } - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(SubButtonItemResourceName); - if (!isContainName(resourceNames, SubButtonItemResourceName)) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) - { - sliderItemResource.Visible = false; - } + //private void setControlVisilbe(string[] resourceNames) + //{ + // ArrayList listItem = new ArrayList(); + // ArrayList subListItem = new ArrayList(); + // System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; + // for (int i = 0; i < cc.Count; i++) + // { + // if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) + // { + // DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; + // for (int j = 0; j < ribbonStripResource.Items.Count; j++) + // { + // if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) + // { + // DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; + // string tabItemResourceName = ribbonTabItemResource.Text; + // listItem.Add(tabItemResourceName); + // subListItem.Add(tabItemResourceName); + // if (!isContainName(resourceNames, tabItemResourceName)) + // { + // ribbonTabItemResource.Visible = false; + // } + // if (ribbonTabItemResource.SubItems.Count > 0) + // { + // for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) + // { + // if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) + // { + // DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; + // for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) + // { + // if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) + // { + // DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; + // for (int k = 0; k < ribbonBarResource.Items.Count; k++) + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // if (buttonItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < buttonItemResource.SubItems.Count; m++) + // { + // if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // string SubButtonItemResourceName = subButtonItemResource.Text; + // subListItem.Add(SubButtonItemResourceName); + // if (!isContainName(resourceNames, SubButtonItemResourceName)) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // else + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) + // { + // DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; + // if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) + // { + // sliderItemResource.Visible = false; + // } - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - } - } - } - } - } - } - } - #endregion + // if (sliderItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < sliderItemResource.SubItems.Count; m++) + // { + // if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + //} + //#endregion void globeControl2_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) { @@ -1961,54 +1662,7 @@ globeControl2.Globe.JumpToCameraState(camera); } } - - void globeControl1_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - if (e.Layer.Name != null && e.Layer.Name.Length > 5) - { - if (e.Layer.Name.Substring(0, 5).Equals("fttp:")) - { - return; - } - } - - if (Path.GetExtension(e.Layer.Name).ToLower().Equals(".kml")) - { - AddKmlLayer(e.Layer); - } - else - { - GSODataset dataset = e.Layer.Dataset; - CheckDatasetGeoReference(e.Layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = e.Layer; - node.Text = e.Layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = e.Layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - layerManagerNode.Expand(); - terrainManagerNode.Expand(); - } - - private void AddKmlLayer(GSOLayer layer) - { - if (layer != null) - { - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - VisitFeature3Ds(layer.GetAllFeatures(), node); - } - } - + private void VisitFeature3Ds(GSOFeatures feature3ds, TreeNode node) { for (int i = 0; i < feature3ds.Length; i++) @@ -2858,28 +2512,7 @@ * **/ } #endregion - - private GSOFeatures PolygonIntersectAnalysis(GSOGeoPolygon3D polygon, string pipelinetype) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelinetype); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pipelinetype, feats.Length); - return feats; - } + /// /// 根据范围统计阀门、管线、工井等, 开挖分析, 挖方量分析 /// @@ -3948,28 +3581,7 @@ } return null; } - /// - /// 添加图层 - /// - /// - /// - /// - private bool AddLayers(string layerName, string layerCaption) - { - try - { - GSODataset dataset1 = Utility.dataSource.GetDatasetByName(layerName); - dataset1.Caption = layerCaption; - GSOLayer templayer = globeControl1.Globe.Layers.Add(dataset1); - templayer.Caption = layerCaption; - templayer.MaxVisibleAltitude = 5000; - return templayer.Visible; - } - catch (Exception ex) - { - return false; - } - } + /// /// 菜单上的 三维导航 工具按钮 /// @@ -4438,50 +4050,7 @@ } Image printImage; - /// - /// 打印 菜单 - /// - /// - /// - private void buttonItem13_Click(object sender, EventArgs e) - { - 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); - printImage = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(printImage); - 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); - int rightBottomX = pt.X + mapWidth; - int rightBottomY = pt.Y + mapHeight; - Image myImg = new Bitmap(mapWidth, mapHeight); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY)); - - - PrintDialog pd = new PrintDialog(); - try - { - if (pd.ShowDialog() == DialogResult.OK) //如果确认,将会覆盖所有的打印参数设置 - { - //打印预览 - PrintPreviewDialog ppd = new PrintPreviewDialog(); - ppd.Document = printDocument1; - if (DialogResult.OK == ppd.ShowDialog()) - { - printDocument1.Print(); //打印 - } - } - } - catch - { - printDocument1.PrintController.OnEndPrint(printDocument1, new System.Drawing.Printing.PrintEventArgs()); - } - } - + private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -4537,43 +4106,7 @@ } } } - - /// - /// 统计管线的里程数 - /// - /// - /// - /// - public Double PipeLength(string currentQlayer, double totalLength) - { - if (dataGridViewX1.Rows.Count - 1 != 0) - { - for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) - { - string featureName = ""; - if (dataGridViewX1.Columns.Contains("编号")) - { - featureName = dataGridViewX1.Rows[i].Cells["编号"].Value.ToString().Trim(); - } - else - { - featureName = dataGridViewX1.Rows[i].Cells["标识器编号"].Value.ToString().Trim(); - } - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)(Utility.LayerLabel_LayerIDs[currentQlayer])); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(currentQlayer); - GSOFeatures features = layer.GetFeatureByName(featureName, false); - for (int j = 0; j < features.Length; j++) - { - GSOFeature feat = features[j]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - double lentgh = line.GetSpaceLength(true, 6378137); - totalLength += lentgh; - } - } - } - return totalLength; - } - + /// /// 窗体下方属性表格 右键菜单中的 “定位”菜单 /// @@ -4687,27 +4220,29 @@ count = 0; } } - + #region wxl 删除无用??有疑问,功能用在哪里? /// /// 绘制线 菜单 /// /// /// - private void btnAddLine_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - } + //private void btnAddLine_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + //} + /// /// 绘制面 菜单 /// /// /// - private void btnAddPolygon_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolygon; - } + //private void btnAddPolygon_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolygon; + //} + #endregion /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -4763,51 +4298,9 @@ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); layer.Dataset.Save(); } + - /// - /// 根据多边形范围统计管线的里程 - /// - /// - /// - /// 返回查询到的管线要素集合 - private GSOFeatures Intersects_Pipeline(GSOGeoPolygon3D polygon, string pipelineLayerCaption) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineLayerCaption); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = new GSOFeatures(); - if (polygon == null) - feats = flayer.GetAllFeatures(); - else - feats = flayer.FindFeaturesInPolygon(polygon, false); - - double totallength = 0.01; - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - if (line == null) - continue; - - double length = line.GetSpaceLength(true, 6378137); - totallength += length; - if (polygon != null) - feat.HighLight = true; - } - double toLength = Convert.ToDouble(totallength.ToString().Substring(0, totallength.ToString().IndexOf("."))); - pipeLineDis.Add(pipelineLayerCaption, toLength); - return feats; - } - - Dictionary pipeLineDis = new Dictionary(); - Dictionary workWellLen = new Dictionary(); - - - - + #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 /// @@ -4838,6 +4331,7 @@ } return feats; } + #endregion /// /// 清除结果 菜单 /// @@ -4897,46 +4391,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - - /// - /// 显示流向 功能 - /// - /// - /// - /// - private void Flow(object sender, string pipelineNameCN, bool bShow) - { - GSOFeatureLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineNameCN) as GSOFeatureLayer; - GSOFeatures feats = layer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - lineStyle.ArrowStyle.Play(); - } - lineStyle.ArrowVisible = bShow; - layerTree.SelectedNode = null; - } - } - globeControl1.Globe.Refresh(); - } - - FrmCloseValves frm; - - FrmBoosterValvers frmbooster = null; - + /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -6276,55 +5731,9 @@ } } + /// - /// 清除所有坑 菜单 - /// - /// - /// - private void buttonItem3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItem3.Text); - - globeControl1.Globe.RemoveAllPits(); - } - - //} - /// - /// 大气层 菜单 - /// - /// - /// - private void buttonItem17_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.Atmosphere.Visible = !globeControl1.Globe.Atmosphere.Visible; - buttonItemSH1.Checked = globeControl1.Globe.Atmosphere.Visible; - globeControl1.Refresh(); - } - /// - /// 经纬网 菜单 - /// - /// - /// - private void buttonItem20_Click(object sender, EventArgs e) - { - globeControl1.Globe.LatLonGrid.Visible = !globeControl1.Globe.LatLonGrid.Visible; - buttonItemSH3.Checked = globeControl1.Globe.LatLonGrid.Visible; - globeControl1.Globe.Refresh(); - } - /// - /// 状态条 菜单 - /// - /// - /// - private void buttonItem21_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.StatusBar.Visible = !globeControl1.Globe.StatusBar.Visible; - buttonItemSH4.Checked = globeControl1.Globe.StatusBar.Visible; - globeControl1.Globe.Refresh(); - } - /// /// 添加指定路径下的数据 功能 /// /// @@ -6365,6 +5774,7 @@ node.SelectedImageIndex = 0; node.Checked = terrain.Visible; // 注意用insert不要用add,因为后加入的图层在上层 + // terrainManagerNode.Nodes.Add(node); layerManagerNode.Nodes.Insert(0, node); } newlayername = terrain.Caption; @@ -6415,88 +5825,7 @@ } return objRes; } - /// - /// 刷新目录树 功能 - /// - private void RefreshDataTree() - { - layerTree.Nodes[0].Nodes.Clear(); - Int32 nCount = globeControl1.Globe.DataManager.DataSourceCount; - Int32 i = 0; - for (i = 0; i < nCount; i++) - { - GSODataSource dataSpace = globeControl1.Globe.DataManager[i]; - TreeNode node = new TreeNode(); - node.Text = dataSpace.Name; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = true; - node.Tag = dataSpace; - Int32 nDatasetCount = dataSpace.DatasetCount; - for (Int32 j = 0; j < nDatasetCount; j++) - { - GSODataset dataset = dataSpace[j]; - TreeNode subNode = new TreeNode(); - subNode.Text = dataset.Name; - subNode.ImageIndex = 0; - subNode.SelectedImageIndex = 0; - subNode.Checked = true; - subNode.Tag = dataset; - node.Nodes.Add(subNode); - } - layerTree.Nodes[0].Nodes.Add(node); - } - } - /// - /// 判断图层是否包含字段列表 - /// - /// - /// - private bool HasFields(string layerName) - { - GSOLayer m_layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName);//获取当前选择的layer图层 - if (m_layer == null) - return false; - GSOFeatureLayer flayer = m_layer as GSOFeatureLayer; - - GSOFeatureDataset _featureDataSet = m_layer.Dataset as GSOFeatureDataset; - if (_featureDataSet == null) - return false; - - _featureDataSet.Open(); - if (_featureDataSet.FieldCount > 0) - return true; - else - return false; - } - - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayer(GSOGeoPolygon3D polygon, string pointLayerName) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pointLayerName, feats.Length); - return feats; - } + /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -6654,17 +5983,7 @@ MessageBox.Show("表格内容为空!", "提示"); } } - /// - /// 导出CAD 菜单 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - FrmExportCADS frm = new FrmExportCADS(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(); - } - + ///// ///// 区域分析 菜单 ///// @@ -6695,16 +6014,7 @@ } } } - /// - /// 数据验证 菜单 - /// - /// - /// - private void buttonItem80_Click(object sender, EventArgs e) - { - FrmValiData frm = new FrmValiData(globeControl1); - frm.ShowDialog(); - } + /// /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 /// @@ -6730,180 +6040,133 @@ } } } - /// - /// 数据库备份 菜单 - /// - /// - /// - private void btnBackDatabase_Click(object sender, EventArgs e) - { - if (MessageBox.Show("是否确定要备份数据库文件", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - try - { - DateTime currentTime = DateTime.Now; - //string Dtime = currentTime.ToShortDateString().ToString("yyyy-MM-dd"); - string Dtime = currentTime.GetDateTimeFormats('D')[0].ToString(); - string Htime = DateTime.Now.ToString("HH时mm分ss秒").Trim(); - string fileName = Dtime + "(" + Htime + ")"; - string pathName = ""; - string sql = "select filename from master..sysdatabases where name='" + Utility.dbdatabase + "'"; - DataTable dt = OledbHelper.ExecuteDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - pathName = dt.Rows[0][0].ToString().Trim(); - int count = pathName.LastIndexOf("\\") == -1 ? pathName.LastIndexOf("/") : pathName.LastIndexOf("\\"); - pathName = pathName.Substring(0, count); - } - pathName += "\\管网数据库" + fileName + ".bak"; - - OracleCommand cmdBK = new OracleCommand(); - cmdBK.CommandType = CommandType.Text; - cmdBK.Connection = connBackup; - cmdBK.CommandText = @"backup database " + Utility.dbdatabase + " to disk='" + pathName + "' with init"; - - connBackup.Open(); - cmdBK.ExecuteNonQuery(); - MessageBox.Show("数据库文件备份成功", "提示"); - } - catch (Exception ex) - { - //MessageBox.Show(ex.Message); - LogError.PublishError(ex); - } - finally - { - connBackup.Close(); - } - } - } - + #region Fan 去掉 - //GSOFeature emitterFeature; // 粒子要素 - /// - /// 添加火苗 功能 - /// - /// - /// - /// - private void AddFire(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + ////GSOFeature emitterFeature; // 粒子要素 + ///// + ///// 添加火苗 功能 + ///// + ///// + ///// + ///// + //private void AddFire(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; - // 烟火粒子示例,由三个发射器构成 - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // string strResPath = Application.StartupPath + "/Resource"; + // // 烟火粒子示例,由三个发射器构成 + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSORingParticleEmitter emitter = new GSORingParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 + // GSORingParticleEmitter emitter = new GSORingParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 - emitter.SetSizeFix(1, 1); - emitter.VelFix = 1; - emitter.VelRnd = 5; + // emitter.SetSizeFix(1, 1); + // emitter.VelFix = 1; + // emitter.VelRnd = 5; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 90; - emitter.AngleXZRnd = 0; + // emitter.AngleXZFix = 90; + // emitter.AngleXZRnd = 0; - emitter.LifeFix = 0.5f; - emitter.LifeRnd = 0.0f; + // emitter.LifeFix = 0.5f; + // emitter.LifeRnd = 0.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 100; - emitter.IsLumAdded = true; + // emitter.EmitPerSec = 100; + // emitter.IsLumAdded = true; - // 采用线性插值生成粒子的初始颜色 - emitter.ColorRndStart = Color.White; - emitter.ColorRndEnd = Color.Red; + // // 采用线性插值生成粒子的初始颜色 + // emitter.ColorRndStart = Color.White; + // emitter.ColorRndEnd = Color.Red; - GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); - effector2.SetColorChanged(0, -1, -1, 0); - effector2.StartTime = 0.0f; - effector2.EndTime = -1.0f; - emitter.AddEffector(effector2); + // GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); + // effector2.SetColorChanged(0, -1, -1, 0); + // effector2.StartTime = 0.0f; + // effector2.EndTime = -1.0f; + // emitter.AddEffector(effector2); - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); + // geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - } - /// - /// 添加喷泉 功能 - /// - /// - /// - /// - private void AddFountain(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + //} + ///// + ///// 添加喷泉 功能 + ///// + ///// + ///// + ///// + //private void AddFountain(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; + // string strResPath = Application.StartupPath + "/Resource"; - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/test.png"; + // GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/test.png"; - emitter.SetSizeFix(0.5f, 2); - emitter.VelFix = 10; - emitter.VelRnd = 2; + // emitter.SetSizeFix(0.5f, 2); + // emitter.VelFix = 10; + // emitter.VelRnd = 2; - emitter.GravityAcc = 9.8f; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.GravityAcc = 9.8f; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 88; - emitter.AngleXZRnd = 2; + // emitter.AngleXZFix = 88; + // emitter.AngleXZRnd = 2; - emitter.LifeFix = 5.0f; - emitter.LifeRnd = 1.0f; + // emitter.LifeFix = 5.0f; + // emitter.LifeRnd = 1.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 1000; - emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); - emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); - emitter.IsLumAdded = false; + // emitter.EmitPerSec = 1000; + // emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); + // emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); + // emitter.IsLumAdded = false; - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // + // geoParticle.Play(); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - //globeControl1.Globe.FlyToFeature(emitterFeature); - } + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // //globeControl1.Globe.FlyToFeature(emitterFeature); + //} #endregion /// @@ -7006,73 +6269,7 @@ } return resFeature; } - - /// - /// 创建label要素 功能 - /// - /// 添加label要素的feature - /// feature的位置 - /// label要素名字 - /// feature名字 - /// label要素距离点的位置 - /// - private GSOFeature createLabel(GSOLayer layer, GSOFeature feature, GSOGeoPoint3D point, string labelName, string featureName, GSOPoint2d point2d) - { - for (int i = layer.GetAllFeatures().Length - 1; i >= 0; i--) - { - GSOFeature gfeat = layer.GetAt(i); - if (gfeat != null && gfeat.Geometry != null && gfeat.Geometry.Type == EnumGeometryType.GeoPoint3D) - { - GSOGeoPoint3D pointItem = gfeat.Geometry as GSOGeoPoint3D; - if (pointItem.X == point.X && pointItem.Y == point.Y && pointItem.Z == point.Z) - { - layer.RemoveAt(i); - break; - } - } - } - point.AltitudeMode = EnumAltitudeMode.RelativeToGround; - feature.Geometry = point; - feature.Name = featureName; - GSOLabel newLabel = new GSOLabel(); - newLabel.Text = labelName; - newLabel.Style = new GSOLabelStyle(); - newLabel.Style.Opaque = 0.8; - newLabel.Style.OutlineColor = Color.Gray; - newLabel.Style.TractionLineEndPos = point2d; - newLabel.Style.OutlineWidth = 1; - newLabel.Style.TracktionLineWidth = 1; - newLabel.Style.TractionLineColor = Color.Green; - - Color color1 = Color.FromArgb(60, 187, 206, 230); - Color color2 = Color.FromArgb(150, 187, 200, 250); - newLabel.Style.BackBeginColor = color1; - newLabel.Style.BackEndColor = color2; - - feature.Label = newLabel; - return feature; - } - - - - /// - /// 获取指定两点组成的线的长度 功能 - /// - /// - /// - /// - private double getDistance(GSOPoint3d point1, GSOPoint3d point2) - { - GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(point1); - point3ds.Add(point2); - lineline.AddPart(point3ds); - - double distance = lineline.GetSpaceLength(true, 6378137.0); - return distance; - } - + /// /// 图层节点树中 节点 右键单击事件处理 /// @@ -7320,591 +6517,11 @@ // buttonItem95.Checked = !buttonItem95.Checked; //} ///// - /// 添加用户仓库 菜单 - /// - /// - /// - private void buttonItem108_Click(object sender, EventArgs e) - { - FrmUserRepo frm = new FrmUserRepo(-1); - frm.ShowDialog(); - } - /// - /// 用户仓库管理 菜单 - /// - /// - /// - private void buttonItem111_Click(object sender, EventArgs e) - { - FrmUserRepoMgr frm = new FrmUserRepoMgr(); - frm.ShowDialog(); - } - /// - /// 添加分系统 菜单 - /// - /// - /// - private void buttonItem112_Click(object sender, EventArgs e) - { - //FrmAPP frm = new FrmAPP(-1); - //frm.ShowDialog(); - } - /// - /// 分系统管理 菜单 - /// - /// - /// - private void buttonItem113_Click(object sender, EventArgs e) - { - //FrmAPPMgr frm = new FrmAPPMgr(); - //frm.ShowDialog(); - } - /// - /// 添加操作 菜单 - /// - /// - /// - private void buttonItem114_Click(object sender, EventArgs e) - { - FrmOper frm = new FrmOper(-1); - frm.ShowDialog(); - } - /// - /// 操作管理 菜单 - /// - /// - /// - private void buttonItem115_Click(object sender, EventArgs e) - { - FrmOperMgr frm = new FrmOperMgr(); - frm.ShowDialog(); - } - /// - /// 添加资源 菜单 - /// - /// - /// - private void buttonItem116_Click(object sender, EventArgs e) - { - FrmRESC frm = new FrmRESC(-1); - frm.ShowDialog(); - } - /// - /// 资源管理 菜单 - /// - /// - /// - private void buttonItem117_Click(object sender, EventArgs e) - { - FrmRESCMgr frm = new FrmRESCMgr(); - frm.ShowDialog(); - } - /// - /// 添加权限 菜单 - /// - /// - /// - private void buttonItem118_Click(object sender, EventArgs e) - { - FrmPerm frm = new FrmPerm(-1); - frm.ShowDialog(); - } - /// - /// 权限管理 菜单 - /// - /// - /// - private void buttonItem119_Click(object sender, EventArgs e) - { - FrmPermMgr frm = new FrmPermMgr(); - frm.ShowDialog(); - } - /// - /// 添加访问控制 菜单 - /// - /// - /// - private void buttonItem120_Click(object sender, EventArgs e) - { - FrmAccess frm = new FrmAccess(-1); - frm.ShowDialog(); - } - /// - /// 访问控制管理 菜单 - /// - /// - /// - private void buttonItem121_Click(object sender, EventArgs e) - { - FrmAccessMgr frm = new FrmAccessMgr(); - frm.ShowDialog(); - } - /// - /// 部门类型管理 菜单 - /// - /// - /// - private void buttonItem122_Click(object sender, EventArgs e) - { - FrmRegionTypeMgr frm = new FrmRegionTypeMgr(); - frm.ShowDialog(); - } - /// - /// 添加用户 菜单 - /// - /// - /// - private void buttonItem127_Click(object sender, EventArgs e) - { - FrmUserAdd frm = new FrmUserAdd(-1); - frm.ShowDialog(); - } - /// - /// 用户信息管理 菜单 - /// - /// - /// - private void buttonItem128_Click_1(object sender, EventArgs e) - { - FrmUserManager frm = new FrmUserManager(); - frm.ShowDialog(); - } - /// - /// 添加角色 菜单 - /// - /// - /// - private void 添加角色_Click(object sender, EventArgs e) - { - FrmRole frm = new FrmRole(-1); - frm.ShowDialog(); - } - /// - /// 所有角色管理 菜单 - /// - /// - /// - private void 角色管理_Click(object sender, EventArgs e) - { - FrmRoleMgr frm = new FrmRoleMgr(); - frm.ShowDialog(); - } - - /// - /// 部门角色管理 菜单 - /// - /// - /// - private void buttonItem133_Click(object sender, EventArgs e) - { - FrmRegionRoleMgr frm = new FrmRegionRoleMgr(); - frm.ShowDialog(); - } - /// - /// 部门管理 菜单 - /// - /// - /// - private void buttonItem130_Click(object sender, EventArgs e) - { - FrmRegionMgr frm = new FrmRegionMgr(); - frm.ShowDialog(); - } - - /// - /// 日志管理 菜单 - /// - /// - /// - private void buttonItem135_Click(object sender, EventArgs e) - { - FrmLogManager frm = new FrmLogManager(); - frm.ShowDialog(); - } - /// - /// 传感器信息查询 菜单 - /// - /// - /// - private void buttonItem131_Click_1(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description.Trim(); - if (tabelName != "" && eqtID != "") - { - string fields = getFields(tabelName); - if (fields != "") - { - string sql = "select " + fields + " from " + Utility.sensorDatabase + "." + tabelName + " where EqtID=" + eqtID + " order by RecordDate desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - FrmQueryMessage.ShowForm(this, dt, layer.Caption); - //queryMessage.Show(this); - } - else - { - MessageBox.Show("没有查询到相关信息!", "提示"); - } - } - else - { - MessageBox.Show("配置文件 \"sensorConfig.xml\" 有误!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - /// - /// 根据指定的图层的caption属性的值在配置文件中查找对应的数据库中的表的名称 - /// - /// 图层的caption属性的值 - /// 对应的数据库中的表的名称 - private string getTableName(string name) - { - string tabelName = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.layerName == name) - { - tabelName = mLayer.tableName; - break; - } - } - } - return tabelName; - } - /// - /// 根据数据库中的表的名称 查找对应的表中的字段名称的集合 - /// - /// 数据库中的表的名称 - /// 对应的表中的字段名称的集合 - private string getFields(string tabelName) - { - string fields = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.tableName.Trim() == tabelName.Trim()) - { - if (mLayer.fields != null) - { - foreach (string key in mLayer.fields.Keys) - { - string value = mLayer.fields[key]; - fields += tabelName.Trim() + "." + key + " as " + value + ","; - } - fields = fields.Remove(fields.Length - 1); - } - break; - } - } - } - return fields; - } - - /// - /// 历史曲线查询 菜单 - /// - /// - /// - private void buttonItem132_Click(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description; - if (tabelName != "" && eqtID != "") - { - FrmQueryHistory.ShowForm(this, tabelName, eqtID); - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - + //定时检查传感器的状态 public System.Windows.Forms.Timer timerOfSensor = null; - public int alarmValueLiuLiang = 0; - public int alarmValueYaLi = 0; - public int alarmValueYeTi = 0; - public int alarmValueZaoSheng = 0; - /// - /// 传感器在线报警 菜单 - /// - /// - /// - private void buttonItem134_Click(object sender, EventArgs e) - { - if (timerOfSensor == null) - { - timerOfSensor = new System.Windows.Forms.Timer(); - timerOfSensor.Interval = 30000; - timerOfSensor.Tick += new EventHandler(timerOfSensor_Tick); - } - FrmQuerySensorAlarm.ShowForm(this); - } - /// - /// 传感器报警 功能中的 定时器 的触发事件处理 - /// - /// - /// - private void timerOfSensor_Tick(Object sender, EventArgs e) - { - checkSensor(); - } - private void checkSensor() - { - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.alarmValue > 0) - { - string sql = "select *,max(CollectTime) from " + Utility.sensorDatabase + "." + mLayer.tableName + " group by EqtID;";// "select * from " + Utility.sensorDatabase + "." + mLayer.tableName + " order by CollectTime desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - for (int j = 0; j < dt.Rows.Count; j++) - { - try - { - string EqtID = dt.Rows[j]["EqtID"].ToString().Trim(); - string RecordDateDATE = dt.Rows[j]["RecordDate"].ToString().Trim(); - string RecordTimeTIME = dt.Rows[j]["RecordTime"].ToString().Trim(); - string CollectTime = dt.Rows[j]["CollectTime"].ToString().Trim(); - string CollectValue = ""; - if (mLayer.tableName == "Data_3a") - { - CollectValue = dt.Rows[j]["InstantValue"].ToString().Trim(); - } - else - { - CollectValue = dt.Rows[j]["CollectValue"].ToString().Trim(); - } - int value = 0; - if (int.TryParse(CollectValue, out value)) - { - if (value > mLayer.alarmValue) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(mLayer.layerName); - if (layer != null) - { - for (int m = 0; m < layer.GetAllFeatures().Length; m++) - { - GSOFeature f = layer.GetAt(m); - if (f != null && f.Description.Trim() == EqtID) - { - f.HighLight = true; - globeControl1.Globe.Refresh(); - LogError.PublishAlarmMessage(f.Name, EqtID, CollectValue, CollectTime); - break; - } - } - } - } - } - } - catch (Exception ex) - { - continue; - } - } - } - } - } - } - } + - - /// - /// 沿线运动 菜单 - /// - /// - /// - private void buttonItem138_Click(object sender, EventArgs e) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - GSOFeature lineFeature = globeControl1.Globe.SelectedObject; - if (lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "*.gcm;*.3ds|*.gcm;*.3ds|*.3ds|*.3ds|*.gcm|*.gcm"; - if (dlg.ShowDialog() == DialogResult.OK) - { - GSOGeoModel model = new GSOGeoModel(); - model.FilePath = dlg.FileName; - - GSOGeoDynamicRoute dynamicRoute = new GSOGeoDynamicRoute(); - dynamicRoute.ActorGeometry = model; - - GSORoute route = new GSORoute(); - GSOGeoPolyline3D geoline = (GSOGeoPolyline3D)lineFeature.Geometry; - for (int i = 0; i < geoline[0].Count; i++) - { - route.Add(geoline[0][i]); - } - route.CircleRoute = false; - route.Speed = 30; - route.RotateSpeed = 50; - route.AltitudeMode = geoline.AltitudeMode; - dynamicRoute.Route = route; - - GSOFeature feature = new GSOFeature(); - - dynamicRoute.Play(); - feature.Geometry = dynamicRoute; - - //GSOLabel gsoLabel = new GSOLabel(); - //gsoLabel.Text = "模型测试"; - //feature.Label = gsoLabel; - globeControl1.Globe.MinModelVisibleSize = 0; - - globeControl1.Globe.MemoryLayer.AddFeature(feature); - globeControl1.Globe.Refresh(); - } - } - /// - /// 回退 菜单 - /// - /// - /// - private void buttonItem99_Click(object sender, EventArgs e) - { - globeControl1.Globe.UnDoEdit(); - } - /// - /// 前进 菜单 - /// - /// - /// - private void buttonItem100_Click(object sender, EventArgs e) - { - globeControl1.Globe.ReDoEdit(); - } - /// - /// 水平净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX4_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX4.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX24.Text = "水平净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 垂直净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX2_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX2.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX23.Text = "垂直净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 覆土分析 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX3_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX3.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX17.Text = "覆土深度小于" + value.ToString() + "米的管线有:"; - } - } - } - - /// - /// 传感器分类查询 全区域 菜单 - /// - /// - /// - private void buttonItemSensor全区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 传感器分类查询 绘制区域 菜单 - /// - /// - /// - private void buttonItemSensor绘制区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 1); - } - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -7954,154 +6571,9 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// - /// 数字预处理 功能 - /// - /// - /// - private void 数字预处理buttonItem140_Click(object sender, EventArgs e) - { - FrmEditShapeFile frm = new FrmEditShapeFile(globeControl1); - frm.ShowDialog(this); - } - - - /// - /// 导出矢量 功能 将图层导出为kml和shp格式数据 - /// - /// - /// - private void 导出矢量buttonItem140_Click(object sender, EventArgs e) - { - List listVectorNames = new List(); - for (int i = 0; i < m_PipelineLayerNames.Count; i++) - { - if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) - { - listVectorNames.Add(m_PipelineLayerNames[i]); - } - } - for (int i = 0; i < valueLayerNames.Count; i++) - { - if (listVectorNames.Contains(valueLayerNames[i]) == false) - { - listVectorNames.Add(valueLayerNames[i]); - } - } - for (int i = 0; i < workwellLayerNames.Count; i++) - { - if (listVectorNames.Contains(workwellLayerNames[i]) == false) - { - listVectorNames.Add(workwellLayerNames[i]); - } - } - for (int i = 0; i < instrumenLayerNames.Count; i++) - { - if (listVectorNames.Contains(instrumenLayerNames[i]) == false) - { - listVectorNames.Add(instrumenLayerNames[i]); - } - } - for (int i = 0; i < pipefittingLayerNames.Count; i++) - { - if (listVectorNames.Contains(pipefittingLayerNames[i]) == false) - { - listVectorNames.Add(pipefittingLayerNames[i]); - } - } - FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames); - frm.ShowDialog(); - } string citySevenLineType = ""; string cityServerLineName = ""; - /// - /// 绘制城市七线 功能按钮 - /// - /// - /// - private void 绘制城市七线buttonItem140_Click(object sender, EventArgs e) - { - FrmCitySevenLineType frm = new FrmCitySevenLineType(); - if (frm.ShowDialog() == DialogResult.OK) - { - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - m_isDrawCitySevenLine = true; - m_isDrawTunnel = false; - m_AddPipeLine = false; - this.citySevenLineType = frm.citySevenLineType; - this.cityServerLineName = frm.citySevenLineName; - switch (frm.citySevenLineType) - { - case "城市红线": - GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerRed != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerRed; - layerRed.Editable = true; - } - break; - case "城市橙线": - GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerOrange != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerOrange; - layerOrange.Editable = true; - } - break; - case "城市黄线": - GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerYellow != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerYellow; - layerYellow.Editable = true; - } - break; - case "城市绿线": - GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerGreen != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerGreen; - layerGreen.Editable = true; - } - break; - case "城市蓝线": - GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlue != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlue; - layerBlue.Editable = true; - } - break; - case "城市紫线": - GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerPurple != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerPurple; - layerPurple.Editable = true; - } - break; - case "城市黑线": - GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlack != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlack; - layerBlack.Editable = true; - } - break; - } - } - } - /// - /// 七线审核 功能按钮 - /// - /// - /// - private void 七线审核buttonItem141_Click(object sender, EventArgs e) - { - FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(this); - } /// /// 间距分析 开始分析按钮 分析绘制的七线和管线的距离是否符合标准 @@ -8382,116 +6854,67 @@ } } } - /// - /// 管线自动缩进 菜单 - /// - /// - /// - private void 管线自动缩进buttonItem140_Click(object sender, EventArgs e) - { - FrmPipelineIndented frm = new FrmPipelineIndented(globeControl1, m_PipelineLayerNames, workwellLayerNames); - frm.ShowDialog(this); - } - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, string pointLayerName, string type) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName + "管线附属物"); - if (layer == null) - return null; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - GSOFeatures newfeats; - string typeg = ""; - if (polygon == null) - { - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } - feats = flayer.GetFeatureByFieldValue("附属物名称", typeg, true); - newfeats = feats; - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats.RemoveAll(); - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } + //// + ////导出路由专题图 + //// + //private void btnOutputR_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputR.Text); - //过滤 - for (int j = 0; j < feats.Length; j++) - { - GSOFeature feat = feats[j]; + // 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))); - if (feat.GetFieldAsString("附属物名称").EndsWith(typeg)) - { - newfeats.Add(feat); - } - } - } + // F_PATMTitle frm = new F_PATMTitle("R", myImg); + // frm.ShowDialog(); + //} + // + //导出配件专题图 + // + //private void btnOutputF_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputF.Text); - workWellLen.Add(pointLayerName + type, newfeats.Length); - return newfeats; - } + // 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))); - //设置图层为隐藏 - private void setLayerVisible(string layerName) - { - GSOLayer templayer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - if (templayer != null) - { - templayer.Visible = false; - } - globeControl1.Globe.Refresh(); - } + // F_PATMTitle frm = new F_PATMTitle("F", myImg); + // frm.ShowDialog(); + //} - /// - /// 连接数据库 - /// - /// - /// - private void buttonItem129_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_1.Text); - FrmDatabaseParaSetting2 frm = new FrmDatabaseParaSetting2(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting2.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } + + + ////交越点入库 + //private void fmrk_Click(object sender, EventArgs e) + //{ + // //保存日志 + // LogManager.saveLog(Utility.userName, this.fmrk.Text); + + // if (ds == null) + // { + // MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + // ConnectDB(null, null); + // } + // if (ds == null) + // return; + // FrmAddValve frm = new FrmAddValve(globeControl1, ds); + // if (frm.ShowDialog() == DialogResult.OK) + // { + // addNodeToLayerManagerNode(frm.rukuLayer); + // } + //} /// /// 一键审核---导入数据 @@ -8504,19 +6927,17 @@ try { + string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", - user, pass); + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (shds == null) { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - - //Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); + Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -8528,6 +6949,7 @@ MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); return; } + } /// @@ -8802,232 +7224,7 @@ } - - /// - /// 绘制垂线 - /// - /// - /// - private void drawCLine(GSOPoint3d fpt, GSOPoint3d tpt) - { - GSOGeoPolyline3D pline = new GSOGeoPolyline3D(); - GSOPoint3ds pts = new GSOPoint3ds(); - pts.Add(fpt); - pts.Add(tpt); - pline.AddPart(pts); - - GSOGeoPoint3D fptg = new GSOGeoPoint3D(); - GSOGeoPoint3D tptg = new GSOGeoPoint3D(); - fptg.X = fpt.X; - fptg.Y = fpt.Y; - fptg.Z = 0; - tptg.X = tpt.X; - tptg.Y = tpt.Y; - tptg.Z = 0; - - GSOFeature gf = new GSOFeature(); - gf.Geometry = pline; - - globeControl1.Globe.MemoryLayer.AddFeature(gf); - } - /// - /// 比较两个点是否是同一个点 - /// - /// - /// - /// - private bool comparePoint(GSOPoint3d pt1, GSOPoint3d pt2) - { - double x1 = 0; double y1 = 0; - double x2 = 0; double y2 = 0; - x1 = pt1.X; - y1 = pt1.Y; - x2 = pt2.X; - y2 = pt2.Y; - if ((x1 == x2) && (y1 == y2)) - { - return true; - } - return false; - } - /// - /// 获得点到线的垂线距离及垂点 - /// - /// - /// - /// - /// - private void comparePointLine(GSOPoint3d point, GSOGeoPolyline3D line, out double length, out GSOPoint3d pointChuiDian) - { - GSOPoint3d lineStartPoint = line[0][0]; - GSOPoint3d lineEndPoint = line[0][1]; - GSOGeoPolyline3D lineAB = new GSOGeoPolyline3D(); - GSOPoint3ds pointsAB = new GSOPoint3ds(); - pointsAB.Add(point); - pointsAB.Add(lineStartPoint); - lineAB.AddPart(pointsAB); - double lengthAB = lineAB.GetSpaceLength(false, 6378137.0); - double xieLvAB = getXieLu("", point.X, point.Y, lineStartPoint.X, lineStartPoint.Y); - double xieLvBC = getXieLu("", lineStartPoint.X, lineStartPoint.Y, lineEndPoint.X, lineEndPoint.Y); - - double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); - double angle = Math.Atan(tanABC); - double lengthAD = lengthAB * Math.Sin(angle); - length = Math.Abs(lengthAD); - double lengthBD = lengthAB * Math.Cos(angle); - - GSOPoint2d point2dStart = Latlon_2_XYZ(lineStartPoint.X, lineStartPoint.Y); - double bBC = point2dStart.Y - xieLvBC * point2dStart.X; - GSOPoint2d point2dEnd = new GSOPoint2d(); - point2dEnd.X = point2dStart.X + 100; - point2dEnd.Y = point2dEnd.X * xieLvBC + bBC; - point2dEnd = XYZ_2_Latlon(point2dEnd.X, point2dEnd.Y); - - GSOPoint3d pointEnd = new GSOPoint3d(); - pointEnd.X = point2dEnd.X; - pointEnd.Y = point2dEnd.Y; - GSOGeoPolyline3D lineYanShen = new GSOGeoPolyline3D(); - GSOPoint3ds pointsYanShen = new GSOPoint3ds(); - pointsYanShen.Add(lineStartPoint); - pointsYanShen.Add(pointEnd); - lineYanShen.AddPart(pointsYanShen); - GSOGeoPolyline3D lineSegment = lineYanShen.GetSegment(0, lengthBD); - pointChuiDian = lineSegment[0][1]; - } - /// - /// 获得斜率 - /// - /// - /// - /// - /// - /// - /// - public static double getXieLu(string projectName, double lon1, double lat1, double lon2, double lat2) - { - if (lon1 == lon2) - { - return 0; - } - else - { - GSOPoint2d pointStart = Latlon_2_XYZ(projectName, lon1, lat1); - GSOPoint2d pointEnd = Latlon_2_XYZ(projectName, lon2, lat2); - return (pointEnd.Y - pointStart.Y) / (pointEnd.X - pointStart.X); - } - } - /// - /// 根据默认投影参数,经纬度转xyz - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据投影参数,经纬度转xyz - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(string projectName, double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据默认投影参数,xyz转经纬度 - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 根据投影参数,Xyz转经纬度 - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(string projectName, double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 获得inpolygon的管线长度 - /// - /// - public double getInDistance(GSOPoint3d markerPosition, GSOGeoPolyline3D linep, GSOGeoPolygon3D sevenPolygon) - { - GSOGeoPolyline3D newline = new GSOGeoPolyline3D(); - GSOPoint3ds newpts = new GSOPoint3ds(); - newpts.Add(markerPosition); - GSOPoint3d inpt = new GSOPoint3d(); - - int lineptcount = linep.PartCount; - if (lineptcount == 1) - { - GSOPoint3ds linept = linep[0]; - GSOPoint3d fpt = linept[0]; - GSOPoint3d tpt = linept[1]; - - GSOGeoPoint3D fpt2 = new GSOGeoPoint3D(); - fpt2.X = fpt.X; - fpt2.Y = fpt.Y; - fpt2.Z = fpt.Z; - GSOFeature ffeat = new GSOFeature(); - ffeat.Geometry = fpt2; - - GSOGeoPoint3D tpt2 = new GSOGeoPoint3D(); - tpt2.X = tpt.X; - tpt2.Y = tpt.Y; - tpt2.Z = tpt.Z; - GSOFeature tfeat = new GSOFeature(); - tfeat.Geometry = tpt2; - - //判断那个点在polygon里 - GSOLayer layer = globeControl1.Globe.MemoryLayer; - layer.RemoveAllFeature(); - layer.AddFeature(ffeat); - GSOFeatures inorout = layer.FindFeaturesInPolygon(sevenPolygon, true); - - layer.RemoveAllFeature(); - layer.AddFeature(tfeat); - GSOFeatures inorout2 = layer.FindFeaturesInPolygon(sevenPolygon, true); - - if (inorout.Length != 0) - { - inpt = fpt; - } - else - { - inpt = tpt; - } - } - newpts.Add(inpt); - newline.AddPart(newpts); - double indis = 0; - indis = newline.GetSpaceLength(true, 6378137); - return indis; - } - + /// /// 一键审核中调节透明度 @@ -10892,88 +9089,7 @@ FrmAPPregion appregion = new FrmAPPregion("拷贝审核"); appregion.Show(); } - - private int connectServerCount = 0; - - /// - /// 还原球到实测库 - /// - private void refreshGlobe1() - { - //添加实测库图层已有图层 - int servernum = 0; - //1.清除global1上 - for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (!layer.Name.Contains("fttp:")) - { - layer.Dataset.Close();//清除内存 - globeControl1.Globe.Layers.Remove(layer); - } - else - { - servernum++; - } - } - - //globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 - - //2.添加实测库图层 - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"); - } - } - - for (int i = 0; i < g1layername.Count; i++) - { - string g1name = g1layername[i]; - GSODataset datasetg1 = Utility.dataSource.GetDatasetByName(g1name); - GSOLayer templayer = globeControl1.Globe.Layers.Add(datasetg1); - templayer.MaxVisibleAltitude = 1000; - } - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市红线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市橙线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黄线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市绿线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市蓝线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市紫线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黑线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/隧道.lgd"); - - //移动server的数据图层 - for (int i = 0; i < servernum; i++) - { - globeControl1.Globe.Layers.MoveTo(globeControl1.Globe.Layers.Count - 1, 0); - } - - if (layerManagerNode.Nodes.Count > 0) - { - for (int i = layerManagerNode.Nodes.Count - 1; i >= 0; i--) - { - layerManagerNode.Nodes[i].Remove(); - - } - } - - globeControl1.Refresh(); - - } - + private void buttonItemSPSZ_Click(object sender, EventArgs e) { //日志记录 @@ -11125,6 +9241,137 @@ 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 /// /// 数据质量检查 /// @@ -11682,99 +9929,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; } - - private void buttonItemHX1_1_Click(object sender, EventArgs e) - { - string filepath = ""; - //日志记录 - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|矢量数据(*.lgd)|*.lgd|CAD数据(*.dxf)|*.dxf|全部支持格式(*.lgd,*.shp,*.dxf)|*.lgd;*.shp;*.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]; - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) - { - string strDataPath = dlg.FileNames[i]; - filepath = strDataPath; - - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - - redlinelayername = layer.Caption; - //objRes = layer; - if (layer != null) - { - layerRedRegion = layer; - - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - 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); - - for (int j = 0; j < layer.GetAllFeatures().Length; j++) - { - GSOFeature f = layer.GetAt(j); - if (f != null) - { - f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } - } - } - layerManagerNode.Expand(); - - //放大到红线 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(redlinelayername); - - GSOSimpleLineStyle3D redlinestyle = new GSOSimpleLineStyle3D(); - redlinestyle.LineColor = Color.Red; - redlinestyle.LineWidth = 5; - lyr.Style = redlinestyle; - - - if (redlinelayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 500); - - ////////////////////////初始化地面透明度为50////////////////////// - sliderGroundTransSet1.Value = 50; - sliderItem1.Value = 50; - - globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - - layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - - /////////////////////////////////////////////////////////////////////////////////////////// - //layer.Visible = false; - globeControl1.Globe.Layers.MoveTo(0, globeControl1.Globe.Layers.Count - 1); - globeControl1.Refresh(); - } - - } - } - } - + public struct LineStruct { public string layerName; @@ -11865,42 +10020,7 @@ ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); MessageBox.Show("导出成功!"); } - /// - /// 去除集合中重复的管线 - /// - /// - /// - /// - private GSOFeatures getFeaturesByFilter(GSOFeatures features, string fieldName) - { - if (features == null) - { - return null; - } - GSOFeatures featuresGet = new GSOFeatures(); - for (int i = 0; i < features.Length; i++) - { - GSOFeature featureFromFS = features[i]; - string fieldValueFromFS = featureFromFS.GetValue(fieldName).ToString().Trim(); - bool isHas = false; - for (int j = featuresGet.Length - 1; j >= 0; j--) - { - GSOFeature featureFromFSGet = featuresGet[j]; - string fieldValueFromFSGet = featureFromFSGet.GetValue(fieldName).ToString().Trim(); - if (fieldValueFromFS.Equals(fieldValueFromFSGet)) - { - isHas = true; - break; - } - } - if (isHas == false) - { - featuresGet.Add(featureFromFS.Clone()); - } - } - return featuresGet; - } - + private void sliderItem2_ValueChanged(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.sliderItem2.Text); @@ -12261,6 +10381,7 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); + globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -12354,7 +10475,7 @@ } } - GSOFeature dpFeatuer = null; + //GSOFeature dpFeatuer = null; /// /// 双屏分析,点击管段分析 /// @@ -12443,6 +10564,231 @@ 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); @@ -12545,6 +10891,18 @@ 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; @@ -12560,39 +10918,7 @@ { this.Cursor = Cursors.Default; } - - /// - /// 判断CAD文件是否有投影信息 - /// - /// - /// - Boolean CheckDatasetGeoReference(GSODataset dataset) - { - Boolean bSuccess = false; - if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat) - { - if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK) - { - String strPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\Coordinate Systems"; - OpenFileDialog dlg = new OpenFileDialog(); - - dlg.InitialDirectory = strPath; - dlg.RestoreDirectory = true; - - dlg.Filter = "投影文件|*.prj||"; - if (dlg.ShowDialog() == DialogResult.OK) - { - bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName); - } - } - } - else - { - return true; - } - return bSuccess; - } - + private void buttonItemexp_CAD_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemexp_CAD.Text); @@ -12681,7 +11007,31 @@ 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/MainFrm.cs b/MainFrm.cs index 8e37fde..5e77983 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -190,6 +190,8 @@ MenuSet(); } + + /// /// 右屏中添加管纵图片 /// @@ -1423,30 +1425,7 @@ } #endregion - - /// - /// 每次gis服务加载时都会触发的 - /// - /// - /// - void globeControl2_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - //throw new NotImplementedException(); - - if (e.Layer != null) - { - if (e.Layer.Name.Contains("fttp:")) - { - if (e.Layer.Caption.Contains("180fd")) - { - - MessageBox.Show("afds==" + e.Layer.Caption); - } - // e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; - } - } - - } + Dictionary dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { @@ -1455,18 +1434,7 @@ e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; } } - - void ReadKmlToMemoryLayer(String kmlPath) - { - GSODataset dataset = globeControl1.Globe.DataManager.AddFileDataset(kmlPath); - GSOFeatureDataset fdataset = dataset as GSOFeatureDataset; - if (fdataset != null) - { - GSOFeatures features = fdataset.GetAllFeatures(); - AddFeaturesNodeToMyPlace(features); - } - } - + void AddFeaturesNodeToMyPlace(GSOFeatures features) { if (features == null || features.Length == 0) @@ -1537,274 +1505,7 @@ } } } - - private void configResource2() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - //string sql = "select ur.gid from casic_userroletest as ur,UserInfoTest as ui where ui.rid=ur.role and ui.username='" + userName + "'"; - string sql = "select casic_userroletest.\"GID\" from casic_userroletest,casic_userinfotest where casic_userroletest.\"ROLE\" = casic_userinfotest.\"RID\" and casic_userinfotest.\"USERNAME\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - - string rolename = ""; - if (dt != null && dt.Rows.Count > 0) - { - rolename = dt.Rows[0][0].ToString().Trim(); - } - setControlVisible(rolename); - } - } - - private void setControlVisible(string rolename) - { - string[] groupname = rolename.Split(','); //有何权限? - - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - //MessageBox.Show("i==" + i.ToString() + "==j==" + j.ToString() + "===" + ribbonStripResource.Items.Count.ToString() + "==" + ribbonStripResource.Items[j].Text); - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - - if (rolename == "all") - { - ribbonTabItemResource.Visible = true; - } - else - { - if (!isContainName(groupname, tabItemResourceName)) - { - //MessageBox.Show(tabItemResourceName); - ribbonTabItemResource.Visible = false; - } - } - - } - - } - - } - } - - } - #region 配置用户权限 - /// - /// 向数据库插入功能列表 - /// - private void insertControlToDatabase() - { - ArrayList listItem = new ArrayList(); - List subListItem = new List(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - - subListItem.Add(new Resource(tabItemResourceName, "NULL")); - - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, tabItemResourceName)); - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, ribbonBarResource.Name)); - - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(SubButtonItemResourceName, buttonItemResourceName)); - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - subListItem.Add(new Resource(sliderItemResource.Text.Trim(), ribbonBarResource.Name)); - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string subButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(subButtonItemResourceName, sliderItemResource.Text.Trim())); - } - } - } - } - } - } - } - } - } - } - if (subListItem.Count > 0) - { - foreach (Resource r in subListItem) - { - string pname = getRealName(r.resourceParentName); - string sql = "insert into casic_resc(\"name\",\"aid\",\"pname\") values('" + r.resourceName + "',1,'" + pname + "')"; - int rowCount = OledbHelper.sqlExecuteNonQuery(sql); - } - MessageBox.Show("插入成功", "提示"); - } - } - - private string getRealName(string name) - { - string realName = ""; - switch (name) - { - case "ribbonBar10": - realName = "文件"; - break; - case "ribbonBar21": - realName = "浏览"; - break; - case "ribbonBar4": - realName = "场景"; - break; - case "ribbonBar2": - realName = "查询"; - break; - case "ribbonBar11": - realName = "编辑"; - break; - case "ribbonBar5": - realName = "编辑"; - break; - case "ribbonBar6": - realName = "统计"; - break; - case "ribbonBar8": - realName = "统计"; - break; - case "ribbonBar14": - realName = "量算"; - break; - case "ribbonBar12": - realName = "标注"; - break; - case "ribbonBar1": - realName = "分析"; - break; - case "ribbonBarJJ": - realName = "净距分析"; - break; - case "ribbonBarTP": - realName = "拓扑分析"; - break; - case "ribbonBarSY": - realName = "视域分析"; - break; - case "ribbonBarKW": - realName = "开挖分析"; - break; - case "ribbonBarQY": - realName = "区域分析"; - break; - case "ribbonBarMN": - realName = "模拟分析"; - break; - case "ribbonBarDM": - realName = "断面分析"; - break; - case "ribbonBar13": - realName = "数据管理"; - break; - case "ribbonBar3": - realName = "数据管理"; - break; - case "ribbonBar9": - realName = "数据管理"; - break; - case "ribbonBar7": - realName = "飞行"; - break; - case "ribbonBar15": - realName = "用户管理"; - break; - case "ribbonBar16": - realName = "传感器"; - break; - default: - realName = name; - break; - } - return realName; - } - - private void configResource() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - string sql = "select casic_resc.\"name\" from casic_userstatus join casic_role on casic_userstatus.\"rid\" = casic_role.\"id\" join casic_perm on casic_role.\"pid\"=casic_perm.\"id\" join casic_permresc on casic_perm.\"id\"=casic_permresc.\"permid\" join casic_resc on casic_permresc.\"rescid\"=casic_resc.\"id\" where casic_userstatus.\"username\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - string[] sResourceName = new string[dt.Rows.Count]; - for (int i = 0; i < dt.Rows.Count; i++) - { - sResourceName[i] = dt.Rows[i][0].ToString().Trim(); - } - setControlVisilbe(sResourceName); - } - } - } + private bool isContainName(string[] array, string name) { @@ -1820,116 +1521,116 @@ return bl; } - private void setControlVisilbe(string[] resourceNames) - { - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - subListItem.Add(tabItemResourceName); - if (!isContainName(resourceNames, tabItemResourceName)) - { - ribbonTabItemResource.Visible = false; - } - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(SubButtonItemResourceName); - if (!isContainName(resourceNames, SubButtonItemResourceName)) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) - { - sliderItemResource.Visible = false; - } + //private void setControlVisilbe(string[] resourceNames) + //{ + // ArrayList listItem = new ArrayList(); + // ArrayList subListItem = new ArrayList(); + // System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; + // for (int i = 0; i < cc.Count; i++) + // { + // if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) + // { + // DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; + // for (int j = 0; j < ribbonStripResource.Items.Count; j++) + // { + // if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) + // { + // DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; + // string tabItemResourceName = ribbonTabItemResource.Text; + // listItem.Add(tabItemResourceName); + // subListItem.Add(tabItemResourceName); + // if (!isContainName(resourceNames, tabItemResourceName)) + // { + // ribbonTabItemResource.Visible = false; + // } + // if (ribbonTabItemResource.SubItems.Count > 0) + // { + // for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) + // { + // if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) + // { + // DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; + // for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) + // { + // if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) + // { + // DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; + // for (int k = 0; k < ribbonBarResource.Items.Count; k++) + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // if (buttonItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < buttonItemResource.SubItems.Count; m++) + // { + // if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // string SubButtonItemResourceName = subButtonItemResource.Text; + // subListItem.Add(SubButtonItemResourceName); + // if (!isContainName(resourceNames, SubButtonItemResourceName)) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // else + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) + // { + // DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; + // if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) + // { + // sliderItemResource.Visible = false; + // } - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - } - } - } - } - } - } - } - #endregion + // if (sliderItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < sliderItemResource.SubItems.Count; m++) + // { + // if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + //} + //#endregion void globeControl2_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) { @@ -1961,54 +1662,7 @@ globeControl2.Globe.JumpToCameraState(camera); } } - - void globeControl1_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - if (e.Layer.Name != null && e.Layer.Name.Length > 5) - { - if (e.Layer.Name.Substring(0, 5).Equals("fttp:")) - { - return; - } - } - - if (Path.GetExtension(e.Layer.Name).ToLower().Equals(".kml")) - { - AddKmlLayer(e.Layer); - } - else - { - GSODataset dataset = e.Layer.Dataset; - CheckDatasetGeoReference(e.Layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = e.Layer; - node.Text = e.Layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = e.Layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - layerManagerNode.Expand(); - terrainManagerNode.Expand(); - } - - private void AddKmlLayer(GSOLayer layer) - { - if (layer != null) - { - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - VisitFeature3Ds(layer.GetAllFeatures(), node); - } - } - + private void VisitFeature3Ds(GSOFeatures feature3ds, TreeNode node) { for (int i = 0; i < feature3ds.Length; i++) @@ -2858,28 +2512,7 @@ * **/ } #endregion - - private GSOFeatures PolygonIntersectAnalysis(GSOGeoPolygon3D polygon, string pipelinetype) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelinetype); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pipelinetype, feats.Length); - return feats; - } + /// /// 根据范围统计阀门、管线、工井等, 开挖分析, 挖方量分析 /// @@ -3948,28 +3581,7 @@ } return null; } - /// - /// 添加图层 - /// - /// - /// - /// - private bool AddLayers(string layerName, string layerCaption) - { - try - { - GSODataset dataset1 = Utility.dataSource.GetDatasetByName(layerName); - dataset1.Caption = layerCaption; - GSOLayer templayer = globeControl1.Globe.Layers.Add(dataset1); - templayer.Caption = layerCaption; - templayer.MaxVisibleAltitude = 5000; - return templayer.Visible; - } - catch (Exception ex) - { - return false; - } - } + /// /// 菜单上的 三维导航 工具按钮 /// @@ -4438,50 +4050,7 @@ } Image printImage; - /// - /// 打印 菜单 - /// - /// - /// - private void buttonItem13_Click(object sender, EventArgs e) - { - 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); - printImage = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(printImage); - 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); - int rightBottomX = pt.X + mapWidth; - int rightBottomY = pt.Y + mapHeight; - Image myImg = new Bitmap(mapWidth, mapHeight); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY)); - - - PrintDialog pd = new PrintDialog(); - try - { - if (pd.ShowDialog() == DialogResult.OK) //如果确认,将会覆盖所有的打印参数设置 - { - //打印预览 - PrintPreviewDialog ppd = new PrintPreviewDialog(); - ppd.Document = printDocument1; - if (DialogResult.OK == ppd.ShowDialog()) - { - printDocument1.Print(); //打印 - } - } - } - catch - { - printDocument1.PrintController.OnEndPrint(printDocument1, new System.Drawing.Printing.PrintEventArgs()); - } - } - + private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -4537,43 +4106,7 @@ } } } - - /// - /// 统计管线的里程数 - /// - /// - /// - /// - public Double PipeLength(string currentQlayer, double totalLength) - { - if (dataGridViewX1.Rows.Count - 1 != 0) - { - for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) - { - string featureName = ""; - if (dataGridViewX1.Columns.Contains("编号")) - { - featureName = dataGridViewX1.Rows[i].Cells["编号"].Value.ToString().Trim(); - } - else - { - featureName = dataGridViewX1.Rows[i].Cells["标识器编号"].Value.ToString().Trim(); - } - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)(Utility.LayerLabel_LayerIDs[currentQlayer])); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(currentQlayer); - GSOFeatures features = layer.GetFeatureByName(featureName, false); - for (int j = 0; j < features.Length; j++) - { - GSOFeature feat = features[j]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - double lentgh = line.GetSpaceLength(true, 6378137); - totalLength += lentgh; - } - } - } - return totalLength; - } - + /// /// 窗体下方属性表格 右键菜单中的 “定位”菜单 /// @@ -4687,27 +4220,29 @@ count = 0; } } - + #region wxl 删除无用??有疑问,功能用在哪里? /// /// 绘制线 菜单 /// /// /// - private void btnAddLine_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - } + //private void btnAddLine_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + //} + /// /// 绘制面 菜单 /// /// /// - private void btnAddPolygon_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolygon; - } + //private void btnAddPolygon_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolygon; + //} + #endregion /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -4763,51 +4298,9 @@ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); layer.Dataset.Save(); } + - /// - /// 根据多边形范围统计管线的里程 - /// - /// - /// - /// 返回查询到的管线要素集合 - private GSOFeatures Intersects_Pipeline(GSOGeoPolygon3D polygon, string pipelineLayerCaption) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineLayerCaption); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = new GSOFeatures(); - if (polygon == null) - feats = flayer.GetAllFeatures(); - else - feats = flayer.FindFeaturesInPolygon(polygon, false); - - double totallength = 0.01; - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - if (line == null) - continue; - - double length = line.GetSpaceLength(true, 6378137); - totallength += length; - if (polygon != null) - feat.HighLight = true; - } - double toLength = Convert.ToDouble(totallength.ToString().Substring(0, totallength.ToString().IndexOf("."))); - pipeLineDis.Add(pipelineLayerCaption, toLength); - return feats; - } - - Dictionary pipeLineDis = new Dictionary(); - Dictionary workWellLen = new Dictionary(); - - - - + #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 /// @@ -4838,6 +4331,7 @@ } return feats; } + #endregion /// /// 清除结果 菜单 /// @@ -4897,46 +4391,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - - /// - /// 显示流向 功能 - /// - /// - /// - /// - private void Flow(object sender, string pipelineNameCN, bool bShow) - { - GSOFeatureLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineNameCN) as GSOFeatureLayer; - GSOFeatures feats = layer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - lineStyle.ArrowStyle.Play(); - } - lineStyle.ArrowVisible = bShow; - layerTree.SelectedNode = null; - } - } - globeControl1.Globe.Refresh(); - } - - FrmCloseValves frm; - - FrmBoosterValvers frmbooster = null; - + /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -6276,55 +5731,9 @@ } } + /// - /// 清除所有坑 菜单 - /// - /// - /// - private void buttonItem3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItem3.Text); - - globeControl1.Globe.RemoveAllPits(); - } - - //} - /// - /// 大气层 菜单 - /// - /// - /// - private void buttonItem17_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.Atmosphere.Visible = !globeControl1.Globe.Atmosphere.Visible; - buttonItemSH1.Checked = globeControl1.Globe.Atmosphere.Visible; - globeControl1.Refresh(); - } - /// - /// 经纬网 菜单 - /// - /// - /// - private void buttonItem20_Click(object sender, EventArgs e) - { - globeControl1.Globe.LatLonGrid.Visible = !globeControl1.Globe.LatLonGrid.Visible; - buttonItemSH3.Checked = globeControl1.Globe.LatLonGrid.Visible; - globeControl1.Globe.Refresh(); - } - /// - /// 状态条 菜单 - /// - /// - /// - private void buttonItem21_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.StatusBar.Visible = !globeControl1.Globe.StatusBar.Visible; - buttonItemSH4.Checked = globeControl1.Globe.StatusBar.Visible; - globeControl1.Globe.Refresh(); - } - /// /// 添加指定路径下的数据 功能 /// /// @@ -6365,6 +5774,7 @@ node.SelectedImageIndex = 0; node.Checked = terrain.Visible; // 注意用insert不要用add,因为后加入的图层在上层 + // terrainManagerNode.Nodes.Add(node); layerManagerNode.Nodes.Insert(0, node); } newlayername = terrain.Caption; @@ -6415,88 +5825,7 @@ } return objRes; } - /// - /// 刷新目录树 功能 - /// - private void RefreshDataTree() - { - layerTree.Nodes[0].Nodes.Clear(); - Int32 nCount = globeControl1.Globe.DataManager.DataSourceCount; - Int32 i = 0; - for (i = 0; i < nCount; i++) - { - GSODataSource dataSpace = globeControl1.Globe.DataManager[i]; - TreeNode node = new TreeNode(); - node.Text = dataSpace.Name; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = true; - node.Tag = dataSpace; - Int32 nDatasetCount = dataSpace.DatasetCount; - for (Int32 j = 0; j < nDatasetCount; j++) - { - GSODataset dataset = dataSpace[j]; - TreeNode subNode = new TreeNode(); - subNode.Text = dataset.Name; - subNode.ImageIndex = 0; - subNode.SelectedImageIndex = 0; - subNode.Checked = true; - subNode.Tag = dataset; - node.Nodes.Add(subNode); - } - layerTree.Nodes[0].Nodes.Add(node); - } - } - /// - /// 判断图层是否包含字段列表 - /// - /// - /// - private bool HasFields(string layerName) - { - GSOLayer m_layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName);//获取当前选择的layer图层 - if (m_layer == null) - return false; - GSOFeatureLayer flayer = m_layer as GSOFeatureLayer; - - GSOFeatureDataset _featureDataSet = m_layer.Dataset as GSOFeatureDataset; - if (_featureDataSet == null) - return false; - - _featureDataSet.Open(); - if (_featureDataSet.FieldCount > 0) - return true; - else - return false; - } - - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayer(GSOGeoPolygon3D polygon, string pointLayerName) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pointLayerName, feats.Length); - return feats; - } + /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -6654,17 +5983,7 @@ MessageBox.Show("表格内容为空!", "提示"); } } - /// - /// 导出CAD 菜单 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - FrmExportCADS frm = new FrmExportCADS(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(); - } - + ///// ///// 区域分析 菜单 ///// @@ -6695,16 +6014,7 @@ } } } - /// - /// 数据验证 菜单 - /// - /// - /// - private void buttonItem80_Click(object sender, EventArgs e) - { - FrmValiData frm = new FrmValiData(globeControl1); - frm.ShowDialog(); - } + /// /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 /// @@ -6730,180 +6040,133 @@ } } } - /// - /// 数据库备份 菜单 - /// - /// - /// - private void btnBackDatabase_Click(object sender, EventArgs e) - { - if (MessageBox.Show("是否确定要备份数据库文件", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - try - { - DateTime currentTime = DateTime.Now; - //string Dtime = currentTime.ToShortDateString().ToString("yyyy-MM-dd"); - string Dtime = currentTime.GetDateTimeFormats('D')[0].ToString(); - string Htime = DateTime.Now.ToString("HH时mm分ss秒").Trim(); - string fileName = Dtime + "(" + Htime + ")"; - string pathName = ""; - string sql = "select filename from master..sysdatabases where name='" + Utility.dbdatabase + "'"; - DataTable dt = OledbHelper.ExecuteDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - pathName = dt.Rows[0][0].ToString().Trim(); - int count = pathName.LastIndexOf("\\") == -1 ? pathName.LastIndexOf("/") : pathName.LastIndexOf("\\"); - pathName = pathName.Substring(0, count); - } - pathName += "\\管网数据库" + fileName + ".bak"; - - OracleCommand cmdBK = new OracleCommand(); - cmdBK.CommandType = CommandType.Text; - cmdBK.Connection = connBackup; - cmdBK.CommandText = @"backup database " + Utility.dbdatabase + " to disk='" + pathName + "' with init"; - - connBackup.Open(); - cmdBK.ExecuteNonQuery(); - MessageBox.Show("数据库文件备份成功", "提示"); - } - catch (Exception ex) - { - //MessageBox.Show(ex.Message); - LogError.PublishError(ex); - } - finally - { - connBackup.Close(); - } - } - } - + #region Fan 去掉 - //GSOFeature emitterFeature; // 粒子要素 - /// - /// 添加火苗 功能 - /// - /// - /// - /// - private void AddFire(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + ////GSOFeature emitterFeature; // 粒子要素 + ///// + ///// 添加火苗 功能 + ///// + ///// + ///// + ///// + //private void AddFire(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; - // 烟火粒子示例,由三个发射器构成 - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // string strResPath = Application.StartupPath + "/Resource"; + // // 烟火粒子示例,由三个发射器构成 + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSORingParticleEmitter emitter = new GSORingParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 + // GSORingParticleEmitter emitter = new GSORingParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 - emitter.SetSizeFix(1, 1); - emitter.VelFix = 1; - emitter.VelRnd = 5; + // emitter.SetSizeFix(1, 1); + // emitter.VelFix = 1; + // emitter.VelRnd = 5; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 90; - emitter.AngleXZRnd = 0; + // emitter.AngleXZFix = 90; + // emitter.AngleXZRnd = 0; - emitter.LifeFix = 0.5f; - emitter.LifeRnd = 0.0f; + // emitter.LifeFix = 0.5f; + // emitter.LifeRnd = 0.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 100; - emitter.IsLumAdded = true; + // emitter.EmitPerSec = 100; + // emitter.IsLumAdded = true; - // 采用线性插值生成粒子的初始颜色 - emitter.ColorRndStart = Color.White; - emitter.ColorRndEnd = Color.Red; + // // 采用线性插值生成粒子的初始颜色 + // emitter.ColorRndStart = Color.White; + // emitter.ColorRndEnd = Color.Red; - GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); - effector2.SetColorChanged(0, -1, -1, 0); - effector2.StartTime = 0.0f; - effector2.EndTime = -1.0f; - emitter.AddEffector(effector2); + // GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); + // effector2.SetColorChanged(0, -1, -1, 0); + // effector2.StartTime = 0.0f; + // effector2.EndTime = -1.0f; + // emitter.AddEffector(effector2); - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); + // geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - } - /// - /// 添加喷泉 功能 - /// - /// - /// - /// - private void AddFountain(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + //} + ///// + ///// 添加喷泉 功能 + ///// + ///// + ///// + ///// + //private void AddFountain(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; + // string strResPath = Application.StartupPath + "/Resource"; - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/test.png"; + // GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/test.png"; - emitter.SetSizeFix(0.5f, 2); - emitter.VelFix = 10; - emitter.VelRnd = 2; + // emitter.SetSizeFix(0.5f, 2); + // emitter.VelFix = 10; + // emitter.VelRnd = 2; - emitter.GravityAcc = 9.8f; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.GravityAcc = 9.8f; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 88; - emitter.AngleXZRnd = 2; + // emitter.AngleXZFix = 88; + // emitter.AngleXZRnd = 2; - emitter.LifeFix = 5.0f; - emitter.LifeRnd = 1.0f; + // emitter.LifeFix = 5.0f; + // emitter.LifeRnd = 1.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 1000; - emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); - emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); - emitter.IsLumAdded = false; + // emitter.EmitPerSec = 1000; + // emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); + // emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); + // emitter.IsLumAdded = false; - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // + // geoParticle.Play(); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - //globeControl1.Globe.FlyToFeature(emitterFeature); - } + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // //globeControl1.Globe.FlyToFeature(emitterFeature); + //} #endregion /// @@ -7006,73 +6269,7 @@ } return resFeature; } - - /// - /// 创建label要素 功能 - /// - /// 添加label要素的feature - /// feature的位置 - /// label要素名字 - /// feature名字 - /// label要素距离点的位置 - /// - private GSOFeature createLabel(GSOLayer layer, GSOFeature feature, GSOGeoPoint3D point, string labelName, string featureName, GSOPoint2d point2d) - { - for (int i = layer.GetAllFeatures().Length - 1; i >= 0; i--) - { - GSOFeature gfeat = layer.GetAt(i); - if (gfeat != null && gfeat.Geometry != null && gfeat.Geometry.Type == EnumGeometryType.GeoPoint3D) - { - GSOGeoPoint3D pointItem = gfeat.Geometry as GSOGeoPoint3D; - if (pointItem.X == point.X && pointItem.Y == point.Y && pointItem.Z == point.Z) - { - layer.RemoveAt(i); - break; - } - } - } - point.AltitudeMode = EnumAltitudeMode.RelativeToGround; - feature.Geometry = point; - feature.Name = featureName; - GSOLabel newLabel = new GSOLabel(); - newLabel.Text = labelName; - newLabel.Style = new GSOLabelStyle(); - newLabel.Style.Opaque = 0.8; - newLabel.Style.OutlineColor = Color.Gray; - newLabel.Style.TractionLineEndPos = point2d; - newLabel.Style.OutlineWidth = 1; - newLabel.Style.TracktionLineWidth = 1; - newLabel.Style.TractionLineColor = Color.Green; - - Color color1 = Color.FromArgb(60, 187, 206, 230); - Color color2 = Color.FromArgb(150, 187, 200, 250); - newLabel.Style.BackBeginColor = color1; - newLabel.Style.BackEndColor = color2; - - feature.Label = newLabel; - return feature; - } - - - - /// - /// 获取指定两点组成的线的长度 功能 - /// - /// - /// - /// - private double getDistance(GSOPoint3d point1, GSOPoint3d point2) - { - GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(point1); - point3ds.Add(point2); - lineline.AddPart(point3ds); - - double distance = lineline.GetSpaceLength(true, 6378137.0); - return distance; - } - + /// /// 图层节点树中 节点 右键单击事件处理 /// @@ -7320,591 +6517,11 @@ // buttonItem95.Checked = !buttonItem95.Checked; //} ///// - /// 添加用户仓库 菜单 - /// - /// - /// - private void buttonItem108_Click(object sender, EventArgs e) - { - FrmUserRepo frm = new FrmUserRepo(-1); - frm.ShowDialog(); - } - /// - /// 用户仓库管理 菜单 - /// - /// - /// - private void buttonItem111_Click(object sender, EventArgs e) - { - FrmUserRepoMgr frm = new FrmUserRepoMgr(); - frm.ShowDialog(); - } - /// - /// 添加分系统 菜单 - /// - /// - /// - private void buttonItem112_Click(object sender, EventArgs e) - { - //FrmAPP frm = new FrmAPP(-1); - //frm.ShowDialog(); - } - /// - /// 分系统管理 菜单 - /// - /// - /// - private void buttonItem113_Click(object sender, EventArgs e) - { - //FrmAPPMgr frm = new FrmAPPMgr(); - //frm.ShowDialog(); - } - /// - /// 添加操作 菜单 - /// - /// - /// - private void buttonItem114_Click(object sender, EventArgs e) - { - FrmOper frm = new FrmOper(-1); - frm.ShowDialog(); - } - /// - /// 操作管理 菜单 - /// - /// - /// - private void buttonItem115_Click(object sender, EventArgs e) - { - FrmOperMgr frm = new FrmOperMgr(); - frm.ShowDialog(); - } - /// - /// 添加资源 菜单 - /// - /// - /// - private void buttonItem116_Click(object sender, EventArgs e) - { - FrmRESC frm = new FrmRESC(-1); - frm.ShowDialog(); - } - /// - /// 资源管理 菜单 - /// - /// - /// - private void buttonItem117_Click(object sender, EventArgs e) - { - FrmRESCMgr frm = new FrmRESCMgr(); - frm.ShowDialog(); - } - /// - /// 添加权限 菜单 - /// - /// - /// - private void buttonItem118_Click(object sender, EventArgs e) - { - FrmPerm frm = new FrmPerm(-1); - frm.ShowDialog(); - } - /// - /// 权限管理 菜单 - /// - /// - /// - private void buttonItem119_Click(object sender, EventArgs e) - { - FrmPermMgr frm = new FrmPermMgr(); - frm.ShowDialog(); - } - /// - /// 添加访问控制 菜单 - /// - /// - /// - private void buttonItem120_Click(object sender, EventArgs e) - { - FrmAccess frm = new FrmAccess(-1); - frm.ShowDialog(); - } - /// - /// 访问控制管理 菜单 - /// - /// - /// - private void buttonItem121_Click(object sender, EventArgs e) - { - FrmAccessMgr frm = new FrmAccessMgr(); - frm.ShowDialog(); - } - /// - /// 部门类型管理 菜单 - /// - /// - /// - private void buttonItem122_Click(object sender, EventArgs e) - { - FrmRegionTypeMgr frm = new FrmRegionTypeMgr(); - frm.ShowDialog(); - } - /// - /// 添加用户 菜单 - /// - /// - /// - private void buttonItem127_Click(object sender, EventArgs e) - { - FrmUserAdd frm = new FrmUserAdd(-1); - frm.ShowDialog(); - } - /// - /// 用户信息管理 菜单 - /// - /// - /// - private void buttonItem128_Click_1(object sender, EventArgs e) - { - FrmUserManager frm = new FrmUserManager(); - frm.ShowDialog(); - } - /// - /// 添加角色 菜单 - /// - /// - /// - private void 添加角色_Click(object sender, EventArgs e) - { - FrmRole frm = new FrmRole(-1); - frm.ShowDialog(); - } - /// - /// 所有角色管理 菜单 - /// - /// - /// - private void 角色管理_Click(object sender, EventArgs e) - { - FrmRoleMgr frm = new FrmRoleMgr(); - frm.ShowDialog(); - } - - /// - /// 部门角色管理 菜单 - /// - /// - /// - private void buttonItem133_Click(object sender, EventArgs e) - { - FrmRegionRoleMgr frm = new FrmRegionRoleMgr(); - frm.ShowDialog(); - } - /// - /// 部门管理 菜单 - /// - /// - /// - private void buttonItem130_Click(object sender, EventArgs e) - { - FrmRegionMgr frm = new FrmRegionMgr(); - frm.ShowDialog(); - } - - /// - /// 日志管理 菜单 - /// - /// - /// - private void buttonItem135_Click(object sender, EventArgs e) - { - FrmLogManager frm = new FrmLogManager(); - frm.ShowDialog(); - } - /// - /// 传感器信息查询 菜单 - /// - /// - /// - private void buttonItem131_Click_1(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description.Trim(); - if (tabelName != "" && eqtID != "") - { - string fields = getFields(tabelName); - if (fields != "") - { - string sql = "select " + fields + " from " + Utility.sensorDatabase + "." + tabelName + " where EqtID=" + eqtID + " order by RecordDate desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - FrmQueryMessage.ShowForm(this, dt, layer.Caption); - //queryMessage.Show(this); - } - else - { - MessageBox.Show("没有查询到相关信息!", "提示"); - } - } - else - { - MessageBox.Show("配置文件 \"sensorConfig.xml\" 有误!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - /// - /// 根据指定的图层的caption属性的值在配置文件中查找对应的数据库中的表的名称 - /// - /// 图层的caption属性的值 - /// 对应的数据库中的表的名称 - private string getTableName(string name) - { - string tabelName = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.layerName == name) - { - tabelName = mLayer.tableName; - break; - } - } - } - return tabelName; - } - /// - /// 根据数据库中的表的名称 查找对应的表中的字段名称的集合 - /// - /// 数据库中的表的名称 - /// 对应的表中的字段名称的集合 - private string getFields(string tabelName) - { - string fields = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.tableName.Trim() == tabelName.Trim()) - { - if (mLayer.fields != null) - { - foreach (string key in mLayer.fields.Keys) - { - string value = mLayer.fields[key]; - fields += tabelName.Trim() + "." + key + " as " + value + ","; - } - fields = fields.Remove(fields.Length - 1); - } - break; - } - } - } - return fields; - } - - /// - /// 历史曲线查询 菜单 - /// - /// - /// - private void buttonItem132_Click(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description; - if (tabelName != "" && eqtID != "") - { - FrmQueryHistory.ShowForm(this, tabelName, eqtID); - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - + //定时检查传感器的状态 public System.Windows.Forms.Timer timerOfSensor = null; - public int alarmValueLiuLiang = 0; - public int alarmValueYaLi = 0; - public int alarmValueYeTi = 0; - public int alarmValueZaoSheng = 0; - /// - /// 传感器在线报警 菜单 - /// - /// - /// - private void buttonItem134_Click(object sender, EventArgs e) - { - if (timerOfSensor == null) - { - timerOfSensor = new System.Windows.Forms.Timer(); - timerOfSensor.Interval = 30000; - timerOfSensor.Tick += new EventHandler(timerOfSensor_Tick); - } - FrmQuerySensorAlarm.ShowForm(this); - } - /// - /// 传感器报警 功能中的 定时器 的触发事件处理 - /// - /// - /// - private void timerOfSensor_Tick(Object sender, EventArgs e) - { - checkSensor(); - } - private void checkSensor() - { - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.alarmValue > 0) - { - string sql = "select *,max(CollectTime) from " + Utility.sensorDatabase + "." + mLayer.tableName + " group by EqtID;";// "select * from " + Utility.sensorDatabase + "." + mLayer.tableName + " order by CollectTime desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - for (int j = 0; j < dt.Rows.Count; j++) - { - try - { - string EqtID = dt.Rows[j]["EqtID"].ToString().Trim(); - string RecordDateDATE = dt.Rows[j]["RecordDate"].ToString().Trim(); - string RecordTimeTIME = dt.Rows[j]["RecordTime"].ToString().Trim(); - string CollectTime = dt.Rows[j]["CollectTime"].ToString().Trim(); - string CollectValue = ""; - if (mLayer.tableName == "Data_3a") - { - CollectValue = dt.Rows[j]["InstantValue"].ToString().Trim(); - } - else - { - CollectValue = dt.Rows[j]["CollectValue"].ToString().Trim(); - } - int value = 0; - if (int.TryParse(CollectValue, out value)) - { - if (value > mLayer.alarmValue) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(mLayer.layerName); - if (layer != null) - { - for (int m = 0; m < layer.GetAllFeatures().Length; m++) - { - GSOFeature f = layer.GetAt(m); - if (f != null && f.Description.Trim() == EqtID) - { - f.HighLight = true; - globeControl1.Globe.Refresh(); - LogError.PublishAlarmMessage(f.Name, EqtID, CollectValue, CollectTime); - break; - } - } - } - } - } - } - catch (Exception ex) - { - continue; - } - } - } - } - } - } - } + - - /// - /// 沿线运动 菜单 - /// - /// - /// - private void buttonItem138_Click(object sender, EventArgs e) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - GSOFeature lineFeature = globeControl1.Globe.SelectedObject; - if (lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "*.gcm;*.3ds|*.gcm;*.3ds|*.3ds|*.3ds|*.gcm|*.gcm"; - if (dlg.ShowDialog() == DialogResult.OK) - { - GSOGeoModel model = new GSOGeoModel(); - model.FilePath = dlg.FileName; - - GSOGeoDynamicRoute dynamicRoute = new GSOGeoDynamicRoute(); - dynamicRoute.ActorGeometry = model; - - GSORoute route = new GSORoute(); - GSOGeoPolyline3D geoline = (GSOGeoPolyline3D)lineFeature.Geometry; - for (int i = 0; i < geoline[0].Count; i++) - { - route.Add(geoline[0][i]); - } - route.CircleRoute = false; - route.Speed = 30; - route.RotateSpeed = 50; - route.AltitudeMode = geoline.AltitudeMode; - dynamicRoute.Route = route; - - GSOFeature feature = new GSOFeature(); - - dynamicRoute.Play(); - feature.Geometry = dynamicRoute; - - //GSOLabel gsoLabel = new GSOLabel(); - //gsoLabel.Text = "模型测试"; - //feature.Label = gsoLabel; - globeControl1.Globe.MinModelVisibleSize = 0; - - globeControl1.Globe.MemoryLayer.AddFeature(feature); - globeControl1.Globe.Refresh(); - } - } - /// - /// 回退 菜单 - /// - /// - /// - private void buttonItem99_Click(object sender, EventArgs e) - { - globeControl1.Globe.UnDoEdit(); - } - /// - /// 前进 菜单 - /// - /// - /// - private void buttonItem100_Click(object sender, EventArgs e) - { - globeControl1.Globe.ReDoEdit(); - } - /// - /// 水平净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX4_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX4.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX24.Text = "水平净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 垂直净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX2_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX2.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX23.Text = "垂直净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 覆土分析 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX3_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX3.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX17.Text = "覆土深度小于" + value.ToString() + "米的管线有:"; - } - } - } - - /// - /// 传感器分类查询 全区域 菜单 - /// - /// - /// - private void buttonItemSensor全区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 传感器分类查询 绘制区域 菜单 - /// - /// - /// - private void buttonItemSensor绘制区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 1); - } - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -7954,154 +6571,9 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// - /// 数字预处理 功能 - /// - /// - /// - private void 数字预处理buttonItem140_Click(object sender, EventArgs e) - { - FrmEditShapeFile frm = new FrmEditShapeFile(globeControl1); - frm.ShowDialog(this); - } - - - /// - /// 导出矢量 功能 将图层导出为kml和shp格式数据 - /// - /// - /// - private void 导出矢量buttonItem140_Click(object sender, EventArgs e) - { - List listVectorNames = new List(); - for (int i = 0; i < m_PipelineLayerNames.Count; i++) - { - if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) - { - listVectorNames.Add(m_PipelineLayerNames[i]); - } - } - for (int i = 0; i < valueLayerNames.Count; i++) - { - if (listVectorNames.Contains(valueLayerNames[i]) == false) - { - listVectorNames.Add(valueLayerNames[i]); - } - } - for (int i = 0; i < workwellLayerNames.Count; i++) - { - if (listVectorNames.Contains(workwellLayerNames[i]) == false) - { - listVectorNames.Add(workwellLayerNames[i]); - } - } - for (int i = 0; i < instrumenLayerNames.Count; i++) - { - if (listVectorNames.Contains(instrumenLayerNames[i]) == false) - { - listVectorNames.Add(instrumenLayerNames[i]); - } - } - for (int i = 0; i < pipefittingLayerNames.Count; i++) - { - if (listVectorNames.Contains(pipefittingLayerNames[i]) == false) - { - listVectorNames.Add(pipefittingLayerNames[i]); - } - } - FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames); - frm.ShowDialog(); - } string citySevenLineType = ""; string cityServerLineName = ""; - /// - /// 绘制城市七线 功能按钮 - /// - /// - /// - private void 绘制城市七线buttonItem140_Click(object sender, EventArgs e) - { - FrmCitySevenLineType frm = new FrmCitySevenLineType(); - if (frm.ShowDialog() == DialogResult.OK) - { - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - m_isDrawCitySevenLine = true; - m_isDrawTunnel = false; - m_AddPipeLine = false; - this.citySevenLineType = frm.citySevenLineType; - this.cityServerLineName = frm.citySevenLineName; - switch (frm.citySevenLineType) - { - case "城市红线": - GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerRed != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerRed; - layerRed.Editable = true; - } - break; - case "城市橙线": - GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerOrange != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerOrange; - layerOrange.Editable = true; - } - break; - case "城市黄线": - GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerYellow != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerYellow; - layerYellow.Editable = true; - } - break; - case "城市绿线": - GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerGreen != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerGreen; - layerGreen.Editable = true; - } - break; - case "城市蓝线": - GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlue != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlue; - layerBlue.Editable = true; - } - break; - case "城市紫线": - GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerPurple != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerPurple; - layerPurple.Editable = true; - } - break; - case "城市黑线": - GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlack != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlack; - layerBlack.Editable = true; - } - break; - } - } - } - /// - /// 七线审核 功能按钮 - /// - /// - /// - private void 七线审核buttonItem141_Click(object sender, EventArgs e) - { - FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(this); - } /// /// 间距分析 开始分析按钮 分析绘制的七线和管线的距离是否符合标准 @@ -8382,116 +6854,67 @@ } } } - /// - /// 管线自动缩进 菜单 - /// - /// - /// - private void 管线自动缩进buttonItem140_Click(object sender, EventArgs e) - { - FrmPipelineIndented frm = new FrmPipelineIndented(globeControl1, m_PipelineLayerNames, workwellLayerNames); - frm.ShowDialog(this); - } - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, string pointLayerName, string type) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName + "管线附属物"); - if (layer == null) - return null; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - GSOFeatures newfeats; - string typeg = ""; - if (polygon == null) - { - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } - feats = flayer.GetFeatureByFieldValue("附属物名称", typeg, true); - newfeats = feats; - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats.RemoveAll(); - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } + //// + ////导出路由专题图 + //// + //private void btnOutputR_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputR.Text); - //过滤 - for (int j = 0; j < feats.Length; j++) - { - GSOFeature feat = feats[j]; + // 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))); - if (feat.GetFieldAsString("附属物名称").EndsWith(typeg)) - { - newfeats.Add(feat); - } - } - } + // F_PATMTitle frm = new F_PATMTitle("R", myImg); + // frm.ShowDialog(); + //} + // + //导出配件专题图 + // + //private void btnOutputF_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputF.Text); - workWellLen.Add(pointLayerName + type, newfeats.Length); - return newfeats; - } + // 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))); - //设置图层为隐藏 - private void setLayerVisible(string layerName) - { - GSOLayer templayer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - if (templayer != null) - { - templayer.Visible = false; - } - globeControl1.Globe.Refresh(); - } + // F_PATMTitle frm = new F_PATMTitle("F", myImg); + // frm.ShowDialog(); + //} - /// - /// 连接数据库 - /// - /// - /// - private void buttonItem129_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_1.Text); - FrmDatabaseParaSetting2 frm = new FrmDatabaseParaSetting2(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting2.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } + + + ////交越点入库 + //private void fmrk_Click(object sender, EventArgs e) + //{ + // //保存日志 + // LogManager.saveLog(Utility.userName, this.fmrk.Text); + + // if (ds == null) + // { + // MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + // ConnectDB(null, null); + // } + // if (ds == null) + // return; + // FrmAddValve frm = new FrmAddValve(globeControl1, ds); + // if (frm.ShowDialog() == DialogResult.OK) + // { + // addNodeToLayerManagerNode(frm.rukuLayer); + // } + //} /// /// 一键审核---导入数据 @@ -8504,19 +6927,17 @@ try { + string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", - user, pass); + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (shds == null) { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - - //Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); + Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -8528,6 +6949,7 @@ MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); return; } + } /// @@ -8802,232 +7224,7 @@ } - - /// - /// 绘制垂线 - /// - /// - /// - private void drawCLine(GSOPoint3d fpt, GSOPoint3d tpt) - { - GSOGeoPolyline3D pline = new GSOGeoPolyline3D(); - GSOPoint3ds pts = new GSOPoint3ds(); - pts.Add(fpt); - pts.Add(tpt); - pline.AddPart(pts); - - GSOGeoPoint3D fptg = new GSOGeoPoint3D(); - GSOGeoPoint3D tptg = new GSOGeoPoint3D(); - fptg.X = fpt.X; - fptg.Y = fpt.Y; - fptg.Z = 0; - tptg.X = tpt.X; - tptg.Y = tpt.Y; - tptg.Z = 0; - - GSOFeature gf = new GSOFeature(); - gf.Geometry = pline; - - globeControl1.Globe.MemoryLayer.AddFeature(gf); - } - /// - /// 比较两个点是否是同一个点 - /// - /// - /// - /// - private bool comparePoint(GSOPoint3d pt1, GSOPoint3d pt2) - { - double x1 = 0; double y1 = 0; - double x2 = 0; double y2 = 0; - x1 = pt1.X; - y1 = pt1.Y; - x2 = pt2.X; - y2 = pt2.Y; - if ((x1 == x2) && (y1 == y2)) - { - return true; - } - return false; - } - /// - /// 获得点到线的垂线距离及垂点 - /// - /// - /// - /// - /// - private void comparePointLine(GSOPoint3d point, GSOGeoPolyline3D line, out double length, out GSOPoint3d pointChuiDian) - { - GSOPoint3d lineStartPoint = line[0][0]; - GSOPoint3d lineEndPoint = line[0][1]; - GSOGeoPolyline3D lineAB = new GSOGeoPolyline3D(); - GSOPoint3ds pointsAB = new GSOPoint3ds(); - pointsAB.Add(point); - pointsAB.Add(lineStartPoint); - lineAB.AddPart(pointsAB); - double lengthAB = lineAB.GetSpaceLength(false, 6378137.0); - double xieLvAB = getXieLu("", point.X, point.Y, lineStartPoint.X, lineStartPoint.Y); - double xieLvBC = getXieLu("", lineStartPoint.X, lineStartPoint.Y, lineEndPoint.X, lineEndPoint.Y); - - double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); - double angle = Math.Atan(tanABC); - double lengthAD = lengthAB * Math.Sin(angle); - length = Math.Abs(lengthAD); - double lengthBD = lengthAB * Math.Cos(angle); - - GSOPoint2d point2dStart = Latlon_2_XYZ(lineStartPoint.X, lineStartPoint.Y); - double bBC = point2dStart.Y - xieLvBC * point2dStart.X; - GSOPoint2d point2dEnd = new GSOPoint2d(); - point2dEnd.X = point2dStart.X + 100; - point2dEnd.Y = point2dEnd.X * xieLvBC + bBC; - point2dEnd = XYZ_2_Latlon(point2dEnd.X, point2dEnd.Y); - - GSOPoint3d pointEnd = new GSOPoint3d(); - pointEnd.X = point2dEnd.X; - pointEnd.Y = point2dEnd.Y; - GSOGeoPolyline3D lineYanShen = new GSOGeoPolyline3D(); - GSOPoint3ds pointsYanShen = new GSOPoint3ds(); - pointsYanShen.Add(lineStartPoint); - pointsYanShen.Add(pointEnd); - lineYanShen.AddPart(pointsYanShen); - GSOGeoPolyline3D lineSegment = lineYanShen.GetSegment(0, lengthBD); - pointChuiDian = lineSegment[0][1]; - } - /// - /// 获得斜率 - /// - /// - /// - /// - /// - /// - /// - public static double getXieLu(string projectName, double lon1, double lat1, double lon2, double lat2) - { - if (lon1 == lon2) - { - return 0; - } - else - { - GSOPoint2d pointStart = Latlon_2_XYZ(projectName, lon1, lat1); - GSOPoint2d pointEnd = Latlon_2_XYZ(projectName, lon2, lat2); - return (pointEnd.Y - pointStart.Y) / (pointEnd.X - pointStart.X); - } - } - /// - /// 根据默认投影参数,经纬度转xyz - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据投影参数,经纬度转xyz - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(string projectName, double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据默认投影参数,xyz转经纬度 - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 根据投影参数,Xyz转经纬度 - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(string projectName, double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 获得inpolygon的管线长度 - /// - /// - public double getInDistance(GSOPoint3d markerPosition, GSOGeoPolyline3D linep, GSOGeoPolygon3D sevenPolygon) - { - GSOGeoPolyline3D newline = new GSOGeoPolyline3D(); - GSOPoint3ds newpts = new GSOPoint3ds(); - newpts.Add(markerPosition); - GSOPoint3d inpt = new GSOPoint3d(); - - int lineptcount = linep.PartCount; - if (lineptcount == 1) - { - GSOPoint3ds linept = linep[0]; - GSOPoint3d fpt = linept[0]; - GSOPoint3d tpt = linept[1]; - - GSOGeoPoint3D fpt2 = new GSOGeoPoint3D(); - fpt2.X = fpt.X; - fpt2.Y = fpt.Y; - fpt2.Z = fpt.Z; - GSOFeature ffeat = new GSOFeature(); - ffeat.Geometry = fpt2; - - GSOGeoPoint3D tpt2 = new GSOGeoPoint3D(); - tpt2.X = tpt.X; - tpt2.Y = tpt.Y; - tpt2.Z = tpt.Z; - GSOFeature tfeat = new GSOFeature(); - tfeat.Geometry = tpt2; - - //判断那个点在polygon里 - GSOLayer layer = globeControl1.Globe.MemoryLayer; - layer.RemoveAllFeature(); - layer.AddFeature(ffeat); - GSOFeatures inorout = layer.FindFeaturesInPolygon(sevenPolygon, true); - - layer.RemoveAllFeature(); - layer.AddFeature(tfeat); - GSOFeatures inorout2 = layer.FindFeaturesInPolygon(sevenPolygon, true); - - if (inorout.Length != 0) - { - inpt = fpt; - } - else - { - inpt = tpt; - } - } - newpts.Add(inpt); - newline.AddPart(newpts); - double indis = 0; - indis = newline.GetSpaceLength(true, 6378137); - return indis; - } - + /// /// 一键审核中调节透明度 @@ -10892,88 +9089,7 @@ FrmAPPregion appregion = new FrmAPPregion("拷贝审核"); appregion.Show(); } - - private int connectServerCount = 0; - - /// - /// 还原球到实测库 - /// - private void refreshGlobe1() - { - //添加实测库图层已有图层 - int servernum = 0; - //1.清除global1上 - for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (!layer.Name.Contains("fttp:")) - { - layer.Dataset.Close();//清除内存 - globeControl1.Globe.Layers.Remove(layer); - } - else - { - servernum++; - } - } - - //globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 - - //2.添加实测库图层 - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"); - } - } - - for (int i = 0; i < g1layername.Count; i++) - { - string g1name = g1layername[i]; - GSODataset datasetg1 = Utility.dataSource.GetDatasetByName(g1name); - GSOLayer templayer = globeControl1.Globe.Layers.Add(datasetg1); - templayer.MaxVisibleAltitude = 1000; - } - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市红线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市橙线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黄线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市绿线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市蓝线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市紫线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黑线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/隧道.lgd"); - - //移动server的数据图层 - for (int i = 0; i < servernum; i++) - { - globeControl1.Globe.Layers.MoveTo(globeControl1.Globe.Layers.Count - 1, 0); - } - - if (layerManagerNode.Nodes.Count > 0) - { - for (int i = layerManagerNode.Nodes.Count - 1; i >= 0; i--) - { - layerManagerNode.Nodes[i].Remove(); - - } - } - - globeControl1.Refresh(); - - } - + private void buttonItemSPSZ_Click(object sender, EventArgs e) { //日志记录 @@ -11125,6 +9241,137 @@ 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 /// /// 数据质量检查 /// @@ -11682,99 +9929,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; } - - private void buttonItemHX1_1_Click(object sender, EventArgs e) - { - string filepath = ""; - //日志记录 - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|矢量数据(*.lgd)|*.lgd|CAD数据(*.dxf)|*.dxf|全部支持格式(*.lgd,*.shp,*.dxf)|*.lgd;*.shp;*.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]; - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) - { - string strDataPath = dlg.FileNames[i]; - filepath = strDataPath; - - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - - redlinelayername = layer.Caption; - //objRes = layer; - if (layer != null) - { - layerRedRegion = layer; - - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - 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); - - for (int j = 0; j < layer.GetAllFeatures().Length; j++) - { - GSOFeature f = layer.GetAt(j); - if (f != null) - { - f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } - } - } - layerManagerNode.Expand(); - - //放大到红线 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(redlinelayername); - - GSOSimpleLineStyle3D redlinestyle = new GSOSimpleLineStyle3D(); - redlinestyle.LineColor = Color.Red; - redlinestyle.LineWidth = 5; - lyr.Style = redlinestyle; - - - if (redlinelayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 500); - - ////////////////////////初始化地面透明度为50////////////////////// - sliderGroundTransSet1.Value = 50; - sliderItem1.Value = 50; - - globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - - layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - - /////////////////////////////////////////////////////////////////////////////////////////// - //layer.Visible = false; - globeControl1.Globe.Layers.MoveTo(0, globeControl1.Globe.Layers.Count - 1); - globeControl1.Refresh(); - } - - } - } - } - + public struct LineStruct { public string layerName; @@ -11865,42 +10020,7 @@ ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); MessageBox.Show("导出成功!"); } - /// - /// 去除集合中重复的管线 - /// - /// - /// - /// - private GSOFeatures getFeaturesByFilter(GSOFeatures features, string fieldName) - { - if (features == null) - { - return null; - } - GSOFeatures featuresGet = new GSOFeatures(); - for (int i = 0; i < features.Length; i++) - { - GSOFeature featureFromFS = features[i]; - string fieldValueFromFS = featureFromFS.GetValue(fieldName).ToString().Trim(); - bool isHas = false; - for (int j = featuresGet.Length - 1; j >= 0; j--) - { - GSOFeature featureFromFSGet = featuresGet[j]; - string fieldValueFromFSGet = featureFromFSGet.GetValue(fieldName).ToString().Trim(); - if (fieldValueFromFS.Equals(fieldValueFromFSGet)) - { - isHas = true; - break; - } - } - if (isHas == false) - { - featuresGet.Add(featureFromFS.Clone()); - } - } - return featuresGet; - } - + private void sliderItem2_ValueChanged(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.sliderItem2.Text); @@ -12261,6 +10381,7 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); + globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -12354,7 +10475,7 @@ } } - GSOFeature dpFeatuer = null; + //GSOFeature dpFeatuer = null; /// /// 双屏分析,点击管段分析 /// @@ -12443,6 +10564,231 @@ 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); @@ -12545,6 +10891,18 @@ 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; @@ -12560,39 +10918,7 @@ { this.Cursor = Cursors.Default; } - - /// - /// 判断CAD文件是否有投影信息 - /// - /// - /// - Boolean CheckDatasetGeoReference(GSODataset dataset) - { - Boolean bSuccess = false; - if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat) - { - if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK) - { - String strPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\Coordinate Systems"; - OpenFileDialog dlg = new OpenFileDialog(); - - dlg.InitialDirectory = strPath; - dlg.RestoreDirectory = true; - - dlg.Filter = "投影文件|*.prj||"; - if (dlg.ShowDialog() == DialogResult.OK) - { - bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName); - } - } - } - else - { - return true; - } - return bSuccess; - } - + private void buttonItemexp_CAD_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemexp_CAD.Text); @@ -12681,7 +11007,31 @@ 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/Config.xml b/bin/x86/Debug/Config.xml index f1bbb91..a5a72aa 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,10 +1,10 @@  LocaSpace三维地下管线信息系统 - scott - SZDB - 127.0.0.1 - SZDB + release + SZHTDB2 + 192.168.0.203 + release 192.168.0.203 1500 http://192.168.0.203/images/ diff --git a/MainFrm.cs b/MainFrm.cs index 8e37fde..5e77983 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -190,6 +190,8 @@ MenuSet(); } + + /// /// 右屏中添加管纵图片 /// @@ -1423,30 +1425,7 @@ } #endregion - - /// - /// 每次gis服务加载时都会触发的 - /// - /// - /// - void globeControl2_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - //throw new NotImplementedException(); - - if (e.Layer != null) - { - if (e.Layer.Name.Contains("fttp:")) - { - if (e.Layer.Caption.Contains("180fd")) - { - - MessageBox.Show("afds==" + e.Layer.Caption); - } - // e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; - } - } - - } + Dictionary dictionaryNetLayerNameAndCaption = new Dictionary(); void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) { @@ -1455,18 +1434,7 @@ e.Layer.Caption = dictionaryNetLayerNameAndCaption[e.Layer.Caption]; } } - - void ReadKmlToMemoryLayer(String kmlPath) - { - GSODataset dataset = globeControl1.Globe.DataManager.AddFileDataset(kmlPath); - GSOFeatureDataset fdataset = dataset as GSOFeatureDataset; - if (fdataset != null) - { - GSOFeatures features = fdataset.GetAllFeatures(); - AddFeaturesNodeToMyPlace(features); - } - } - + void AddFeaturesNodeToMyPlace(GSOFeatures features) { if (features == null || features.Length == 0) @@ -1537,274 +1505,7 @@ } } } - - private void configResource2() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - //string sql = "select ur.gid from casic_userroletest as ur,UserInfoTest as ui where ui.rid=ur.role and ui.username='" + userName + "'"; - string sql = "select casic_userroletest.\"GID\" from casic_userroletest,casic_userinfotest where casic_userroletest.\"ROLE\" = casic_userinfotest.\"RID\" and casic_userinfotest.\"USERNAME\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - - string rolename = ""; - if (dt != null && dt.Rows.Count > 0) - { - rolename = dt.Rows[0][0].ToString().Trim(); - } - setControlVisible(rolename); - } - } - - private void setControlVisible(string rolename) - { - string[] groupname = rolename.Split(','); //有何权限? - - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - //MessageBox.Show("i==" + i.ToString() + "==j==" + j.ToString() + "===" + ribbonStripResource.Items.Count.ToString() + "==" + ribbonStripResource.Items[j].Text); - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - - if (rolename == "all") - { - ribbonTabItemResource.Visible = true; - } - else - { - if (!isContainName(groupname, tabItemResourceName)) - { - //MessageBox.Show(tabItemResourceName); - ribbonTabItemResource.Visible = false; - } - } - - } - - } - - } - } - - } - #region 配置用户权限 - /// - /// 向数据库插入功能列表 - /// - private void insertControlToDatabase() - { - ArrayList listItem = new ArrayList(); - List subListItem = new List(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - - subListItem.Add(new Resource(tabItemResourceName, "NULL")); - - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, tabItemResourceName)); - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(new Resource(buttonItemResourceName, ribbonBarResource.Name)); - - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(SubButtonItemResourceName, buttonItemResourceName)); - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - subListItem.Add(new Resource(sliderItemResource.Text.Trim(), ribbonBarResource.Name)); - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string subButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(new Resource(subButtonItemResourceName, sliderItemResource.Text.Trim())); - } - } - } - } - } - } - } - } - } - } - if (subListItem.Count > 0) - { - foreach (Resource r in subListItem) - { - string pname = getRealName(r.resourceParentName); - string sql = "insert into casic_resc(\"name\",\"aid\",\"pname\") values('" + r.resourceName + "',1,'" + pname + "')"; - int rowCount = OledbHelper.sqlExecuteNonQuery(sql); - } - MessageBox.Show("插入成功", "提示"); - } - } - - private string getRealName(string name) - { - string realName = ""; - switch (name) - { - case "ribbonBar10": - realName = "文件"; - break; - case "ribbonBar21": - realName = "浏览"; - break; - case "ribbonBar4": - realName = "场景"; - break; - case "ribbonBar2": - realName = "查询"; - break; - case "ribbonBar11": - realName = "编辑"; - break; - case "ribbonBar5": - realName = "编辑"; - break; - case "ribbonBar6": - realName = "统计"; - break; - case "ribbonBar8": - realName = "统计"; - break; - case "ribbonBar14": - realName = "量算"; - break; - case "ribbonBar12": - realName = "标注"; - break; - case "ribbonBar1": - realName = "分析"; - break; - case "ribbonBarJJ": - realName = "净距分析"; - break; - case "ribbonBarTP": - realName = "拓扑分析"; - break; - case "ribbonBarSY": - realName = "视域分析"; - break; - case "ribbonBarKW": - realName = "开挖分析"; - break; - case "ribbonBarQY": - realName = "区域分析"; - break; - case "ribbonBarMN": - realName = "模拟分析"; - break; - case "ribbonBarDM": - realName = "断面分析"; - break; - case "ribbonBar13": - realName = "数据管理"; - break; - case "ribbonBar3": - realName = "数据管理"; - break; - case "ribbonBar9": - realName = "数据管理"; - break; - case "ribbonBar7": - realName = "飞行"; - break; - case "ribbonBar15": - realName = "用户管理"; - break; - case "ribbonBar16": - realName = "传感器"; - break; - default: - realName = name; - break; - } - return realName; - } - - private void configResource() - { - if (Utility.userName != null && Utility.userName != "") - { - string userName = Utility.userName; - string sql = "select casic_resc.\"name\" from casic_userstatus join casic_role on casic_userstatus.\"rid\" = casic_role.\"id\" join casic_perm on casic_role.\"pid\"=casic_perm.\"id\" join casic_permresc on casic_perm.\"id\"=casic_permresc.\"permid\" join casic_resc on casic_permresc.\"rescid\"=casic_resc.\"id\" where casic_userstatus.\"username\"='" + userName + "'"; - DataTable dt = OledbHelper.QueryTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - string[] sResourceName = new string[dt.Rows.Count]; - for (int i = 0; i < dt.Rows.Count; i++) - { - sResourceName[i] = dt.Rows[i][0].ToString().Trim(); - } - setControlVisilbe(sResourceName); - } - } - } + private bool isContainName(string[] array, string name) { @@ -1820,116 +1521,116 @@ return bl; } - private void setControlVisilbe(string[] resourceNames) - { - ArrayList listItem = new ArrayList(); - ArrayList subListItem = new ArrayList(); - System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; - for (int i = 0; i < cc.Count; i++) - { - if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) - { - DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; - for (int j = 0; j < ribbonStripResource.Items.Count; j++) - { - if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) - { - DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; - string tabItemResourceName = ribbonTabItemResource.Text; - listItem.Add(tabItemResourceName); - subListItem.Add(tabItemResourceName); - if (!isContainName(resourceNames, tabItemResourceName)) - { - ribbonTabItemResource.Visible = false; - } - if (ribbonTabItemResource.SubItems.Count > 0) - { - for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) - { - if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - } - } - } - } - } - } - else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) - { - DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; - for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) - { - if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) - { - DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; - for (int k = 0; k < ribbonBarResource.Items.Count; k++) - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; - string buttonItemResourceName = buttonItemResource.Text; - subListItem.Add(buttonItemResourceName); - if (!isContainName(resourceNames, buttonItemResourceName)) - { - buttonItemResource.Visible = false; - } - if (buttonItemResource.SubItems.Count > 0) - { - for (int m = 0; m < buttonItemResource.SubItems.Count; m++) - { - if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - string SubButtonItemResourceName = subButtonItemResource.Text; - subListItem.Add(SubButtonItemResourceName); - if (!isContainName(resourceNames, SubButtonItemResourceName)) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - else - { - if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) - { - DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; - if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) - { - sliderItemResource.Visible = false; - } + //private void setControlVisilbe(string[] resourceNames) + //{ + // ArrayList listItem = new ArrayList(); + // ArrayList subListItem = new ArrayList(); + // System.Windows.Forms.Control.ControlCollection cc = ribbonControl1.Controls; + // for (int i = 0; i < cc.Count; i++) + // { + // if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonStrip)) + // { + // DevComponents.DotNetBar.RibbonStrip ribbonStripResource = cc[i] as DevComponents.DotNetBar.RibbonStrip; + // for (int j = 0; j < ribbonStripResource.Items.Count; j++) + // { + // if (ribbonStripResource.Items[j].GetType() == typeof(DevComponents.DotNetBar.RibbonTabItem)) + // { + // DevComponents.DotNetBar.RibbonTabItem ribbonTabItemResource = ribbonStripResource.Items[j] as DevComponents.DotNetBar.RibbonTabItem; + // string tabItemResourceName = ribbonTabItemResource.Text; + // listItem.Add(tabItemResourceName); + // subListItem.Add(tabItemResourceName); + // if (!isContainName(resourceNames, tabItemResourceName)) + // { + // ribbonTabItemResource.Visible = false; + // } + // if (ribbonTabItemResource.SubItems.Count > 0) + // { + // for (int k = 0; k < ribbonTabItemResource.SubItems.Count; k++) + // { + // if (ribbonTabItemResource.SubItems[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonTabItemResource.SubItems[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // else if (cc[i].GetType() == typeof(DevComponents.DotNetBar.RibbonPanel)) + // { + // DevComponents.DotNetBar.RibbonPanel ribbonPanelResource = cc[i] as DevComponents.DotNetBar.RibbonPanel; + // for (int j = 0; j < ribbonPanelResource.Controls.Count; j++) + // { + // if (ribbonPanelResource.Controls[j].GetType() == typeof(DevComponents.DotNetBar.RibbonBar)) + // { + // DevComponents.DotNetBar.RibbonBar ribbonBarResource = ribbonPanelResource.Controls[j] as DevComponents.DotNetBar.RibbonBar; + // for (int k = 0; k < ribbonBarResource.Items.Count; k++) + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem buttonItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.ButtonItem; + // string buttonItemResourceName = buttonItemResource.Text; + // subListItem.Add(buttonItemResourceName); + // if (!isContainName(resourceNames, buttonItemResourceName)) + // { + // buttonItemResource.Visible = false; + // } + // if (buttonItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < buttonItemResource.SubItems.Count; m++) + // { + // if (buttonItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = buttonItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // string SubButtonItemResourceName = subButtonItemResource.Text; + // subListItem.Add(SubButtonItemResourceName); + // if (!isContainName(resourceNames, SubButtonItemResourceName)) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // else + // { + // if (ribbonBarResource.Items[k].GetType() == typeof(DevComponents.DotNetBar.SliderItem)) + // { + // DevComponents.DotNetBar.SliderItem sliderItemResource = ribbonBarResource.Items[k] as DevComponents.DotNetBar.SliderItem; + // if (!isContainName(resourceNames, sliderItemResource.Text.Trim())) + // { + // sliderItemResource.Visible = false; + // } - if (sliderItemResource.SubItems.Count > 0) - { - for (int m = 0; m < sliderItemResource.SubItems.Count; m++) - { - if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) - { - DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; - if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) - { - subButtonItemResource.Visible = false; - } - } - } - } - } - } - } - } - } - } - } - } - #endregion + // if (sliderItemResource.SubItems.Count > 0) + // { + // for (int m = 0; m < sliderItemResource.SubItems.Count; m++) + // { + // if (sliderItemResource.SubItems[m].GetType() == typeof(DevComponents.DotNetBar.ButtonItem)) + // { + // DevComponents.DotNetBar.ButtonItem subButtonItemResource = sliderItemResource.SubItems[m] as DevComponents.DotNetBar.ButtonItem; + // if (!isContainName(resourceNames, subButtonItemResource.Text.Trim())) + // { + // subButtonItemResource.Visible = false; + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + // } + //} + //#endregion void globeControl2_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) { @@ -1961,54 +1662,7 @@ globeControl2.Globe.JumpToCameraState(camera); } } - - void globeControl1_AfterLayerAddEvent(object sender, AfterLayerAddEventArgs e) - { - if (e.Layer.Name != null && e.Layer.Name.Length > 5) - { - if (e.Layer.Name.Substring(0, 5).Equals("fttp:")) - { - return; - } - } - - if (Path.GetExtension(e.Layer.Name).ToLower().Equals(".kml")) - { - AddKmlLayer(e.Layer); - } - else - { - GSODataset dataset = e.Layer.Dataset; - CheckDatasetGeoReference(e.Layer.Dataset, ""); - TreeNode node = new TreeNode(); - node.Tag = e.Layer; - node.Text = e.Layer.Dataset.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = e.Layer.Visible; - // 注意用insert不要用add,因为后加入的图层在上层 - //layerManagerNode.Nodes.Add(node); - layerManagerNode.Nodes.Insert(0, node); - } - layerManagerNode.Expand(); - terrainManagerNode.Expand(); - } - - private void AddKmlLayer(GSOLayer layer) - { - if (layer != null) - { - TreeNode node = new TreeNode(); - node.Tag = layer; - node.Text = layer.Caption; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = layer.Visible; - layerManagerNode.Nodes.Insert(0, node); - VisitFeature3Ds(layer.GetAllFeatures(), node); - } - } - + private void VisitFeature3Ds(GSOFeatures feature3ds, TreeNode node) { for (int i = 0; i < feature3ds.Length; i++) @@ -2858,28 +2512,7 @@ * **/ } #endregion - - private GSOFeatures PolygonIntersectAnalysis(GSOGeoPolygon3D polygon, string pipelinetype) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelinetype); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pipelinetype, feats.Length); - return feats; - } + /// /// 根据范围统计阀门、管线、工井等, 开挖分析, 挖方量分析 /// @@ -3948,28 +3581,7 @@ } return null; } - /// - /// 添加图层 - /// - /// - /// - /// - private bool AddLayers(string layerName, string layerCaption) - { - try - { - GSODataset dataset1 = Utility.dataSource.GetDatasetByName(layerName); - dataset1.Caption = layerCaption; - GSOLayer templayer = globeControl1.Globe.Layers.Add(dataset1); - templayer.Caption = layerCaption; - templayer.MaxVisibleAltitude = 5000; - return templayer.Visible; - } - catch (Exception ex) - { - return false; - } - } + /// /// 菜单上的 三维导航 工具按钮 /// @@ -4438,50 +4050,7 @@ } Image printImage; - /// - /// 打印 菜单 - /// - /// - /// - private void buttonItem13_Click(object sender, EventArgs e) - { - 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); - printImage = new Bitmap(Convert.ToInt32(panelEx5.Width), Convert.ToInt32(panelEx5.Height)); - Graphics g = Graphics.FromImage(printImage); - 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); - int rightBottomX = pt.X + mapWidth; - int rightBottomY = pt.Y + mapHeight; - Image myImg = new Bitmap(mapWidth, mapHeight); - Graphics g = Graphics.FromImage(myImg); - g.CopyFromScreen(pt, new Point(0, 0), new Size(rightBottomX, rightBottomY)); - - - PrintDialog pd = new PrintDialog(); - try - { - if (pd.ShowDialog() == DialogResult.OK) //如果确认,将会覆盖所有的打印参数设置 - { - //打印预览 - PrintPreviewDialog ppd = new PrintPreviewDialog(); - ppd.Document = printDocument1; - if (DialogResult.OK == ppd.ShowDialog()) - { - printDocument1.Print(); //打印 - } - } - } - catch - { - printDocument1.PrintController.OnEndPrint(printDocument1, new System.Drawing.Printing.PrintEventArgs()); - } - } - + private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawImage(printImage, 10, 10); @@ -4537,43 +4106,7 @@ } } } - - /// - /// 统计管线的里程数 - /// - /// - /// - /// - public Double PipeLength(string currentQlayer, double totalLength) - { - if (dataGridViewX1.Rows.Count - 1 != 0) - { - for (int i = 0; i < dataGridViewX1.Rows.Count - 1; i++) - { - string featureName = ""; - if (dataGridViewX1.Columns.Contains("编号")) - { - featureName = dataGridViewX1.Rows[i].Cells["编号"].Value.ToString().Trim(); - } - else - { - featureName = dataGridViewX1.Rows[i].Cells["标识器编号"].Value.ToString().Trim(); - } - //GSOLayer layer = globeControl1.Globe.Layers.GetLayerByID((int)(Utility.LayerLabel_LayerIDs[currentQlayer])); - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(currentQlayer); - GSOFeatures features = layer.GetFeatureByName(featureName, false); - for (int j = 0; j < features.Length; j++) - { - GSOFeature feat = features[j]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - double lentgh = line.GetSpaceLength(true, 6378137); - totalLength += lentgh; - } - } - } - return totalLength; - } - + /// /// 窗体下方属性表格 右键菜单中的 “定位”菜单 /// @@ -4687,27 +4220,29 @@ count = 0; } } - + #region wxl 删除无用??有疑问,功能用在哪里? /// /// 绘制线 菜单 /// /// /// - private void btnAddLine_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - } + //private void btnAddLine_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + //} + /// /// 绘制面 菜单 /// /// /// - private void btnAddPolygon_Click(object sender, EventArgs e) - { - globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; - globeControl1.Globe.Action = EnumAction3D.DrawPolygon; - } + //private void btnAddPolygon_Click(object sender, EventArgs e) + //{ + // globeControl1.Globe.DestLayerFeatureAdd = globeControl1.Globe.MemoryLayer; + // globeControl1.Globe.Action = EnumAction3D.DrawPolygon; + //} + #endregion /// /// 图层目录树 右键菜单中的 目标图层 菜单 /// @@ -4763,51 +4298,9 @@ GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(layerCaption); layer.Dataset.Save(); } + - /// - /// 根据多边形范围统计管线的里程 - /// - /// - /// - /// 返回查询到的管线要素集合 - private GSOFeatures Intersects_Pipeline(GSOGeoPolygon3D polygon, string pipelineLayerCaption) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineLayerCaption); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats = new GSOFeatures(); - if (polygon == null) - feats = flayer.GetAllFeatures(); - else - feats = flayer.FindFeaturesInPolygon(polygon, false); - - double totallength = 0.01; - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOGeoPolyline3D line = feat.Geometry as GSOGeoPolyline3D; - if (line == null) - continue; - - double length = line.GetSpaceLength(true, 6378137); - totallength += length; - if (polygon != null) - feat.HighLight = true; - } - double toLength = Convert.ToDouble(totallength.ToString().Substring(0, totallength.ToString().IndexOf("."))); - pipeLineDis.Add(pipelineLayerCaption, toLength); - return feats; - } - - Dictionary pipeLineDis = new Dictionary(); - Dictionary workWellLen = new Dictionary(); - - - - + #region wxl feature的公共方法 /// /// 查找指定图层中在 指定范围内的feature对象集合 /// @@ -4838,6 +4331,7 @@ } return feats; } + #endregion /// /// 清除结果 菜单 /// @@ -4897,46 +4391,7 @@ //注销id号为103的热键设定 // UnregisterHotKey(Handle, 103); } - - /// - /// 显示流向 功能 - /// - /// - /// - /// - private void Flow(object sender, string pipelineNameCN, bool bShow) - { - GSOFeatureLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pipelineNameCN) as GSOFeatureLayer; - GSOFeatures feats = layer.GetAllFeatures(); - for (int i = 0; i < feats.Length; i++) - { - GSOFeature feat = feats[i]; - GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; - if (lineStyle != null) - { - if (lineStyle.ArrowStyle == null) - { - lineStyle.ArrowStyle = new GSOArrowStyle(); - lineStyle.ArrowStyle.BodyWidth = 2; - lineStyle.ArrowStyle.BodyLen = 6; - lineStyle.ArrowStyle.HeadWidth = 8; - lineStyle.ArrowStyle.HeadLen = 10; - lineStyle.ArrowStyle.OutlineVisible = true; - lineStyle.ArrowStyle.OutlineColor = Color.Red; - lineStyle.ArrowStyle.Speed = lineStyle.ArrowStyle.Speed / 2; - lineStyle.ArrowStyle.Play(); - } - lineStyle.ArrowVisible = bShow; - layerTree.SelectedNode = null; - } - } - globeControl1.Globe.Refresh(); - } - - FrmCloseValves frm; - - FrmBoosterValvers frmbooster = null; - + /// /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 /// @@ -6276,55 +5731,9 @@ } } + /// - /// 清除所有坑 菜单 - /// - /// - /// - private void buttonItem3_Click(object sender, EventArgs e) - { - //日志记录 - LogManager.saveLog(Utility.userName, this.buttonItem3.Text); - - globeControl1.Globe.RemoveAllPits(); - } - - //} - /// - /// 大气层 菜单 - /// - /// - /// - private void buttonItem17_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.Atmosphere.Visible = !globeControl1.Globe.Atmosphere.Visible; - buttonItemSH1.Checked = globeControl1.Globe.Atmosphere.Visible; - globeControl1.Refresh(); - } - /// - /// 经纬网 菜单 - /// - /// - /// - private void buttonItem20_Click(object sender, EventArgs e) - { - globeControl1.Globe.LatLonGrid.Visible = !globeControl1.Globe.LatLonGrid.Visible; - buttonItemSH3.Checked = globeControl1.Globe.LatLonGrid.Visible; - globeControl1.Globe.Refresh(); - } - /// - /// 状态条 菜单 - /// - /// - /// - private void buttonItem21_Click_1(object sender, EventArgs e) - { - globeControl1.Globe.StatusBar.Visible = !globeControl1.Globe.StatusBar.Visible; - buttonItemSH4.Checked = globeControl1.Globe.StatusBar.Visible; - globeControl1.Globe.Refresh(); - } - /// /// 添加指定路径下的数据 功能 /// /// @@ -6365,6 +5774,7 @@ node.SelectedImageIndex = 0; node.Checked = terrain.Visible; // 注意用insert不要用add,因为后加入的图层在上层 + // terrainManagerNode.Nodes.Add(node); layerManagerNode.Nodes.Insert(0, node); } newlayername = terrain.Caption; @@ -6415,88 +5825,7 @@ } return objRes; } - /// - /// 刷新目录树 功能 - /// - private void RefreshDataTree() - { - layerTree.Nodes[0].Nodes.Clear(); - Int32 nCount = globeControl1.Globe.DataManager.DataSourceCount; - Int32 i = 0; - for (i = 0; i < nCount; i++) - { - GSODataSource dataSpace = globeControl1.Globe.DataManager[i]; - TreeNode node = new TreeNode(); - node.Text = dataSpace.Name; - node.ImageIndex = 0; - node.SelectedImageIndex = 0; - node.Checked = true; - node.Tag = dataSpace; - Int32 nDatasetCount = dataSpace.DatasetCount; - for (Int32 j = 0; j < nDatasetCount; j++) - { - GSODataset dataset = dataSpace[j]; - TreeNode subNode = new TreeNode(); - subNode.Text = dataset.Name; - subNode.ImageIndex = 0; - subNode.SelectedImageIndex = 0; - subNode.Checked = true; - subNode.Tag = dataset; - node.Nodes.Add(subNode); - } - layerTree.Nodes[0].Nodes.Add(node); - } - } - /// - /// 判断图层是否包含字段列表 - /// - /// - /// - private bool HasFields(string layerName) - { - GSOLayer m_layer = globeControl1.Globe.Layers.GetLayerByCaption(layerName);//获取当前选择的layer图层 - if (m_layer == null) - return false; - GSOFeatureLayer flayer = m_layer as GSOFeatureLayer; - - GSOFeatureDataset _featureDataSet = m_layer.Dataset as GSOFeatureDataset; - if (_featureDataSet == null) - return false; - - _featureDataSet.Open(); - if (_featureDataSet.FieldCount > 0) - return true; - else - return false; - } - - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayer(GSOGeoPolygon3D polygon, string pointLayerName) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName); - if (layer == null) - return null; - - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - if (polygon == null) - { - feats = flayer.GetAllFeatures(); - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - } - - workWellLen.Add(pointLayerName, feats.Length); - return feats; - } + /// /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 /// @@ -6654,17 +5983,7 @@ MessageBox.Show("表格内容为空!", "提示"); } } - /// - /// 导出CAD 菜单 - /// - /// - /// - private void btnExportCAD_Click(object sender, EventArgs e) - { - FrmExportCADS frm = new FrmExportCADS(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(); - } - + ///// ///// 区域分析 菜单 ///// @@ -6695,16 +6014,7 @@ } } } - /// - /// 数据验证 菜单 - /// - /// - /// - private void buttonItem80_Click(object sender, EventArgs e) - { - FrmValiData frm = new FrmValiData(globeControl1); - frm.ShowDialog(); - } + /// /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 /// @@ -6730,180 +6040,133 @@ } } } - /// - /// 数据库备份 菜单 - /// - /// - /// - private void btnBackDatabase_Click(object sender, EventArgs e) - { - if (MessageBox.Show("是否确定要备份数据库文件", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) - { - try - { - DateTime currentTime = DateTime.Now; - //string Dtime = currentTime.ToShortDateString().ToString("yyyy-MM-dd"); - string Dtime = currentTime.GetDateTimeFormats('D')[0].ToString(); - string Htime = DateTime.Now.ToString("HH时mm分ss秒").Trim(); - string fileName = Dtime + "(" + Htime + ")"; - string pathName = ""; - string sql = "select filename from master..sysdatabases where name='" + Utility.dbdatabase + "'"; - DataTable dt = OledbHelper.ExecuteDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - pathName = dt.Rows[0][0].ToString().Trim(); - int count = pathName.LastIndexOf("\\") == -1 ? pathName.LastIndexOf("/") : pathName.LastIndexOf("\\"); - pathName = pathName.Substring(0, count); - } - pathName += "\\管网数据库" + fileName + ".bak"; - - OracleCommand cmdBK = new OracleCommand(); - cmdBK.CommandType = CommandType.Text; - cmdBK.Connection = connBackup; - cmdBK.CommandText = @"backup database " + Utility.dbdatabase + " to disk='" + pathName + "' with init"; - - connBackup.Open(); - cmdBK.ExecuteNonQuery(); - MessageBox.Show("数据库文件备份成功", "提示"); - } - catch (Exception ex) - { - //MessageBox.Show(ex.Message); - LogError.PublishError(ex); - } - finally - { - connBackup.Close(); - } - } - } - + #region Fan 去掉 - //GSOFeature emitterFeature; // 粒子要素 - /// - /// 添加火苗 功能 - /// - /// - /// - /// - private void AddFire(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + ////GSOFeature emitterFeature; // 粒子要素 + ///// + ///// 添加火苗 功能 + ///// + ///// + ///// + ///// + //private void AddFire(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; - // 烟火粒子示例,由三个发射器构成 - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // string strResPath = Application.StartupPath + "/Resource"; + // // 烟火粒子示例,由三个发射器构成 + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSORingParticleEmitter emitter = new GSORingParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 + // GSORingParticleEmitter emitter = new GSORingParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/flare1.png";//烟1111111111111 - emitter.SetSizeFix(1, 1); - emitter.VelFix = 1; - emitter.VelRnd = 5; + // emitter.SetSizeFix(1, 1); + // emitter.VelFix = 1; + // emitter.VelRnd = 5; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 90; - emitter.AngleXZRnd = 0; + // emitter.AngleXZFix = 90; + // emitter.AngleXZRnd = 0; - emitter.LifeFix = 0.5f; - emitter.LifeRnd = 0.0f; + // emitter.LifeFix = 0.5f; + // emitter.LifeRnd = 0.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 100; - emitter.IsLumAdded = true; + // emitter.EmitPerSec = 100; + // emitter.IsLumAdded = true; - // 采用线性插值生成粒子的初始颜色 - emitter.ColorRndStart = Color.White; - emitter.ColorRndEnd = Color.Red; + // // 采用线性插值生成粒子的初始颜色 + // emitter.ColorRndStart = Color.White; + // emitter.ColorRndEnd = Color.Red; - GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); - effector2.SetColorChanged(0, -1, -1, 0); - effector2.StartTime = 0.0f; - effector2.EndTime = -1.0f; - emitter.AddEffector(effector2); + // GSOColorParticleEffector effector2 = new GSOColorParticleEffector(); + // effector2.SetColorChanged(0, -1, -1, 0); + // effector2.StartTime = 0.0f; + // effector2.EndTime = -1.0f; + // emitter.AddEffector(effector2); - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); + // geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - } - /// - /// 添加喷泉 功能 - /// - /// - /// - /// - private void AddFountain(double x, double y, double z) - { - GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); - if (feats.Length > 0) - globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); + //} + ///// + ///// 添加喷泉 功能 + ///// + ///// + ///// + ///// + //private void AddFountain(double x, double y, double z) + //{ + // GSOFeatures feats = globeControl1.Globe.MemoryLayer.GetFeatureByName("粒子要素", true); + // if (feats.Length > 0) + // globeControl1.Globe.MemoryLayer.RemoveFeatureByID(feats[0].ID); - string strResPath = Application.StartupPath + "/Resource"; + // string strResPath = Application.StartupPath + "/Resource"; - GSOGeoParticle geoParticle = new GSOGeoParticle(); - geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 - geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; + // GSOGeoParticle geoParticle = new GSOGeoParticle(); + // geoParticle.SetPosition(x, y, z); // 添加到这个经纬度位置 + // geoParticle.AltitudeMode = EnumAltitudeMode.RelativeToGround; - GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); - emitter.TexturePath = strResPath + "/ParticleImage/test.png"; + // GSOPointParticleEmitter emitter = new GSOPointParticleEmitter(); + // emitter.TexturePath = strResPath + "/ParticleImage/test.png"; - emitter.SetSizeFix(0.5f, 2); - emitter.VelFix = 10; - emitter.VelRnd = 2; + // emitter.SetSizeFix(0.5f, 2); + // emitter.VelFix = 10; + // emitter.VelRnd = 2; - emitter.GravityAcc = 9.8f; - emitter.AngleXYFix = 0; - emitter.AngleXYRnd = 180; + // emitter.GravityAcc = 9.8f; + // emitter.AngleXYFix = 0; + // emitter.AngleXYRnd = 180; - emitter.AngleXZFix = 88; - emitter.AngleXZRnd = 2; + // emitter.AngleXZFix = 88; + // emitter.AngleXZRnd = 2; - emitter.LifeFix = 5.0f; - emitter.LifeRnd = 1.0f; + // emitter.LifeFix = 5.0f; + // emitter.LifeRnd = 1.0f; - emitter.RotFix = 0; - emitter.RotRnd = 0; + // emitter.RotFix = 0; + // emitter.RotRnd = 0; - emitter.RotVelFix = 0; - emitter.RotVelRnd = 0; + // emitter.RotVelFix = 0; + // emitter.RotVelRnd = 0; - emitter.EmitPerSec = 1000; - emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); - emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); - emitter.IsLumAdded = false; + // emitter.EmitPerSec = 1000; + // emitter.ColorRndStart = Color.FromArgb(33, 255, 255, 255); + // emitter.ColorRndEnd = Color.FromArgb(11, 255, 255, 255); + // emitter.IsLumAdded = false; - // 将三个发射器添加到粒子对象中 - geoParticle.AddEmitter(emitter); + // // 将三个发射器添加到粒子对象中 + // geoParticle.AddEmitter(emitter); - geoParticle.Play(); - GSOFeature emitterFeature = new GSOFeature(); - emitterFeature.Geometry = geoParticle; - emitterFeature.Name = "粒子要素"; // + // geoParticle.Play(); + // GSOFeature emitterFeature = new GSOFeature(); + // emitterFeature.Geometry = geoParticle; + // emitterFeature.Name = "粒子要素"; // - globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); - //globeControl1.Globe.FlyToFeature(emitterFeature); - } + // globeControl1.Globe.MemoryLayer.AddFeature(emitterFeature); + // //globeControl1.Globe.FlyToFeature(emitterFeature); + //} #endregion /// @@ -7006,73 +6269,7 @@ } return resFeature; } - - /// - /// 创建label要素 功能 - /// - /// 添加label要素的feature - /// feature的位置 - /// label要素名字 - /// feature名字 - /// label要素距离点的位置 - /// - private GSOFeature createLabel(GSOLayer layer, GSOFeature feature, GSOGeoPoint3D point, string labelName, string featureName, GSOPoint2d point2d) - { - for (int i = layer.GetAllFeatures().Length - 1; i >= 0; i--) - { - GSOFeature gfeat = layer.GetAt(i); - if (gfeat != null && gfeat.Geometry != null && gfeat.Geometry.Type == EnumGeometryType.GeoPoint3D) - { - GSOGeoPoint3D pointItem = gfeat.Geometry as GSOGeoPoint3D; - if (pointItem.X == point.X && pointItem.Y == point.Y && pointItem.Z == point.Z) - { - layer.RemoveAt(i); - break; - } - } - } - point.AltitudeMode = EnumAltitudeMode.RelativeToGround; - feature.Geometry = point; - feature.Name = featureName; - GSOLabel newLabel = new GSOLabel(); - newLabel.Text = labelName; - newLabel.Style = new GSOLabelStyle(); - newLabel.Style.Opaque = 0.8; - newLabel.Style.OutlineColor = Color.Gray; - newLabel.Style.TractionLineEndPos = point2d; - newLabel.Style.OutlineWidth = 1; - newLabel.Style.TracktionLineWidth = 1; - newLabel.Style.TractionLineColor = Color.Green; - - Color color1 = Color.FromArgb(60, 187, 206, 230); - Color color2 = Color.FromArgb(150, 187, 200, 250); - newLabel.Style.BackBeginColor = color1; - newLabel.Style.BackEndColor = color2; - - feature.Label = newLabel; - return feature; - } - - - - /// - /// 获取指定两点组成的线的长度 功能 - /// - /// - /// - /// - private double getDistance(GSOPoint3d point1, GSOPoint3d point2) - { - GSOGeoPolyline3D lineline = new GSOGeoPolyline3D(); - GSOPoint3ds point3ds = new GSOPoint3ds(); - point3ds.Add(point1); - point3ds.Add(point2); - lineline.AddPart(point3ds); - - double distance = lineline.GetSpaceLength(true, 6378137.0); - return distance; - } - + /// /// 图层节点树中 节点 右键单击事件处理 /// @@ -7320,591 +6517,11 @@ // buttonItem95.Checked = !buttonItem95.Checked; //} ///// - /// 添加用户仓库 菜单 - /// - /// - /// - private void buttonItem108_Click(object sender, EventArgs e) - { - FrmUserRepo frm = new FrmUserRepo(-1); - frm.ShowDialog(); - } - /// - /// 用户仓库管理 菜单 - /// - /// - /// - private void buttonItem111_Click(object sender, EventArgs e) - { - FrmUserRepoMgr frm = new FrmUserRepoMgr(); - frm.ShowDialog(); - } - /// - /// 添加分系统 菜单 - /// - /// - /// - private void buttonItem112_Click(object sender, EventArgs e) - { - //FrmAPP frm = new FrmAPP(-1); - //frm.ShowDialog(); - } - /// - /// 分系统管理 菜单 - /// - /// - /// - private void buttonItem113_Click(object sender, EventArgs e) - { - //FrmAPPMgr frm = new FrmAPPMgr(); - //frm.ShowDialog(); - } - /// - /// 添加操作 菜单 - /// - /// - /// - private void buttonItem114_Click(object sender, EventArgs e) - { - FrmOper frm = new FrmOper(-1); - frm.ShowDialog(); - } - /// - /// 操作管理 菜单 - /// - /// - /// - private void buttonItem115_Click(object sender, EventArgs e) - { - FrmOperMgr frm = new FrmOperMgr(); - frm.ShowDialog(); - } - /// - /// 添加资源 菜单 - /// - /// - /// - private void buttonItem116_Click(object sender, EventArgs e) - { - FrmRESC frm = new FrmRESC(-1); - frm.ShowDialog(); - } - /// - /// 资源管理 菜单 - /// - /// - /// - private void buttonItem117_Click(object sender, EventArgs e) - { - FrmRESCMgr frm = new FrmRESCMgr(); - frm.ShowDialog(); - } - /// - /// 添加权限 菜单 - /// - /// - /// - private void buttonItem118_Click(object sender, EventArgs e) - { - FrmPerm frm = new FrmPerm(-1); - frm.ShowDialog(); - } - /// - /// 权限管理 菜单 - /// - /// - /// - private void buttonItem119_Click(object sender, EventArgs e) - { - FrmPermMgr frm = new FrmPermMgr(); - frm.ShowDialog(); - } - /// - /// 添加访问控制 菜单 - /// - /// - /// - private void buttonItem120_Click(object sender, EventArgs e) - { - FrmAccess frm = new FrmAccess(-1); - frm.ShowDialog(); - } - /// - /// 访问控制管理 菜单 - /// - /// - /// - private void buttonItem121_Click(object sender, EventArgs e) - { - FrmAccessMgr frm = new FrmAccessMgr(); - frm.ShowDialog(); - } - /// - /// 部门类型管理 菜单 - /// - /// - /// - private void buttonItem122_Click(object sender, EventArgs e) - { - FrmRegionTypeMgr frm = new FrmRegionTypeMgr(); - frm.ShowDialog(); - } - /// - /// 添加用户 菜单 - /// - /// - /// - private void buttonItem127_Click(object sender, EventArgs e) - { - FrmUserAdd frm = new FrmUserAdd(-1); - frm.ShowDialog(); - } - /// - /// 用户信息管理 菜单 - /// - /// - /// - private void buttonItem128_Click_1(object sender, EventArgs e) - { - FrmUserManager frm = new FrmUserManager(); - frm.ShowDialog(); - } - /// - /// 添加角色 菜单 - /// - /// - /// - private void 添加角色_Click(object sender, EventArgs e) - { - FrmRole frm = new FrmRole(-1); - frm.ShowDialog(); - } - /// - /// 所有角色管理 菜单 - /// - /// - /// - private void 角色管理_Click(object sender, EventArgs e) - { - FrmRoleMgr frm = new FrmRoleMgr(); - frm.ShowDialog(); - } - - /// - /// 部门角色管理 菜单 - /// - /// - /// - private void buttonItem133_Click(object sender, EventArgs e) - { - FrmRegionRoleMgr frm = new FrmRegionRoleMgr(); - frm.ShowDialog(); - } - /// - /// 部门管理 菜单 - /// - /// - /// - private void buttonItem130_Click(object sender, EventArgs e) - { - FrmRegionMgr frm = new FrmRegionMgr(); - frm.ShowDialog(); - } - - /// - /// 日志管理 菜单 - /// - /// - /// - private void buttonItem135_Click(object sender, EventArgs e) - { - FrmLogManager frm = new FrmLogManager(); - frm.ShowDialog(); - } - /// - /// 传感器信息查询 菜单 - /// - /// - /// - private void buttonItem131_Click_1(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description.Trim(); - if (tabelName != "" && eqtID != "") - { - string fields = getFields(tabelName); - if (fields != "") - { - string sql = "select " + fields + " from " + Utility.sensorDatabase + "." + tabelName + " where EqtID=" + eqtID + " order by RecordDate desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - FrmQueryMessage.ShowForm(this, dt, layer.Caption); - //queryMessage.Show(this); - } - else - { - MessageBox.Show("没有查询到相关信息!", "提示"); - } - } - else - { - MessageBox.Show("配置文件 \"sensorConfig.xml\" 有误!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - /// - /// 根据指定的图层的caption属性的值在配置文件中查找对应的数据库中的表的名称 - /// - /// 图层的caption属性的值 - /// 对应的数据库中的表的名称 - private string getTableName(string name) - { - string tabelName = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.layerName == name) - { - tabelName = mLayer.tableName; - break; - } - } - } - return tabelName; - } - /// - /// 根据数据库中的表的名称 查找对应的表中的字段名称的集合 - /// - /// 数据库中的表的名称 - /// 对应的表中的字段名称的集合 - private string getFields(string tabelName) - { - string fields = ""; - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.tableName.Trim() == tabelName.Trim()) - { - if (mLayer.fields != null) - { - foreach (string key in mLayer.fields.Keys) - { - string value = mLayer.fields[key]; - fields += tabelName.Trim() + "." + key + " as " + value + ","; - } - fields = fields.Remove(fields.Length - 1); - } - break; - } - } - } - return fields; - } - - /// - /// 历史曲线查询 菜单 - /// - /// - /// - private void buttonItem132_Click(object sender, EventArgs e) - { - GSOFeature selectedFeature = globeControl1.Globe.SelectedObject; - if (selectedFeature == null) - { - MessageBox.Show("请选择一个对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { - if (selectedFeature.Geometry != null && selectedFeature.Geometry.Type == EnumGeometryType.GeoModel) - { - GSOLayer layer = globeControl1.Globe.SelectedObjectLayer; - string tabelName = getTableName(layer.Caption); - string eqtID = selectedFeature.Description; - if (tabelName != "" && eqtID != "") - { - FrmQueryHistory.ShowForm(this, tabelName, eqtID); - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示"); - } - } - else - { - MessageBox.Show("请选择一个传感器对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - + //定时检查传感器的状态 public System.Windows.Forms.Timer timerOfSensor = null; - public int alarmValueLiuLiang = 0; - public int alarmValueYaLi = 0; - public int alarmValueYeTi = 0; - public int alarmValueZaoSheng = 0; - /// - /// 传感器在线报警 菜单 - /// - /// - /// - private void buttonItem134_Click(object sender, EventArgs e) - { - if (timerOfSensor == null) - { - timerOfSensor = new System.Windows.Forms.Timer(); - timerOfSensor.Interval = 30000; - timerOfSensor.Tick += new EventHandler(timerOfSensor_Tick); - } - FrmQuerySensorAlarm.ShowForm(this); - } - /// - /// 传感器报警 功能中的 定时器 的触发事件处理 - /// - /// - /// - private void timerOfSensor_Tick(Object sender, EventArgs e) - { - checkSensor(); - } - private void checkSensor() - { - if (Utility.sensorMarkerLayers != null) - { - for (int i = 0; i < Utility.sensorMarkerLayers.Count; i++) - { - MarkerLayer mLayer = Utility.sensorMarkerLayers[i]; - if (mLayer.alarmValue > 0) - { - string sql = "select *,max(CollectTime) from " + Utility.sensorDatabase + "." + mLayer.tableName + " group by EqtID;";// "select * from " + Utility.sensorDatabase + "." + mLayer.tableName + " order by CollectTime desc limit 1;"; - DataTable dt = MySqlHelper.queryDataTable(sql); - if (dt != null && dt.Rows.Count > 0) - { - for (int j = 0; j < dt.Rows.Count; j++) - { - try - { - string EqtID = dt.Rows[j]["EqtID"].ToString().Trim(); - string RecordDateDATE = dt.Rows[j]["RecordDate"].ToString().Trim(); - string RecordTimeTIME = dt.Rows[j]["RecordTime"].ToString().Trim(); - string CollectTime = dt.Rows[j]["CollectTime"].ToString().Trim(); - string CollectValue = ""; - if (mLayer.tableName == "Data_3a") - { - CollectValue = dt.Rows[j]["InstantValue"].ToString().Trim(); - } - else - { - CollectValue = dt.Rows[j]["CollectValue"].ToString().Trim(); - } - int value = 0; - if (int.TryParse(CollectValue, out value)) - { - if (value > mLayer.alarmValue) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(mLayer.layerName); - if (layer != null) - { - for (int m = 0; m < layer.GetAllFeatures().Length; m++) - { - GSOFeature f = layer.GetAt(m); - if (f != null && f.Description.Trim() == EqtID) - { - f.HighLight = true; - globeControl1.Globe.Refresh(); - LogError.PublishAlarmMessage(f.Name, EqtID, CollectValue, CollectTime); - break; - } - } - } - } - } - } - catch (Exception ex) - { - continue; - } - } - } - } - } - } - } + - - /// - /// 沿线运动 菜单 - /// - /// - /// - private void buttonItem138_Click(object sender, EventArgs e) - { - if (globeControl1.Globe.SelectedObject == null) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - GSOFeature lineFeature = globeControl1.Globe.SelectedObject; - if (lineFeature.Geometry == null || lineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) - { - MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "*.gcm;*.3ds|*.gcm;*.3ds|*.3ds|*.3ds|*.gcm|*.gcm"; - if (dlg.ShowDialog() == DialogResult.OK) - { - GSOGeoModel model = new GSOGeoModel(); - model.FilePath = dlg.FileName; - - GSOGeoDynamicRoute dynamicRoute = new GSOGeoDynamicRoute(); - dynamicRoute.ActorGeometry = model; - - GSORoute route = new GSORoute(); - GSOGeoPolyline3D geoline = (GSOGeoPolyline3D)lineFeature.Geometry; - for (int i = 0; i < geoline[0].Count; i++) - { - route.Add(geoline[0][i]); - } - route.CircleRoute = false; - route.Speed = 30; - route.RotateSpeed = 50; - route.AltitudeMode = geoline.AltitudeMode; - dynamicRoute.Route = route; - - GSOFeature feature = new GSOFeature(); - - dynamicRoute.Play(); - feature.Geometry = dynamicRoute; - - //GSOLabel gsoLabel = new GSOLabel(); - //gsoLabel.Text = "模型测试"; - //feature.Label = gsoLabel; - globeControl1.Globe.MinModelVisibleSize = 0; - - globeControl1.Globe.MemoryLayer.AddFeature(feature); - globeControl1.Globe.Refresh(); - } - } - /// - /// 回退 菜单 - /// - /// - /// - private void buttonItem99_Click(object sender, EventArgs e) - { - globeControl1.Globe.UnDoEdit(); - } - /// - /// 前进 菜单 - /// - /// - /// - private void buttonItem100_Click(object sender, EventArgs e) - { - globeControl1.Globe.ReDoEdit(); - } - /// - /// 水平净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX4_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX4.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX24.Text = "水平净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 垂直净距 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX2_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX2.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX23.Text = "垂直净距小于" + value.ToString() + "米的管线有:"; - } - } - } - /// - /// 覆土分析 功能界面中的 标签内容改变事件处理 - /// - /// - /// - private void textBoxX3_TextChanged(object sender, EventArgs e) - { - string valueJingJu = textBoxX3.Text.Trim(); - if (valueJingJu != "") - { - double value = 0; - bool bl = double.TryParse(valueJingJu, out value); - if (bl) - { - labelX17.Text = "覆土深度小于" + value.ToString() + "米的管线有:"; - } - } - } - - /// - /// 传感器分类查询 全区域 菜单 - /// - /// - /// - private void buttonItemSensor全区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 0); - } - /// - /// 传感器分类查询 绘制区域 菜单 - /// - /// - /// - private void buttonItemSensor绘制区域查询_Click(object sender, EventArgs e) - { - FrmAccessoriesSensor.ShowForm(globeControl1, instrumenLayerNames, 1); - } - - /// /// 碰撞分析 功能界面中 关闭按钮 事件处理 /// @@ -7954,154 +6571,9 @@ layerTemp.RemoveAllFeature(); globeControl1.Refresh(); } - /// - /// 数字预处理 功能 - /// - /// - /// - private void 数字预处理buttonItem140_Click(object sender, EventArgs e) - { - FrmEditShapeFile frm = new FrmEditShapeFile(globeControl1); - frm.ShowDialog(this); - } - - - /// - /// 导出矢量 功能 将图层导出为kml和shp格式数据 - /// - /// - /// - private void 导出矢量buttonItem140_Click(object sender, EventArgs e) - { - List listVectorNames = new List(); - for (int i = 0; i < m_PipelineLayerNames.Count; i++) - { - if (listVectorNames.Contains(m_PipelineLayerNames[i]) == false) - { - listVectorNames.Add(m_PipelineLayerNames[i]); - } - } - for (int i = 0; i < valueLayerNames.Count; i++) - { - if (listVectorNames.Contains(valueLayerNames[i]) == false) - { - listVectorNames.Add(valueLayerNames[i]); - } - } - for (int i = 0; i < workwellLayerNames.Count; i++) - { - if (listVectorNames.Contains(workwellLayerNames[i]) == false) - { - listVectorNames.Add(workwellLayerNames[i]); - } - } - for (int i = 0; i < instrumenLayerNames.Count; i++) - { - if (listVectorNames.Contains(instrumenLayerNames[i]) == false) - { - listVectorNames.Add(instrumenLayerNames[i]); - } - } - for (int i = 0; i < pipefittingLayerNames.Count; i++) - { - if (listVectorNames.Contains(pipefittingLayerNames[i]) == false) - { - listVectorNames.Add(pipefittingLayerNames[i]); - } - } - FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames); - frm.ShowDialog(); - } string citySevenLineType = ""; string cityServerLineName = ""; - /// - /// 绘制城市七线 功能按钮 - /// - /// - /// - private void 绘制城市七线buttonItem140_Click(object sender, EventArgs e) - { - FrmCitySevenLineType frm = new FrmCitySevenLineType(); - if (frm.ShowDialog() == DialogResult.OK) - { - globeControl1.Globe.Action = EnumAction3D.DrawPolyline; - m_isDrawCitySevenLine = true; - m_isDrawTunnel = false; - m_AddPipeLine = false; - this.citySevenLineType = frm.citySevenLineType; - this.cityServerLineName = frm.citySevenLineName; - switch (frm.citySevenLineType) - { - case "城市红线": - GSOLayer layerRed = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerRed != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerRed; - layerRed.Editable = true; - } - break; - case "城市橙线": - GSOLayer layerOrange = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerOrange != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerOrange; - layerOrange.Editable = true; - } - break; - case "城市黄线": - GSOLayer layerYellow = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerYellow != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerYellow; - layerYellow.Editable = true; - } - break; - case "城市绿线": - GSOLayer layerGreen = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerGreen != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerGreen; - layerGreen.Editable = true; - } - break; - case "城市蓝线": - GSOLayer layerBlue = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlue != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlue; - layerBlue.Editable = true; - } - break; - case "城市紫线": - GSOLayer layerPurple = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerPurple != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerPurple; - layerPurple.Editable = true; - } - break; - case "城市黑线": - GSOLayer layerBlack = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); - if (layerBlack != null) - { - globeControl1.Globe.DestLayerFeatureAdd = layerBlack; - layerBlack.Editable = true; - } - break; - } - } - } - /// - /// 七线审核 功能按钮 - /// - /// - /// - private void 七线审核buttonItem141_Click(object sender, EventArgs e) - { - FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, m_PipelineLayerNames); - frm.ShowDialog(this); - } /// /// 间距分析 开始分析按钮 分析绘制的七线和管线的距离是否符合标准 @@ -8382,116 +6854,67 @@ } } } - /// - /// 管线自动缩进 菜单 - /// - /// - /// - private void 管线自动缩进buttonItem140_Click(object sender, EventArgs e) - { - FrmPipelineIndented frm = new FrmPipelineIndented(globeControl1, m_PipelineLayerNames, workwellLayerNames); - frm.ShowDialog(this); - } - /// - /// 统计指定图层在指定范围内的所有feature对象 - /// - /// - /// - /// - private GSOFeatures Intersect_PointLayerByType(GSOGeoPolygon3D polygon, string pointLayerName, string type) - { - GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(pointLayerName + "管线附属物"); - if (layer == null) - return null; - GSOFeatureLayer flayer = layer as GSOFeatureLayer; - GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; - GSOFeatures feats; - GSOFeatures newfeats; - string typeg = ""; - if (polygon == null) - { - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } - feats = flayer.GetFeatureByFieldValue("附属物名称", typeg, true); - newfeats = feats; - } - else - { - feats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats = flayer.FindFeaturesInPolygon(polygon, false); - newfeats.RemoveAll(); - if (type == "阀门") - { - typeg = "阀门井"; - } - else if (type == "井") - { - typeg = type; - } - else - { - typeg = type; - } + //// + ////导出路由专题图 + //// + //private void btnOutputR_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputR.Text); - //过滤 - for (int j = 0; j < feats.Length; j++) - { - GSOFeature feat = feats[j]; + // 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))); - if (feat.GetFieldAsString("附属物名称").EndsWith(typeg)) - { - newfeats.Add(feat); - } - } - } + // F_PATMTitle frm = new F_PATMTitle("R", myImg); + // frm.ShowDialog(); + //} + // + //导出配件专题图 + // + //private void btnOutputF_Click(object sender, EventArgs e) + //{ + // //日志记录 + // LogManager.saveLog(Utility.userName, this.btnOutputF.Text); - workWellLen.Add(pointLayerName + type, newfeats.Length); - return newfeats; - } + // 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))); - //设置图层为隐藏 - private void setLayerVisible(string layerName) - { - GSOLayer templayer = globeControl1.Globe.Layers.GetLayerByCaption(layerName); - if (templayer != null) - { - templayer.Visible = false; - } - globeControl1.Globe.Refresh(); - } + // F_PATMTitle frm = new F_PATMTitle("F", myImg); + // frm.ShowDialog(); + //} - /// - /// 连接数据库 - /// - /// - /// - private void buttonItem129_Click(object sender, EventArgs e) - { - //保存日志 - LogManager.saveLog(Utility.userName, this.buttonItemSJGL4_1.Text); - FrmDatabaseParaSetting2 frm = new FrmDatabaseParaSetting2(globeControl1); - if (frm.ShowDialog() == DialogResult.OK) - { - ds = FrmDatabaseParaSetting2.ds; - if (ds != null) - { - ds.IsCloseSaved = false; - } - } - } + + + ////交越点入库 + //private void fmrk_Click(object sender, EventArgs e) + //{ + // //保存日志 + // LogManager.saveLog(Utility.userName, this.fmrk.Text); + + // if (ds == null) + // { + // MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + // ConnectDB(null, null); + // } + // if (ds == null) + // return; + // FrmAddValve frm = new FrmAddValve(globeControl1, ds); + // if (frm.ShowDialog() == DialogResult.OK) + // { + // addNodeToLayerManagerNode(frm.rukuLayer); + // } + //} /// /// 一键审核---导入数据 @@ -8504,19 +6927,17 @@ try { + string dbIp = Utility.sgdbip; string database = Utility.sgdbname; string user = Utility.sgdbuser; string pass = Utility.sgdbpwd; - shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", - user, pass); + shds = globeControl1.Globe.DataManager.OpenOracleDataSource(dbIp + "/" + database, "", "", user, pass); if (shds == null) { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } - - //Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); - Cyberpipe.Forms.FrmPipelineModelDB frm = new Cyberpipe.Forms.FrmPipelineModelDB(globeControl1, ds); + Cyberpipe.Forms.FrmPipelineModelDataOneStep frm = new Cyberpipe.Forms.FrmPipelineModelDataOneStep(globeControl1, shds, layerTree); if (frm.ShowDialog() == DialogResult.OK) { addNodeToLayerManagerNode(frm.rukuLayer); @@ -8528,6 +6949,7 @@ MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); return; } + } /// @@ -8802,232 +7224,7 @@ } - - /// - /// 绘制垂线 - /// - /// - /// - private void drawCLine(GSOPoint3d fpt, GSOPoint3d tpt) - { - GSOGeoPolyline3D pline = new GSOGeoPolyline3D(); - GSOPoint3ds pts = new GSOPoint3ds(); - pts.Add(fpt); - pts.Add(tpt); - pline.AddPart(pts); - - GSOGeoPoint3D fptg = new GSOGeoPoint3D(); - GSOGeoPoint3D tptg = new GSOGeoPoint3D(); - fptg.X = fpt.X; - fptg.Y = fpt.Y; - fptg.Z = 0; - tptg.X = tpt.X; - tptg.Y = tpt.Y; - tptg.Z = 0; - - GSOFeature gf = new GSOFeature(); - gf.Geometry = pline; - - globeControl1.Globe.MemoryLayer.AddFeature(gf); - } - /// - /// 比较两个点是否是同一个点 - /// - /// - /// - /// - private bool comparePoint(GSOPoint3d pt1, GSOPoint3d pt2) - { - double x1 = 0; double y1 = 0; - double x2 = 0; double y2 = 0; - x1 = pt1.X; - y1 = pt1.Y; - x2 = pt2.X; - y2 = pt2.Y; - if ((x1 == x2) && (y1 == y2)) - { - return true; - } - return false; - } - /// - /// 获得点到线的垂线距离及垂点 - /// - /// - /// - /// - /// - private void comparePointLine(GSOPoint3d point, GSOGeoPolyline3D line, out double length, out GSOPoint3d pointChuiDian) - { - GSOPoint3d lineStartPoint = line[0][0]; - GSOPoint3d lineEndPoint = line[0][1]; - GSOGeoPolyline3D lineAB = new GSOGeoPolyline3D(); - GSOPoint3ds pointsAB = new GSOPoint3ds(); - pointsAB.Add(point); - pointsAB.Add(lineStartPoint); - lineAB.AddPart(pointsAB); - double lengthAB = lineAB.GetSpaceLength(false, 6378137.0); - double xieLvAB = getXieLu("", point.X, point.Y, lineStartPoint.X, lineStartPoint.Y); - double xieLvBC = getXieLu("", lineStartPoint.X, lineStartPoint.Y, lineEndPoint.X, lineEndPoint.Y); - - double tanABC = Math.Abs(xieLvAB - xieLvBC) / (1 + xieLvAB * xieLvBC); - double angle = Math.Atan(tanABC); - double lengthAD = lengthAB * Math.Sin(angle); - length = Math.Abs(lengthAD); - double lengthBD = lengthAB * Math.Cos(angle); - - GSOPoint2d point2dStart = Latlon_2_XYZ(lineStartPoint.X, lineStartPoint.Y); - double bBC = point2dStart.Y - xieLvBC * point2dStart.X; - GSOPoint2d point2dEnd = new GSOPoint2d(); - point2dEnd.X = point2dStart.X + 100; - point2dEnd.Y = point2dEnd.X * xieLvBC + bBC; - point2dEnd = XYZ_2_Latlon(point2dEnd.X, point2dEnd.Y); - - GSOPoint3d pointEnd = new GSOPoint3d(); - pointEnd.X = point2dEnd.X; - pointEnd.Y = point2dEnd.Y; - GSOGeoPolyline3D lineYanShen = new GSOGeoPolyline3D(); - GSOPoint3ds pointsYanShen = new GSOPoint3ds(); - pointsYanShen.Add(lineStartPoint); - pointsYanShen.Add(pointEnd); - lineYanShen.AddPart(pointsYanShen); - GSOGeoPolyline3D lineSegment = lineYanShen.GetSegment(0, lengthBD); - pointChuiDian = lineSegment[0][1]; - } - /// - /// 获得斜率 - /// - /// - /// - /// - /// - /// - /// - public static double getXieLu(string projectName, double lon1, double lat1, double lon2, double lat2) - { - if (lon1 == lon2) - { - return 0; - } - else - { - GSOPoint2d pointStart = Latlon_2_XYZ(projectName, lon1, lat1); - GSOPoint2d pointEnd = Latlon_2_XYZ(projectName, lon2, lat2); - return (pointEnd.Y - pointStart.Y) / (pointEnd.X - pointStart.X); - } - } - /// - /// 根据默认投影参数,经纬度转xyz - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据投影参数,经纬度转xyz - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d Latlon_2_XYZ(string projectName, double lon, double lat) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(lon, lat); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Forward(pt2d, id); - return result; - } - /// - /// 根据默认投影参数,xyz转经纬度 - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(null);//Utility.GetProjectName()); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 根据投影参数,Xyz转经纬度 - /// - /// - /// - /// - /// - public static GeoScene.Data.GSOPoint2d XYZ_2_Latlon(string projectName, double x, double y) - { - int id = GeoScene.Data.GSOProjectManager.AddProject(projectName); - GeoScene.Data.GSOPoint2d pt2d = new GeoScene.Data.GSOPoint2d(x, y); - GeoScene.Data.GSOPoint2d result = GeoScene.Data.GSOProjectManager.Inverse(pt2d, id); - return result; - } - /// - /// 获得inpolygon的管线长度 - /// - /// - public double getInDistance(GSOPoint3d markerPosition, GSOGeoPolyline3D linep, GSOGeoPolygon3D sevenPolygon) - { - GSOGeoPolyline3D newline = new GSOGeoPolyline3D(); - GSOPoint3ds newpts = new GSOPoint3ds(); - newpts.Add(markerPosition); - GSOPoint3d inpt = new GSOPoint3d(); - - int lineptcount = linep.PartCount; - if (lineptcount == 1) - { - GSOPoint3ds linept = linep[0]; - GSOPoint3d fpt = linept[0]; - GSOPoint3d tpt = linept[1]; - - GSOGeoPoint3D fpt2 = new GSOGeoPoint3D(); - fpt2.X = fpt.X; - fpt2.Y = fpt.Y; - fpt2.Z = fpt.Z; - GSOFeature ffeat = new GSOFeature(); - ffeat.Geometry = fpt2; - - GSOGeoPoint3D tpt2 = new GSOGeoPoint3D(); - tpt2.X = tpt.X; - tpt2.Y = tpt.Y; - tpt2.Z = tpt.Z; - GSOFeature tfeat = new GSOFeature(); - tfeat.Geometry = tpt2; - - //判断那个点在polygon里 - GSOLayer layer = globeControl1.Globe.MemoryLayer; - layer.RemoveAllFeature(); - layer.AddFeature(ffeat); - GSOFeatures inorout = layer.FindFeaturesInPolygon(sevenPolygon, true); - - layer.RemoveAllFeature(); - layer.AddFeature(tfeat); - GSOFeatures inorout2 = layer.FindFeaturesInPolygon(sevenPolygon, true); - - if (inorout.Length != 0) - { - inpt = fpt; - } - else - { - inpt = tpt; - } - } - newpts.Add(inpt); - newline.AddPart(newpts); - double indis = 0; - indis = newline.GetSpaceLength(true, 6378137); - return indis; - } - + /// /// 一键审核中调节透明度 @@ -10892,88 +9089,7 @@ FrmAPPregion appregion = new FrmAPPregion("拷贝审核"); appregion.Show(); } - - private int connectServerCount = 0; - - /// - /// 还原球到实测库 - /// - private void refreshGlobe1() - { - //添加实测库图层已有图层 - int servernum = 0; - //1.清除global1上 - for (int i = globeControl1.Globe.Layers.Count - 1; i >= 0; i--) - { - GSOLayer layer = globeControl1.Globe.Layers[i]; - if (!layer.Name.Contains("fttp:")) - { - layer.Dataset.Close();//清除内存 - globeControl1.Globe.Layers.Remove(layer); - } - else - { - servernum++; - } - } - - //globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 - - //2.添加实测库图层 - string[] markerStrs = new string[9]; - markerStrs[0] = "标高标注"; - markerStrs[1] = "管径标注"; - markerStrs[2] = "埋深标注"; - markerStrs[3] = "坐标标注"; - markerStrs[4] = "坡度标注"; - markerStrs[5] = "属性标注"; - markerStrs[6] = "自定义标注"; - markerStrs[7] = "距离标注"; - markerStrs[8] = "扯旗标注"; - for (int i = 0; i < markerStrs.Length; i++) - { - if (File.Exists(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd")) - { - GSOLayer markerLayer = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"); - } - } - - for (int i = 0; i < g1layername.Count; i++) - { - string g1name = g1layername[i]; - GSODataset datasetg1 = Utility.dataSource.GetDatasetByName(g1name); - GSOLayer templayer = globeControl1.Globe.Layers.Add(datasetg1); - templayer.MaxVisibleAltitude = 1000; - } - layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市红线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市橙线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黄线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市绿线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市蓝线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市紫线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/城市七线/城市黑线.lgd"); - globeControl1.Globe.Layers.Add(Application.StartupPath + "/隧道.lgd"); - - //移动server的数据图层 - for (int i = 0; i < servernum; i++) - { - globeControl1.Globe.Layers.MoveTo(globeControl1.Globe.Layers.Count - 1, 0); - } - - if (layerManagerNode.Nodes.Count > 0) - { - for (int i = layerManagerNode.Nodes.Count - 1; i >= 0; i--) - { - layerManagerNode.Nodes[i].Remove(); - - } - } - - globeControl1.Refresh(); - - } - + private void buttonItemSPSZ_Click(object sender, EventArgs e) { //日志记录 @@ -11125,6 +9241,137 @@ 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 /// /// 数据质量检查 /// @@ -11682,99 +9929,7 @@ globeControl1.Globe.Action = EnumAction3D.ActionNull; } - - private void buttonItemHX1_1_Click(object sender, EventArgs e) - { - string filepath = ""; - //日志记录 - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Filter = "矢量数据(*.shp)|*.shp|矢量数据(*.lgd)|*.lgd|CAD数据(*.dxf)|*.dxf|全部支持格式(*.lgd,*.shp,*.dxf)|*.lgd;*.shp;*.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]; - string filePath = dlg.FileName; - string lastname = Path.GetFileName(filePath); - - for (int i = 0; i < dlg.FileNames.Length; i++) - { - string strDataPath = dlg.FileNames[i]; - filepath = strDataPath; - - GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); - - redlinelayername = layer.Caption; - //objRes = layer; - if (layer != null) - { - layerRedRegion = layer; - - GSODataset dataset = layer.Dataset; - CheckDatasetGeoReference(layer.Dataset, strDataPath); - 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); - - for (int j = 0; j < layer.GetAllFeatures().Length; j++) - { - GSOFeature f = layer.GetAt(j); - if (f != null) - { - f.Geometry.AltitudeMode = EnumAltitudeMode.RelativeToGround; - } - } - } - layerManagerNode.Expand(); - - //放大到红线 - GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(redlinelayername); - - GSOSimpleLineStyle3D redlinestyle = new GSOSimpleLineStyle3D(); - redlinestyle.LineColor = Color.Red; - redlinestyle.LineWidth = 5; - lyr.Style = redlinestyle; - - - if (redlinelayername != "") - { - GSOFeatures features = lyr.GetAllFeatures(); - GSORect2d rd = lyr.LatLonBounds; - GSOPoint2d rdcenter = rd.Center; - - globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 500); - - ////////////////////////初始化地面透明度为50////////////////////// - sliderGroundTransSet1.Value = 50; - sliderItem1.Value = 50; - - globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; - - layer = globeControl1.Globe.Layers.GetLayerByCaption(roadLayerName);//("180fd"); - if (layer != null) - { - layer.Opaque = 100 - sliderGroundTransSet1.Value; - } - - /////////////////////////////////////////////////////////////////////////////////////////// - //layer.Visible = false; - globeControl1.Globe.Layers.MoveTo(0, globeControl1.Globe.Layers.Count - 1); - globeControl1.Refresh(); - } - - } - } - } - + public struct LineStruct { public string layerName; @@ -11865,42 +10020,7 @@ ExpEXCEL.ExpToExcel(dataGridViewX1, strSaveFile, "红线审核", lineStruct, featsList); MessageBox.Show("导出成功!"); } - /// - /// 去除集合中重复的管线 - /// - /// - /// - /// - private GSOFeatures getFeaturesByFilter(GSOFeatures features, string fieldName) - { - if (features == null) - { - return null; - } - GSOFeatures featuresGet = new GSOFeatures(); - for (int i = 0; i < features.Length; i++) - { - GSOFeature featureFromFS = features[i]; - string fieldValueFromFS = featureFromFS.GetValue(fieldName).ToString().Trim(); - bool isHas = false; - for (int j = featuresGet.Length - 1; j >= 0; j--) - { - GSOFeature featureFromFSGet = featuresGet[j]; - string fieldValueFromFSGet = featureFromFSGet.GetValue(fieldName).ToString().Trim(); - if (fieldValueFromFS.Equals(fieldValueFromFSGet)) - { - isHas = true; - break; - } - } - if (isHas == false) - { - featuresGet.Add(featureFromFS.Clone()); - } - } - return featuresGet; - } - + private void sliderItem2_ValueChanged(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.sliderItem2.Text); @@ -12261,6 +10381,7 @@ globeControl1.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl1_BeforeSceneRenderEvent); globeControl2.BeforeSceneRenderEvent -= new BeforeSceneRenderEventHandler(globeControl2_BeforeSceneRenderEvent); + globeControl1.Globe.Action = EnumAction3D.ActionNull; panelOfTable.Visible = false; //zhanshi = false; @@ -12354,7 +10475,7 @@ } } - GSOFeature dpFeatuer = null; + //GSOFeature dpFeatuer = null; /// /// 双屏分析,点击管段分析 /// @@ -12443,6 +10564,231 @@ 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); @@ -12545,6 +10891,18 @@ 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; @@ -12560,39 +10918,7 @@ { this.Cursor = Cursors.Default; } - - /// - /// 判断CAD文件是否有投影信息 - /// - /// - /// - Boolean CheckDatasetGeoReference(GSODataset dataset) - { - Boolean bSuccess = false; - if (dataset.GeoReferenceType == EnumGeoReferenceType.Flat) - { - if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK) - { - String strPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\Coordinate Systems"; - OpenFileDialog dlg = new OpenFileDialog(); - - dlg.InitialDirectory = strPath; - dlg.RestoreDirectory = true; - - dlg.Filter = "投影文件|*.prj||"; - if (dlg.ShowDialog() == DialogResult.OK) - { - bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName); - } - } - } - else - { - return true; - } - return bSuccess; - } - + private void buttonItemexp_CAD_Click(object sender, EventArgs e) { LogManager.saveLog(Utility.userName, this.buttonItemexp_CAD.Text); @@ -12681,7 +11007,31 @@ 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/Config.xml b/bin/x86/Debug/Config.xml index f1bbb91..a5a72aa 100644 --- a/bin/x86/Debug/Config.xml +++ b/bin/x86/Debug/Config.xml @@ -1,10 +1,10 @@  LocaSpace三维地下管线信息系统 - scott - SZDB - 127.0.0.1 - SZDB + release + SZHTDB2 + 192.168.0.203 + release 192.168.0.203 1500 http://192.168.0.203/images/ diff --git a/bin/x86/Debug/glVersion.txt b/bin/x86/Debug/glVersion.txt index 06a7613..1fc46d0 100644 --- a/bin/x86/Debug/glVersion.txt +++ b/bin/x86/Debug/glVersion.txt Binary files differ