diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs index 6928b7a..9798f59 100644 --- a/FrmAllWorkWellStatis.cs +++ b/FrmAllWorkWellStatis.cs @@ -100,7 +100,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs index 6928b7a..9798f59 100644 --- a/FrmAllWorkWellStatis.cs +++ b/FrmAllWorkWellStatis.cs @@ -100,7 +100,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs index 37d7d0d..f4770a9 100644 --- a/FrmValveStatistics.cs +++ b/FrmValveStatistics.cs @@ -107,7 +107,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) { diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs index 6928b7a..9798f59 100644 --- a/FrmAllWorkWellStatis.cs +++ b/FrmAllWorkWellStatis.cs @@ -100,7 +100,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs index 37d7d0d..f4770a9 100644 --- a/FrmValveStatistics.cs +++ b/FrmValveStatistics.cs @@ -107,7 +107,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) { diff --git a/MainFrm.cs b/MainFrm.cs index 75a271a..1c30092 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1161,7 +1161,6 @@ globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 // globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 //初始化TreeView - //初始化TreeView initLayerTree(); } @@ -2339,8 +2338,6 @@ var code = feature.GetFieldAsString("编码"); var title = FeatureTools.GetFeatureTypeByCode(code); str += "" + title + " " + feature.GetFieldAsString(featureIDFieldName) + ""; - - int rowCount = feature.GetFieldCount(); string layerName = feature.Dataset.Name; string queryFields = ""; if (Utility.Query_Fields.ContainsKey(layerName)) @@ -2350,135 +2347,36 @@ else { layerName = feature.Dataset.Caption; - queryFields = getpipeLineFields.get_Fields(layerName, globeControl); + queryFields = GetpipeLineFields.GetFieldsForBubble(layerName, globeControl); } if (queryFields != null) { string[] param = { "," }; string[] fieldNames = queryFields.Split(param, StringSplitOptions.RemoveEmptyEntries); - for (int j = 0; j < fieldNames.Length; j++) + for (int j = 0; j < fieldNames.Length; ) { - string fieldName = fieldNames[j].Trim(); - GSOFieldDefn field1 = feature.GetFieldDefn(fieldName); - - string name1 = ""; - string value1 = ""; - if (field1 != null) + int count = 0; + string tmpStr = ""; + while (count<2&&j
" + + fieldNames[j] + + "
" + + value + + "
"; + count ++; } - if (j < rowCount) - { - field1 = feature.GetFieldDefn(j); - name1 = field1.Name; - if (name1 == "模型路径") - { - continue; - } - if (field1.Type == EnumFieldType.Text) - { - value1 = feature.GetFieldAsString(j); - } - else if (field1.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j)); - if (dd.Year <= 1) - { - value1 = ""; - } - else - { - value1 = dd.ToShortDateString(); - } - } - else if (field1.Type == EnumFieldType.Double) - { - double dl1 = feature.GetFieldAsDouble(j); - if (!name1.Contains("管径") && !name1.Contains("电压") && !name1.Contains("角度")) - { - name1 += "_米"; - } - value1 = dl1.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j)) - { - value1 = feature.GetValue(j).ToString(); - } - } - } - } - string name2 = ""; - string value2 = ""; - if (j + 1 < rowCount) - { - GSOFieldDefn field2 = feature.GetFieldDefn(j + 1); - - if (field2 != null) - { - if (field2.Name == "图片编码") - { - j++; - } - if (j + 1 < rowCount) - { - field2 = feature.GetFieldDefn(j + 1); - name2 = field2.Name; - - if (name2 == "模型路径") - { - continue; - } - - if (field2.Type == EnumFieldType.Text) - { - value2 = feature.GetFieldAsString(j + 1); - } - else if (field2.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j + 1)); - - if (dd.Year <= 1) - { - value2 = ""; - } - else - { - value2 = dd.ToShortDateString(); - } - } - else if (field2.Type == EnumFieldType.Double) - { - double dl2 = feature.GetFieldAsDouble(j + 1); - if (!name2.Contains("管径") && !name2.Contains("电压") && !name2.Contains("角度")) - { - name2 += "_米"; - } - value2 = dl2.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j + 1)) - { - value2 = feature.GetValue(j + 1).ToString(); - } - } - } - } - j++; } - str += "
" + - name1 + - "
" + - value1 + - "
" + - name2 + - "
" + - value2 + "
"; + if (count == 1) + {//不够两行 + tmpStr += ""; + } + tmpStr += ""; + if (tmpStr.Contains("" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs index 6928b7a..9798f59 100644 --- a/FrmAllWorkWellStatis.cs +++ b/FrmAllWorkWellStatis.cs @@ -100,7 +100,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs index 37d7d0d..f4770a9 100644 --- a/FrmValveStatistics.cs +++ b/FrmValveStatistics.cs @@ -107,7 +107,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) { diff --git a/MainFrm.cs b/MainFrm.cs index 75a271a..1c30092 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1161,7 +1161,6 @@ globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 // globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 //初始化TreeView - //初始化TreeView initLayerTree(); } @@ -2339,8 +2338,6 @@ var code = feature.GetFieldAsString("编码"); var title = FeatureTools.GetFeatureTypeByCode(code); str += "" + title + " " + feature.GetFieldAsString(featureIDFieldName) + ""; - - int rowCount = feature.GetFieldCount(); string layerName = feature.Dataset.Name; string queryFields = ""; if (Utility.Query_Fields.ContainsKey(layerName)) @@ -2350,135 +2347,36 @@ else { layerName = feature.Dataset.Caption; - queryFields = getpipeLineFields.get_Fields(layerName, globeControl); + queryFields = GetpipeLineFields.GetFieldsForBubble(layerName, globeControl); } if (queryFields != null) { string[] param = { "," }; string[] fieldNames = queryFields.Split(param, StringSplitOptions.RemoveEmptyEntries); - for (int j = 0; j < fieldNames.Length; j++) + for (int j = 0; j < fieldNames.Length; ) { - string fieldName = fieldNames[j].Trim(); - GSOFieldDefn field1 = feature.GetFieldDefn(fieldName); - - string name1 = ""; - string value1 = ""; - if (field1 != null) + int count = 0; + string tmpStr = ""; + while (count<2&&j
" + + fieldNames[j] + + "
" + + value + + "
"; + count ++; } - if (j < rowCount) - { - field1 = feature.GetFieldDefn(j); - name1 = field1.Name; - if (name1 == "模型路径") - { - continue; - } - if (field1.Type == EnumFieldType.Text) - { - value1 = feature.GetFieldAsString(j); - } - else if (field1.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j)); - if (dd.Year <= 1) - { - value1 = ""; - } - else - { - value1 = dd.ToShortDateString(); - } - } - else if (field1.Type == EnumFieldType.Double) - { - double dl1 = feature.GetFieldAsDouble(j); - if (!name1.Contains("管径") && !name1.Contains("电压") && !name1.Contains("角度")) - { - name1 += "_米"; - } - value1 = dl1.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j)) - { - value1 = feature.GetValue(j).ToString(); - } - } - } - } - string name2 = ""; - string value2 = ""; - if (j + 1 < rowCount) - { - GSOFieldDefn field2 = feature.GetFieldDefn(j + 1); - - if (field2 != null) - { - if (field2.Name == "图片编码") - { - j++; - } - if (j + 1 < rowCount) - { - field2 = feature.GetFieldDefn(j + 1); - name2 = field2.Name; - - if (name2 == "模型路径") - { - continue; - } - - if (field2.Type == EnumFieldType.Text) - { - value2 = feature.GetFieldAsString(j + 1); - } - else if (field2.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j + 1)); - - if (dd.Year <= 1) - { - value2 = ""; - } - else - { - value2 = dd.ToShortDateString(); - } - } - else if (field2.Type == EnumFieldType.Double) - { - double dl2 = feature.GetFieldAsDouble(j + 1); - if (!name2.Contains("管径") && !name2.Contains("电压") && !name2.Contains("角度")) - { - name2 += "_米"; - } - value2 = dl2.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j + 1)) - { - value2 = feature.GetValue(j + 1).ToString(); - } - } - } - } - j++; } - str += "
" + - name1 + - "
" + - value1 + - "
" + - name2 + - "
" + - value2 + "
"; + if (count == 1) + {//不够两行 + tmpStr += ""; + } + tmpStr += ""; + if (tmpStr.Contains(" + /// + /// + public MainFrm() + { + InitializeComponent(); + + PipeSys.Attach(panelEx5.Controls); + globeControl1 = PipeSys.getGlobeCtrl(); + globeControl1.Dock = DockStyle.Fill; + ribbonControl1.Width = Width; + + panelEx4.Controls.Add(splitContainer1); + splitContainer1.Dock = DockStyle.Fill; + + panelEx4.Controls.Add(expandableSplitter2); + expandableSplitter2.Dock = DockStyle.Bottom; + expandableSplitter2.Expanded = false; + panelEx4.Controls.Add(panelOfTable); + panelOfTable.Dock = DockStyle.Bottom; + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + controlContainerItem3.Visible = true; + controlContainerItem3.Control = layerTree; + layerTree.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem3; + sideBar1.Refresh(); + Refresh(); + + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Height = Screen.PrimaryScreen.WorkingArea.Height - 120; + sideBarPanelItem4.Visible = false; + panel5.Visible = false; + panelEx3.Visible = false; + panelSpacingAnalysis.Visible = false; + + panel2.Height = Screen.PrimaryScreen.WorkingArea.Height - 120; + featureTooltip = new GSOBalloon(globeControl1.Handle); + balloonEx = new GSOBalloonEx(globeControl1.Handle); + Utility.SetBallons(featureTooltip, balloonEx); + + PipeSys.Attach(panelEx1.Controls); + globeControl2 = PipeSys.getGlobeCtrl(); + globeControl2.Dock = DockStyle.Fill; + + featureTooltip2 = new GSOBalloon(globeControl2.Handle); + balloonEx2 = new GSOBalloonEx(globeControl2.Handle); + Utility.SetBallons(featureTooltip, balloonEx); + + panelOfTable.Height = 200; + + RigthMenuSet(); + + MenuSet(); + + } + + /// + /// 右屏中添加管纵图片 + /// + private void AddGZ() + { + + lendendGZ50 = new GSOHudButton(); + lendendGZ50.SetImage(Application.StartupPath + "/Resource/管纵/50.png"); + lendendGZ50.SetOffset(0, 0); + lendendGZ50.MinOpaque = 1; + lendendGZ50.MaxOpaque = 1; + lendendGZ50.FadeOut = false; + lendendGZ50.Name = "lendendGZ50"; + lendendGZ50.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ50); + lendendGZ50.Visible = false; + + lendendGZ36 = new GSOHudButton(); + lendendGZ36.SetImage(Application.StartupPath + "/Resource/管纵/36.png"); + lendendGZ36.SetOffset(0, 0); + lendendGZ36.MinOpaque = 1; + lendendGZ36.MaxOpaque = 1; + lendendGZ36.FadeOut = false; + lendendGZ36.Name = "lendendGZ36"; + lendendGZ36.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ36); + lendendGZ36.Visible = false; + + lendendGZ42 = new GSOHudButton(); + lendendGZ42.SetImage(Application.StartupPath + "/Resource/管纵/42.png"); + lendendGZ42.SetOffset(0, 0); + lendendGZ42.MinOpaque = 1; + lendendGZ42.MaxOpaque = 1; + lendendGZ42.FadeOut = false; + lendendGZ42.Name = "lendendGZ42"; + lendendGZ42.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ42); + lendendGZ42.Visible = false; + + lendendGZ24_1 = new GSOHudButton(); + lendendGZ24_1.SetImage(Application.StartupPath + "/Resource/管纵/24_1.png"); + lendendGZ24_1.SetOffset(0, 0); + lendendGZ24_1.MinOpaque = 1; + lendendGZ24_1.MaxOpaque = 1; + lendendGZ24_1.FadeOut = false; + lendendGZ24_1.Name = "lendendGZ24_1"; + lendendGZ24_1.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_1); + lendendGZ24_1.Visible = false; + + lendendGZ24_2 = new GSOHudButton(); + lendendGZ24_2.SetImage(Application.StartupPath + "/Resource/管纵/24_2.png"); + lendendGZ24_2.SetOffset(0, 0); + lendendGZ24_2.MinOpaque = 1; + lendendGZ24_2.MaxOpaque = 1; + lendendGZ24_2.FadeOut = false; + lendendGZ24_2.Name = "lendendGZ24_2"; + lendendGZ24_2.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_2); + lendendGZ24_2.Visible = false; + + lendendGZ24_3 = new GSOHudButton(); + lendendGZ24_3.SetImage(Application.StartupPath + "/Resource/管纵/24_3.png"); + lendendGZ24_3.SetOffset(0, 0); + lendendGZ24_3.MinOpaque = 1; + lendendGZ24_3.MaxOpaque = 1; + lendendGZ24_3.FadeOut = false; + lendendGZ24_3.Name = "lendendGZ24_3"; + lendendGZ24_3.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_3); + lendendGZ24_3.Visible = false; + + lendendGZ26 = new GSOHudButton(); + lendendGZ26.SetImage(Application.StartupPath + "/Resource/管纵/26.png"); + lendendGZ26.SetOffset(0, 0); + lendendGZ26.MinOpaque = 1; + lendendGZ26.MaxOpaque = 1; + lendendGZ26.FadeOut = false; + lendendGZ26.Name = "lendendGZ26"; + lendendGZ26.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ26); + lendendGZ26.Visible = false; + + } + + public void RigthMenuSet() + { + if (Utility.userRole.IndexOf("清除分析") < 0) + { + toolRightMenu.Items.Remove(清除分析ToolStripMenuItem); + } + + #region 区域分析 + + if (Utility.userRole.IndexOf("区域分析") < 0) + { + toolRightMenu.Items.Remove(区域分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("缓冲区分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(缓冲区分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("附属物分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(附属物分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("无源淹没分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(无源淹没分析ToolStripMenuItem); + } + } + + #endregion + + #region 视域分析 + + if (Utility.userRole.IndexOf("视域分析") < 0) + { + toolRightMenu.Items.Remove(视域分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("通视分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(通视分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("可视域分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(可视域分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("可视包络分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(可视包络分析ToolStripMenuItem); + } + } + + #endregion + + #region 开发分析 + + if (Utility.userRole.IndexOf("开挖分析") < 0) + { + toolRightMenu.Items.Remove(开挖分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("多边形开挖") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(多边形开挖ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("挖方量分析") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(挖方量分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("沿线开挖") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(沿线开挖ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("创建隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(创建隧道ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("隐藏隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(隐藏隧道ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("删除隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(删除隧道ToolStripMenuItem); + } + } + + #endregion + + #region 拓扑分析 + + if (Utility.userRole.IndexOf("拓扑分析") < 0) + { + toolRightMenu.Items.Remove(拓扑分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("创建拓扑") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(创建拓扑ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("上游分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(上游分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("下游分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(下游分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("流向分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(流向分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关阀分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(关阀分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("连通分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(连通分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("爆管分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(爆管分析ToolStripMenuItem); + } + } + + #endregion + + #region 断面分析 + + if (Utility.userRole.IndexOf("断面分析") < 0) + { + toolRightMenu.Items.Remove(断面分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("横断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(横断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("纵断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(纵断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("道路断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(道路断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("基线剖面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(基线剖面分析ToolStripMenuItem); + } + } + + #endregion + + #region 绘制区域统计 + + if (Utility.userRole.IndexOf("绘制区域统计") < 0) + { + toolRightMenu.Items.Remove(绘制区域统计ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("绘制区域管线长度统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管线长度统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域阀门数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(阀门数量统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域井盖数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(井盖数量统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域管径分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分段统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域埋深分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(埋深分段统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域管径分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域材质分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(材质分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域附属物分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(附属物分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域标识器分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(标识器分类统计ToolStripMenuItem1); + } + + } + + #endregion + + #region 全区域统计 + + if (Utility.userRole.IndexOf("全区域统计") < 0) + { + toolRightMenu.Items.Remove(全区域统计ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("全区域管线长度统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管线长度统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域阀门数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(阀门数量统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域井盖数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(井盖数量统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域管径分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分段统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域埋深分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(埋深分段统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域管径分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域材质分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(材质分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域附属物分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(附属物分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域标识器分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(标识器分类统计ToolStripMenuItem); + } + + } + + #endregion + + #region 查询 + + if (Utility.userRole.IndexOf("查询") < 0) + { + toolRightMenu.Items.Remove(查询ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("空间查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(空间查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("编号查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(编号查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坐标查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(坐标查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("管径查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(管径查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("材质查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(材质查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("基本查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(基本查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("复合查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(复合查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关联查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(关联查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关键字查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(关键字查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("附属物查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(附属物查询ToolStripMenuItem); + } + } + + #endregion + + #region 标注 + + if (Utility.userRole.IndexOf("标注") < 0) + { + toolRightMenu.Items.Remove(标注ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("标高标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(标高标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("管径标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(管径标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("埋深标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(埋深标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坐标标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(坐标标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("距离标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(距离标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("自定义标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(自定义标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("扯旗标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(扯旗标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坡度标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(坡度标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("属性标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(属性标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("标注管理") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(标注管理ToolStripMenuItem); + } + } + + #endregion + + #region 飞行 + + if (Utility.userRole.IndexOf("飞行") < 0) + { + toolRightMenu.Items.Remove(飞行ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("自定义飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(自定义飞行ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("飞行到目标点") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(飞行到目标点ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("绕中心点飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(绕中心点飞行ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("绕眼睛飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(绕眼睛飞行ToolStripMenuItem); + } + } + + #endregion + + #region 编辑 + + if (Utility.userRole.IndexOf("编辑") < 0) + { + toolRightMenu.Items.Remove(编辑ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("平移对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(平移对象ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("升降对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(升降对象ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("旋转对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(旋转对象ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("连接管段") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(连接管段ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("导出文件") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(导出文件ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("前进") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(前进ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("后退") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(后退ToolStripMenuItem); + } + } + + #endregion + + #region 量算 + + if (Utility.userRole.IndexOf("量算") < 0) + { + toolRightMenu.Items.Remove(量算ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("水平距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(水平距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("垂直距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(垂直距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("空间距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(空间距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("地表距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(地表距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("高度量算") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(高度量算ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("水平面积") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(水平面积ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("地表面积") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(地表面积ToolStripMenuItem1); + } + } + + #endregion + } + + public void MenuSet() + { + + #region 权限管理 + + if (Utility.userRole.IndexOf("权限管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem2); + } + else + { + + if (Utility.userRole.IndexOf("用户管理") < 0) + { + btn_user_info.Visible = false; + } + if (Utility.userRole.IndexOf("角色管理") < 0) + { + btn_role_info.Visible = false; + } + if (Utility.userRole.IndexOf("资源管理") < 0) + { + btn_resc_info.Visible = false; + } + if (Utility.userRole.IndexOf("角色授权") < 0) + { + btn_role_resc.Visible = false; + } + if (Utility.userRole.IndexOf("用户授权") < 0) + { + btn_user_role.Visible = false; + } + if (Utility.userRole.IndexOf("密码修改") < 0) + { + btn_password_edit.Visible = false; + } + + } + + #endregion + + #region 基础工具 + + if (Utility.userRole.IndexOf("基础工具") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem1); + } + else + { + if (Utility.userRole.IndexOf("地上模式") < 0) + { + buttonItem87.Visible = false; + } + if (Utility.userRole.IndexOf("地下模式") < 0) + { + buttonItem88.Visible = false; + } + if (Utility.userRole.IndexOf("行走模式") < 0) + { + buttonItem27.Visible = false; + } + if (Utility.userRole.IndexOf("透明度设置") < 0) + { + sliderGroundTransSet1.Visible = false; + } + if (Utility.userRole.IndexOf("快速定位") < 0) + { + buttonItem91.Visible = false; + } + if (Utility.userRole.IndexOf("图层管理") < 0) + { + buttonItem1.Visible = false; + } + if (Utility.userRole.IndexOf("图例管理") < 0) + { + btnlegendSet.Visible = false; + } + if (Utility.userRole.IndexOf("全屏显示") < 0) + { + buttonItem89.Visible = false; + } + if (Utility.userRole.IndexOf("导出图片") < 0) + { + btnOutputJPG.Visible = false; + } + + } + + #endregion + + #region 一键审核 + + if (Utility.userRole.IndexOf("一键审核") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem11); + } + + #endregion + + #region 红线审核 + + if (Utility.userRole.IndexOf("红线审核") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem6); + } + + #endregion + + #region 双屏对比 + + if (Utility.userRole.IndexOf("双屏对比") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem9); + } + + #endregion + + #region 文档管理 + + if (Utility.userRole.IndexOf("文档管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem4); + } + + #endregion + + #region 基础管理 + + if (Utility.userRole.IndexOf("基础管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem14); + } + else + { + if (Utility.userRole.IndexOf("专题图审批") < 0) + { + buttonItemZTT3_2.Visible = false; + } + if (Utility.userRole.IndexOf("打印审批") < 0) + { + buttonItemZTT4_2.Visible = false; + } + if (Utility.userRole.IndexOf("拷贝审批") < 0) + { + buttonItemZTT5_2.Visible = false; + } + } + + #endregion + + if (ribbonControl1.Items.Count <= 0) + { + ribbonControl1.Visible = false; + } + } + + #region Fan Zhang 重构现有代码 + + //初始化控件布局 + private void initLayout() + { + int SW = Screen.PrimaryScreen.Bounds.Width; + double dsw = SW; + if (SW > 1440) + { + double myScreen = dsw/1440; + buttonX1.Width = (int) (buttonX1.Width*myScreen); + buttonX2.Width = (int) (buttonX2.Width*myScreen); + buttonX4.Width = (int) (buttonX4.Width*myScreen); + buttonX5.Width = (int) (buttonX5.Width*myScreen); + buttonX6.Width = (int) (buttonX6.Width*myScreen); + buttonX7.Width = (int) (buttonX8.Width*myScreen); + buttonX8.Width = (int) (buttonX8.Width*myScreen); + buttonX9.Width = (int) (buttonX9.Width*myScreen); + buttonX12.Width = (int) (buttonX12.Width*myScreen); + buttonX14.Width = (int) (buttonX14.Width*myScreen); + buttonX15.Width = (int) (buttonX15.Width*myScreen); + buttonX16.Width = (int) (buttonX16.Width*myScreen); + buttonX17.Width = (int) (buttonX17.Width*myScreen); + + labelX1.Width = (int) (labelX1.Width*myScreen); + labelX2.Width = (int) (labelX2.Width*myScreen); + labelX3.Width = (int) (labelX3.Width*myScreen); + labelX6.Width = (int) (labelX6.Width*myScreen); + labelX8.Width = (int) (labelX8.Width*myScreen); + labelX9.Width = (int) (labelX9.Width*myScreen); + labelX12.Width = (int) (labelX12.Width*myScreen); + labelX13.Width = (int) (labelX13.Width*myScreen); + labelX14.Width = (int) (labelX14.Width*myScreen); + labelX16.Width = (int) (labelX16.Width*myScreen); + labelX17.Width = (int) (labelX17.Width*myScreen); + labelX11.Width = (int) (labelX11.Width*myScreen); + labelX19.Width = (int) (labelX19.Width*myScreen); + labelX21.Width = (int) (labelX21.Width*myScreen); + labelX22.Width = (int) (labelX22.Width*myScreen); + labelX24.Width = (int) (labelX24.Width*myScreen); + } + sideBar1.Visible = false; + sideBar1.ExpandedPanel = sideBarPanelItem3; + + comboBoxEx1.Items.Clear(); + comboBoxEx2.Items.Clear(); + comboBoxEx3.Items.Clear(); + comboBoxEx4.Items.Clear(); + comboBoxLayer.Items.Clear(); + foreach (string t1 in Utility.m_PipelineLayerNames) + { + comboBoxEx1.Items.Add(t1); + comboBoxEx2.Items.Add(t1); + comboBoxEx3.Items.Add(t1); + comboBoxEx4.Items.Add(t1); + comboBoxLayer.Items.Add(t1); + } + + splitContainer1.Panel2Collapsed = true; + + buttonItem87.Checked = true; //默认地上模式 + ribbonTabItem1.Select(); //初始化状态为浏览 + + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + if (sideBarPanelItem4.Visible) + { + sideBar1.Visible = true; + controlContainerItem5.Visible = true; + } + else + { + sideBar1.Visible = false; + } + Refresh(); + sliderGroundTransSet1.Value = optiValue; + sliderItem1.Value = optiValue; + sliderItem2.Value = optiValue; + sliderItem3.Value = optiValue; + + } + + //初始化地球控件 + private void initGlobalControl() + { + //选择 + btnToolSelect = new GSOHudButton(); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + btnToolSelect.FadeOut = false; + btnToolSelect.Align = EnumAlign.TopLeft; + btnToolSelect.SetOffset(20, 50); + btnToolSelect.Name = "1"; + btnToolSelect.HeightFixed = true; + btnToolSelect.WidthFixed = true; + globeControl1.Globe.AddHudControl(btnToolSelect); + globeControl2.Globe.AddHudControl(btnToolSelect); + + //浏览 + btnToolNone = new GSOHudButton(); + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolNone.FadeOut = false; + btnToolNone.Align = EnumAlign.TopLeft; + btnToolNone.SetOffset(20, 15); + btnToolNone.Name = "0"; + btnToolNone.HeightFixed = true; + btnToolNone.WidthFixed = true; + globeControl1.Globe.AddHudControl(btnToolNone); + globeControl2.Globe.AddHudControl(btnToolNone); + + //图例 + legend = new GSOHudButton(); + legend.SetImage(Application.StartupPath + "/Resource/图例P.jpg"); //图例P + legend.SetOffset(0, 15); + legend.MinOpaque = 1; + legend.MaxOpaque = 1; + legend.FadeOut = false; + legend.Name = "legend"; + legend.Align = EnumAlign.BottomRight; + legend.Visible = false; + globeControl1.Globe.AddHudControl(legend); + + //实测 + legendSC = new GSOHudButton(); + legendSC.SetImage(Application.StartupPath + "/Resource/sc.jpg"); + legendSC.SetOffset(0, 15); + legendSC.MinOpaque = 1; + legendSC.MaxOpaque = 1; + legendSC.FadeOut = false; + legendSC.Name = "legendSC"; + legendSC.Align = EnumAlign.BottomRight; + globeControl1.Globe.AddHudControl(legendSC); + legendSC.Visible = false; + + //施工 + legendSG = new GSOHudButton(); + legendSG.SetImage(Application.StartupPath + "/Resource/sg.jpg"); + legendSG.SetOffset(0, 15); + legendSG.MinOpaque = 1; + legendSG.MaxOpaque = 1; + legendSG.FadeOut = false; + legendSG.Name = "legendSG"; + legendSG.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(legendSG); + legendSG.Visible = false; + + //管纵 + AddGZ(); + + globeControl1.Globe.UnderGroundFloor.Visible = false; + globeControl1.Globe.OverviewControl.Visible = false; + globeControl1.Globe.ScalerControl.Visible = false; + globeControl1.Globe.LatLonGrid.Visible = false; + globeControl1.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, false); + globeControl1.Globe.Antialiasing = true; + globeControl1.Globe.FeatureMouseOverEnable = true; + globeControl1.Globe.ModelUseLighting = true; + globeControl1.Globe.EditSnapObject = false; + globeControl1.Globe.MaxUserBackgroundAlt = 20000; + globeControl1.Globe.UserBackgroundColorValid = true; + globeControl1.Globe.UserBackgroundColor = Color.White; + globeControl1.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl1.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl1.Globe.FlyToPointSpeed = globeControl1.Globe.FlyToPointSpeed*3; + globeControl1.Globe.EditSnapObject = true; + globeControl1.Globe.IsReleaseMemOutOfView = true; + globeControl1.Globe.ControlPanel.Visible = true; + + globeControl2.Globe.UnderGroundFloor.Visible = false; + globeControl2.Globe.OverviewControl.Visible = false; + globeControl2.Globe.ScalerControl.Visible = false; + globeControl2.Globe.LatLonGrid.Visible = false; + globeControl2.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, false); + globeControl2.Globe.Antialiasing = true; + globeControl2.Globe.FeatureMouseOverEnable = true; + globeControl2.Globe.ModelUseLighting = true; + globeControl2.Globe.EditSnapObject = false; + globeControl2.Globe.MaxUserBackgroundAlt = 20000; + globeControl2.Globe.UserBackgroundColorValid = true; + globeControl2.Globe.UserBackgroundColor = Color.White; + globeControl2.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl2.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl2.Globe.FlyToPointSpeed = globeControl2.Globe.FlyToPointSpeed*3; + globeControl2.Globe.EditSnapObject = true; + globeControl2.Globe.IsReleaseMemOutOfView = true; + globeControl2.Globe.ControlPanel.Visible = false; + + GSOSimplePolygonStyle3D trackingRectStyle = + globeControl1.Globe.TrackRectTool.TrackingPolygonStyle as GSOSimplePolygonStyle3D; + trackingRectStyle.FillColor = Color.FromArgb(0, 0, 0, 0); + GSOSimplePolygonStyle3D trackRectStyle = + globeControl1.Globe.TrackRectTool.PolygonStyle as GSOSimplePolygonStyle3D; + trackRectStyle.FillColor = Color.FromArgb(0, 0, 0, 0); + GSOSimpleLineStyle3D trackRectLineStyle = + globeControl1.Globe.TrackRectTool.PolygonStyle.OutlineStyle as GSOSimpleLineStyle3D; + trackRectLineStyle.LineType = EnumLineType.Solid; + GSOSimpleLineStyle3D trackRectLineStyle1 = + globeControl1.Globe.TrackRectTool.TrackingPolygonStyle.OutlineStyle as GSOSimpleLineStyle3D; + trackRectLineStyle1.LineType = EnumLineType.Solid; + trackRectLineStyle1.LineColor = Color.FromArgb(0, 174, 255); + trackRectLineStyle1.LineWidth = 1; + + globeControl1.Globe.StatusBar.SetProject(Utility.projectStr); + globeControl1.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, true); + globeControl2.Globe.StatusBar.SetProject(Utility.projectStr); + globeControl2.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, true); + + //添加临时图层 + layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData.lgd"); + layerTemp2 = globeControl2.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData2.lgd"); + if (layerTemp != null) + { + layerTemp.MaxVisibleAltitude = 1000; + } + + //添加城市7线图层 + 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"); + + //注册对应事件 + registerEvent(); + } + + //注册地球事件 + private bool registerEvent() + { + if (globeControl1 == null || globeControl2 == null) + { + return false; + } + globeControl1.HudControlMouseDownEvent += globeControl1_HudControlMouseDownEvent; + globeControl2.HudControlMouseDownEvent += globeControl2_HudControlMouseDownEvent; + + globeControl1.HudControlMouseIntoEvent += globeControl1_HudControlMouseIntoEvent; + globeControl1.HudControlMouseOutEvent += globeControl1_HudControlMouseOutEvent; + + globeControl1.AfterNetLayerAddEvent += globeControl1_AfterNetLayerAddEvent; + + globeControl1.FeatureMouseClickEvent += globeControl1_FeatureMouseClickEvent; + globeControl1.FeatureMouseHoverEvent += globeControl1_FeatureMouseHoverEvent; + + globeControl2.FeatureMouseClickEvent += globeControl2_FeatureMouseClickEvent; + globeControl2.CameraBeginMoveEvent += globeControl2_CameraBeginMoveEvent; + + globeControl1.MouseDoubleClick += globeControl1_MouseDoubleClick; + globeControl1.MouseClick += globeControl1_MouseClick; + globeControl1.MouseDown += globeControl1_MouseDown; + + globeControl2.MouseClick += globeControl2_MouseClick; + globeControl2.MouseDown += globeControl2_MouseDown; + + globeControl1.MouseWheel += globeControl1_MouseWheel; + globeControl2.MouseWheel += globeControl2_MouseWheel; + + globeControl1.CameraBeginMoveEvent += globeControl1_CameraBeginMoveEvent; + + globeControl1.TrackPolylineEndEvent += globeControl1_TrackPolylineEndEvent; + globeControl1.TrackPolygonEndEvent += globeControl1_TrackPolygonEndEvent; + globeControl1.TrackRectEndEvent += globeControl1_TrackRectEndEvent; + + return true; + } + + //加载两个地球数据 + private void loadData() + { + Thread t1 = new Thread(doLoadDataForGlobalControl); + t1.IsBackground = true; + t1.Start(); + } + + //delegate void LoadDataForGlobalControl(); + + private void connectServer() + { +<<<<<<< HEAD + globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 +// globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + //初始化TreeView +======= + globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + //初始化TreeView + +>>>>>>> 5ad8bb289f47939f129a26356a54dc1053a8848a + initLayerTree(); + + } + /// + /// 加载地球1、2的图层 + /// + private void doLoadDataForGlobalControl() + { + try + { + globeControl1.Globe.Layers.MoveDown(10000); + //加载实测管线数据 + Utility.dataSource = + globeControl1.Globe.DataManager.OpenOracleDataSource( + Utility.DBServer.Trim() + "/" + Utility.dbdatabase.Trim(), "", "", Utility.userID, + Utility.DBPassword); + + if (Utility.dataSource != null) + { + for (int j = 0; j < Utility.dataSource.DatasetCount; j++) + { + GSODataset dataset = Utility.dataSource.GetDatasetAt(j); + if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + } + } + } + //隐藏红线图层 + globeControl1.Globe.Layers.GetLayerByCaption("红线").Visible = false; + + //globleControl1中加载规划数据 + GSODataSource ghDS = + globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.ghdbip + "/" + Utility.ghdbname, "", "", + Utility.ghdbuser, Utility.ghdbpwd); + if (ghDS != null) + { + for (int j = 0; j < ghDS.DatasetCount; j++) + { + GSODataset dataset = ghDS.GetDatasetAt(j); + if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + globeControl1.Globe.Layers[0].Visible = false; + } + } + } + + //globeControl1,globeControl2中加载施工数据 + GSODataSource sgDS = + globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, "", "", + Utility.sgdbuser, Utility.sgdbpwd); + if (sgDS != null) + { + for (int m = 0; m < sgDS.DatasetCount; m++) + { + GSODataset dataset = sgDS.GetDatasetAt(m); + if (dataset != null && !dataset.Caption.Contains("SH") && + Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + globeControl1.Globe.Layers[0].Visible = false; + + globeControl2.Globe.Layers.Add(dataset); + globeControl2.Globe.Layers[0].Visible = true; + } + } + } + this.Invoke((EventHandler) delegate + { + connectServer(); + }); + + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + private void initLayerTree() + { + layerTree.Nodes.Clear(); + //加载临时图层节点 + layerManagerNode = new TreeNode(); + layerManagerNode.ImageIndex = 0; + layerManagerNode.SelectedImageIndex = 0; + layerManagerNode.Checked = true; + layerManagerNode.Text = "临时图层"; + layerManagerNode.Tag = layerTemp; + layerTree.Nodes.Add(layerManagerNode); + + TreeUtils.InitLayerTree(globeControl1, layerTree, null); + + } + + private void initMarkerTree() + { + TreeNode node = new TreeNode(); + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = true; + node.Text = "标注管理"; + layerMarkerTree.Nodes.Add(node); + 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")) continue; + GSOLayer markerLayer = + globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"); + if (markerLayer == null) continue; + TreeNode node1 = new TreeNode(); + node1.Text = markerLayer.Caption; + node1.ImageIndex = 0; + node1.SelectedImageIndex = 0; + node1.Checked = markerLayer.Visible; + node1.Tag = markerLayer; + layerMarkerTree.Nodes[0].Nodes.Add(node1); + } + } + + private void MainFrm_Load(object sender, EventArgs e) + { + + layerTree.Nodes.Add("正在加载,请稍后……");//树状图加载在图层加载之后,故增加提示 + initGlobalControl(); + //initGlobalMap(); +// initLayerTree(); + initMarkerTree(); + initLayout(); + loadData(); + + + double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]); + double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]); + double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]); + jumpToCameraState(x, y, z); + + } + + #endregion + + void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) + { + if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption)) + { + e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption]; + } + } + + void globeControl2_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) + { + switch (e.HudControl.Name) + { + case "0": + globeControl2.Globe.Action = EnumAction3D.ActionNull; + break; + case "1": + globeControl2.Globe.Action = EnumAction3D.SelectObject; + break; + } + } + + void globeControl2_BeforeSceneRenderEvent(object sender, BeforeSceneRenderEventArgs e) + { + if (globeControl2.Focused) + { + GSOCameraState camera = globeControl2.Globe.CameraState; + globeControl1.Globe.JumpToCameraState(camera); + } + } + + void globeControl1_BeforeSceneRenderEvent(object sender, BeforeSceneRenderEventArgs e) + { + if (globeControl1.Focused) + { + GSOCameraState camera = globeControl1.Globe.CameraState; + globeControl2.Globe.JumpToCameraState(camera); + } + } + + private void VisitFeature3Ds(GSOFeatures feature3ds, TreeNode node) + { + for (int i = 0; i < feature3ds.Length; i++) + { + GSOFeature feature = feature3ds[i]; + if (feature.Type == EnumFeatureType.FeatureFolder) + { + TreeNode tempnode = new TreeNode(); + tempnode.Text = feature.Name; + tempnode.ImageIndex = 1; + tempnode.SelectedImageIndex = 1; + tempnode.Checked = node.Checked && feature.Visible; + tempnode.Tag = feature; + node.Nodes.Add(tempnode); + GSOFeatureFolder featureFolder = (GSOFeatureFolder) feature; + VisitFeature3Ds(featureFolder.Features, tempnode); + } + else + { + TreeNode tempnode = new TreeNode {Text = feature.Name}; + if (feature.Geometry != null) + { + switch (feature.Geometry.Type) + { + case EnumGeometryType.GeoPoint3D: + case EnumGeometryType.GeoMarker: + tempnode.ImageIndex = 3; + tempnode.SelectedImageIndex = 3; + break; + case EnumGeometryType.GeoPolyline3D: + tempnode.ImageIndex = 4; + tempnode.SelectedImageIndex = 4; + break; + case EnumGeometryType.GeoPolygon3D: + tempnode.ImageIndex = 5; + tempnode.SelectedImageIndex = 5; + break; + case EnumGeometryType.GeoModel: + case EnumGeometryType.GeoEntity: + case EnumGeometryType.GeoGroupEntity: + case EnumGeometryType.GeoSphereEntity: + case EnumGeometryType.GeoBoxEntity: + case EnumGeometryType.GeoEllipsoidEntity: + case EnumGeometryType.GeoCylinderEntity: + case EnumGeometryType.GeoFrustumEntity: + case EnumGeometryType.GeoEllipCylinderEntity: + case EnumGeometryType.GeoEllipFrustumEntity: + case EnumGeometryType.GeoRangeEllipsoidEntity: + case EnumGeometryType.GeoRangeEllipCylinderEntity: + case EnumGeometryType.GeoRangeEllipFrustumEntity: + tempnode.ImageIndex = 6; + tempnode.SelectedImageIndex = 6; + break; + case EnumGeometryType.GeoGroundOverlay: + tempnode.ImageIndex = 7; + tempnode.SelectedImageIndex = 7; + break; + } + } + + tempnode.Checked = node.Checked && feature.Visible; + tempnode.Tag = feature; + node.Nodes.Add(tempnode); + } + } + } + + /// + /// 检查数据集是否有坐标系信息(待完善) + /// + /// + /// + Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath) + { + if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true; + Boolean bSuccess = false; + if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) != + DialogResult.OK) return bSuccess; + String strPath = Application.StartupPath + "\\Coordinate Systems"; + OpenFileDialog dlg = new OpenFileDialog(); + + dlg.InitialDirectory = strPath; + dlg.RestoreDirectory = true; + + dlg.Filter = "投影文件|*.prj||"; + if (dlg.ShowDialog() != DialogResult.OK) return bSuccess; + string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); + string lprjFileContent = "0prj4" + lprjStr + + ""; + + bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName); + + string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj"; + StreamWriter writer = new StreamWriter(lprjFileName, false); + writer.Write(lprjFileContent); + writer.Close(); + + return bSuccess; + } + + /// + /// 矩形拉框结束事件处理函数 + /// + /// + /// + void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e) + { + if (e.Polygon == null) return; + globeControl1.Globe.TrackRectTool.Clear(); + globeControl1.ImmediatelyRefresh(); + globeControl1.SwapBuffer(); + Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y)); + Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y)); + + 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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName); //扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + globeControl1.Globe.Action = EnumAction3D.ActionNull; + globeControl1.Globe.MouseRoamingEnable = true; + } + + /// + /// 定位正北正90度俯视 + /// + /// + /// + /// + private void jumpToCameraState(double x, double y, double z) + { + GSOCameraState camera = new GSOCameraState(); + camera.Latitude = y; + camera.Longitude = x; + camera.Distance = z; + camera.Tilt = 0; + camera.Heading = 0; + globeControl1.Globe.JumpToCameraState(camera); + globeControl2.Globe.JumpToCameraState(camera); + } + + void globeControl1_HudControlMouseOutEvent(object sender, HudControlMouseOutEventArgs e) + { + if (tooltip1 != null) + { + tooltip1.RemoveAll(); + } + } + + void globeControl1_HudControlMouseIntoEvent(object sender, HudControlMouseIntoEventArgs e) + { + tooltip1 = new ToolTip(); + switch (e.HudControl.Name) + { + case "0": + tooltip1.SetToolTip(globeControl1, "浏览对象"); + break; + case "1": + tooltip1.SetToolTip(globeControl1, "选择对象"); + break; + } + } + + void globeControl1_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) + { + switch (e.HudControl.Name) + { + case "0": + globeControl1.Globe.Action = EnumAction3D.ActionNull; //导航功能 + break; + case "1": + globeControl1.Globe.Action = EnumAction3D.SelectObject; //选中对象功能 + break; + } + } + + #region wxl 重构树形结构代码 + + private void layerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + TreeUtils.TreeNodeCheckedChange(globeControl1, e.Node); + } + } + + #endregion + private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button != MouseButtons.Right) return; + layerTree.SelectedNode = e.Node; + if (e.Node.Tag == null || e.Node.Parent == null) return; //排除无图层节点和第一级节点 + + GSOLayer gsoLayer = e.Node.Tag as GSOLayer; + if (gsoLayer == null || gsoLayer.Caption.Equals(Utility.roadLayerName)) return; + if (e.Node.Parent.Text.Equals("临时图层") || e.Node.Parent.Text.Equals("我的地标")) + { + //临时图层下的子节点应该展示的 + contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y); + contextMenuStripDeleteLayerNode.Tag = e.Node; + } + else + { + LayerSelectableMenuItem.Visible = true; + LayerEditableMenuItem.Visible = true; + SaveLayerMenuItem.Visible = true; + LayerFlyMenuItem.Visible = true; + 导出CADToolStripMenuItem1.Visible = true; + layerNodeContexMenu.Show(layerTree, e.X, e.Y); + layerNodeContexMenu.Tag = e.Node; + LayerSelectableMenuItem.Checked = gsoLayer.Selectable; + LayerEditableMenuItem.Checked = gsoLayer.Editable; + } + + } + //wxl Tag更正 + /// + /// 删除临时添加的本地数据图层 + /// + /// + /// + private void 删除ToolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null || node.Parent == null) return; + if (node.Parent.Text.Trim() == "临时图层") + { + if (!(node.Tag is GSOLayer)) return; + GSOLayer layer = node.Tag as GSOLayer; + globeControl1.Globe.Layers.Remove(layer); + globeControl1.Globe.Refresh(); + node.Remove(); + }else if (node.Parent.Text.Trim() == "我的地标") + { + if (!(node.Tag is GSOFeature)) return; + GSOFeature f = node.Tag as GSOFeature; + f.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + + } + //wxl Tag更正 + private void 可编辑ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null || + node.Parent == null || + node.Parent.Text.Trim() != "临时图层" || !(node.Tag is GSOLayer)) return; + GSOLayer layer = node.Tag as GSOLayer; + 可编辑ToolStripMenuItem.Checked = !可编辑ToolStripMenuItem.Checked; + layer.Editable = 可编辑ToolStripMenuItem.Checked; + } + //wxl Tag更正 + private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null||node.Tag==null) return; + GSOLayer layer = node.Tag as GSOLayer; + if (layer == null) return; + layer.Dataset.Save(); + } + //wxl Tag更正 + private void 定位ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null||node.Parent==null) return; + if (node.Parent.Text.Trim() == "临时图层") + { + GSOLayer lsLayer = node.Tag as GSOLayer; + if (lsLayer == null) + { + LogHelper.WriteLog(typeof(MainFrm),"要定位的临时图层不存在:"+node.Text); + return; + } + double x = lsLayer.LatLonBounds.Center.X; + double y = lsLayer.LatLonBounds.Center.Y; + if (x.Equals(0) && y.Equals(0)) + { + x = lsLayer.Bounds.Center.X; + y = lsLayer.Bounds.Center.Y; + } + + globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute); + } + else + { + GSOLayer layer = node.Tag as GSOLayer; + if (layer == null) return; + if (layer.Caption.Equals("红线")) + { + globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000); + globeControl1.Globe.FlyToPointSpeed = 10000000; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + layer.Visible = true; + globeControl1.Refresh(); + } + else + { + double x = layer.LatLonBounds.Center.X; + double y = layer.LatLonBounds.Center.Y; + globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute); + } + } + } + //wxl Tag更正 + private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null) return; + if (node.Tag is GSOLayer) + { + GSOLayer layer = node.Tag as GSOLayer; + if (layer.GetAllFeatures().Length <= 0) return; + GSOFeature feature = layer.GetAt(0); + if (feature != null && feature.Geometry != null) + { + globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000); + } + else + { + globeControl1.Globe.FlyToFeature(feature); + } + } + else if (node.Tag is GSOFeature) + { + GSOFeature feature = node.Tag as GSOFeature; + if (feature.Geometry != null) + { + globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10); + } + else + { + globeControl1.Globe.FlyToFeature(feature); + } + } + } + + /// + /// 在三维场景移动时,隐藏气泡globeControl1 + /// + /// + /// + void globeControl1_CameraBeginMoveEvent(object sender, CameraBeginMoveEventArgs e) + { + if (featureTooltip.IsVisible()) + { + featureTooltip.HideBalloon(); + } + if (balloonEx.IsVisible()) + { + balloonEx.HideBalloon(); + } + } + + /// + /// 在三维场景移动时,隐藏气泡globeControl2 + /// + /// + /// + void globeControl2_CameraBeginMoveEvent(object sender, CameraBeginMoveEventArgs e) + { + if (featureTooltip2.IsVisible()) + { + featureTooltip2.HideBalloon(); + } + if (balloonEx2.IsVisible()) + { + balloonEx2.HideBalloon(); + } + } + + void globeControl1_MouseWheel(object sender, MouseEventArgs e) + { + if (globeControl1.Globe.CameraState.Distance > 20000000) + { + GSOCameraState cameraState = globeControl1.Globe.CameraState; + cameraState.Distance = 20000000; + globeControl1.Globe.CameraState = cameraState; + globeControl1.Globe.Refresh(); + } + } + void globeControl2_MouseWheel(object sender, MouseEventArgs e) + { + if (globeControl2.Globe.CameraState.Distance > 20000000) + { + GSOCameraState cameraState = globeControl2.Globe.CameraState; + cameraState.Distance = 20000000; + globeControl2.Globe.CameraState = cameraState; + globeControl2.Globe.Refresh(); + } + } + + #region Fan 横断面 + /// + /// 横断面分析、基线剖面分析、道路断面分析等 + /// + /// + /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) + { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis || + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1, + e.Polyline, Utility.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + } + #endregion + + /// + /// 根据范围统计阀门、管线、工井等, 开挖分析, 挖方量分析 + /// + /// + /// + void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e) + { + if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return; + GSOGeoPolygon3D polygon = e.Polygon; + + switch (trackflag) + { + case "valvequery": + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1); + frm.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + + case "PipelineDistanceStatistics": + + FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames); + frm1.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + case "PipelineSpatialQuery": + + FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames); + globeControl1.Globe.ClearAnalysis(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + case "workwellquery": + FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1); + frmWell.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + + case "pit": + double depth; + FrmTackPolygonDlg dlg = new FrmTackPolygonDlg(); + if (dlg.ShowDialog() == DialogResult.OK) + { + depth = dlg.depth; + GSOGeoPit geoPit = new GSOGeoPit(); + geoPit.PitPolygon = polygon; + geoPit.PitDepth = depth; + geoPit.PitDepthUsing = true; + globeControl1.Globe.AddPit("", geoPit); + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = false; + } + } + globeControl1.Globe.ClearLastTrackPolygon(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + case "digFillAnalysis": + DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg(); + dlg1.m_globe = globeControl1.Globe; + dlg1.m_polygon3D = polygon; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + dlg1.Show(this); + break; + case "FloodAnalysis": + FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon); + frmFloodAnalysis.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + case "BSQDuoBianXiangStatis": + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + bsqFrm.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + + case "": + break; + default: + break; + } + } + /// + /// 鼠标悬浮提示 + /// + /// + /// + void globeControl1_FeatureMouseHoverEvent(object sender, FeatureMouseHoverEventArgs e) + { + try + { + if (e.Feature == null) return; + if (isFeatureContainsBianhao(e.Feature)) + { + featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString()); + } + else if (e.Feature.Name != "") + { + featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + + /// + /// 添加管线、隧道、城市七线绘制完成事件 + /// + /// + /// + void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + + if (enumDesignMode==EnumDesignMode.AddPipe + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 + { + GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; + if (layerDest != null) + { + GSOFeatures features = layerDest.GetAllFeatures(); + GSOFeature f = features[features.Length - 1]; + if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + //TODO LIST:代码需要优化 张帆 + FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption); + lineCoordiante.Show(this); + } + } + } + if (enumDesignMode==EnumDesignMode.AddTunnel + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道 + { + GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (tunnel != null && tunnel.GetAllFeatures().Length > 0) + { + GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1); + FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature); + if (frm.ShowDialog() == DialogResult.OK) + { + //tunnel.Save(); + } + } + + } + if (enumDesignMode==EnumDesignMode.AddCitySevenLine + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线 + { + CitySevenLine citySevenLine = globeControl1.Tag as CitySevenLine; + string lineType = citySevenLine.Type; + string lineName = citySevenLine.Name; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(lineType); + if (layer != null && layer.GetAllFeatures().Length > 0) + { + GSOFeature feature = layer.GetAt(layer.GetAllFeatures().Length - 1); + if (feature != null) + { + feature.Name = lineName; + GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); + style.LineColor = CitySevenLine.getColorByName(lineType); + style.LineWidth = 1; + feature.Geometry.Style = style; + } + } + globeControl1.Tag = null; + globeControl1.Globe.DestLayerFeatureAdd = null; + } + globeControl1.Refresh(); + enumDesignMode=EnumDesignMode.Null; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + + /// + /// 获取globeControl1中鼠标按下的坐标供区别鼠标右键和滚轮按下事件 + /// + /// + /// + void globeControl1_MouseDown(object sender, MouseEventArgs e) + { + mouseDownX1 = e.X; + mouseDownY1 = e.Y; + } + /// + /// 获取globeControl2中鼠标按下的坐标供区别鼠标右键和滚轮按下事件 + /// + /// + /// + void globeControl2_MouseDown(object sender, MouseEventArgs e) + { + mouseDownX2 = e.X; + mouseDownY2 = e.Y; + } + /// + /// + /// + /// + /// + void globeControl2_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); + } + } + /// + /// (完善)#wxl 待整理 + /// + /// + /// + void globeControl1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + if (globeControl1.Globe.Action == EnumAction3D.VisibilityAnalysis) + { + 通视分析ToolStripMenuItem.Checked = false; + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "vertical") // 垂直净距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX2.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX2.Rows.Add(); + dataGridViewX2.Rows[idx].Tag = feat; + dataGridViewX2.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX2.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "spacing") // 间距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewLineList.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewLineList.Rows.Add(); + dataGridViewLineList.Rows[idx].Tag = feat; + dataGridViewLineList.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewLineList.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "horizontal") // 水平净距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX8.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX8.Rows.Add(); + dataGridViewX8.Rows[idx].Tag = feat; + dataGridViewX8.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX8.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "collision") // 管线碰撞分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX4.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX4.Rows.Add(); + dataGridViewX4.Rows[idx].Tag = feat; + dataGridViewX4.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX4.Rows[idx].Cells[1].Value = featureName; + + } + } + return; + } + + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "ftAnalysis") // 覆土分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX6.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX6.Rows.Add(); + dataGridViewX6.Rows[idx].Tag = feat; + dataGridViewX6.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX6.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + GSOPoint3d point; + GSOLayer templayer; + GSOFeature feature1 = globeControl1.Globe.HitTest(e.X, e.Y, out templayer, out point, false, true, 0); + if (point.X == 0 && point.Y == 0 && point.Z == 0) + { + point = globeControl1.Globe.ScreenToScene(e.X, e.Y); + } + GSOGeoPoint3D pt = new GSOGeoPoint3D(); + pt.X = point.X; + pt.Y = point.Y; + pt.Z = point.Z; + + bsqPT = pt; + + if (高度量算ToolStripMenuItem1.Checked && globeControl1.Globe.Action == EnumAction3D.SelectObject) // 高度量算菜单 + { + double z = globeControl1.Globe.GetZ(point.X, point.Y); + double modelZ = 0; + if (feature1 != null) + { + modelZ = feature1.Geometry.GeoBottomCenterPoint.Z; + } + GSOGeoPolyline3D line = new GSOGeoPolyline3D(); + GSOPoint3ds pts = new GSOPoint3ds(); + GSOPoint3d pt1 = new GSOPoint3d(); + pt1.X = point.X; + pt1.Y = point.Y; + pt1.Z = point.Z - z; + pts.Add(pt1); + pts.Add(point); + line.AddPart(pts); + GSOFeature feat = new GSOFeature(); + line.AltitudeMode = EnumAltitudeMode.Absolute; + feat.Geometry = line; + GSOLabel label = new GSOLabel(); + GSOLabelStyle style = new GSOLabelStyle(); + style.OutlineColor = Color.Transparent; + style.HasTracktionLine = false; + style.BackBeginColor = Color.Transparent; + style.BackEndColor = Color.Transparent; + style.BackMidColor = Color.Transparent; + label.Style = style; + label.Text = "高度:" + (point.Z - z).ToString("0.00") + "米"; + feat.Label = label; + layerTemp.AddFeature(feat); + } + } + else if (e.Button == MouseButtons.Right) // 右键取消 高度量算 功能 + { + if (e.X == mouseDownX1 && e.Y == mouseDownY1) + { + toolRightMenu.Show(globeControl1, e.X, e.Y); + if (高度量算ToolStripMenuItem1.Checked) + { + 高度量算ToolStripMenuItem1.Checked = false; + } + } + else + { + return; + } + } + globeControl1.Refresh(); + } + + /// + /// 判断网络图片是否存在 + /// + /// + /// + public static bool RemoteFileExists(string fileUrl) + { + bool result = false; + + WebResponse response = null; + try + { + WebRequest req = WebRequest.Create(fileUrl); + response = req.GetResponse(); + result = true; + } + catch (Exception ex) + { + result = false; + } + finally + { + if (response != null) + { + response.Close(); + } + } + return result; + } + + string featureIDFieldName = "编号";//待完善 + private bool isFeatureContainsBianhao(GSOFeature feature) + { + if (feature.GetFieldDefn("标识器编号") != null) + { + featureIDFieldName = "标识器编号"; + return true; + } + if (feature.GetFieldDefn("编号") == null) return false; + featureIDFieldName = "编号"; + return true; + } + + /// + /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理 + /// + /// + /// + void globeControl1_FeatureMouseClickEvent(object sender, FeatureMouseClickEventArgs e) + { + GSOFeature feature = e.Feature; + + string str1 = ""; + if (feature == null) return; + if (feature.GetFieldDefn("图片编码") != null)// + { + str1 = GetBubbleInfo(feature, globeControl1); + if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码"))) + { + str1 += ""; + } + else if (RemoteFileExists(Utility.PicDefaultURL)) + { + str1 += ""; + } + } + else if (isFeatureContainsBianhao(feature)) //管线模型图层 + { + str1 = GetBubbleInfo(feature, globeControl1); + } + + if (str1 == "") return; + featureTooltip.HideBalloon(); + balloonEx.HideBalloon(); + balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480); + balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420); + balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1); + } + + /// + /// 鼠标点击, 弹出气泡功能globeControl2 + /// + /// + /// + void globeControl2_FeatureMouseClickEvent(object sender, FeatureMouseClickEventArgs e) + { + GSOFeature feature = e.Feature; + + string str1 = ""; + if (feature == null) return; + if (feature.GetFieldDefn("图片编码") != null) // + { + str1 = GetBubbleInfo(feature, globeControl2); + if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码"))) + { + str1 += ""; + } + else if (RemoteFileExists(Utility.PicDefaultURL)) + { + str1 += ""; + } + } + else if (isFeatureContainsBianhao(feature)) //管线模型图层 + { + str1 = GetBubbleInfo(feature, globeControl2); + } + + if (str1 == "") return; + featureTooltip2.HideBalloon(); + balloonEx2.HideBalloon(); + balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480); + balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420); + balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1); + } + + /// + /// 拼接气泡表格字符串(完善) + /// + /// + /// + private string GetBubbleInfo(GSOFeature feature, GSOGlobeControl globeControl) + { + if (feature == null) return ""; + string str = ""; + var code = feature.GetFieldAsString("编码"); + var title = FeatureTools.GetFeatureTypeByCode(code); + str += ""; + + int rowCount = feature.GetFieldCount(); + string layerName = feature.Dataset.Name; + string queryFields = ""; + if (Utility.Query_Fields.ContainsKey(layerName)) + { + queryFields = Utility.Query_Fields[layerName].ToString().Trim(); + } + else + { + layerName = feature.Dataset.Caption; + queryFields = getpipeLineFields.get_Fields(layerName, globeControl); + } + if (queryFields != null) + { + string[] param = { "," }; + string[] fieldNames = queryFields.Split(param, StringSplitOptions.RemoveEmptyEntries); + for (int j = 0; j < fieldNames.Length; j++) + { + string fieldName = fieldNames[j].Trim(); + GSOFieldDefn field1 = feature.GetFieldDefn(fieldName); + + string name1 = ""; + string value1 = ""; + if (field1 != null) + { + if (field1.Name == "图片编码") + { + j++; + } + if (j < rowCount) + { + field1 = feature.GetFieldDefn(j); + name1 = field1.Name; + if (name1 == "模型路径") + { + continue; + } + if (field1.Type == EnumFieldType.Text) + { + value1 = feature.GetFieldAsString(j); + } + else if (field1.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j)); + if (dd.Year <= 1) + { + value1 = ""; + } + else + { + value1 = dd.ToShortDateString(); + } + } + else if (field1.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(j); + if (!name1.Contains("管径") && !name1.Contains("电压") && !name1.Contains("角度")) + { + name1 += "_米"; + } + value1 = dl1.ToString("0.00"); + } + else + { + if (!feature.IsFieldValueNull(j)) + { + value1 = feature.GetValue(j).ToString(); + } + } + } + } + string name2 = ""; + string value2 = ""; + if (j + 1 < rowCount) + { + GSOFieldDefn field2 = feature.GetFieldDefn(j + 1); + + if (field2 != null) + { + if (field2.Name == "图片编码") + { + j++; + } + if (j + 1 < rowCount) + { + field2 = feature.GetFieldDefn(j + 1); + name2 = field2.Name; + + if (name2 == "模型路径") + { + continue; + } + + if (field2.Type == EnumFieldType.Text) + { + value2 = feature.GetFieldAsString(j + 1); + } + else if (field2.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j + 1)); + + if (dd.Year <= 1) + { + value2 = ""; + } + else + { + value2 = dd.ToShortDateString(); + } + } + else if (field2.Type == EnumFieldType.Double) + { + double dl2 = feature.GetFieldAsDouble(j + 1); + if (!name2.Contains("管径") && !name2.Contains("电压") && !name2.Contains("角度")) + { + name2 += "_米"; + } + value2 = dl2.ToString("0.00"); + } + else + { + if (!feature.IsFieldValueNull(j + 1)) + { + value2 = feature.GetValue(j + 1).ToString(); + } + } + } + } + + j++; + } + str += ""; + } + } + str += "
" + title + " " + feature.GetFieldAsString(featureIDFieldName) + "
" + + name1 + + "
" + + value1 + + "
" + + name2 + + "
" + + value2 + "
"; + return str; + } + + private GSOLayer TreeNodeFeatureLayer() + { + TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); + if (featureAddPipeFitTreenode == null) return null; + GSOLayer featureAddLayer = featureAddPipeFitTreenode.Tag as GSOLayer; + return featureAddLayer; + } + //遍历最深三层找到目标node. + private TreeNode GetDestLayerFeatureAddTreeNode() + { + + foreach (TreeNode layerTreeNode in layerTree.Nodes) + { + if (layerTreeNode.Tag == null && layerTreeNode.Nodes.Count > 0) + { + foreach (TreeNode node in layerTreeNode.Nodes) + { + if (node.Tag == null & node.Nodes.Count > 0) + { + foreach (TreeNode nodeNode in node.Nodes) + { + GSOLayer gsoLayer = nodeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return nodeNode; + } + } + else + { + GSOLayer gsoLayer = node.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; + } + } + } + else + { + GSOLayer gsoLayer = layerTreeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return layerTreeNode; + } + } + return null; + } + + /// + /// 地上模式 菜单按钮 + /// + /// + /// + private void buttonItem87_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem87.Text); + + if (buttonItem87.Checked) return; + buttonItem87.Checked = true; + buttonItem88.Checked = false; + buttonItem27.Checked = false; + + switch (globeControl1.Globe.CameraMode) + { + case EnumCameraMode.UnderGround: + globeControl1.Globe.CameraMode = EnumCameraMode.Navigation; + GSOCameraState state = new GSOCameraState(); + state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode; + state.Altitude = globeControl1.Globe.CameraState.Altitude; + state.Distance = globeControl1.Globe.CameraState.Distance; + state.Heading = globeControl1.Globe.CameraState.Heading; + state.Latitude = globeControl1.Globe.CameraState.Latitude; + state.Longitude = globeControl1.Globe.CameraState.Longitude; + if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85) + state.Tilt = 85; + else + state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt; + globeControl1.Globe.JumpToCameraState(state); + break; + case EnumCameraMode.Walk: + globeControl1.Globe.CameraMode = EnumCameraMode.Navigation; + break; + } + globeControl1.Globe.Refresh(); + } + /// + /// 地下模式 菜单按钮 + /// + /// + /// + private void buttonItem88_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem88.Text); + + if (buttonItem88.Checked) return; + buttonItem88.Checked = true; + buttonItem27.Checked = false; + buttonItem87.Checked = false; + + switch (globeControl1.Globe.CameraMode) + { + case EnumCameraMode.Navigation: + case EnumCameraMode.Walk: + globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround; + GSOCameraState state = new GSOCameraState(); + state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode; + state.Altitude = globeControl1.Globe.CameraState.Altitude; + state.Distance = globeControl1.Globe.CameraState.Distance; + state.Heading = globeControl1.Globe.CameraState.Heading; + state.Latitude = globeControl1.Globe.CameraState.Latitude; + state.Longitude = globeControl1.Globe.CameraState.Longitude; + if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85) + state.Tilt = 95; + else + state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt; + globeControl1.Globe.JumpToCameraState(state); + break; + } + globeControl1.Globe.Refresh(); + } + /// + /// 行走模式 菜单按钮 + /// + /// + /// + private void buttonItem27_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem27.Text); + + if (buttonItem27.Checked) return; + buttonItem27.Checked = true; + buttonItem87.Checked = false; + buttonItem88.Checked = false; + + globeControl1.Globe.CameraMode = EnumCameraMode.Walk; + } + /// + /// 地面透明度设置 菜单 + /// + /// + /// + private void sliderGroundTransSet1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderGroundTransSet1.Value; + optiValue = sliderGroundTransSet1.Value; + } + /// + /// 图例 菜单按钮 + /// + /// + /// + private void btnlegendSet_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, btnlegendSet.Text); + + btnlegendSet.Checked = !btnlegendSet.Checked; + legend.Visible = !legend.Visible; + globeControl1.Refresh(); + } + /// + /// 快速定位 菜单按钮 + /// + /// + /// + private void buttonItem91_Click(object sender, EventArgs e) // + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem91.Text); + FrmFlyToPosition fly = new FrmFlyToPosition(globeControl1); + fly.Show(this); + } + /// + /// 图层管理 菜单按钮 + /// + /// + /// + private void buttonItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem1.Text); + + buttonItem1.Checked = !buttonItem1.Checked; + if (buttonItem1.Checked) + { + sideBarPanelItem3.Visible = true; + layerTree.Visible = true; + controlContainerItem3.Visible = true; + sideBar1.Visible = true; + Refresh(); + } + else + { + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + + //修改图层管理与标注管理、覆土审查、水平净距分析、垂直净距分析和碰撞分析控件之间的逻辑关系 + controlContainerItem5.Visible = false; + sideBar1.Visible = false; + sideBarPanelItem4.Visible = false; + panel3.Visible = false; + sideBar1.ExpandedPanel = sideBarPanelItem3; + 标注管理ToolStripMenuItem.Checked = false; + Refresh(); + } + } + /// + /// 全屏显示 菜单按钮 + /// + /// + /// + private void buttonItem89_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem89.Text); + + buttonItem89.Checked = !buttonItem89.Checked; + FullScreen(); + } + + //全屏显示调用的windows底层api函数 + [DllImport("user32.dll", EntryPoint = "ShowWindow")] + private static extern int ShowWindow(int hWnd, int _value); + + //任务栏 + [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)] + static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); + int widthOld; + int heightOld; + int xOld; + int yOld; + /// + /// 全屏显示功能实现(完善) + /// + private void FullScreen() + { + if (!m_bFullScreen) // 启用全屏 + { + xOld = Location.X; + yOld = Location.Y; + widthOld = Width; + heightOld = Height; + + SuspendLayout();//挂起 + + FormBorderStyle = FormBorderStyle.Sizable; + WindowState = FormWindowState.Maximized; + //////任务栏 + IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null); + if (trayHwnd != IntPtr.Zero) + { + ShowWindow(trayHwnd.ToInt32(), 0); + } + + int widthFull = Screen.PrimaryScreen.Bounds.Width; + int heightFull = Screen.PrimaryScreen.Bounds.Height; + + FormBorderStyle = FormBorderStyle.None; + WindowState = FormWindowState.Normal; + + Location = new Point(0, 0); + SetFullScreen(widthFull, heightFull); + + ////hudButton + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + buttonItem89.Checked = true; + sideBar1.Visible = false; + expandableSplitter1.Expanded = false; + expandableSplitter1.Visible = false; + + statusStrip1.Visible = false; + expandableSplitter2.Expanded = false; + expandableSplitter2.Visible = false; + ribbonControl1.Visible = false; + pictureBox1.Visible = false; + + ResumeLayout();//重新开始 + + m_bFullScreen = true; + } + else // 取消全屏 + { + SuspendLayout();//挂起 + + //////任务栏 + IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null); + if (trayHwnd != IntPtr.Zero) + { + ShowWindow(trayHwnd.ToInt32(), 1); + } + + FormBorderStyle = FormBorderStyle.Sizable; + WindowState = FormWindowState.Normal; + + Location = new Point(xOld, yOld); + SetFullScreen(widthOld, heightOld); + + ////hudButton + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + buttonItem89.Checked = false; + expandableSplitter1.Expanded = true; + expandableSplitter1.Visible = true; + sideBar1.Visible = true; + buttonItem1.Checked = true; + expandableSplitter2.Visible = true; + statusStrip1.Visible = true; + ribbonControl1.Visible = true; + pictureBox1.Visible = true; + + ResumeLayout();//重新开始 + m_bFullScreen = false; + Focus(); + //初始化隐藏图层管理 + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + if (sideBarPanelItem4.Visible) + { + sideBar1.Visible = true; + controlContainerItem5.Visible = true; + } + else + { + sideBar1.Visible = false; + } + buttonItem1.Checked = false; + Refresh(); + } + } + + /// + /// 设置窗体宽、高 + /// + /// + /// + private void SetFullScreen(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// 全屏功能的快捷键F5 + /// + /// + /// + private void MainFrm_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.F5: + FullScreen(); + break; + case Keys.Escape: + if (m_bFullScreen) + { + FullScreen(); + } + break; + default: + break; + } + if (e.KeyCode == Keys.P && e.Modifiers == Keys.Control) + { + buttonItem130_Click_1(this, EventArgs.Empty); + } + } + + private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // + { + Rectangle rc = new Rectangle(); + + p1 = globeControl1.PointToScreen(p1); + p2 = globeControl1.PointToScreen(p2); + + int x = Screen.PrimaryScreen.Bounds.X; + int y = Screen.PrimaryScreen.Bounds.Y; + int screenWidth = SystemInformation.WorkingArea.Width; + int screenHeight = SystemInformation.WorkingArea.Height; + + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; + p1.X = rc.Left; + p1.Y = rc.Top; + + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; + rc.Width = p2.X - rc.X; + rc.Height = p2.Y - rc.Y; + + mapWidth = rc.Width; + mapHeight = rc.Height; + Point pt = new Point(rc.Left, rc.Top); + return pt; + } + + Image printImage; + private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) + { + e.Graphics.DrawImage(printImage, 10, 10); + } + /// + /// 输出地图 菜单 + /// + /// + /// + private void btnOutputJPG_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btnOutputJPG.Text); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 目标图层 菜单 + /// + /// + /// + private void FeatureAddLayerMenuItem_Click(object sender, EventArgs e) + { + if (FeatureAddLayerMenuItem.Checked) return; + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + FeatureAddLayerMenuItem.Checked = true; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + globeControl1.Globe.DestLayerFeatureAdd = layer; + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 可选择 菜单 + /// + /// + /// + private void LayerSelectableMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + LayerSelectableMenuItem.Checked = !LayerSelectableMenuItem.Checked; + if (layer != null) layer.Selectable = LayerSelectableMenuItem.Checked; + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 可编辑 菜单 + /// + /// + /// + private void LayerEditableMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + LayerEditableMenuItem.Checked = !LayerEditableMenuItem.Checked; + if (layer != null) layer.Editable = LayerEditableMenuItem.Checked; + } + /// + /// 图层目录树 右键菜单中的 保存 菜单 + /// + /// + /// + //wxl Tag更正 + private void SaveLayerMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + if (layer != null) layer.Dataset.Save(); + } + + /// + /// 清除结果 菜单 + /// + /// + /// + private void buttonItem47_Click(object sender, EventArgs e) + { + globeControl1.Globe.ClearAnalysis(); + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + clearFeatureHighLight(); + } + /// + /// 设置菜单的选中状态 + /// + private void ActionToolMenuChecked() + { + if (globeControl1.Globe.Action != EnumAction3D.TrackPolyline) + { + 横断面分析ToolStripMenuItem.Checked = false; + 道路断面分析ToolStripMenuItem.Checked = false; + 基线剖面分析ToolStripMenuItem.Checked = false; + 沿线开挖ToolStripMenuItem.Checked = false; + } + if (globeControl1.Globe.Action != EnumAction3D.NormalHit) + { + 关阀分析ToolStripMenuItem.Checked = false; + 连通分析ToolStripMenuItem.Checked = false; + } + if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) + { + 多边形开挖ToolStripMenuItem.Checked = false; + 挖方量分析ToolStripMenuItem.Checked = false; + } + } + /// + /// 主窗体关闭事件处理 + /// + /// + /// + private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) + { + if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + e.Cancel = true; + else + globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); + } + + #region 完善(各种净距分析) + /// + /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX2_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx1.Enabled = checkBoxX2.Checked; + if (checkBoxX2.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + trackflag = ""; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + + comboBoxEx1.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 水平净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX2_CheckedChanged_shuiping(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + comboBoxEx4.Enabled = checkBoxX8.Checked; + if (checkBoxX8.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + + comboBoxEx4.SelectedIndex = -1; + + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 垂直净距分析 功能界面中的 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX1_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX1.Checked) + { + comboBoxEx1.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx1.Enabled = false; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + trackflag = "vertical"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx1.Enabled = true; + } + } + /// + /// 水平净距分析 功能界面中的 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX1_CheckedChanged_shuiping(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + if (checkBoxX7.Checked) + { + comboBoxEx4.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx4.Enabled = false; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + trackflag = "horizontal"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx4.Enabled = true; + } + } + /// + /// 垂直净距分析 功能界面中的 选择图层下拉框 选中项改变 事件处理 + /// + /// + /// + private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx1.SelectedIndex <= -1) return; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + listBox1.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX2.Rows.Add(); + dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString(); + dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 水平净距分析 功能界面中的 选择图层下拉框 选中项改变 事件处理 + /// + /// + /// + private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e) + { + if (comboBoxEx4.SelectedIndex <= -1) return; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + listBox3.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX8.Rows.Add(); + dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString(); + dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + Dictionary featCount = new Dictionary(); + Dictionary featLenth = new Dictionary(); + Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 + + /// + /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 + /// + /// + /// + private void buttonX1_Click(object sender, EventArgs e) + { + if (!checkBoxX1.Checked && !checkBoxX2.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX2.Text.Trim() == "") + { + MessageBox.Show("净距标准不能为空!", "提示"); + return; + } + double dJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxX2.Text.Trim(), out dJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的净距标准!", "提示"); + return; + } + if (dataGridViewX2.Rows.Count <= 0) + { + MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis(selectedFeature,Utility.m_PipelineLayerNames,dJingJuBiaoZhun); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + + /// + /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 + /// + /// + /// + /// + /// + /// + private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible) + { + if (pntIntersect1 == null || pntIntersect2 == null) + { + return new GSOPoint3d(); + } + + GSOGeoPolyline3D disline = new GSOGeoPolyline3D(); + GSOPoint3ds point3Ds = new GSOPoint3ds(); + point3Ds.Add(pntIntersect1); + point3Ds.Add(pntIntersect2); + disline.AddPart(point3Ds); + GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格 + //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255 + style.LineColor = Color.GreenYellow; + style.LineWidth = 3; //设置线的宽度为3 + style.VertexVisible = true; //显示线的节点 + disline.Style = style; //把风格添加到线上 + disline.AltitudeMode = EnumAltitudeMode.Absolute; + + GSOFeature line = new GSOFeature(); + line.Geometry = disline; + + GSOGeoMarker dismarker = new GSOGeoMarker(); + dismarker.X = pntIntersect1.X; + dismarker.Y = pntIntersect1.Y; + dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2; + + string disStr = distance.ToString("0.00"); + if (disStr != "0.00") + { + dismarker.Text = distance.ToString("0.00") + "米"; + } + else + { + dismarker.Text = "交叉"; + } + dismarker.AltitudeMode = EnumAltitudeMode.Absolute; + GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D(); + GSOTextStyle styleText = new GSOTextStyle(); + styleText.IsSizeFixed = true; + styleText.ForeColor = Color.White; + styleText.FontSize = 20; + styleMarker.TextStyle = styleText; + dismarker.Style = styleMarker; + + GSOFeature marker = new GSOFeature(); + marker.Geometry = dismarker; + + line.Visible = marker.Visible = markerVisible; + + markerLayer.AddFeature(line); + markerLayer.AddFeature(marker); + + return dismarker.Position; + } + #region wxl + /// + /// wxl重构,碰撞分析 + /// + /// + /// + /// + private void CollisionAnalysis(GSOFeature selectedFeature, List pipelineLayerNames) + { + List result = DoublePanelAnalysis.CollisionAnalysis(globeControl1, selectedFeature, pipelineLayerNames); + if (result == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + + string caption = selectedFeature.Dataset.Caption; + foreach (FeatureAnalysisInfo featureAnalysisInfo in result) + { + string feat2Caption = featureAnalysisInfo.feature.Dataset.Caption; + featureAnalysisInfo.feature.HighLight = true; + var idx = dataGridViewX5.Rows.Add(); + dataGridViewX5.Rows[idx].Cells[0].Value = caption; + dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX5.Rows[idx].Cells[2].Value = feat2Caption; + dataGridViewX5.Rows[idx].Cells[3].Value = featureAnalysisInfo.feature.Name; + GSOGeoPolyline3D line2 = featureAnalysisInfo.feature.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + featureAnalysisInfo.feature.Name) == false) + { + GSOGeoMarker dismarker = new GSOGeoMarker(); + dismarker.X = featureAnalysisInfo.point1.X; + dismarker.Y = featureAnalysisInfo.point1.Y; + dismarker.Z = (featureAnalysisInfo.point1.Z + featureAnalysisInfo.point1.Z) / 2; + dismarker.AltitudeMode = EnumAltitudeMode.Absolute; + m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + featureAnalysisInfo.feature.Name, dismarker.Position);//添加飞行位置记录 + } + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + + } + /// + /// wxl重构,垂直净距分析 + /// + /// + /// + /// + private void VerticalDistanceAnalysis(GSOFeature selectedFeature, List pipelineLayerNames, double verticalDistance) + { + List result = DoublePanelAnalysis.VerticalDistanceAnalysis(globeControl1, selectedFeature, pipelineLayerNames, + verticalDistance); + if (result == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + string caption = selectedFeature.Dataset.Caption; + foreach (FeatureAnalysisInfo featureAnalysisInfo in result) + { + GSOFeature feat2 = featureAnalysisInfo.feature; + string feat2Caption = feat2.Dataset.Caption; + feat2.HighLight = true; + var idx = dataGridViewX3.Rows.Add(); + dataGridViewX3.Rows[idx].Cells[0].Value = caption; + dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX3.Rows[idx].Cells[2].Value = feat2Caption; // feat2.Dataset.Caption;一致 + dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX3.Rows[idx].Cells[4].Value = featureAnalysisInfo.distance.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + string markerInfo = featureAnalysisInfo.distance.ToString("0.00") + "米"; + GSOPoint3d markerPosition = DoublePanelAnalysis.MakeLabel(layerTemp, featureAnalysisInfo.point1, featureAnalysisInfo.point2, markerInfo, true); + if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feat2.Name) == false) + { + m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feat2.Name, markerPosition); //添加飞行位置记录 + } + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + } + + #endregion + + /// + /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 + /// + /// + /// + private void dataGridViewX3_MouseDoubleClick(object sender, MouseEventArgs e) // + { + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX3.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string key = dataGridViewX3.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX3.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim(); + if (m_FeaturesWithBianhao.ContainsKey(key)) + { + globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5); + } + } + } + } + + /// + /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 + /// + /// + /// + private void buttonX1_Click_shuiping(object sender, EventArgs e) // + { + if (!checkBoxX7.Checked && !checkBoxX8.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX4.Text.Trim() == "") + { + MessageBox.Show("净距标准不能为空!", "提示"); + return; + } + double dJingJuBiaoZhun = 0; + if (!double.TryParse(textBoxX4.Text.Trim(), out dJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的净距标准!", "提示"); + return; + } + if (dataGridViewX8.Rows.Count <= 0) + { + MessageBox.Show("请选中要进行水平净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox3.Items.Clear(); + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + dataGridViewX9.Rows.Clear(); + Cursor = Cursors.WaitCursor; + for (int i = 0; i < dataGridViewX8.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX8.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun); + } + if (dataGridViewX9.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); + } + + for (int i = 0; i < Utility.m_PipelineLayerNames.Count&&featCount.Count>0; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + #region wxl 水平净距分析重构 + /// + /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 + /// + /// + /// + /// + private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + if (featureMap == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + foreach (KeyValuePair kvp in featureMap) + { + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + string feat2Caption = feat2.Dataset.Caption; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = kvp.Value.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + } + #endregion + + /// + /// 水平净距分析 功能界面中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature; + if (rowFeature == null) return; + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); + } + else + { + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + /// + /// 碰撞分析 功能界面中 开始分析按钮 事件处理 + /// + /// + /// + private void buttonX5_Click(object sender, EventArgs e) + { + if (!checkBoxX3.Checked && !checkBoxX4.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (dataGridViewX4.Rows.Count > 0) + { + featLenth.Clear(); + featCount.Clear(); + listBox2.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + dataGridViewX5.Rows.Clear(); + clearFeatureHighLight(); + m_FeaturesWithBianhao.Clear(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + Cursor = Cursors.WaitCursor; + if (checkBoxX3.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX4.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; +// VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); + CollisionAnalysis(selectedFeature,Utility.m_PipelineLayerNames); + } + } + else if (checkBoxX4.Checked) // 选择图层 + { + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + CollisionAnalysis(feats[i], Utility.m_PipelineLayerNames); +// VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0); + } + } + + if (featCount.Count > 0) + { + foreach (string pipelineLayer in Utility.m_PipelineLayerNames) + { + if (featCount.ContainsKey(pipelineLayer) && featLenth.ContainsKey(pipelineLayer)) + { + listBox2.Items.Add(pipelineLayer + ":" + featCount[pipelineLayer] + "条,共" + featLenth[pipelineLayer].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX5.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有发生碰撞的管线!", "提示"); + } + } + else + { + MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + /// + /// 碰撞分析功能界面中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim(); + if (m_FeaturesWithBianhao.ContainsKey(key)) + { + globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5); + } + } + /// + /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 + /// + /// + /// + private void checkBoxX5_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX5.Checked) + { + comboBoxEx3.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx3.Enabled = false; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + trackflag = "ftAnalysis"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx3.Enabled = true; + } + } + /// + /// 覆土分析功能操作界面中的 选择图层 复选框选中状态改变事件处理 + /// + /// + /// + private void checkBoxX6_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx3.Enabled = checkBoxX6.Checked; + if (checkBoxX6.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + trackflag = ""; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + comboBoxEx3.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 覆土分析功能操作界面中的 图层下拉框选中项改变事件处理 + /// + /// + /// + private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx3.SelectedIndex <= -1) return; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX6.Rows.Add(); + dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString(); + dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 覆土分析功能操作界面中的 开始分析 按钮事件处理 + /// + /// + /// + private void buttonX9_Click(object sender, EventArgs e) + { + if (!checkBoxX5.Checked && !checkBoxX6.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX3.Text.Trim() == "") + { + MessageBox.Show("覆土深度不能为空!", "提示"); + return; + } + double dFuTuShenDu = 0; + if (!double.TryParse(textBoxX3.Text.Trim(), out dFuTuShenDu)) + { + MessageBox.Show("请输入正确的覆土深度!", "提示"); + return; + } + + if (dataGridViewX6.Rows.Count > 0) + { + layerTemp.RemoveAllFeature(); + dataGridViewX7.Rows.Clear(); + clearFeatureHighLight(); + Cursor = Cursors.WaitCursor; + + if (checkBoxX5.Checked) // 覆土分析 选择管线 + { + for (int i = 0; i < dataGridViewX6.Rows.Count; i++) + { + GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; + if (rowFeature == null) continue; + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; + + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) + { + continue; + } + GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; + if (style == null) + { + continue; + } + if (line.PartCount <= 0) continue; + GSOPoint3ds pts = line[0]; + GSOPoint3d pt = new GSOPoint3d(); + + for (int m = 0; m < pts.Count; m++) + { + if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim())) + { + rowFeature.HighLight = true; + int idx = dataGridViewX7.Rows.Add(); + dataGridViewX7.Rows[idx].Tag = rowFeature; + dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption; + dataGridViewX7.Rows[idx].Cells[1].Value = featureName; + dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00"); + + pt.X = pts[m].X; + pt.Y = pts[m].Y; + pt.Z = 0; + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + break; + } + } + } + } + else if (checkBoxX6.Checked) // 覆土分析 选择图层 + { + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null)return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + GSOFeature f = feats[i]; + string featureName = ""; + featureName = isFeatureContainsBianhao(feats[i]) ? feats[i].GetValue(featureIDFieldName).ToString() : feats[i].Name; + GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; + if (line == null) continue; + GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; + if (style == null || line.PartCount <= 0) continue; + GSOPoint3ds pts = line[0]; + GSOPoint3d pt = new GSOPoint3d(); + for (int m = 0; m < pts.Count; m++) + { + if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim())) + { + f.HighLight = true; + int idx = dataGridViewX7.Rows.Add(); + dataGridViewX7.Rows[idx].Tag = f; + dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption; + dataGridViewX7.Rows[idx].Cells[1].Value = featureName; + dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00"); + + pt.X = pts[m].X; + pt.Y = pts[m].Y; + pt.Z = 0; + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + + break; + } + } + } + } + globeControl1.Refresh(); + if (dataGridViewX7.Rows.Count == 0) + { + MessageBox.Show("所有管线满足覆土净距标准!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + Cursor = Cursors.Default; + } + /// + /// 覆土分析中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature; + if (rowFeature == null) return; + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); + } + else + { + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + /// + /// 覆土分析功能操作界面中的 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX10_Click(object sender, EventArgs e) + { + if (dataGridViewX7.Rows.Count > 0) + { + ExportExcel("覆土分析", dataGridViewX7, null); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 覆土分析功能操作界面底部的 关闭 按钮事件处理 + /// + /// + /// + private void buttonX11_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel4.Visible = false; + checkBoxX5.Checked = false; + checkBoxX6.Checked = false; + comboBoxEx3.SelectedIndex = -1; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + layerTemp.RemoveAllFeature(); + + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + globeControl1.Refresh(); + + //Refresh(); + } + /// + /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX2_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX1.Checked = false; + checkBoxX2.Checked = false; + comboBoxEx1.SelectedIndex = -1; + comboBoxEx1.Enabled = false; + textBoxX2.Text = "1"; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + listBox1.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 水平净距分析 功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX15_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX7.Checked = false; + checkBoxX8.Checked = false; + comboBoxEx4.SelectedIndex = -1; + comboBoxEx4.Enabled = false; + textBoxX4.Text = "1"; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + listBox3.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 垂直净距分析功能界面中 关闭按钮 事件处理 + /// + /// + /// + private void buttonX3_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel2.Visible = false; + checkBoxX1.Checked = false; + checkBoxX2.Checked = false; + comboBoxEx1.SelectedIndex = -1; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + if (layerTemp != null) + { + layerTemp.RemoveAllFeature(); + } + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + /// + /// 水平净距分析功能界面中 删除缓冲区按钮 事件处理 + /// + /// + /// + private void buttonX14_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel5.Visible = false; + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + /// + /// 导出指定DataGridView控件中的内容 + /// + /// + /// + private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox) + { + if (_dataGridView.Rows.Count <= 0) return; + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "Excel files (*.xls)|*.xls"; + dlg.FilterIndex = 0; + dlg.RestoreDirectory = true; + //dlg.CreatePrompt = true; + dlg.Title = "保存为Excel文件"; + dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; + if (dlg.ShowDialog() == DialogResult.OK) + { + Stream myStream = dlg.OpenFile(); + StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0)); + string columnTitle = ""; + try + { + if (_listBox != null) + { + string strList = ""; + for (int i = 0; i < _listBox.Items.Count; i++) + { + strList += _listBox.Items[i] + @"/"; + } + sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList); + } + else + { + sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd")); + } + //写入列标题 + for (int i = 0; i < _dataGridView.ColumnCount; i++) + { + if (i > 0) + { + columnTitle += "\t"; + } + columnTitle += _dataGridView.Columns[i].HeaderText; + } + sw.WriteLine(columnTitle); + + //写入列内容 + for (int j = 0; j < _dataGridView.Rows.Count; j++) + { + string columnValue = ""; + for (int k = 0; k < _dataGridView.Columns.Count; k++) + { + if (k > 0) + { + columnValue += "\t"; + } + if (_dataGridView.Rows[j].Cells[k].Value == null) + { + columnValue += ""; + } + else + { + columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim(); + } + } + + sw.WriteLine(columnValue); + } + sw.Close(); + myStream.Close(); + if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + Process.Start(dlg.FileName); + } + } + catch (Exception ex) + { + //MessageBox.Show(ex.ToString()); + } + finally + { + sw.Close(); + myStream.Close(); + } + } + } + /// + /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX4_Click(object sender, EventArgs e) + { + if (dataGridViewX3.Rows.Count > 0) + { + ExportExcel("垂直净距分析", dataGridViewX3, listBox1); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 水平净距分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX4_Click_shuiping(object sender, EventArgs e) + { + if (dataGridViewX9.Rows.Count > 0) + { + ExportExcel("水平净距分析", dataGridViewX9, listBox3); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX3_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX3.Checked) + { + comboBoxEx2.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx2.Enabled = false; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + trackflag = "collision"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx2.Enabled = true; + } + } + /// + /// 碰撞分析功能界面中 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX4_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx2.Enabled = checkBoxX4.Checked; + if (checkBoxX4.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + + comboBoxEx2.SelectedIndex = -1; + + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 碰撞分析功能界面中 选择图层下拉框 选中项改变事件处理 + /// + /// + /// + private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx2.SelectedIndex <= -1) return; + listBox2.Items.Clear(); + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX4.Rows.Add(); + dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString(); + dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 清除所有图层中的所有feature对象的高亮状态 功能 + /// + private void clearFeatureHighLight() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (!(layer is GSOFeatureLayer)) continue; + GSOFeatures feats = layer.GetAllFeatures(); + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feat = feats[j]; + feat.HighLight = false; + GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; + if (lineStyle == null) continue; + lineStyle.ArrowVisible = false; + feat.Geometry.SetModified(true); + } + } + for (int i = 0; i < globeControl2.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl2.Globe.Layers[i]; + if (!(layer is GSOFeatureLayer)) continue; + GSOFeatures feats = layer.GetAllFeatures(); + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feat = feats[j]; + feat.HighLight = false; + } + } + + if (globeControl1.Globe.Action == EnumAction3D.SelectObject) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + } + /// + /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX8_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + comboBoxEx2.Enabled = false; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + listBox2.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 碰撞分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX6_Click(object sender, EventArgs e) + { + if (dataGridViewX5.Rows.Count > 0) + { + ExportExcel("碰撞分析", dataGridViewX5, listBox2); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 碰撞分析 功能界面中 关闭按钮 事件处理 + /// + /// + /// + private void buttonX7_Click_1(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel2.Visible = false; + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + if (buttonItem1.Checked) + sideBar1.ExpandedPanel = sideBarPanelItem3; + else + sideBar1.Visible = false; + Refresh(); + } + /// + /// 覆土分析 功能界面中的 清除分析结果 按钮事件处理 + /// + /// + /// + private void buttonX16_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX5.Checked = false; + checkBoxX6.Checked = false; + comboBoxEx3.SelectedIndex = -1; + comboBoxEx3.Enabled = false; + textBoxX3.Text = "1"; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 开始分析按钮 分析绘制的七线和管线的距离是否符合标准 + /// + /// + /// + private void buttonStartAnalysis_Click(object sender, EventArgs e) + { + if (!checkBoxSelectPipeline.Checked && !checkBoxSelectLayer.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxVerticalDistance.Text.Trim() == "") + { + MessageBox.Show("垂直净距标准不能为空!", "提示"); + return; + } + if (textBoxHorizontalDistance.Text.Trim() == "") + { + MessageBox.Show("水平净距标准不能为空!", "提示"); + return; + } + double dVerticalJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxVerticalDistance.Text.Trim(), out dVerticalJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的垂直净距标准!", "提示"); + return; + } + double dHorizontalJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxHorizontalDistance.Text.Trim(), out dHorizontalJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的水平净距标准!", "提示"); + return; + } + + if (dataGridViewLineList.Rows.Count > 0) + { + featCount.Clear(); + featLenth.Clear(); + listBoxStasticsResult.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewAnalysisResult.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxSelectPipeline.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewLineList.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewLineList.Rows[i].Tag as GSOFeature; + if (selectedFeature != null) + { + selectState = 1; +// VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析 + } + } + } + else if (checkBoxSelectLayer.Checked) // 选择图层 + { + if (comboBoxLayer.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); + if (layer == null) + { + return; + } + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) + { + return; + } + + GSOFeatures feats = flayer.GetAllFeatures(); + if (feats == null) + { + return; + } + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; +// VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析 + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewAnalysisResult.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合间距分析标准的管线!", "提示"); + } + } + else + { + MessageBox.Show("请选中要进行间距分析的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + /// + /// 间距分析 清除分析结果 + /// + /// + /// + private void buttonClearAnalysisResult_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxSelectLayer.Checked = false; + checkBoxSelectPipeline.Checked = false; + comboBoxLayer.SelectedIndex = -1; + comboBoxLayer.Enabled = false; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + listBoxStasticsResult.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 导出Excel按钮 将间距分析的结果以Excel表格的形式导出 + /// + /// + /// + private void buttonExportExcel_Click(object sender, EventArgs e) + { + if (dataGridViewAnalysisResult.Rows.Count > 0) + { + ExportExcel("间距分析", dataGridViewAnalysisResult, listBoxStasticsResult); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 间距分析 关闭按钮 + /// + /// + /// + private void buttonClosePanel_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panelSpacingAnalysis.Visible = false; + checkBoxSelectPipeline.Checked = false; + checkBoxSelectLayer.Checked = false; + comboBoxLayer.SelectedIndex = -1; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + + sideBar1.Visible = false; + Refresh(); + } + /// + /// 间距分析 分析结果表格双击定位 + /// + /// + /// + private void dataGridViewAnalysisResult_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) + { + if (e.Button == MouseButtons.Left && e.RowIndex > -1) + { + GSOFeature rowFeature = dataGridViewAnalysisResult.Rows[e.RowIndex].Tag as GSOFeature; + if (rowFeature != null) + { + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); + } + else + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + } + /// + /// 间距分析 选择管线复选框 + /// + /// + /// + private void checkBoxSelectPipeline_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + if (checkBoxSelectPipeline.Checked) + { + comboBoxLayer.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxLayer.Enabled = false; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + trackflag = "spacing"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxLayer.Enabled = true; + } + } + /// + /// 间距分析 选择图层复选框 + /// + /// + /// + private void checkBoxSelectLayer_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + comboBoxLayer.Enabled = checkBoxSelectLayer.Checked; + if (checkBoxSelectLayer.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + + comboBoxLayer.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 选择图层下拉框 + /// + /// + /// + private void comboBoxLayer_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxLayer.SelectedIndex > -1) + { + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + listBoxStasticsResult.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) + return; + GSOFeatures feats = flayer.GetAllFeatures(); + if (feats == null) + return; + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewLineList.Rows.Add(); + dataGridViewLineList.Rows[idx].Cells[0].Value = comboBoxLayer.SelectedItem.ToString(); + dataGridViewLineList.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + } + /// + /// 碰撞分析 + /// + /// + /// + private void buttonItemFX1_1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "碰撞分析"); + + dataGridViewX4.Size = new Size(195, 120); + dataGridViewX5.Size = new Size(195, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞分析"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 覆土分析 + /// + /// + /// + private void buttonItemFX1_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "覆土分析"); + dataGridViewX6.Size = new Size(195, 120); + dataGridViewX7.Size = new Size(195, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土分析"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 间距分析 + /// + /// + /// + private void buttonItemFX1_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "间距分析"); + + dataGridViewLineList.Size = new Size(185, 120); + dataGridViewAnalysisResult.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "间距分析"; + trackflag = "spacing"; + controlContainerItem5.Control = panelSpacingAnalysis; + panelSpacingAnalysis.Dock = DockStyle.Fill; + panelSpacingAnalysis.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + + Refresh(); + } + /// + /// 垂直净距分析 + /// + /// + /// + private void buttonItemFX1_4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "垂直净距分析"); + dataGridViewX2.Size = new Size(185, 92); + dataGridViewX3.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距分析"; + trackflag = "vertical"; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距分析 + /// + /// + /// + private void buttonItemFX1_5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平净距分析"); + dataGridViewX8.Size = new Size(185, 120); + dataGridViewX9.Size = new Size(185, 120); + + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距分析"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH1.Text); + + dataGridViewX4.Size = new Size(185, 92); + dataGridViewX5.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH2.Text); + + dataGridViewX6.Size = new Size(185, 92); + dataGridViewX7.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH3.Text); + + dataGridViewX8.Size = new Size(190, 92); + dataGridViewX9.Size = new Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH4.Text); + + dataGridViewX2.Visible = true; + dataGridViewX3.Visible = true; + dataGridViewX2.Size = new Size(185, 92); + dataGridViewX3.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + string extension = Path.GetExtension(strDataPath); + if (extension != null && extension.ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, ""); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain == null) return objRes; + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + newlayername = terrain.Caption; + } + else if (extension != null && extension.ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer == null) return objRes; + 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; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + { + MessageBox.Show("layer is null"); + return objRes; + } + 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; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer == null) return; + CheckDatasetGeoReference(layer.Dataset, ""); + + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + + if (layerManagerNode.Nodes.Contains(node)) return; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button != MouseButtons.Right||e.Node.Parent==null) return; + if (e.Node.Parent.Text.Equals("标注管理") ) + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (!(e.Node.Tag is GSOFeature)||e.Node.Parent.Parent==null) return; + if (e.Node.Parent.Parent.Text.Equals("标注管理")) + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + if (node == null) return; + TreeNode parentNode = node.Parent; + + if (parentNode.Text.Equals("标注管理") || parentNode.Text.Equals("传感器管理")) + { + RefreshTreeNodeLayerFeatureList(node); + } + } + + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + if (node == null) return; + GSOFeature feature3D = node.Tag as GSOFeature; + if (feature3D == null) return; + feature3D.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + //wxl优化标注管理树形结构 + TreeUtils.TreeNodeCheckedChange(globeControl1,e.Node); + } + } + + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l == null) return; + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + //定时检查传感器的状态 待完善 + public Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + 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); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem128.Text); + if (boolfrmShResult) + {//关闭等待窗口,否则会一直存在下去 + MessageBox.Show("正在审核或关闭上次审核结果才能进行审核"); + return; + } + boolfrmShResult = true; + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree);//layerManagerNode + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(Width - frmWait.Width - 10, Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(doWork); + thread.IsBackground = true; + thread.Start(); + } + } + + void doWork() + { + FrmShResult frmShResult; + if (frmSh.rukuLayer != null) + { + try + { + this.Invoke((EventHandler)delegate + { + TreeUtils.AddNodeToManagerNode(layerManagerNode, frmSh.rukuLayer); + }); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + frmShResult = new FrmShResult(shlayername, globeControl1, Utility.m_PipelineLayerNames); + frmShResult.Location = new Point(Width - frmShResult.Width - 10, Height - frmShResult.Height - 50); + frmShResult.Owner = this; + frmShResult.analysis(); + + try + { + this.Invoke((EventHandler)delegate + { + frmShResult.Show(); + returnShTap(); + }); + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } +// boolfrmShResult = true; + } + + void returnShTap() + { + frmWait.Close(); + ribbonTabItem11.Checked = true; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify) return; + frmModify.Owner = this; + frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (!redSH) + { + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex < 0) return; + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex < 0) return; + string layerName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string redLineName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, layerName, redLineName); + frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20); + frm.Show(this); + from = frm; + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void 空间查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "空间查询"); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void 关键字查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "关键字查询"); + + FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 编号查询 + /// + /// + /// + private void 编号查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "编号查询"); + + FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 坐标查询 + /// + /// + /// + private void 坐标查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "坐标查询"); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void 附属物查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物查询"); + + FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1); + } + /// + /// 管径查询 + /// + /// + /// + private void 管径查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径查询"); + + FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 材质查询 + /// + /// + /// + private void 材质查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质查询"); + + FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 基本查询 + /// + /// + /// + private void 基本查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "基本查询"); + + FrmBasicQuery.ShowForm(globeControl1, InitDataGridViewX1); + } + /// + /// 复合查询 + /// + /// + /// + private void 复合查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "复合查询"); + + FrmQuerySQL.ShowForm(globeControl1, InitDataGridViewX1); + } + /// + /// 关联查询 + /// + /// + /// + private void 关联查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "关联查询"); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames, + Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance); + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "清除分析"); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + 高度量算ToolStripMenuItem1.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl2.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(globeControl1); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + MarkTools.removeAllMarker(globeControl1);//清除所有标注 + #region wxl 这段不清楚什么用处,注释掉,对系统没有影响 + + // if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + // { + // for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + // { + // layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + // } + // } + #endregion + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void 管线长度统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void 管线长度统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void 阀门数量统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, InitDataGridViewX1); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void 阀门数量统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void 井盖数量统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, InitDataGridViewX1); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void 井盖数量统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void 管径分段统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void 管径分段统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void 埋深分段统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void 埋深分段统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void 管径分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void 管径分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void 材质分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void 材质分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void 附属物分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void 附属物分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1); + } + #region Predaotr,断面分析 + /// + /// 横断面分析 + /// + /// + /// + private void 横断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } + /// + /// 纵断面分析 + /// + /// + /// + private void 纵断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 1) + { + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature; + GSOLayer layer; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + selectFeatures.Add(feature); + } + } + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats == null || feats.Count < 1) return; + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); + } + /// + /// 道路断面分析 + /// + /// + /// + private void 道路断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; + } + /// + /// 基线剖面分析 + /// + /// + /// + private void 基线剖面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + #endregion + /// + /// 创建拓扑 + /// + /// + /// + private void 创建拓扑ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建拓扑"); + + FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames); + frm.Show(this); + } + #region Predator :拓扑分析 + /// + /// 上游分析 + /// + /// + /// + private void 上游分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "上游分析"); + NetworkTraceUpDown(true); + } + /// + /// 下游分析 + /// + /// + /// + private void 下游分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "下游分析"); + NetworkTraceUpDown(false); + } + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// + /// 流向分析 + /// + /// + /// + private void 流向分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "流向分析"); + + FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 关阀分析 + /// + /// + /// + private void 关阀分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 1) + { + MessageBox.Show("请选中至少一根管线!!"); + 流向分析ToolStripMenuItem.Checked = false; + return; + } + GSOLayer resLayer = null; + GSOFeature resFeature = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + + String pipeLayerName = resLayer.Caption; + String pipeLayerNamePrefix = pipeLayerName.Substring(0, pipeLayerName.IndexOf("管线")); + GSOLayer valveLayer = globeControl1.Globe.Layers[pipeLayerNamePrefix + "阀门"]; + if (valveLayer == null) + { + MessageBox.Show("无" + pipeLayerNamePrefix + "阀门图层", "提示"); + return; + } + + GSOFeatures valveFeats = NetworkAnalysisTool.CloseValvesAnalysis(resFeature, + resLayer, valveLayer); + + if (valveFeats != null) + { + FrmCloseValves frm = new FrmCloseValves(globeControl1, valveFeats); + frm.Show(this); + } + else + { + MessageBox.Show("未找到关闭阀门"); + } + } + /// + /// 连通分析 + /// + /// + /// + private void 连通分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 2) + { + MessageBox.Show("请选中至少两个管线!!"); + 连通分析ToolStripMenuItem.Checked = false; + return; + } + GSOFeature selFeat0, selFeat1; + GSOLayer layer0, layer1; + globeControl1.Globe.GetSelectObject(0, out selFeat0, out layer0); + globeControl1.Globe.GetSelectObject(1, out selFeat1, out layer1); + + if (!layer0.IsSameInnerObject(layer1)) + { + MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + 连通分析ToolStripMenuItem.Checked = false; + return; + } + NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); + } + /// + /// 爆管分析 + /// + /// + /// + private void 爆管分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + NetworkTraceUpDown(true); //上游追踪: + + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.ExplodeAnalysis(globeControl1, selLineFeature, selLayer); + + 关阀分析ToolStripMenuItem_Click(sender, e); //关阀分析: + } + #endregion + /// + /// 多边形开挖 + /// + /// + /// + private void 多边形开挖ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "多边形开挖"); + + trackflag = "pit"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; //是这个么?是的,在模型上 + } + /// + /// 挖方量分析 + /// + /// + /// + private void 挖方量分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "挖方量分析"); + + trackflag = "digFillAnalysis"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + ActionToolMenuChecked(); + } + /// + /// 沿线开挖 + /// + /// + /// + private void 沿线开挖ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "沿线开挖"); + + if (!沿线开挖ToolStripMenuItem.Checked) + { + FrmDigPitSetting dlg = new FrmDigPitSetting(m_dDigPitValue, m_bDigPitByDepth, m_dDigPitWidthAlongLine); + if (dlg.ShowDialog() == DialogResult.OK) + { + m_dDigPitValue = dlg.m_dDigPitValue; + m_bDigPitByDepth = dlg.m_bDigPitByDepth; + m_dDigPitWidthAlongLine = dlg.m_dDigPitWidthAlongLine; + trackflag = "LineDigPit"; + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + 沿线开挖ToolStripMenuItem.Checked = true; + } + } + else + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + 沿线开挖ToolStripMenuItem.Checked = false; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; + } + ActionToolMenuChecked(); + } + /// + /// 创建隧道 + /// + /// + /// + private void 创建隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "创建隧道"); + + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else + { + globeControl1.Globe.DestLayerFeatureAdd = tunnel; + tunnel.Editable = true; + enumDesignMode = EnumDesignMode.AddTunnel; + + } + } + /// + /// 隐藏隧道 + /// + /// + /// + private void 隐藏隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "隐藏隧道"); + + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (layer != null) + { + layer.Visible = !layer.Visible; + } + } + /// + /// 删除隧道 + /// + /// + /// + private void 删除隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "删除隧道"); + + if (globeControl1.Globe.SelObjectCount > 0) + { + int tunnelCount = 0; + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature f = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out f, out layer); + if (f == null || f.Dataset.Caption != "隧道") continue; + tunnelCount++; + f.Delete(); + if (layer != null) + { + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + } + globeControl1.Refresh(); + } + if (tunnelCount == 0) + { + MessageBox.Show("请选中要删除的隧道!", "提示"); + } + } + else + { + MessageBox.Show("请选中要删除的隧道!", "提示"); + } + } + /// + /// 通视分析 + /// + /// + /// + private void 通视分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "通视分析"); + + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; + } + /// + /// 可视域分析 + /// + /// + /// + private void 可视域分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "可视域分析"); + + globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; + } + /// + /// 可视包络分析 + /// + /// + /// + private void 可视包络分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "可视包络分析"); + + globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; + } + /// + /// 缓冲区分析 + /// + /// + /// + private void 缓冲区分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "缓冲区分析"); + + GSOFeature feat = globeControl1.Globe.SelectedObject; + if (feat == null) + { + MessageBox.Show("请选择要分析的要素!"); + return; + } + if (feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line1 = feat.Geometry as GSOGeoPolyline3D; + if (line1 == null) + { + MessageBox.Show("请选择一条管线!"); + return; + } + + FrmBufferAnalysis frm = new FrmBufferAnalysis(globeControl1, line1, layerTemp); + frm.Show(this); + } + else + { + FrmBufferAnalysisBSQ frm = new FrmBufferAnalysisBSQ(globeControl1, layerTemp, bsqPT); + frm.Show(this); + } + + } + /// + /// 附属物分析 + /// + /// + /// + private void 附属物分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分析"); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + FrmAccessoryAnalysis dlg = new FrmAccessoryAnalysis(globeControl1, layerTemp); + dlg.Show(this); + } + /// + /// 无源淹没分析 + /// + /// + /// + private void 无源淹没分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "无源淹没分析"); + + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + trackflag = "FloodAnalysis"; + } + /// + /// 水平距离 + /// + /// + /// + private void 水平距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平距离"); + + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + 高度量算ToolStripMenuItem1.Checked = false; + } + /// + /// 垂直距离 + /// + /// + /// + private void 垂直距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "垂直距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureHeight; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + } + /// + /// 空间距离 + /// + /// + /// + private void 空间距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "空间距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = true; + } + /// + /// 地表距离 + /// + /// + /// + private void 地表距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "地表距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + } + /// + /// 高度量算 + /// + /// + /// + private void 高度量算ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "高度量算"); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + 高度量算ToolStripMenuItem1.Checked = !高度量算ToolStripMenuItem1.Checked; + if (!高度量算ToolStripMenuItem1.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + /// + /// 水平面积 + /// + /// + /// + private void 水平面积ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平面积"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureArea; + globeControl1.Globe.AreaRuler.SpaceMeasure = true; + } + /// + /// 地表面积 + /// + /// + /// + private void 地表面积ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "地表面积"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureArea; + globeControl1.Globe.AreaRuler.SpaceMeasure = false; + + } + + # region Fan 重构标注代码 + /// + /// 标高标注 + /// + /// + /// + private void 标高标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Altitude, ""); + } + /// + /// 管径标注 + /// +// GSOFeature radiusMarkerFeature; + private void 管径标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) //wxl增加为空判断,下面方法同理 + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Diameter, ""); + } + /// + /// 埋深标注 + /// + /// + /// + private void 埋深标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null||selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Depth, ""); + + } + /// + /// 坐标标注 + /// + /// + /// + private void 坐标标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Location, ""); + } + /// + /// 距离标注 + /// +// bool distanceMarker; + private void 距离标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, 距离标注ToolStripMenuItem.Text); + + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + } + /// + /// 自定义标注 + /// + /// + /// + private void 自定义标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmCustomLabel frm = new FrmCustomLabel(globeControl1, l, f); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Custom, frm.labelText); + } + } + /// + /// 扯旗标注 + /// + /// + /// + private void 扯旗标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmMarker frm = new FrmMarker(); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Flag, frm.markerContent); + } + } + /// + /// 坡度标注 + /// + /// + /// + private void 坡度标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Slope, ""); + } + /// + /// 属性标注 + /// + /// + /// + private void 属性标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmPropertiesMarker frm = new FrmPropertiesMarker(globeControl1, l, f); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Property, frm.labelText); + } + } + /// + /// 标注管理 + /// + /// + /// + private void 标注管理ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, 标注管理ToolStripMenuItem.Text); + + 标注管理ToolStripMenuItem.Checked = !标注管理ToolStripMenuItem.Checked; + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + if (标注管理ToolStripMenuItem.Checked) + { + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "标注管理"; + panel2.Visible = false; + panel1.Visible = false; + panel4.Visible = false; + panel5.Visible = false; + controlContainerItem5.Control = panel3; + panel3.Dock = DockStyle.Fill; + panel3.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + else + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel3.Visible = false; + + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + } + + #endregion + /// + /// 飞行到目标点 + /// + /// + /// + private void 飞行到目标点ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "飞行到目标点"); + + FrmSetFlytoPos.ShowForm(globeControl1); + } + /// + /// 自定义飞行 + /// + /// + /// + private void 自定义飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "自定义飞行"); + + GSOGeoPolyline3D line = null; + GSOFeature f = globeControl1.Globe.SelectedObject; + if (f != null) + { + line = f.Geometry as GSOGeoPolyline3D; + } + + if (line == null) + { + MessageBox.Show("请先选中一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + globeControl1.Globe.Action = EnumAction3D.SelectObject; + return; + } + FrmFlySetDlg dlg = new FrmFlySetDlg(); + dlg.dFlyAboveLine = m_dFlyAboveLine; + dlg.dFlyAloneLineSpeed = m_dFlyAlongLineSpeed; + dlg.dFlyAloneLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + if (dlg.ShowDialog() == DialogResult.OK) + { + m_dFlyAboveLine = dlg.dFlyAboveLine; + m_dFlyAlongLineSpeed = dlg.dFlyAloneLineSpeed; + m_dFlyAlongLineRotateSpeed = dlg.dFlyAloneLineRotateSpeed; + globeControl1.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl1.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl1.Globe.FlyEyeAlongWithLine(line, m_dFlyAboveLine, 85, true, 0, false); + } + } + /// + /// 绕中心点飞行 + /// + /// + /// + private void 绕中心点飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绕中心点飞行"); + + globeControl1.Globe.FlyAroundCenter(10000, EnumFlyRepeatValueType.MiliSeconds); + globeControl1.Globe.CurFlyID = 1; + } + /// + /// 绕眼睛飞行 + /// + /// + /// + private void 绕眼睛飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绕眼睛飞行"); + + globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); + globeControl1.Globe.CurFlyID = 2; + } + /// + /// 权限管理 + /// + /// + /// + private void buttonItemXT1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT1.Text); + + FrmUserRoleMgr frm = new FrmUserRoleMgr(); + frm.ShowDialog(); + } + /// + /// 数据库管理 + /// + /// + /// + private void buttonItemXT2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT2.Text); + + //查看数据库列表 + FrmDbManager frm = new FrmDbManager(); + frm.ShowDialog(); + } + /// + /// 用户列表 + /// + /// + /// + private void buttonItemXT3_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT3_1.Text); + + FrmUserManager frm = new FrmUserManager(); + frm.ShowDialog(); + } + /// + /// 创建新用户 + /// + /// + /// + private void buttonItemXT3_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT3_2.Text); + + FrmUserAdd frm = new FrmUserAdd(-1); + frm.ShowDialog(); + } + /// + /// 人员修改 + /// + /// + /// + private void buttonItemXT4_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT4_2.Text); + + FrmAppUSER appUser = new FrmAppUSER(); + appUser.ShowDialog(); + } + /// + /// 增加人员 + /// + /// + /// + private void buttonItemXT4_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT4_1.Text); + + FrmAppUSERRESET appUserReset = new FrmAppUSERRESET(); + appUserReset.ShowDialog(); + } + /// + /// 热点功能统计 + /// + /// + /// + private void buttonItemZTT2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT2.Text); + + FrmHotFuncStat frmhfs = new FrmHotFuncStat(); + frmhfs.ShowDialog(); + } + + private void buttonItemZTT3_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_1.Text); + + FrmAPP appfrm = new FrmAPP("专题图申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT3_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("专题图审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT3_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("专题图审核"); + appregion.ShowDialog(); + } + + private void buttonItemZTT4_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_1.Text); + + FrmAPP appfrm = new FrmAPP("打印申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT4_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("打印审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT4_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("打印审核"); + appregion.ShowDialog(); + } + + private void buttonItemZTT5_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_1.Text); + + FrmAPP appfrm = new FrmAPP("拷贝申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT5_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("拷贝审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT5_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("拷贝审核"); + appregion.Show(); + } + private void buttonItemSPSZ_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSPSZ.Text); + + FrmLayerControl frm = new FrmLayerControl(globeControl1, globeControl2); + frm.Show(this); + } + /// + /// 综合规划区域审查 + /// + /// + /// + private void buttonItemSH5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH5.Text); + FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 数据质量检查 + /// + /// + /// + private void buttonItemSJGL2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL2.Text); + FrmValiData frm = new FrmValiData(globeControl1); + frm.ShowDialog(); + + /* + ValidateInfo validateInfo = ValidateConfig.LoadConfig(); + String ss = ""; + */ + } + /// + /// 数据预处理 + /// + /// + /// + private void buttonItemSJGL3_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL3.Text); + + FrmEditShapeFile frm = new FrmEditShapeFile(globeControl1); + frm.ShowDialog(this); + } + /// + /// 连接数据库 + /// + /// + /// + private void buttonItemSJGL4_1_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_1.Text); + + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 管线入库 + /// + /// + /// + private void buttonItemSJGL4_2_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_2.Text); + + if (ds == null) + { + MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + ConnectDB(null, null); + } + if (ds == null) + return; + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + /// + /// 附属物入库 + /// + /// + /// + private void buttonItemSJGL4_3_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_3.Text); + + if (ds == null) + { + MessageBox.Show("请先连接数据库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + + ConnectDB(null, null); + } + if (ds == null) + return; + FrmAddWellShp frm = new FrmAddWellShp(globeControl1, ds); + + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + /// + /// 坐标转换 + /// + /// + /// + private void buttonItemSJGL5_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL5.Text); + + FrmProject frm = new FrmProject(); + frm.ShowDialog(); + } + /// + /// 元数据基本管理 + /// + /// + /// + private void buttonItemSJGL6_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL6_1.Text); + + FrmMetadata frmmd = new FrmMetadata(); + frmmd.ShowDialog(); + } + /// + /// 元数据查询管理 + /// + /// + /// + private void buttonItemSJGL6_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL6_2.Text); + + FrmMetadataStat frmmds = new FrmMetadataStat(); + frmmds.ShowDialog(); + } + /// + /// 操作日志管理 + /// + /// + /// + private void buttonItemSJGL7_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL7.Text); + + FrmLogOper frmlo = new FrmLogOper(); + frmlo.ShowDialog(); + } + /// + /// 数据字典管理 + /// + /// + /// + private void buttonItemSJGL8_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL8.Text); + + FrmMDDictory frmmdd = new FrmMDDictory(); + frmmdd.ShowDialog(); + } + /// + /// 数据库备份 + /// + /// + /// + private void buttonItemSJGL9_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL9.Text); + + //新 + FrmBACKORACLE backOracle = new FrmBACKORACLE(); + backOracle.Show(); + } + #region 模拟规划:Fan + /// + /// 创建管段 + /// + /// + /// + private void buttonItemBJ1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建管段"); + + frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames); + if (frm.ShowDialog() == DialogResult.OK) + { + enumDesignMode = EnumDesignMode.AddPipe; + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + } + } + /// + /// 创建附属物 + /// + /// + /// + private void buttonItemBJ2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建附属物"); + + FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物"); + if (frm.ShowDialog() == DialogResult.OK) + { + GSOLayer featureAddLayer = TreeNodeFeatureLayer(); + if (featureAddLayer == null) return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); + } + } + /// + /// 创建特征管点 + /// + /// + /// + private void buttonItemBJ3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建特征管点"); + + FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点"); + if (frm.ShowDialog() == DialogResult.OK) + { + GSOLayer featureAddLayer = TreeNodeFeatureLayer(); + if (featureAddLayer == null) return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); + } + } + /// + /// 绘制城市七线 + /// + /// + /// + + private void buttonItemBJ4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绘制城市七线"); + + FrmCitySevenLineType frm = new FrmCitySevenLineType(); + if (frm.ShowDialog() == DialogResult.OK) + { + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + enumDesignMode = EnumDesignMode.AddCitySevenLine; + + CitySevenLine citySevenLine = new CitySevenLine(frm.citySevenLineName, + frm.citySevenLineType); + globeControl1.Tag = citySevenLine; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); + if (layer == null) return; + globeControl1.Globe.DestLayerFeatureAdd = layer; + layer.Editable = true; + } + } + #endregion + /// + /// 选中对象 + /// + /// + /// + private void buttonItemBJ5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "选中对象"); + + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + /// + /// 平移对象 + /// + /// + /// + private void 平移对象ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "平移对象"); + + globeControl1.Globe.Action = EnumAction3D.MoveObject; + } + /// + /// 升降对象 + /// + /// + /// + private void 升降对象ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "升降对象"); + + globeControl1.Globe.Action = EnumAction3D.ElevateObject; + } + /// + /// 旋转对象 + /// + /// + /// + private void 旋转对象ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "旋转对象"); + + globeControl1.Globe.Action = EnumAction3D.RotateObject; + } + /// + /// 连接管段 + /// + /// + /// + private void 连接管段ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "连接管段"); + + if (globeControl1.Globe.SelObjectCount < 2) + { + MessageBox.Show("对不起,请至少选中2个对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + globeControl1.Globe.InsertJointPipeline(false); + } + /// + /// 后退 + /// + /// + /// + private void 后退ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "后退"); + globeControl1.Globe.UnDoEdit(); + } + /// + /// 前进 + /// + /// + /// + private void 前进ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "前进"); + + globeControl1.Globe.ReDoEdit(); + } + /// + /// 导出CAD + /// + /// + /// + private void 导出CADToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "导出CAD"); + + #region 导出成dxf格式 + List listVectorNames = new List(); + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通" + || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通" + || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号" + || Utility.m_PipelineLayerNames[i] == "供电") + { + continue; + } + if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i])) + { + listVectorNames.Add(Utility.m_PipelineLayerNames[i]); + } + } + for (int i = 0; i < Utility.valueLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.valueLayerNames[i])) + { + listVectorNames.Add(Utility.valueLayerNames[i]); + } + } + for (int i = 0; i < Utility.workwellLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.workwellLayerNames[i])) + { + listVectorNames.Add(Utility.workwellLayerNames[i]); + } + } + for (int i = 0; i < Utility.instrumenLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.instrumenLayerNames[i])) + { + listVectorNames.Add(Utility.instrumenLayerNames[i]); + } + } + for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i])) + { + listVectorNames.Add(Utility.pipefittingLayerNames[i]); + } + } + + FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames); + frm.ShowDialog(); + #endregion + } + /// + /// 导出矢量 + /// + /// + /// + private void 导出文件ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "导出矢量"); + + List listVectorNames = new List(); + foreach (string pipeline in Utility.m_PipelineLayerNames) + { + if (!listVectorNames.Contains(pipeline)) + { + listVectorNames.Add(pipeline); + } + } + foreach (string valve in Utility.valueLayerNames) + { + if (!listVectorNames.Contains(valve)) + { + listVectorNames.Add(valve); + } + } + foreach (string workwell in Utility.workwellLayerNames) + { + if (!listVectorNames.Contains(workwell)) + { + listVectorNames.Add(workwell); + } + } + foreach (string instrument in Utility.instrumenLayerNames) + { + if (!listVectorNames.Contains(instrument)) + { + listVectorNames.Add(instrument); + } + } + foreach (string pipefitting in Utility.pipefittingLayerNames) + { + if (!listVectorNames.Contains(pipefitting)) + { + listVectorNames.Add(pipefitting); + } + } + FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames); + frm.ShowDialog(); + } + + /// + /// 删除模型 + /// + /// + /// + private void buttonItemBJ13_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "删除模型"); + var selObjCount = globeControl1.Globe.SelObjectCount; + if (selObjCount == 0) + { + MessageBox.Show("请选中要删除的模型!", "提示"); + return; + } + int delSuccessCount = 0; + for (int i = 0; i < selObjCount; i++) + { + GSOFeature f; + GSOLayer layer; + globeControl1.Globe.GetSelectObject(i, out f, out layer); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + bool result = FeatureTools.DeleteFeature(f); + if (result) delSuccessCount++; + globeControl1.Refresh(); + + + } + + MessageBox.Show("成功删除"+delSuccessCount+"个模型!", "提示"); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + + /// 红线审核 + /// + /// + /// + private void buttonItemHX2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemHX2.Text); + RedLineAnalysisTool.redLineResultList.Clear(); + + GSOFeatures selectFeatures = new GSOFeatures(); + GSOLayer layer = null; + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + selectFeatures.Add(feature); + } + try + { + RedLineAnalysisTool.redLineResultList = + RedLineAnalysisTool.Anaylysis(selectFeatures, Utility.m_PipelineLayerNames, globeControl1); + + if (RedLineAnalysisTool.redLineResultList == null || RedLineAnalysisTool.redLineResultList.Count != 0) + addRedLineDataToDataGridView(RedLineAnalysisTool.redLineResultList, dataGridViewX1); + else + { + MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + } + } + catch (Exception ex) + { + redSH = false; + LogHelper.WriteLog(typeof(MainFrm), ex); + } + } + void addRedLineDataToDataGridView(List dt, DataGridView dataGridView) + { + DataTable table=new DataTable(); + table.Columns.Add("红线编号"); + table.Columns.Add("管线类型"); + table.Columns.Add("侵占面积/m³"); + table.Columns.Add("侵入长度/m"); + table.Columns.Add("侵入管线长度"); + table.Columns.Add("侵入附属物个数"); + + for (int i = 0; i < dt.Count; i++) + { + DataRow row = table.NewRow(); + row[0] = dt[i].RedLineName; + row[1] = dt[i].LayerName; + row[2] = dt[i].MinArea.ToString("0.00"); + row[3] = dt[i].Length.ToString("0.00"); + row[4] = dt[i].LineFeaturesInRedLine == null ? 0 : dt[i].LineFeaturesInRedLine.Length; + row[5] = dt[i].PointFeaturesInRedLine == null ? 0 : dt[i].PointFeaturesInRedLine.Length; + table.Rows.Add(row); + } + + dataGridView.DataSource = table; + redSH = true; + panelOfTable.Visible = true; + panelOfTable.Height = 200; + toolStripNumbers.Text = "红线审核 |共有:" + dataGridView.Rows.Count + "条"; + toolStripDropDownButton3.Visible = true; + } + + /// + /// 主窗体 下方的工具条中的 导出.xls文件 按钮事件处理 + /// + /// + /// + private void toolStripDropDownButton3_Click(object sender, EventArgs e) + { + if (dataGridViewX1.Rows.Count == 0) + { + MessageBox.Show("表格内容为空!", "提示"); + return; + } + string strSaveFile; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcelWithManySheet(dataGridViewX1, strSaveFile, "红线审核"); + MessageBox.Show("导出成功!"); + + } + + /// + /// 双屏对比的地面透明度设置 + /// + /// + /// + private void sliderItem2_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem2.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + { + layer.Opaque = 100 - sliderItem2.Value; + } + layer = globeControl2.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + { + layer.Opaque = 100 - sliderItem2.Value; + } + globeControl2.Globe.GroundOpaque = 100 - sliderItem2.Value; + + optiValue = sliderItem2.Value; + } + /// + /// 数据管理导入文件 + /// + /// + /// + private void buttonItemSJGL1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL1.Text); + + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) + { + try + { + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } + } + } + /// + /// 导入红线(完善) + /// + /// + /// + private void buttonItemHX1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemHX1.Text); + + GSODataSource dataSpace = globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + string filepath = ""; + //日志记录 + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "矢量数据(*.shp)|*.shp|矢量数据(*.lgd)|*.lgd|CAD数据(*.dxf)|*.dxf|全部支持格式(*.lgd,*.shp,*.dxf)|*.lgd;*.shp;*.dxf;"; + dlg.Multiselect = true; + + #region 临时图层显示 + if (dlg.ShowDialog() == DialogResult.OK) + { + #region + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + string strDataPath = dlg.FileNames[i]; + + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + if (layer == null) + {//wxl + LogHelper.WriteLog(typeof(MainFrm), "buttonItemHX1_Click操作中," + strDataPath + "的layer为空"); + continue; + } + GSOFeatures redFeatures = layer.GetAllFeatures(); + redlinelayername = layer.Caption; + layerRedRegion = layer; +// CheckDatasetGeoReference(layer.Dataset, strDataPath); + bool checkresult = CheckDatasetGeoReference(layer.Dataset, strDataPath); + if (!checkresult) continue;//wxl 没通过检查,跳过此次循环 + 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(); + //wxlwhy 为何不直接用之前的layer? + //放大到红线 +// GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(redlinelayername); +// GSOLayer lyr = layer; + GSOSimpleLineStyle3D redlinestyle = new GSOSimpleLineStyle3D(); + redlinestyle.LineColor = Color.Red; + redlinestyle.LineWidth = 5; + layer.Style = redlinestyle; + + if (redlinelayername != "") + { +// GSOFeatures features = lyr.GetAllFeatures(); +// redFeatures = features; + GSORect2d rd = layer.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; + + GSOLayer roadlayer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + if (roadlayer != null) + { + roadlayer.Opaque = 100 - sliderGroundTransSet1.Value; + } + + /////////////////////////////////////////////////////////////////////////////////////////// + globeControl1.Globe.Layers.MoveTo(0, globeControl1.Globe.Layers.Count - 1); + globeControl1.Refresh(); + } + + IModelBuilder modelBuilder = new RedLineBuilder(); + + modelBuilder.batchInsert(dataSpace, redDt, redFeatures); + + } + + #endregion + + } + #endregion + } + /// + /// 定位 + /// + /// + /// + private void buttonItemLocation_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemLocation.Text); + + FrmFlyToPosition fly = new FrmFlyToPosition(globeControl1, globeControl2); + fly.Show(this); + } + /// + /// 红线审核 + /// + /// + /// + private void ribbonTabItem6_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); + globeControl1.Globe.FlyToPointSpeed = 10000000; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + globeControl1.Refresh(); + + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + + //zhanshi = false; + redSH = true; + splitContainer1.Panel2Collapsed = true; + legendSG.Visible = false; + legendSC.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = true; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 基础工具 + /// + /// + /// + private void ribbonTabItem1_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 一键审核 + /// + /// + /// + private void ribbonTabItem11_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /// + /// 双屏对比 + /// + /// + /// + private void ribbonTabItem9_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent += globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent += globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + + splitContainer1.Panel2Collapsed = false; + //zhanshi = true; + redSH = false; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + sliderItem2.Value = 100 - globeControl1.Globe.GroundOpaque; + globeControl2.Globe.GroundOpaque = globeControl1.Globe.GroundOpaque; + legendSC.Visible = true; + legendSG.Visible = true; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 文档管理 + /// + /// + /// + private void ribbonTabItem4_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 基础管理 + /// + /// + /// + private void ribbonTabItem14_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 权限管理 + /// + /// + /// + private void ribbonTabItem2_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + //GSOFeature dpFeatuer = null; + /// + /// 双屏分析,点击管段分析 + /// + /// + /// + private void buttonItem8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem8.Text); + + int width = Width; + FrmCompareFeature.ShowForm(globeControl1, globeControl2, width); + } + /// + /// 红线审核导出图片 + /// + /// + /// + private void buttonItemDCTP_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemDCTP.Text); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 标识器全区域统计 + /// + /// + /// + private void 标识器分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); + bsqStatis.Show(this); + } + /// + /// 标识器绘制区域统计 + /// + /// + /// + private void 标识器分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + trackflag = "BSQDuoBianXiangStatis"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + } + + private void btn_check_history_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_check_history.Text); + + if (FrmCheckHistory.isOpen) + return; + FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); + frm.addNode += addNodeToLayerManagerNode; + frm.Show(); + } + + private void buttonItem查看数据_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem查看数据.Text); + + FrmThreeOracle tr = new FrmThreeOracle(globeControl1); + + if (tr.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(tr.rukuLayer); + globeControl1.Refresh(); + } + } + /// + /// 规划数据入库 + /// + /// + /// + private void buttonItemGHRK_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemGHRK.Text); + + FrmGHRK ghrk = new FrmGHRK(globeControl1, layerManagerNode); + ghrk.Show(this); + } + + private void btn_user_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_user_info.Text); + + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); + } + + private void btn_role_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_role_info.Text); + + if (!FrmRoleInfoManager.IS_OPEN) + { + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); + } + } + + private void btn_resc_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_resc_info.Text); + + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); + } + + private void btn_role_resc_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_role_resc.Text); + + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); + } + + private void btn_user_role_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_user_role.Text); + + if (!FrmUserRole.IS_OPEN) + { + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); + } + } + + //文档管理 操作 + private void btn_document_info_Click(object sender, EventArgs e) + { + + LogManager.saveLog(Utility.userName, btn_document_info.Text); + if (FormDocumentManager.IS_OPEN) return; + Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += changeCursorToDefault; + frm.ShowDialog(); + } + + private void changeCursorToDefault() + { + Cursor = Cursors.Default; + } + + private void buttonItemexp_CAD_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemexp_CAD.Text); + + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "支持格式(*.dwg)|*.dwg"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) + { + foreach (string strDataPath in dlg.FileNames) + { + AddLayerData(strDataPath); + } + } + + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } + } + + private void btn_password_edit_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_password_edit.Text); + + if (!FrmChangePassword.IS_OPEN) + { + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); + } + } + + private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) + { + MessageBox.Show("请在左侧节点集中选择要导出的图层", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); + if (layer != null && layer.GetAllFeatures().Length > 0) + { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; + dlg.FileName = layer.Caption; + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) + { + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) + { + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; + } + newlayer.AddFeature(feature); + } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void buttonItemGBJC_Click(object sender, EventArgs e) + { + FrmGBJC gb = new FrmGBJC(globeControl1, globeControl2); + gb.Show(this); + } + + #region 右屏管纵数据控制 + private void 五十米主干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = true; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 三十六米次干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = true; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 四十二米次干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = true; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 二十四米一块板ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = true; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 二十四米三块板ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = true; + } + + private void 二十四米停车带ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = true; + lendendGZ24_3.Visible = false; + } + + private void 二十六米大堤路ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = true; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 清除管纵数据ToolStripMenuItem_Click(object sender, EventArgs e) + { + ClearGZData(); + } + + private void ClearGZData() + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + #endregion + + private void buttonItemPasswordReset_Click(object sender, EventArgs e) + { + Frm_password_reset reset = new Frm_password_reset(); + reset.Show(); + } + + private void pictureBox1_Paint(object sender, PaintEventArgs e) + { + string welcomeUser = "欢迎您:" + Utility.userName; + e.Graphics.DrawString(welcomeUser, new Font("宋体", 12), new SolidBrush(Color.Black), Width - 180, 50); + } + + } +} \ No newline at end of file diff --git a/ClassSearchAnalysis.cs b/ClassSearchAnalysis.cs index 62efc7d..cb8b06d 100644 --- a/ClassSearchAnalysis.cs +++ b/ClassSearchAnalysis.cs @@ -25,12 +25,12 @@ string sql = ""; if (filedObject == "") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " like '%" + filedValue + "%'"; } @@ -54,13 +54,13 @@ string sql = ""; if (mathT == "区间") { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + ">" + leftFiledValue + "and "+filedObject+"<" + rightFiledValue; } else { - sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + mathT + rightFiledValue; } dt = OledbHelper.QueryTable(sql); @@ -91,7 +91,7 @@ public static void ResultDataTableContainNull(out DataTable dt,GSOGlobeControl m_globeControl, string layerName,string filedObject,List filedValueList) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + filedObject + " = '"; for (int i = 0; i < filedValueList.Count; i++) @@ -133,7 +133,7 @@ /// public static void ResultDataTable(out DataTable dt,GSOGlobeControl m_globeControl, string layerName, string whereSql) { - string sql = "select " + getpipeLineFields.getFields(layerName, m_globeControl) + string sql = "select " + GetpipeLineFields.GetFields(layerName, m_globeControl) + " from " + layerName + " where " + whereSql; dt = OledbHelper.QueryTable(sql); diff --git a/Cyberpipe.suo b/Cyberpipe.suo index 3927161..7dd508a 100644 --- a/Cyberpipe.suo +++ b/Cyberpipe.suo Binary files differ diff --git a/FeatureTools.cs b/FeatureTools.cs index 95f2339..be4b469 100644 --- a/FeatureTools.cs +++ b/FeatureTools.cs @@ -74,5 +74,37 @@ return result; } + public static string GetFieldValueByName(GSOFeature feature, string fieldName) + { + if (fieldName.Equals("图片编码")) + { + return null; + } + if (fieldName.Equals("模型路径")) + { + return null; + } + GSOFieldDefn field = feature.GetFieldDefn(fieldName); + string value = ""; + if (field.Type == EnumFieldType.Text) + { + value = feature.GetFieldAsString(fieldName); + } + else if (field.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(fieldName)); + value = dd.Year <= 1 ? "" : dd.ToShortDateString(); + } + else if (field.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(fieldName); + value = dl1.ToString("0.00"); + } + else if (!feature.IsFieldValueNull(fieldName)) + { + value = feature.GetValue(fieldName).ToString(); + } + return value; + } } } diff --git a/FrmAllWorkWellStatis.cs b/FrmAllWorkWellStatis.cs index 6928b7a..9798f59 100644 --- a/FrmAllWorkWellStatis.cs +++ b/FrmAllWorkWellStatis.cs @@ -100,7 +100,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) diff --git a/FrmValveStatistics.cs b/FrmValveStatistics.cs index 37d7d0d..f4770a9 100644 --- a/FrmValveStatistics.cs +++ b/FrmValveStatistics.cs @@ -107,7 +107,7 @@ return; } - sql = "select " + getpipeLineFields.getFields(layername, globeControl1) + " from " + layer.Name; + sql = "select " + GetpipeLineFields.GetFields(layername, globeControl1) + " from " + layer.Name; sql += " where 1>2 "; for (int i = 0; i < fs.Length; i++) { diff --git a/MainFrm.cs b/MainFrm.cs index 75a271a..1c30092 100644 --- a/MainFrm.cs +++ b/MainFrm.cs @@ -1161,7 +1161,6 @@ globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 // globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 //初始化TreeView - //初始化TreeView initLayerTree(); } @@ -2339,8 +2338,6 @@ var code = feature.GetFieldAsString("编码"); var title = FeatureTools.GetFeatureTypeByCode(code); str += "" + title + " " + feature.GetFieldAsString(featureIDFieldName) + ""; - - int rowCount = feature.GetFieldCount(); string layerName = feature.Dataset.Name; string queryFields = ""; if (Utility.Query_Fields.ContainsKey(layerName)) @@ -2350,135 +2347,36 @@ else { layerName = feature.Dataset.Caption; - queryFields = getpipeLineFields.get_Fields(layerName, globeControl); + queryFields = GetpipeLineFields.GetFieldsForBubble(layerName, globeControl); } if (queryFields != null) { string[] param = { "," }; string[] fieldNames = queryFields.Split(param, StringSplitOptions.RemoveEmptyEntries); - for (int j = 0; j < fieldNames.Length; j++) + for (int j = 0; j < fieldNames.Length; ) { - string fieldName = fieldNames[j].Trim(); - GSOFieldDefn field1 = feature.GetFieldDefn(fieldName); - - string name1 = ""; - string value1 = ""; - if (field1 != null) + int count = 0; + string tmpStr = ""; + while (count<2&&j
" + + fieldNames[j] + + "
" + + value + + "
"; + count ++; } - if (j < rowCount) - { - field1 = feature.GetFieldDefn(j); - name1 = field1.Name; - if (name1 == "模型路径") - { - continue; - } - if (field1.Type == EnumFieldType.Text) - { - value1 = feature.GetFieldAsString(j); - } - else if (field1.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j)); - if (dd.Year <= 1) - { - value1 = ""; - } - else - { - value1 = dd.ToShortDateString(); - } - } - else if (field1.Type == EnumFieldType.Double) - { - double dl1 = feature.GetFieldAsDouble(j); - if (!name1.Contains("管径") && !name1.Contains("电压") && !name1.Contains("角度")) - { - name1 += "_米"; - } - value1 = dl1.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j)) - { - value1 = feature.GetValue(j).ToString(); - } - } - } - } - string name2 = ""; - string value2 = ""; - if (j + 1 < rowCount) - { - GSOFieldDefn field2 = feature.GetFieldDefn(j + 1); - - if (field2 != null) - { - if (field2.Name == "图片编码") - { - j++; - } - if (j + 1 < rowCount) - { - field2 = feature.GetFieldDefn(j + 1); - name2 = field2.Name; - - if (name2 == "模型路径") - { - continue; - } - - if (field2.Type == EnumFieldType.Text) - { - value2 = feature.GetFieldAsString(j + 1); - } - else if (field2.Type == EnumFieldType.Date) - { - DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j + 1)); - - if (dd.Year <= 1) - { - value2 = ""; - } - else - { - value2 = dd.ToShortDateString(); - } - } - else if (field2.Type == EnumFieldType.Double) - { - double dl2 = feature.GetFieldAsDouble(j + 1); - if (!name2.Contains("管径") && !name2.Contains("电压") && !name2.Contains("角度")) - { - name2 += "_米"; - } - value2 = dl2.ToString("0.00"); - } - else - { - if (!feature.IsFieldValueNull(j + 1)) - { - value2 = feature.GetValue(j + 1).ToString(); - } - } - } - } - j++; } - str += "
" + - name1 + - "
" + - value1 + - "
" + - name2 + - "
" + - value2 + "
"; + if (count == 1) + {//不够两行 + tmpStr += ""; + } + tmpStr += ""; + if (tmpStr.Contains(" + /// + /// + public MainFrm() + { + InitializeComponent(); + + PipeSys.Attach(panelEx5.Controls); + globeControl1 = PipeSys.getGlobeCtrl(); + globeControl1.Dock = DockStyle.Fill; + ribbonControl1.Width = Width; + + panelEx4.Controls.Add(splitContainer1); + splitContainer1.Dock = DockStyle.Fill; + + panelEx4.Controls.Add(expandableSplitter2); + expandableSplitter2.Dock = DockStyle.Bottom; + expandableSplitter2.Expanded = false; + panelEx4.Controls.Add(panelOfTable); + panelOfTable.Dock = DockStyle.Bottom; + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + controlContainerItem3.Visible = true; + controlContainerItem3.Control = layerTree; + layerTree.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem3; + sideBar1.Refresh(); + Refresh(); + + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Height = Screen.PrimaryScreen.WorkingArea.Height - 120; + sideBarPanelItem4.Visible = false; + panel5.Visible = false; + panelEx3.Visible = false; + panelSpacingAnalysis.Visible = false; + + panel2.Height = Screen.PrimaryScreen.WorkingArea.Height - 120; + featureTooltip = new GSOBalloon(globeControl1.Handle); + balloonEx = new GSOBalloonEx(globeControl1.Handle); + Utility.SetBallons(featureTooltip, balloonEx); + + PipeSys.Attach(panelEx1.Controls); + globeControl2 = PipeSys.getGlobeCtrl(); + globeControl2.Dock = DockStyle.Fill; + + featureTooltip2 = new GSOBalloon(globeControl2.Handle); + balloonEx2 = new GSOBalloonEx(globeControl2.Handle); + Utility.SetBallons(featureTooltip, balloonEx); + + panelOfTable.Height = 200; + + RigthMenuSet(); + + MenuSet(); + + } + + /// + /// 右屏中添加管纵图片 + /// + private void AddGZ() + { + + lendendGZ50 = new GSOHudButton(); + lendendGZ50.SetImage(Application.StartupPath + "/Resource/管纵/50.png"); + lendendGZ50.SetOffset(0, 0); + lendendGZ50.MinOpaque = 1; + lendendGZ50.MaxOpaque = 1; + lendendGZ50.FadeOut = false; + lendendGZ50.Name = "lendendGZ50"; + lendendGZ50.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ50); + lendendGZ50.Visible = false; + + lendendGZ36 = new GSOHudButton(); + lendendGZ36.SetImage(Application.StartupPath + "/Resource/管纵/36.png"); + lendendGZ36.SetOffset(0, 0); + lendendGZ36.MinOpaque = 1; + lendendGZ36.MaxOpaque = 1; + lendendGZ36.FadeOut = false; + lendendGZ36.Name = "lendendGZ36"; + lendendGZ36.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ36); + lendendGZ36.Visible = false; + + lendendGZ42 = new GSOHudButton(); + lendendGZ42.SetImage(Application.StartupPath + "/Resource/管纵/42.png"); + lendendGZ42.SetOffset(0, 0); + lendendGZ42.MinOpaque = 1; + lendendGZ42.MaxOpaque = 1; + lendendGZ42.FadeOut = false; + lendendGZ42.Name = "lendendGZ42"; + lendendGZ42.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ42); + lendendGZ42.Visible = false; + + lendendGZ24_1 = new GSOHudButton(); + lendendGZ24_1.SetImage(Application.StartupPath + "/Resource/管纵/24_1.png"); + lendendGZ24_1.SetOffset(0, 0); + lendendGZ24_1.MinOpaque = 1; + lendendGZ24_1.MaxOpaque = 1; + lendendGZ24_1.FadeOut = false; + lendendGZ24_1.Name = "lendendGZ24_1"; + lendendGZ24_1.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_1); + lendendGZ24_1.Visible = false; + + lendendGZ24_2 = new GSOHudButton(); + lendendGZ24_2.SetImage(Application.StartupPath + "/Resource/管纵/24_2.png"); + lendendGZ24_2.SetOffset(0, 0); + lendendGZ24_2.MinOpaque = 1; + lendendGZ24_2.MaxOpaque = 1; + lendendGZ24_2.FadeOut = false; + lendendGZ24_2.Name = "lendendGZ24_2"; + lendendGZ24_2.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_2); + lendendGZ24_2.Visible = false; + + lendendGZ24_3 = new GSOHudButton(); + lendendGZ24_3.SetImage(Application.StartupPath + "/Resource/管纵/24_3.png"); + lendendGZ24_3.SetOffset(0, 0); + lendendGZ24_3.MinOpaque = 1; + lendendGZ24_3.MaxOpaque = 1; + lendendGZ24_3.FadeOut = false; + lendendGZ24_3.Name = "lendendGZ24_3"; + lendendGZ24_3.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ24_3); + lendendGZ24_3.Visible = false; + + lendendGZ26 = new GSOHudButton(); + lendendGZ26.SetImage(Application.StartupPath + "/Resource/管纵/26.png"); + lendendGZ26.SetOffset(0, 0); + lendendGZ26.MinOpaque = 1; + lendendGZ26.MaxOpaque = 1; + lendendGZ26.FadeOut = false; + lendendGZ26.Name = "lendendGZ26"; + lendendGZ26.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(lendendGZ26); + lendendGZ26.Visible = false; + + } + + public void RigthMenuSet() + { + if (Utility.userRole.IndexOf("清除分析") < 0) + { + toolRightMenu.Items.Remove(清除分析ToolStripMenuItem); + } + + #region 区域分析 + + if (Utility.userRole.IndexOf("区域分析") < 0) + { + toolRightMenu.Items.Remove(区域分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("缓冲区分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(缓冲区分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("附属物分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(附属物分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("无源淹没分析") < 0) + { + 区域分析ToolStripMenuItem.DropDownItems.Remove(无源淹没分析ToolStripMenuItem); + } + } + + #endregion + + #region 视域分析 + + if (Utility.userRole.IndexOf("视域分析") < 0) + { + toolRightMenu.Items.Remove(视域分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("通视分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(通视分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("可视域分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(可视域分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("可视包络分析") < 0) + { + 视域分析ToolStripMenuItem.DropDownItems.Remove(可视包络分析ToolStripMenuItem); + } + } + + #endregion + + #region 开发分析 + + if (Utility.userRole.IndexOf("开挖分析") < 0) + { + toolRightMenu.Items.Remove(开挖分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("多边形开挖") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(多边形开挖ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("挖方量分析") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(挖方量分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("沿线开挖") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(沿线开挖ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("创建隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(创建隧道ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("隐藏隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(隐藏隧道ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("删除隧道") < 0) + { + 开挖分析ToolStripMenuItem.DropDownItems.Remove(删除隧道ToolStripMenuItem); + } + } + + #endregion + + #region 拓扑分析 + + if (Utility.userRole.IndexOf("拓扑分析") < 0) + { + toolRightMenu.Items.Remove(拓扑分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("创建拓扑") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(创建拓扑ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("上游分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(上游分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("下游分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(下游分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("流向分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(流向分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关阀分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(关阀分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("连通分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(连通分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("爆管分析") < 0) + { + 拓扑分析ToolStripMenuItem.DropDownItems.Remove(爆管分析ToolStripMenuItem); + } + } + + #endregion + + #region 断面分析 + + if (Utility.userRole.IndexOf("断面分析") < 0) + { + toolRightMenu.Items.Remove(断面分析ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("横断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(横断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("纵断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(纵断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("道路断面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(道路断面分析ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("基线剖面分析") < 0) + { + 断面分析ToolStripMenuItem.DropDownItems.Remove(基线剖面分析ToolStripMenuItem); + } + } + + #endregion + + #region 绘制区域统计 + + if (Utility.userRole.IndexOf("绘制区域统计") < 0) + { + toolRightMenu.Items.Remove(绘制区域统计ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("绘制区域管线长度统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管线长度统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域阀门数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(阀门数量统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域井盖数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(井盖数量统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域管径分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分段统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域埋深分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(埋深分段统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域管径分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域材质分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(材质分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域附属物分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(附属物分类统计ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("绘制区域标识器分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(标识器分类统计ToolStripMenuItem1); + } + + } + + #endregion + + #region 全区域统计 + + if (Utility.userRole.IndexOf("全区域统计") < 0) + { + toolRightMenu.Items.Remove(全区域统计ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("全区域管线长度统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管线长度统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域阀门数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(阀门数量统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域井盖数量统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(井盖数量统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域管径分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分段统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域埋深分段统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(埋深分段统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域管径分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(管径分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域材质分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(材质分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域附属物分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(附属物分类统计ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("全区域标识器分类统计") < 0) + { + 绘制区域统计ToolStripMenuItem.DropDownItems.Remove(标识器分类统计ToolStripMenuItem); + } + + } + + #endregion + + #region 查询 + + if (Utility.userRole.IndexOf("查询") < 0) + { + toolRightMenu.Items.Remove(查询ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("空间查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(空间查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("编号查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(编号查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坐标查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(坐标查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("管径查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(管径查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("材质查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(材质查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("基本查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(基本查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("复合查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(复合查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关联查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(关联查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("关键字查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(关键字查询ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("附属物查询") < 0) + { + 查询ToolStripMenuItem.DropDownItems.Remove(附属物查询ToolStripMenuItem); + } + } + + #endregion + + #region 标注 + + if (Utility.userRole.IndexOf("标注") < 0) + { + toolRightMenu.Items.Remove(标注ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("标高标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(标高标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("管径标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(管径标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("埋深标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(埋深标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坐标标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(坐标标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("距离标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(距离标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("自定义标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(自定义标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("扯旗标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(扯旗标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("坡度标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(坡度标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("属性标注") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(属性标注ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("标注管理") < 0) + { + 标注ToolStripMenuItem.DropDownItems.Remove(标注管理ToolStripMenuItem); + } + } + + #endregion + + #region 飞行 + + if (Utility.userRole.IndexOf("飞行") < 0) + { + toolRightMenu.Items.Remove(飞行ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("自定义飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(自定义飞行ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("飞行到目标点") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(飞行到目标点ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("绕中心点飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(绕中心点飞行ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("绕眼睛飞行") < 0) + { + 飞行ToolStripMenuItem.DropDownItems.Remove(绕眼睛飞行ToolStripMenuItem); + } + } + + #endregion + + #region 编辑 + + if (Utility.userRole.IndexOf("编辑") < 0) + { + toolRightMenu.Items.Remove(编辑ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("平移对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(平移对象ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("升降对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(升降对象ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("旋转对象") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(旋转对象ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("连接管段") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(连接管段ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("导出文件") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(导出文件ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("前进") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(前进ToolStripMenuItem); + } + if (Utility.userRole.IndexOf("后退") < 0) + { + 编辑ToolStripMenuItem.DropDownItems.Remove(后退ToolStripMenuItem); + } + } + + #endregion + + #region 量算 + + if (Utility.userRole.IndexOf("量算") < 0) + { + toolRightMenu.Items.Remove(量算ToolStripMenuItem); + } + else + { + if (Utility.userRole.IndexOf("水平距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(水平距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("垂直距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(垂直距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("空间距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(空间距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("地表距离") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(地表距离ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("高度量算") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(高度量算ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("水平面积") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(水平面积ToolStripMenuItem1); + } + if (Utility.userRole.IndexOf("地表面积") < 0) + { + 量算ToolStripMenuItem.DropDownItems.Remove(地表面积ToolStripMenuItem1); + } + } + + #endregion + } + + public void MenuSet() + { + + #region 权限管理 + + if (Utility.userRole.IndexOf("权限管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem2); + } + else + { + + if (Utility.userRole.IndexOf("用户管理") < 0) + { + btn_user_info.Visible = false; + } + if (Utility.userRole.IndexOf("角色管理") < 0) + { + btn_role_info.Visible = false; + } + if (Utility.userRole.IndexOf("资源管理") < 0) + { + btn_resc_info.Visible = false; + } + if (Utility.userRole.IndexOf("角色授权") < 0) + { + btn_role_resc.Visible = false; + } + if (Utility.userRole.IndexOf("用户授权") < 0) + { + btn_user_role.Visible = false; + } + if (Utility.userRole.IndexOf("密码修改") < 0) + { + btn_password_edit.Visible = false; + } + + } + + #endregion + + #region 基础工具 + + if (Utility.userRole.IndexOf("基础工具") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem1); + } + else + { + if (Utility.userRole.IndexOf("地上模式") < 0) + { + buttonItem87.Visible = false; + } + if (Utility.userRole.IndexOf("地下模式") < 0) + { + buttonItem88.Visible = false; + } + if (Utility.userRole.IndexOf("行走模式") < 0) + { + buttonItem27.Visible = false; + } + if (Utility.userRole.IndexOf("透明度设置") < 0) + { + sliderGroundTransSet1.Visible = false; + } + if (Utility.userRole.IndexOf("快速定位") < 0) + { + buttonItem91.Visible = false; + } + if (Utility.userRole.IndexOf("图层管理") < 0) + { + buttonItem1.Visible = false; + } + if (Utility.userRole.IndexOf("图例管理") < 0) + { + btnlegendSet.Visible = false; + } + if (Utility.userRole.IndexOf("全屏显示") < 0) + { + buttonItem89.Visible = false; + } + if (Utility.userRole.IndexOf("导出图片") < 0) + { + btnOutputJPG.Visible = false; + } + + } + + #endregion + + #region 一键审核 + + if (Utility.userRole.IndexOf("一键审核") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem11); + } + + #endregion + + #region 红线审核 + + if (Utility.userRole.IndexOf("红线审核") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem6); + } + + #endregion + + #region 双屏对比 + + if (Utility.userRole.IndexOf("双屏对比") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem9); + } + + #endregion + + #region 文档管理 + + if (Utility.userRole.IndexOf("文档管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem4); + } + + #endregion + + #region 基础管理 + + if (Utility.userRole.IndexOf("基础管理") < 0) + { + ribbonControl1.Items.Remove(ribbonTabItem14); + } + else + { + if (Utility.userRole.IndexOf("专题图审批") < 0) + { + buttonItemZTT3_2.Visible = false; + } + if (Utility.userRole.IndexOf("打印审批") < 0) + { + buttonItemZTT4_2.Visible = false; + } + if (Utility.userRole.IndexOf("拷贝审批") < 0) + { + buttonItemZTT5_2.Visible = false; + } + } + + #endregion + + if (ribbonControl1.Items.Count <= 0) + { + ribbonControl1.Visible = false; + } + } + + #region Fan Zhang 重构现有代码 + + //初始化控件布局 + private void initLayout() + { + int SW = Screen.PrimaryScreen.Bounds.Width; + double dsw = SW; + if (SW > 1440) + { + double myScreen = dsw/1440; + buttonX1.Width = (int) (buttonX1.Width*myScreen); + buttonX2.Width = (int) (buttonX2.Width*myScreen); + buttonX4.Width = (int) (buttonX4.Width*myScreen); + buttonX5.Width = (int) (buttonX5.Width*myScreen); + buttonX6.Width = (int) (buttonX6.Width*myScreen); + buttonX7.Width = (int) (buttonX8.Width*myScreen); + buttonX8.Width = (int) (buttonX8.Width*myScreen); + buttonX9.Width = (int) (buttonX9.Width*myScreen); + buttonX12.Width = (int) (buttonX12.Width*myScreen); + buttonX14.Width = (int) (buttonX14.Width*myScreen); + buttonX15.Width = (int) (buttonX15.Width*myScreen); + buttonX16.Width = (int) (buttonX16.Width*myScreen); + buttonX17.Width = (int) (buttonX17.Width*myScreen); + + labelX1.Width = (int) (labelX1.Width*myScreen); + labelX2.Width = (int) (labelX2.Width*myScreen); + labelX3.Width = (int) (labelX3.Width*myScreen); + labelX6.Width = (int) (labelX6.Width*myScreen); + labelX8.Width = (int) (labelX8.Width*myScreen); + labelX9.Width = (int) (labelX9.Width*myScreen); + labelX12.Width = (int) (labelX12.Width*myScreen); + labelX13.Width = (int) (labelX13.Width*myScreen); + labelX14.Width = (int) (labelX14.Width*myScreen); + labelX16.Width = (int) (labelX16.Width*myScreen); + labelX17.Width = (int) (labelX17.Width*myScreen); + labelX11.Width = (int) (labelX11.Width*myScreen); + labelX19.Width = (int) (labelX19.Width*myScreen); + labelX21.Width = (int) (labelX21.Width*myScreen); + labelX22.Width = (int) (labelX22.Width*myScreen); + labelX24.Width = (int) (labelX24.Width*myScreen); + } + sideBar1.Visible = false; + sideBar1.ExpandedPanel = sideBarPanelItem3; + + comboBoxEx1.Items.Clear(); + comboBoxEx2.Items.Clear(); + comboBoxEx3.Items.Clear(); + comboBoxEx4.Items.Clear(); + comboBoxLayer.Items.Clear(); + foreach (string t1 in Utility.m_PipelineLayerNames) + { + comboBoxEx1.Items.Add(t1); + comboBoxEx2.Items.Add(t1); + comboBoxEx3.Items.Add(t1); + comboBoxEx4.Items.Add(t1); + comboBoxLayer.Items.Add(t1); + } + + splitContainer1.Panel2Collapsed = true; + + buttonItem87.Checked = true; //默认地上模式 + ribbonTabItem1.Select(); //初始化状态为浏览 + + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + if (sideBarPanelItem4.Visible) + { + sideBar1.Visible = true; + controlContainerItem5.Visible = true; + } + else + { + sideBar1.Visible = false; + } + Refresh(); + sliderGroundTransSet1.Value = optiValue; + sliderItem1.Value = optiValue; + sliderItem2.Value = optiValue; + sliderItem3.Value = optiValue; + + } + + //初始化地球控件 + private void initGlobalControl() + { + //选择 + btnToolSelect = new GSOHudButton(); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + btnToolSelect.FadeOut = false; + btnToolSelect.Align = EnumAlign.TopLeft; + btnToolSelect.SetOffset(20, 50); + btnToolSelect.Name = "1"; + btnToolSelect.HeightFixed = true; + btnToolSelect.WidthFixed = true; + globeControl1.Globe.AddHudControl(btnToolSelect); + globeControl2.Globe.AddHudControl(btnToolSelect); + + //浏览 + btnToolNone = new GSOHudButton(); + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolNone.FadeOut = false; + btnToolNone.Align = EnumAlign.TopLeft; + btnToolNone.SetOffset(20, 15); + btnToolNone.Name = "0"; + btnToolNone.HeightFixed = true; + btnToolNone.WidthFixed = true; + globeControl1.Globe.AddHudControl(btnToolNone); + globeControl2.Globe.AddHudControl(btnToolNone); + + //图例 + legend = new GSOHudButton(); + legend.SetImage(Application.StartupPath + "/Resource/图例P.jpg"); //图例P + legend.SetOffset(0, 15); + legend.MinOpaque = 1; + legend.MaxOpaque = 1; + legend.FadeOut = false; + legend.Name = "legend"; + legend.Align = EnumAlign.BottomRight; + legend.Visible = false; + globeControl1.Globe.AddHudControl(legend); + + //实测 + legendSC = new GSOHudButton(); + legendSC.SetImage(Application.StartupPath + "/Resource/sc.jpg"); + legendSC.SetOffset(0, 15); + legendSC.MinOpaque = 1; + legendSC.MaxOpaque = 1; + legendSC.FadeOut = false; + legendSC.Name = "legendSC"; + legendSC.Align = EnumAlign.BottomRight; + globeControl1.Globe.AddHudControl(legendSC); + legendSC.Visible = false; + + //施工 + legendSG = new GSOHudButton(); + legendSG.SetImage(Application.StartupPath + "/Resource/sg.jpg"); + legendSG.SetOffset(0, 15); + legendSG.MinOpaque = 1; + legendSG.MaxOpaque = 1; + legendSG.FadeOut = false; + legendSG.Name = "legendSG"; + legendSG.Align = EnumAlign.BottomRight; + globeControl2.Globe.AddHudControl(legendSG); + legendSG.Visible = false; + + //管纵 + AddGZ(); + + globeControl1.Globe.UnderGroundFloor.Visible = false; + globeControl1.Globe.OverviewControl.Visible = false; + globeControl1.Globe.ScalerControl.Visible = false; + globeControl1.Globe.LatLonGrid.Visible = false; + globeControl1.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, false); + globeControl1.Globe.Antialiasing = true; + globeControl1.Globe.FeatureMouseOverEnable = true; + globeControl1.Globe.ModelUseLighting = true; + globeControl1.Globe.EditSnapObject = false; + globeControl1.Globe.MaxUserBackgroundAlt = 20000; + globeControl1.Globe.UserBackgroundColorValid = true; + globeControl1.Globe.UserBackgroundColor = Color.White; + globeControl1.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl1.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl1.Globe.FlyToPointSpeed = globeControl1.Globe.FlyToPointSpeed*3; + globeControl1.Globe.EditSnapObject = true; + globeControl1.Globe.IsReleaseMemOutOfView = true; + globeControl1.Globe.ControlPanel.Visible = true; + + globeControl2.Globe.UnderGroundFloor.Visible = false; + globeControl2.Globe.OverviewControl.Visible = false; + globeControl2.Globe.ScalerControl.Visible = false; + globeControl2.Globe.LatLonGrid.Visible = false; + globeControl2.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, false); + globeControl2.Globe.Antialiasing = true; + globeControl2.Globe.FeatureMouseOverEnable = true; + globeControl2.Globe.ModelUseLighting = true; + globeControl2.Globe.EditSnapObject = false; + globeControl2.Globe.MaxUserBackgroundAlt = 20000; + globeControl2.Globe.UserBackgroundColorValid = true; + globeControl2.Globe.UserBackgroundColor = Color.White; + globeControl2.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl2.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl2.Globe.FlyToPointSpeed = globeControl2.Globe.FlyToPointSpeed*3; + globeControl2.Globe.EditSnapObject = true; + globeControl2.Globe.IsReleaseMemOutOfView = true; + globeControl2.Globe.ControlPanel.Visible = false; + + GSOSimplePolygonStyle3D trackingRectStyle = + globeControl1.Globe.TrackRectTool.TrackingPolygonStyle as GSOSimplePolygonStyle3D; + trackingRectStyle.FillColor = Color.FromArgb(0, 0, 0, 0); + GSOSimplePolygonStyle3D trackRectStyle = + globeControl1.Globe.TrackRectTool.PolygonStyle as GSOSimplePolygonStyle3D; + trackRectStyle.FillColor = Color.FromArgb(0, 0, 0, 0); + GSOSimpleLineStyle3D trackRectLineStyle = + globeControl1.Globe.TrackRectTool.PolygonStyle.OutlineStyle as GSOSimpleLineStyle3D; + trackRectLineStyle.LineType = EnumLineType.Solid; + GSOSimpleLineStyle3D trackRectLineStyle1 = + globeControl1.Globe.TrackRectTool.TrackingPolygonStyle.OutlineStyle as GSOSimpleLineStyle3D; + trackRectLineStyle1.LineType = EnumLineType.Solid; + trackRectLineStyle1.LineColor = Color.FromArgb(0, 174, 255); + trackRectLineStyle1.LineWidth = 1; + + globeControl1.Globe.StatusBar.SetProject(Utility.projectStr); + globeControl1.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, true); + globeControl2.Globe.StatusBar.SetProject(Utility.projectStr); + globeControl2.Globe.StatusBar.SetTextVisible(EnumStatusBarText.ProCoord, true); + + //添加临时图层 + layerTemp = globeControl1.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData.lgd"); + layerTemp2 = globeControl2.Globe.Layers.Add(Application.StartupPath + "\\tempLgdData2.lgd"); + if (layerTemp != null) + { + layerTemp.MaxVisibleAltitude = 1000; + } + + //添加城市7线图层 + 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"); + + //注册对应事件 + registerEvent(); + } + + //注册地球事件 + private bool registerEvent() + { + if (globeControl1 == null || globeControl2 == null) + { + return false; + } + globeControl1.HudControlMouseDownEvent += globeControl1_HudControlMouseDownEvent; + globeControl2.HudControlMouseDownEvent += globeControl2_HudControlMouseDownEvent; + + globeControl1.HudControlMouseIntoEvent += globeControl1_HudControlMouseIntoEvent; + globeControl1.HudControlMouseOutEvent += globeControl1_HudControlMouseOutEvent; + + globeControl1.AfterNetLayerAddEvent += globeControl1_AfterNetLayerAddEvent; + + globeControl1.FeatureMouseClickEvent += globeControl1_FeatureMouseClickEvent; + globeControl1.FeatureMouseHoverEvent += globeControl1_FeatureMouseHoverEvent; + + globeControl2.FeatureMouseClickEvent += globeControl2_FeatureMouseClickEvent; + globeControl2.CameraBeginMoveEvent += globeControl2_CameraBeginMoveEvent; + + globeControl1.MouseDoubleClick += globeControl1_MouseDoubleClick; + globeControl1.MouseClick += globeControl1_MouseClick; + globeControl1.MouseDown += globeControl1_MouseDown; + + globeControl2.MouseClick += globeControl2_MouseClick; + globeControl2.MouseDown += globeControl2_MouseDown; + + globeControl1.MouseWheel += globeControl1_MouseWheel; + globeControl2.MouseWheel += globeControl2_MouseWheel; + + globeControl1.CameraBeginMoveEvent += globeControl1_CameraBeginMoveEvent; + + globeControl1.TrackPolylineEndEvent += globeControl1_TrackPolylineEndEvent; + globeControl1.TrackPolygonEndEvent += globeControl1_TrackPolygonEndEvent; + globeControl1.TrackRectEndEvent += globeControl1_TrackRectEndEvent; + + return true; + } + + //加载两个地球数据 + private void loadData() + { + Thread t1 = new Thread(doLoadDataForGlobalControl); + t1.IsBackground = true; + t1.Start(); + } + + //delegate void LoadDataForGlobalControl(); + + private void connectServer() + { +<<<<<<< HEAD + globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 +// globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + //初始化TreeView +======= + globeControl1.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + globeControl2.Globe.ConnectServer(Utility.serverip, Utility.serverport, "", ""); //加载locaServer中的数据 + //初始化TreeView + +>>>>>>> 5ad8bb289f47939f129a26356a54dc1053a8848a + initLayerTree(); + + } + /// + /// 加载地球1、2的图层 + /// + private void doLoadDataForGlobalControl() + { + try + { + globeControl1.Globe.Layers.MoveDown(10000); + //加载实测管线数据 + Utility.dataSource = + globeControl1.Globe.DataManager.OpenOracleDataSource( + Utility.DBServer.Trim() + "/" + Utility.dbdatabase.Trim(), "", "", Utility.userID, + Utility.DBPassword); + + if (Utility.dataSource != null) + { + for (int j = 0; j < Utility.dataSource.DatasetCount; j++) + { + GSODataset dataset = Utility.dataSource.GetDatasetAt(j); + if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + } + } + } + //隐藏红线图层 + globeControl1.Globe.Layers.GetLayerByCaption("红线").Visible = false; + + //globleControl1中加载规划数据 + GSODataSource ghDS = + globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.ghdbip + "/" + Utility.ghdbname, "", "", + Utility.ghdbuser, Utility.ghdbpwd); + if (ghDS != null) + { + for (int j = 0; j < ghDS.DatasetCount; j++) + { + GSODataset dataset = ghDS.GetDatasetAt(j); + if (dataset != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + globeControl1.Globe.Layers[0].Visible = false; + } + } + } + + //globeControl1,globeControl2中加载施工数据 + GSODataSource sgDS = + globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.sgdbip + "/" + Utility.sgdbname, "", "", + Utility.sgdbuser, Utility.sgdbpwd); + if (sgDS != null) + { + for (int m = 0; m < sgDS.DatasetCount; m++) + { + GSODataset dataset = sgDS.GetDatasetAt(m); + if (dataset != null && !dataset.Caption.Contains("SH") && + Utility.dictionaryNetLayerNameAndCaption.ContainsKey(dataset.Caption)) + { + dataset.Caption = dataset.Name; + globeControl1.Globe.Layers.Add(dataset); + globeControl1.Globe.Layers[0].Visible = false; + + globeControl2.Globe.Layers.Add(dataset); + globeControl2.Globe.Layers[0].Visible = true; + } + } + } + this.Invoke((EventHandler) delegate + { + connectServer(); + }); + + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + private void initLayerTree() + { + layerTree.Nodes.Clear(); + //加载临时图层节点 + layerManagerNode = new TreeNode(); + layerManagerNode.ImageIndex = 0; + layerManagerNode.SelectedImageIndex = 0; + layerManagerNode.Checked = true; + layerManagerNode.Text = "临时图层"; + layerManagerNode.Tag = layerTemp; + layerTree.Nodes.Add(layerManagerNode); + + TreeUtils.InitLayerTree(globeControl1, layerTree, null); + + } + + private void initMarkerTree() + { + TreeNode node = new TreeNode(); + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = true; + node.Text = "标注管理"; + layerMarkerTree.Nodes.Add(node); + 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")) continue; + GSOLayer markerLayer = + globeControl1.Globe.Layers.Add(Application.StartupPath + "\\标注管理\\" + markerStrs[i] + ".lgd"); + if (markerLayer == null) continue; + TreeNode node1 = new TreeNode(); + node1.Text = markerLayer.Caption; + node1.ImageIndex = 0; + node1.SelectedImageIndex = 0; + node1.Checked = markerLayer.Visible; + node1.Tag = markerLayer; + layerMarkerTree.Nodes[0].Nodes.Add(node1); + } + } + + private void MainFrm_Load(object sender, EventArgs e) + { + + layerTree.Nodes.Add("正在加载,请稍后……");//树状图加载在图层加载之后,故增加提示 + initGlobalControl(); + //initGlobalMap(); +// initLayerTree(); + initMarkerTree(); + initLayout(); + loadData(); + + + double x = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[0]); + double y = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[1]); + double z = Convert.ToDouble(Utility.Query_Roads["绿岛"].ToString().Split(',')[2]); + jumpToCameraState(x, y, z); + + } + + #endregion + + void globeControl1_AfterNetLayerAddEvent(object sender, AfterNetLayerAddEventArgs e) + { + if (e.Layer != null && Utility.dictionaryNetLayerNameAndCaption.ContainsKey(e.Layer.Caption)) + { + e.Layer.Caption = Utility.dictionaryNetLayerNameAndCaption[e.Layer.Caption]; + } + } + + void globeControl2_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) + { + switch (e.HudControl.Name) + { + case "0": + globeControl2.Globe.Action = EnumAction3D.ActionNull; + break; + case "1": + globeControl2.Globe.Action = EnumAction3D.SelectObject; + break; + } + } + + void globeControl2_BeforeSceneRenderEvent(object sender, BeforeSceneRenderEventArgs e) + { + if (globeControl2.Focused) + { + GSOCameraState camera = globeControl2.Globe.CameraState; + globeControl1.Globe.JumpToCameraState(camera); + } + } + + void globeControl1_BeforeSceneRenderEvent(object sender, BeforeSceneRenderEventArgs e) + { + if (globeControl1.Focused) + { + GSOCameraState camera = globeControl1.Globe.CameraState; + globeControl2.Globe.JumpToCameraState(camera); + } + } + + private void VisitFeature3Ds(GSOFeatures feature3ds, TreeNode node) + { + for (int i = 0; i < feature3ds.Length; i++) + { + GSOFeature feature = feature3ds[i]; + if (feature.Type == EnumFeatureType.FeatureFolder) + { + TreeNode tempnode = new TreeNode(); + tempnode.Text = feature.Name; + tempnode.ImageIndex = 1; + tempnode.SelectedImageIndex = 1; + tempnode.Checked = node.Checked && feature.Visible; + tempnode.Tag = feature; + node.Nodes.Add(tempnode); + GSOFeatureFolder featureFolder = (GSOFeatureFolder) feature; + VisitFeature3Ds(featureFolder.Features, tempnode); + } + else + { + TreeNode tempnode = new TreeNode {Text = feature.Name}; + if (feature.Geometry != null) + { + switch (feature.Geometry.Type) + { + case EnumGeometryType.GeoPoint3D: + case EnumGeometryType.GeoMarker: + tempnode.ImageIndex = 3; + tempnode.SelectedImageIndex = 3; + break; + case EnumGeometryType.GeoPolyline3D: + tempnode.ImageIndex = 4; + tempnode.SelectedImageIndex = 4; + break; + case EnumGeometryType.GeoPolygon3D: + tempnode.ImageIndex = 5; + tempnode.SelectedImageIndex = 5; + break; + case EnumGeometryType.GeoModel: + case EnumGeometryType.GeoEntity: + case EnumGeometryType.GeoGroupEntity: + case EnumGeometryType.GeoSphereEntity: + case EnumGeometryType.GeoBoxEntity: + case EnumGeometryType.GeoEllipsoidEntity: + case EnumGeometryType.GeoCylinderEntity: + case EnumGeometryType.GeoFrustumEntity: + case EnumGeometryType.GeoEllipCylinderEntity: + case EnumGeometryType.GeoEllipFrustumEntity: + case EnumGeometryType.GeoRangeEllipsoidEntity: + case EnumGeometryType.GeoRangeEllipCylinderEntity: + case EnumGeometryType.GeoRangeEllipFrustumEntity: + tempnode.ImageIndex = 6; + tempnode.SelectedImageIndex = 6; + break; + case EnumGeometryType.GeoGroundOverlay: + tempnode.ImageIndex = 7; + tempnode.SelectedImageIndex = 7; + break; + } + } + + tempnode.Checked = node.Checked && feature.Visible; + tempnode.Tag = feature; + node.Nodes.Add(tempnode); + } + } + } + + /// + /// 检查数据集是否有坐标系信息(待完善) + /// + /// + /// + Boolean CheckDatasetGeoReference(GSODataset dataset, string strDataPath) + { + if (dataset.GeoReferenceType != EnumGeoReferenceType.Flat) return true; + Boolean bSuccess = false; + if (MessageBox.Show("数据没有空间参考信息,请设置空间参考信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) != + DialogResult.OK) return bSuccess; + String strPath = Application.StartupPath + "\\Coordinate Systems"; + OpenFileDialog dlg = new OpenFileDialog(); + + dlg.InitialDirectory = strPath; + dlg.RestoreDirectory = true; + + dlg.Filter = "投影文件|*.prj||"; + if (dlg.ShowDialog() != DialogResult.OK) return bSuccess; + string lprjStr = GSODataEngineUtility.ConvertEsriPrjFileToProj4(dlg.FileName); + string lprjFileContent = "0prj4" + lprjStr + + ""; + + bSuccess = dataset.LoadProjectionFromESRIFile(dlg.FileName); + + string lprjFileName = strDataPath.Substring(0, strDataPath.LastIndexOf(".")) + ".lprj"; + StreamWriter writer = new StreamWriter(lprjFileName, false); + writer.Write(lprjFileContent); + writer.Close(); + + return bSuccess; + } + + /// + /// 矩形拉框结束事件处理函数 + /// + /// + /// + void globeControl1_TrackRectEndEvent(object sender, TrackRectEndEventArgs e) + { + if (e.Polygon == null) return; + globeControl1.Globe.TrackRectTool.Clear(); + globeControl1.ImmediatelyRefresh(); + globeControl1.SwapBuffer(); + Point pt1 = new Point(Convert.ToInt32(e.StartPos.X), Convert.ToInt32(e.StartPos.Y)); + Point pt2 = new Point(Convert.ToInt32(e.EndPos.X), Convert.ToInt32(e.EndPos.Y)); + + 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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName); //扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + globeControl1.Globe.Action = EnumAction3D.ActionNull; + globeControl1.Globe.MouseRoamingEnable = true; + } + + /// + /// 定位正北正90度俯视 + /// + /// + /// + /// + private void jumpToCameraState(double x, double y, double z) + { + GSOCameraState camera = new GSOCameraState(); + camera.Latitude = y; + camera.Longitude = x; + camera.Distance = z; + camera.Tilt = 0; + camera.Heading = 0; + globeControl1.Globe.JumpToCameraState(camera); + globeControl2.Globe.JumpToCameraState(camera); + } + + void globeControl1_HudControlMouseOutEvent(object sender, HudControlMouseOutEventArgs e) + { + if (tooltip1 != null) + { + tooltip1.RemoveAll(); + } + } + + void globeControl1_HudControlMouseIntoEvent(object sender, HudControlMouseIntoEventArgs e) + { + tooltip1 = new ToolTip(); + switch (e.HudControl.Name) + { + case "0": + tooltip1.SetToolTip(globeControl1, "浏览对象"); + break; + case "1": + tooltip1.SetToolTip(globeControl1, "选择对象"); + break; + } + } + + void globeControl1_HudControlMouseDownEvent(object sender, HudControlMouseDownEventArgs e) + { + switch (e.HudControl.Name) + { + case "0": + globeControl1.Globe.Action = EnumAction3D.ActionNull; //导航功能 + break; + case "1": + globeControl1.Globe.Action = EnumAction3D.SelectObject; //选中对象功能 + break; + } + } + + #region wxl 重构树形结构代码 + + private void layerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + TreeUtils.TreeNodeCheckedChange(globeControl1, e.Node); + } + } + + #endregion + private void layerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button != MouseButtons.Right) return; + layerTree.SelectedNode = e.Node; + if (e.Node.Tag == null || e.Node.Parent == null) return; //排除无图层节点和第一级节点 + + GSOLayer gsoLayer = e.Node.Tag as GSOLayer; + if (gsoLayer == null || gsoLayer.Caption.Equals(Utility.roadLayerName)) return; + if (e.Node.Parent.Text.Equals("临时图层") || e.Node.Parent.Text.Equals("我的地标")) + { + //临时图层下的子节点应该展示的 + contextMenuStripDeleteLayerNode.Show(layerTree, e.X, e.Y); + contextMenuStripDeleteLayerNode.Tag = e.Node; + } + else + { + LayerSelectableMenuItem.Visible = true; + LayerEditableMenuItem.Visible = true; + SaveLayerMenuItem.Visible = true; + LayerFlyMenuItem.Visible = true; + 导出CADToolStripMenuItem1.Visible = true; + layerNodeContexMenu.Show(layerTree, e.X, e.Y); + layerNodeContexMenu.Tag = e.Node; + LayerSelectableMenuItem.Checked = gsoLayer.Selectable; + LayerEditableMenuItem.Checked = gsoLayer.Editable; + } + + } + //wxl Tag更正 + /// + /// 删除临时添加的本地数据图层 + /// + /// + /// + private void 删除ToolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null || node.Parent == null) return; + if (node.Parent.Text.Trim() == "临时图层") + { + if (!(node.Tag is GSOLayer)) return; + GSOLayer layer = node.Tag as GSOLayer; + globeControl1.Globe.Layers.Remove(layer); + globeControl1.Globe.Refresh(); + node.Remove(); + }else if (node.Parent.Text.Trim() == "我的地标") + { + if (!(node.Tag is GSOFeature)) return; + GSOFeature f = node.Tag as GSOFeature; + f.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + + } + //wxl Tag更正 + private void 可编辑ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null || + node.Parent == null || + node.Parent.Text.Trim() != "临时图层" || !(node.Tag is GSOLayer)) return; + GSOLayer layer = node.Tag as GSOLayer; + 可编辑ToolStripMenuItem.Checked = !可编辑ToolStripMenuItem.Checked; + layer.Editable = 可编辑ToolStripMenuItem.Checked; + } + //wxl Tag更正 + private void 保存ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null||node.Tag==null) return; + GSOLayer layer = node.Tag as GSOLayer; + if (layer == null) return; + layer.Dataset.Save(); + } + //wxl Tag更正 + private void 定位ToolStripMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null||node.Parent==null) return; + if (node.Parent.Text.Trim() == "临时图层") + { + GSOLayer lsLayer = node.Tag as GSOLayer; + if (lsLayer == null) + { + LogHelper.WriteLog(typeof(MainFrm),"要定位的临时图层不存在:"+node.Text); + return; + } + double x = lsLayer.LatLonBounds.Center.X; + double y = lsLayer.LatLonBounds.Center.Y; + if (x.Equals(0) && y.Equals(0)) + { + x = lsLayer.Bounds.Center.X; + y = lsLayer.Bounds.Center.Y; + } + + globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 10), EnumAltitudeMode.Absolute); + } + else + { + GSOLayer layer = node.Tag as GSOLayer; + if (layer == null) return; + if (layer.Caption.Equals("红线")) + { + globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 1000); + globeControl1.Globe.FlyToPointSpeed = 10000000; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + layer.Visible = true; + globeControl1.Refresh(); + } + else + { + double x = layer.LatLonBounds.Center.X; + double y = layer.LatLonBounds.Center.Y; + globeControl1.Globe.FlyToPosition(new GSOPoint3d(x, y, 100), EnumAltitudeMode.Absolute); + } + } + } + //wxl Tag更正 + private void layerTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) + { + TreeNode node = layerTree.SelectedNode; + if (node == null) return; + if (node.Tag is GSOLayer) + { + GSOLayer layer = node.Tag as GSOLayer; + if (layer.GetAllFeatures().Length <= 0) return; + GSOFeature feature = layer.GetAt(0); + if (feature != null && feature.Geometry != null) + { + globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute);//, 0, 0, 1000); + } + else + { + globeControl1.Globe.FlyToFeature(feature); + } + } + else if (node.Tag is GSOFeature) + { + GSOFeature feature = node.Tag as GSOFeature; + if (feature.Geometry != null) + { + globeControl1.Globe.FlyToPosition(feature.Geometry.GeoCenterPoint, EnumAltitudeMode.Absolute, 0, 0, 10); + } + else + { + globeControl1.Globe.FlyToFeature(feature); + } + } + } + + /// + /// 在三维场景移动时,隐藏气泡globeControl1 + /// + /// + /// + void globeControl1_CameraBeginMoveEvent(object sender, CameraBeginMoveEventArgs e) + { + if (featureTooltip.IsVisible()) + { + featureTooltip.HideBalloon(); + } + if (balloonEx.IsVisible()) + { + balloonEx.HideBalloon(); + } + } + + /// + /// 在三维场景移动时,隐藏气泡globeControl2 + /// + /// + /// + void globeControl2_CameraBeginMoveEvent(object sender, CameraBeginMoveEventArgs e) + { + if (featureTooltip2.IsVisible()) + { + featureTooltip2.HideBalloon(); + } + if (balloonEx2.IsVisible()) + { + balloonEx2.HideBalloon(); + } + } + + void globeControl1_MouseWheel(object sender, MouseEventArgs e) + { + if (globeControl1.Globe.CameraState.Distance > 20000000) + { + GSOCameraState cameraState = globeControl1.Globe.CameraState; + cameraState.Distance = 20000000; + globeControl1.Globe.CameraState = cameraState; + globeControl1.Globe.Refresh(); + } + } + void globeControl2_MouseWheel(object sender, MouseEventArgs e) + { + if (globeControl2.Globe.CameraState.Distance > 20000000) + { + GSOCameraState cameraState = globeControl2.Globe.CameraState; + cameraState.Distance = 20000000; + globeControl2.Globe.CameraState = cameraState; + globeControl2.Globe.Refresh(); + } + } + + #region Fan 横断面 + /// + /// 横断面分析、基线剖面分析、道路断面分析等 + /// + /// + /// + private static EnumTrackPolylineEndMode trackPolylineEndMode; + + void globeControl1_TrackPolylineEndEvent(object sender, TrackPolylineEndEventArgs e) + { + //横断面分析、道路横断面分析 + if (trackPolylineEndMode == EnumTrackPolylineEndMode.HDM_Analysis || + trackPolylineEndMode == EnumTrackPolylineEndMode.DLDM_Analysis) + { + Dictionary hdmDic = SectionAnalysisTool.HDMAnalysis(globeControl1, + e.Polyline, Utility.m_PipelineLayerNames); + FrmHDMAnalysis3 frm = new FrmHDMAnalysis3(hdmDic, globeControl1, + trackPolylineEndMode); + frm.Show(this); + } + //基线剖面分析 + else if (trackPolylineEndMode == EnumTrackPolylineEndMode.JXPM_Analysis) + { + FrmBaseLineProfillAnalysis dlg = new FrmBaseLineProfillAnalysis(globeControl1.Globe, e.Polyline); + dlg.Show(this); + globeControl1.Globe.ClearLastTrackPolyline(); + /* + FrmRoadHDM f = new FrmRoadHDM(); + f.Show() + * **/ + } + trackPolylineEndMode = EnumTrackPolylineEndMode.Default_Analysis; + } + #endregion + + /// + /// 根据范围统计阀门、管线、工井等, 开挖分析, 挖方量分析 + /// + /// + /// + void globeControl1_TrackPolygonEndEvent(object sender, TrackPolygonEndEventArgs e) + { + if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon || e.Polygon == null) return; + GSOGeoPolygon3D polygon = e.Polygon; + + switch (trackflag) + { + case "valvequery": + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, polygon, InitDataGridViewX1); + frm.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + + case "PipelineDistanceStatistics": + + FrmAllPipelineStatis frm1 = new FrmAllPipelineStatis(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames); + frm1.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + case "PipelineSpatialQuery": + + FrmAllPipelineStatis.ShowForm(globeControl1, polygon, InitDataGridViewX1, Utility.m_PipelineLayerNames); + globeControl1.Globe.ClearAnalysis(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + case "workwellquery": + FrmAllWorkWellStatis frmWell = new FrmAllWorkWellStatis(globeControl1, polygon, InitDataGridViewX1); + frmWell.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + break; + + case "pit": + double depth; + FrmTackPolygonDlg dlg = new FrmTackPolygonDlg(); + if (dlg.ShowDialog() == DialogResult.OK) + { + depth = dlg.depth; + GSOGeoPit geoPit = new GSOGeoPit(); + geoPit.PitPolygon = polygon; + geoPit.PitDepth = depth; + geoPit.PitDepthUsing = true; + globeControl1.Globe.AddPit("", geoPit); + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = false; + } + } + globeControl1.Globe.ClearLastTrackPolygon(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + case "digFillAnalysis": + DigFillAnalysisDlg dlg1 = new DigFillAnalysisDlg(); + dlg1.m_globe = globeControl1.Globe; + dlg1.m_polygon3D = polygon; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + dlg1.Show(this); + break; + case "FloodAnalysis": + FrmFloodAnalysis frmFloodAnalysis = new FrmFloodAnalysis(globeControl1.Globe, polygon); + frmFloodAnalysis.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + case "BSQDuoBianXiangStatis": + FrmBSQStatis bsqFrm = new FrmBSQStatis(globeControl1, e.Polygon); + bsqFrm.Show(this); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + break; + + case "": + break; + default: + break; + } + } + /// + /// 鼠标悬浮提示 + /// + /// + /// + void globeControl1_FeatureMouseHoverEvent(object sender, FeatureMouseHoverEventArgs e) + { + try + { + if (e.Feature == null) return; + if (isFeatureContainsBianhao(e.Feature)) + { + featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.GetValue(featureIDFieldName).ToString()); + } + else if (e.Feature.Name != "") + { + featureTooltip.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, e.Feature.Name); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + + /// + /// 添加管线、隧道、城市七线绘制完成事件 + /// + /// + /// + void globeControl1_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + + if (enumDesignMode==EnumDesignMode.AddPipe + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//添加管线 + { + GSOLayer layerDest = globeControl1.Globe.DestLayerFeatureAdd; + if (layerDest != null) + { + GSOFeatures features = layerDest.GetAllFeatures(); + GSOFeature f = features[features.Length - 1]; + if (f != null && f.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + //TODO LIST:代码需要优化 张帆 + FrmLineCoordinate lineCoordiante = new FrmLineCoordinate(f, globeControl1, layerDest.Caption); + lineCoordiante.Show(this); + } + } + } + if (enumDesignMode==EnumDesignMode.AddTunnel + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//创建隧道 + { + GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (tunnel != null && tunnel.GetAllFeatures().Length > 0) + { + GSOFeature feature = tunnel.GetAt(tunnel.GetAllFeatures().Length - 1); + FrmCreateTunnel frm = new FrmCreateTunnel(globeControl1, feature); + if (frm.ShowDialog() == DialogResult.OK) + { + //tunnel.Save(); + } + } + + } + if (enumDesignMode==EnumDesignMode.AddCitySevenLine + && globeControl1.Globe.Action == EnumAction3D.DrawPolyline)//绘制城市七线 + { + CitySevenLine citySevenLine = globeControl1.Tag as CitySevenLine; + string lineType = citySevenLine.Type; + string lineName = citySevenLine.Name; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(lineType); + if (layer != null && layer.GetAllFeatures().Length > 0) + { + GSOFeature feature = layer.GetAt(layer.GetAllFeatures().Length - 1); + if (feature != null) + { + feature.Name = lineName; + GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); + style.LineColor = CitySevenLine.getColorByName(lineType); + style.LineWidth = 1; + feature.Geometry.Style = style; + } + } + globeControl1.Tag = null; + globeControl1.Globe.DestLayerFeatureAdd = null; + } + globeControl1.Refresh(); + enumDesignMode=EnumDesignMode.Null; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + + /// + /// 获取globeControl1中鼠标按下的坐标供区别鼠标右键和滚轮按下事件 + /// + /// + /// + void globeControl1_MouseDown(object sender, MouseEventArgs e) + { + mouseDownX1 = e.X; + mouseDownY1 = e.Y; + } + /// + /// 获取globeControl2中鼠标按下的坐标供区别鼠标右键和滚轮按下事件 + /// + /// + /// + void globeControl2_MouseDown(object sender, MouseEventArgs e) + { + mouseDownX2 = e.X; + mouseDownY2 = e.Y; + } + /// + /// + /// + /// + /// + void globeControl2_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.X != mouseDownX2 || e.Y != mouseDownY2) return; + RightScreenToolMenu.Show(globeControl2, e.X, e.Y); + } + } + /// + /// (完善)#wxl 待整理 + /// + /// + /// + void globeControl1_MouseClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + if (globeControl1.Globe.Action == EnumAction3D.VisibilityAnalysis) + { + 通视分析ToolStripMenuItem.Checked = false; + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "vertical") // 垂直净距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX2.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX2.Rows.Add(); + dataGridViewX2.Rows[idx].Tag = feat; + dataGridViewX2.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX2.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "spacing") // 间距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewLineList.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewLineList.Rows.Add(); + dataGridViewLineList.Rows[idx].Tag = feat; + dataGridViewLineList.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewLineList.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "horizontal") // 水平净距分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX8.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX8.Rows.Add(); + dataGridViewX8.Rows[idx].Tag = feat; + dataGridViewX8.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX8.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "collision") // 管线碰撞分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX4.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX4.Rows.Add(); + dataGridViewX4.Rows[idx].Tag = feat; + dataGridViewX4.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX4.Rows[idx].Cells[1].Value = featureName; + + } + } + return; + } + + if (globeControl1.Globe.Action == EnumAction3D.SelectObject && trackflag == "ftAnalysis") // 覆土分析 + { + if (globeControl1.Globe.SelObjectCount > 0) + { + dataGridViewX6.Rows.Clear(); + } + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOLayer resLayer = null; + GSOFeature feat = null; + globeControl1.Globe.GetSelectObject(i, out feat, out resLayer); + if (feat != null && feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + int idx = dataGridViewX6.Rows.Add(); + dataGridViewX6.Rows[idx].Tag = feat; + dataGridViewX6.Rows[idx].Cells[0].Value = resLayer.Caption; + var featureName = isFeatureContainsBianhao(feat) ? feat.GetValue(featureIDFieldName).ToString() : feat.Name; + dataGridViewX6.Rows[idx].Cells[1].Value = featureName; + } + } + return; + } + GSOPoint3d point; + GSOLayer templayer; + GSOFeature feature1 = globeControl1.Globe.HitTest(e.X, e.Y, out templayer, out point, false, true, 0); + if (point.X == 0 && point.Y == 0 && point.Z == 0) + { + point = globeControl1.Globe.ScreenToScene(e.X, e.Y); + } + GSOGeoPoint3D pt = new GSOGeoPoint3D(); + pt.X = point.X; + pt.Y = point.Y; + pt.Z = point.Z; + + bsqPT = pt; + + if (高度量算ToolStripMenuItem1.Checked && globeControl1.Globe.Action == EnumAction3D.SelectObject) // 高度量算菜单 + { + double z = globeControl1.Globe.GetZ(point.X, point.Y); + double modelZ = 0; + if (feature1 != null) + { + modelZ = feature1.Geometry.GeoBottomCenterPoint.Z; + } + GSOGeoPolyline3D line = new GSOGeoPolyline3D(); + GSOPoint3ds pts = new GSOPoint3ds(); + GSOPoint3d pt1 = new GSOPoint3d(); + pt1.X = point.X; + pt1.Y = point.Y; + pt1.Z = point.Z - z; + pts.Add(pt1); + pts.Add(point); + line.AddPart(pts); + GSOFeature feat = new GSOFeature(); + line.AltitudeMode = EnumAltitudeMode.Absolute; + feat.Geometry = line; + GSOLabel label = new GSOLabel(); + GSOLabelStyle style = new GSOLabelStyle(); + style.OutlineColor = Color.Transparent; + style.HasTracktionLine = false; + style.BackBeginColor = Color.Transparent; + style.BackEndColor = Color.Transparent; + style.BackMidColor = Color.Transparent; + label.Style = style; + label.Text = "高度:" + (point.Z - z).ToString("0.00") + "米"; + feat.Label = label; + layerTemp.AddFeature(feat); + } + } + else if (e.Button == MouseButtons.Right) // 右键取消 高度量算 功能 + { + if (e.X == mouseDownX1 && e.Y == mouseDownY1) + { + toolRightMenu.Show(globeControl1, e.X, e.Y); + if (高度量算ToolStripMenuItem1.Checked) + { + 高度量算ToolStripMenuItem1.Checked = false; + } + } + else + { + return; + } + } + globeControl1.Refresh(); + } + + /// + /// 判断网络图片是否存在 + /// + /// + /// + public static bool RemoteFileExists(string fileUrl) + { + bool result = false; + + WebResponse response = null; + try + { + WebRequest req = WebRequest.Create(fileUrl); + response = req.GetResponse(); + result = true; + } + catch (Exception ex) + { + result = false; + } + finally + { + if (response != null) + { + response.Close(); + } + } + return result; + } + + string featureIDFieldName = "编号";//待完善 + private bool isFeatureContainsBianhao(GSOFeature feature) + { + if (feature.GetFieldDefn("标识器编号") != null) + { + featureIDFieldName = "标识器编号"; + return true; + } + if (feature.GetFieldDefn("编号") == null) return false; + featureIDFieldName = "编号"; + return true; + } + + /// + /// 鼠标点击, 弹出气泡功能globeControl1 wxl待整理 + /// + /// + /// + void globeControl1_FeatureMouseClickEvent(object sender, FeatureMouseClickEventArgs e) + { + GSOFeature feature = e.Feature; + + string str1 = ""; + if (feature == null) return; + if (feature.GetFieldDefn("图片编码") != null)// + { + str1 = GetBubbleInfo(feature, globeControl1); + if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码"))) + { + str1 += ""; + } + else if (RemoteFileExists(Utility.PicDefaultURL)) + { + str1 += ""; + } + } + else if (isFeatureContainsBianhao(feature)) //管线模型图层 + { + str1 = GetBubbleInfo(feature, globeControl1); + } + + if (str1 == "") return; + featureTooltip.HideBalloon(); + balloonEx.HideBalloon(); + balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CX, 480); + balloonEx.SetSize(EnumSizeIndexEx.CONTENT_CY, 420); + balloonEx.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1); + } + + /// + /// 鼠标点击, 弹出气泡功能globeControl2 + /// + /// + /// + void globeControl2_FeatureMouseClickEvent(object sender, FeatureMouseClickEventArgs e) + { + GSOFeature feature = e.Feature; + + string str1 = ""; + if (feature == null) return; + if (feature.GetFieldDefn("图片编码") != null) // + { + str1 = GetBubbleInfo(feature, globeControl2); + if (RemoteFileExists(Utility.PicRootURL + feature.GetValue("图片编码"))) + { + str1 += ""; + } + else if (RemoteFileExists(Utility.PicDefaultURL)) + { + str1 += ""; + } + } + else if (isFeatureContainsBianhao(feature)) //管线模型图层 + { + str1 = GetBubbleInfo(feature, globeControl2); + } + + if (str1 == "") return; + featureTooltip2.HideBalloon(); + balloonEx2.HideBalloon(); + balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CX, 480); + balloonEx2.SetSize(EnumSizeIndexEx.CONTENT_CY, 420); + balloonEx2.ShowBalloon((int)e.MousePos.X, (int)e.MousePos.Y, str1); + } + + /// + /// 拼接气泡表格字符串(完善) + /// + /// + /// + private string GetBubbleInfo(GSOFeature feature, GSOGlobeControl globeControl) + { + if (feature == null) return ""; + string str = ""; + var code = feature.GetFieldAsString("编码"); + var title = FeatureTools.GetFeatureTypeByCode(code); + str += ""; + + int rowCount = feature.GetFieldCount(); + string layerName = feature.Dataset.Name; + string queryFields = ""; + if (Utility.Query_Fields.ContainsKey(layerName)) + { + queryFields = Utility.Query_Fields[layerName].ToString().Trim(); + } + else + { + layerName = feature.Dataset.Caption; + queryFields = getpipeLineFields.get_Fields(layerName, globeControl); + } + if (queryFields != null) + { + string[] param = { "," }; + string[] fieldNames = queryFields.Split(param, StringSplitOptions.RemoveEmptyEntries); + for (int j = 0; j < fieldNames.Length; j++) + { + string fieldName = fieldNames[j].Trim(); + GSOFieldDefn field1 = feature.GetFieldDefn(fieldName); + + string name1 = ""; + string value1 = ""; + if (field1 != null) + { + if (field1.Name == "图片编码") + { + j++; + } + if (j < rowCount) + { + field1 = feature.GetFieldDefn(j); + name1 = field1.Name; + if (name1 == "模型路径") + { + continue; + } + if (field1.Type == EnumFieldType.Text) + { + value1 = feature.GetFieldAsString(j); + } + else if (field1.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j)); + if (dd.Year <= 1) + { + value1 = ""; + } + else + { + value1 = dd.ToShortDateString(); + } + } + else if (field1.Type == EnumFieldType.Double) + { + double dl1 = feature.GetFieldAsDouble(j); + if (!name1.Contains("管径") && !name1.Contains("电压") && !name1.Contains("角度")) + { + name1 += "_米"; + } + value1 = dl1.ToString("0.00"); + } + else + { + if (!feature.IsFieldValueNull(j)) + { + value1 = feature.GetValue(j).ToString(); + } + } + } + } + string name2 = ""; + string value2 = ""; + if (j + 1 < rowCount) + { + GSOFieldDefn field2 = feature.GetFieldDefn(j + 1); + + if (field2 != null) + { + if (field2.Name == "图片编码") + { + j++; + } + if (j + 1 < rowCount) + { + field2 = feature.GetFieldDefn(j + 1); + name2 = field2.Name; + + if (name2 == "模型路径") + { + continue; + } + + if (field2.Type == EnumFieldType.Text) + { + value2 = feature.GetFieldAsString(j + 1); + } + else if (field2.Type == EnumFieldType.Date) + { + DateTime dd = Convert.ToDateTime(feature.GetFieldAsDataTime(j + 1)); + + if (dd.Year <= 1) + { + value2 = ""; + } + else + { + value2 = dd.ToShortDateString(); + } + } + else if (field2.Type == EnumFieldType.Double) + { + double dl2 = feature.GetFieldAsDouble(j + 1); + if (!name2.Contains("管径") && !name2.Contains("电压") && !name2.Contains("角度")) + { + name2 += "_米"; + } + value2 = dl2.ToString("0.00"); + } + else + { + if (!feature.IsFieldValueNull(j + 1)) + { + value2 = feature.GetValue(j + 1).ToString(); + } + } + } + } + + j++; + } + str += ""; + } + } + str += "
" + title + " " + feature.GetFieldAsString(featureIDFieldName) + "
" + + name1 + + "
" + + value1 + + "
" + + name2 + + "
" + + value2 + "
"; + return str; + } + + private GSOLayer TreeNodeFeatureLayer() + { + TreeNode featureAddPipeFitTreenode = GetDestLayerFeatureAddTreeNode(); + if (featureAddPipeFitTreenode == null) return null; + GSOLayer featureAddLayer = featureAddPipeFitTreenode.Tag as GSOLayer; + return featureAddLayer; + } + //遍历最深三层找到目标node. + private TreeNode GetDestLayerFeatureAddTreeNode() + { + + foreach (TreeNode layerTreeNode in layerTree.Nodes) + { + if (layerTreeNode.Tag == null && layerTreeNode.Nodes.Count > 0) + { + foreach (TreeNode node in layerTreeNode.Nodes) + { + if (node.Tag == null & node.Nodes.Count > 0) + { + foreach (TreeNode nodeNode in node.Nodes) + { + GSOLayer gsoLayer = nodeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return nodeNode; + } + } + else + { + GSOLayer gsoLayer = node.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return node; + } + } + } + else + { + GSOLayer gsoLayer = layerTreeNode.Tag as GSOLayer; + if (gsoLayer != null && gsoLayer.IsDestLayerFeatureAdd()) return layerTreeNode; + } + } + return null; + } + + /// + /// 地上模式 菜单按钮 + /// + /// + /// + private void buttonItem87_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem87.Text); + + if (buttonItem87.Checked) return; + buttonItem87.Checked = true; + buttonItem88.Checked = false; + buttonItem27.Checked = false; + + switch (globeControl1.Globe.CameraMode) + { + case EnumCameraMode.UnderGround: + globeControl1.Globe.CameraMode = EnumCameraMode.Navigation; + GSOCameraState state = new GSOCameraState(); + state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode; + state.Altitude = globeControl1.Globe.CameraState.Altitude; + state.Distance = globeControl1.Globe.CameraState.Distance; + state.Heading = globeControl1.Globe.CameraState.Heading; + state.Latitude = globeControl1.Globe.CameraState.Latitude; + state.Longitude = globeControl1.Globe.CameraState.Longitude; + if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85) + state.Tilt = 85; + else + state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt; + globeControl1.Globe.JumpToCameraState(state); + break; + case EnumCameraMode.Walk: + globeControl1.Globe.CameraMode = EnumCameraMode.Navigation; + break; + } + globeControl1.Globe.Refresh(); + } + /// + /// 地下模式 菜单按钮 + /// + /// + /// + private void buttonItem88_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem88.Text); + + if (buttonItem88.Checked) return; + buttonItem88.Checked = true; + buttonItem27.Checked = false; + buttonItem87.Checked = false; + + switch (globeControl1.Globe.CameraMode) + { + case EnumCameraMode.Navigation: + case EnumCameraMode.Walk: + globeControl1.Globe.CameraMode = EnumCameraMode.UnderGround; + GSOCameraState state = new GSOCameraState(); + state.AltitudeMode = globeControl1.Globe.CameraState.AltitudeMode; + state.Altitude = globeControl1.Globe.CameraState.Altitude; + state.Distance = globeControl1.Globe.CameraState.Distance; + state.Heading = globeControl1.Globe.CameraState.Heading; + state.Latitude = globeControl1.Globe.CameraState.Latitude; + state.Longitude = globeControl1.Globe.CameraState.Longitude; + if (globeControl1.Globe.CameraState.Tilt < 95 && globeControl1.Globe.CameraState.Tilt > 85) + state.Tilt = 95; + else + state.Tilt = 180 - globeControl1.Globe.CameraState.Tilt; + globeControl1.Globe.JumpToCameraState(state); + break; + } + globeControl1.Globe.Refresh(); + } + /// + /// 行走模式 菜单按钮 + /// + /// + /// + private void buttonItem27_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem27.Text); + + if (buttonItem27.Checked) return; + buttonItem27.Checked = true; + buttonItem87.Checked = false; + buttonItem88.Checked = false; + + globeControl1.Globe.CameraMode = EnumCameraMode.Walk; + } + /// + /// 地面透明度设置 菜单 + /// + /// + /// + private void sliderGroundTransSet1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderGroundTransSet1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderGroundTransSet1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderGroundTransSet1.Value; + optiValue = sliderGroundTransSet1.Value; + } + /// + /// 图例 菜单按钮 + /// + /// + /// + private void btnlegendSet_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, btnlegendSet.Text); + + btnlegendSet.Checked = !btnlegendSet.Checked; + legend.Visible = !legend.Visible; + globeControl1.Refresh(); + } + /// + /// 快速定位 菜单按钮 + /// + /// + /// + private void buttonItem91_Click(object sender, EventArgs e) // + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem91.Text); + FrmFlyToPosition fly = new FrmFlyToPosition(globeControl1); + fly.Show(this); + } + /// + /// 图层管理 菜单按钮 + /// + /// + /// + private void buttonItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem1.Text); + + buttonItem1.Checked = !buttonItem1.Checked; + if (buttonItem1.Checked) + { + sideBarPanelItem3.Visible = true; + layerTree.Visible = true; + controlContainerItem3.Visible = true; + sideBar1.Visible = true; + Refresh(); + } + else + { + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + + //修改图层管理与标注管理、覆土审查、水平净距分析、垂直净距分析和碰撞分析控件之间的逻辑关系 + controlContainerItem5.Visible = false; + sideBar1.Visible = false; + sideBarPanelItem4.Visible = false; + panel3.Visible = false; + sideBar1.ExpandedPanel = sideBarPanelItem3; + 标注管理ToolStripMenuItem.Checked = false; + Refresh(); + } + } + /// + /// 全屏显示 菜单按钮 + /// + /// + /// + private void buttonItem89_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItem89.Text); + + buttonItem89.Checked = !buttonItem89.Checked; + FullScreen(); + } + + //全屏显示调用的windows底层api函数 + [DllImport("user32.dll", EntryPoint = "ShowWindow")] + private static extern int ShowWindow(int hWnd, int _value); + + //任务栏 + [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)] + static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); + int widthOld; + int heightOld; + int xOld; + int yOld; + /// + /// 全屏显示功能实现(完善) + /// + private void FullScreen() + { + if (!m_bFullScreen) // 启用全屏 + { + xOld = Location.X; + yOld = Location.Y; + widthOld = Width; + heightOld = Height; + + SuspendLayout();//挂起 + + FormBorderStyle = FormBorderStyle.Sizable; + WindowState = FormWindowState.Maximized; + //////任务栏 + IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null); + if (trayHwnd != IntPtr.Zero) + { + ShowWindow(trayHwnd.ToInt32(), 0); + } + + int widthFull = Screen.PrimaryScreen.Bounds.Width; + int heightFull = Screen.PrimaryScreen.Bounds.Height; + + FormBorderStyle = FormBorderStyle.None; + WindowState = FormWindowState.Normal; + + Location = new Point(0, 0); + SetFullScreen(widthFull, heightFull); + + ////hudButton + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + buttonItem89.Checked = true; + sideBar1.Visible = false; + expandableSplitter1.Expanded = false; + expandableSplitter1.Visible = false; + + statusStrip1.Visible = false; + expandableSplitter2.Expanded = false; + expandableSplitter2.Visible = false; + ribbonControl1.Visible = false; + pictureBox1.Visible = false; + + ResumeLayout();//重新开始 + + m_bFullScreen = true; + } + else // 取消全屏 + { + SuspendLayout();//挂起 + + //////任务栏 + IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null); + if (trayHwnd != IntPtr.Zero) + { + ShowWindow(trayHwnd.ToInt32(), 1); + } + + FormBorderStyle = FormBorderStyle.Sizable; + WindowState = FormWindowState.Normal; + + Location = new Point(xOld, yOld); + SetFullScreen(widthOld, heightOld); + + ////hudButton + btnToolNone.SetImage(Application.StartupPath + "\\Resource\\image\\Pan1.png"); + btnToolSelect.SetImage(Application.StartupPath + "\\Resource\\image\\select1.png"); + buttonItem89.Checked = false; + expandableSplitter1.Expanded = true; + expandableSplitter1.Visible = true; + sideBar1.Visible = true; + buttonItem1.Checked = true; + expandableSplitter2.Visible = true; + statusStrip1.Visible = true; + ribbonControl1.Visible = true; + pictureBox1.Visible = true; + + ResumeLayout();//重新开始 + m_bFullScreen = false; + Focus(); + //初始化隐藏图层管理 + sideBarPanelItem3.Visible = false; + layerTree.Visible = false; + controlContainerItem3.Visible = false; + if (sideBarPanelItem4.Visible) + { + sideBar1.Visible = true; + controlContainerItem5.Visible = true; + } + else + { + sideBar1.Visible = false; + } + buttonItem1.Checked = false; + Refresh(); + } + } + + /// + /// 设置窗体宽、高 + /// + /// + /// + private void SetFullScreen(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// 全屏功能的快捷键F5 + /// + /// + /// + private void MainFrm_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.F5: + FullScreen(); + break; + case Keys.Escape: + if (m_bFullScreen) + { + FullScreen(); + } + break; + default: + break; + } + if (e.KeyCode == Keys.P && e.Modifiers == Keys.Control) + { + buttonItem130_Click_1(this, EventArgs.Empty); + } + } + + private Point getUpperLeftPoint(Point p1, Point p2, out int mapWidth, out int mapHeight) // + { + Rectangle rc = new Rectangle(); + + p1 = globeControl1.PointToScreen(p1); + p2 = globeControl1.PointToScreen(p2); + + int x = Screen.PrimaryScreen.Bounds.X; + int y = Screen.PrimaryScreen.Bounds.Y; + int screenWidth = SystemInformation.WorkingArea.Width; + int screenHeight = SystemInformation.WorkingArea.Height; + + rc.X = p1.X < x ? x : p1.X; + rc.Y = p1.Y < y ? y : p1.Y; + p1.X = rc.Left; + p1.Y = rc.Top; + + p2.X = p2.X > screenWidth ? screenWidth : p2.X; + p2.Y = p2.Y > screenHeight ? screenHeight : p2.Y; + rc.Width = p2.X - rc.X; + rc.Height = p2.Y - rc.Y; + + mapWidth = rc.Width; + mapHeight = rc.Height; + Point pt = new Point(rc.Left, rc.Top); + return pt; + } + + Image printImage; + private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) + { + e.Graphics.DrawImage(printImage, 10, 10); + } + /// + /// 输出地图 菜单 + /// + /// + /// + private void btnOutputJPG_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btnOutputJPG.Text); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 目标图层 菜单 + /// + /// + /// + private void FeatureAddLayerMenuItem_Click(object sender, EventArgs e) + { + if (FeatureAddLayerMenuItem.Checked) return; + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + FeatureAddLayerMenuItem.Checked = true; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + globeControl1.Globe.DestLayerFeatureAdd = layer; + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 可选择 菜单 + /// + /// + /// + private void LayerSelectableMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + LayerSelectableMenuItem.Checked = !LayerSelectableMenuItem.Checked; + if (layer != null) layer.Selectable = LayerSelectableMenuItem.Checked; + } + //wxl Tag更正 + /// + /// 图层目录树 右键菜单中的 可编辑 菜单 + /// + /// + /// + private void LayerEditableMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + LayerEditableMenuItem.Checked = !LayerEditableMenuItem.Checked; + if (layer != null) layer.Editable = LayerEditableMenuItem.Checked; + } + /// + /// 图层目录树 右键菜单中的 保存 菜单 + /// + /// + /// + //wxl Tag更正 + private void SaveLayerMenuItem_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) return; + GSOLayer layer = node.Tag as GSOLayer; + if (layer != null) layer.Dataset.Save(); + } + + /// + /// 清除结果 菜单 + /// + /// + /// + private void buttonItem47_Click(object sender, EventArgs e) + { + globeControl1.Globe.ClearAnalysis(); + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + clearFeatureHighLight(); + } + /// + /// 设置菜单的选中状态 + /// + private void ActionToolMenuChecked() + { + if (globeControl1.Globe.Action != EnumAction3D.TrackPolyline) + { + 横断面分析ToolStripMenuItem.Checked = false; + 道路断面分析ToolStripMenuItem.Checked = false; + 基线剖面分析ToolStripMenuItem.Checked = false; + 沿线开挖ToolStripMenuItem.Checked = false; + } + if (globeControl1.Globe.Action != EnumAction3D.NormalHit) + { + 关阀分析ToolStripMenuItem.Checked = false; + 连通分析ToolStripMenuItem.Checked = false; + } + if (globeControl1.Globe.Action != EnumAction3D.TrackPolygon) + { + 多边形开挖ToolStripMenuItem.Checked = false; + 挖方量分析ToolStripMenuItem.Checked = false; + } + } + /// + /// 主窗体关闭事件处理 + /// + /// + /// + private void MainFrm_FormClosing(object sender, FormClosingEventArgs e) + { + if (MessageBox.Show("是否退出系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + e.Cancel = true; + else + globeControl1.Globe.MemoryLayer.SaveAs(Application.StartupPath + "/MyPlace.kml"); + } + + #region 完善(各种净距分析) + /// + /// 垂直净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX2_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx1.Enabled = checkBoxX2.Checked; + if (checkBoxX2.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + trackflag = ""; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + + comboBoxEx1.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 水平净距分析 功能界面中的 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX2_CheckedChanged_shuiping(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + comboBoxEx4.Enabled = checkBoxX8.Checked; + if (checkBoxX8.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + + comboBoxEx4.SelectedIndex = -1; + + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 垂直净距分析 功能界面中的 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX1_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX1.Checked) + { + comboBoxEx1.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx1.Enabled = false; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + trackflag = "vertical"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx1.Enabled = true; + } + } + /// + /// 水平净距分析 功能界面中的 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX1_CheckedChanged_shuiping(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + if (checkBoxX7.Checked) + { + comboBoxEx4.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx4.Enabled = false; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + trackflag = "horizontal"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx4.Enabled = true; + } + } + /// + /// 垂直净距分析 功能界面中的 选择图层下拉框 选中项改变 事件处理 + /// + /// + /// + private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx1.SelectedIndex <= -1) return; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + listBox1.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX2.Rows.Add(); + dataGridViewX2.Rows[idx].Cells[0].Value = comboBoxEx1.SelectedItem.ToString(); + dataGridViewX2.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 水平净距分析 功能界面中的 选择图层下拉框 选中项改变 事件处理 + /// + /// + /// + private void comboBoxEx1_SelectedIndexChanged_shuiping(object sender, EventArgs e) + { + if (comboBoxEx4.SelectedIndex <= -1) return; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + listBox3.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx4.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX8.Rows.Add(); + dataGridViewX8.Rows[idx].Cells[0].Value = comboBoxEx4.SelectedItem.ToString(); + dataGridViewX8.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + Dictionary featCount = new Dictionary(); + Dictionary featLenth = new Dictionary(); + Dictionary m_FeaturesWithBianhao = new Dictionary();//记录编号和对应的标注点的位置 + + /// + /// 垂直净距分析 功能界面中的 开始分析按钮 事件处理 + /// + /// + /// + private void buttonX1_Click(object sender, EventArgs e) + { + if (!checkBoxX1.Checked && !checkBoxX2.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX2.Text.Trim() == "") + { + MessageBox.Show("净距标准不能为空!", "提示"); + return; + } + double dJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxX2.Text.Trim(), out dJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的净距标准!", "提示"); + return; + } + if (dataGridViewX2.Rows.Count <= 0) + { + MessageBox.Show("请选中要进行垂直净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox1.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewX3.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxX1.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX2.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX2.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + VerticalDistanceAnalysis(selectedFeature,Utility.m_PipelineLayerNames,dJingJuBiaoZhun); + } + } + else if (checkBoxX2.Checked) // 选择图层 + { + if (comboBoxEx1.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + VerticalDistanceAnalysis(feats[i], Utility.m_PipelineLayerNames, dJingJuBiaoZhun); + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox1.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX3.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + + /// + /// 在指定的两点组成的线的中间添加一个marker对象,并将marker对象添加到指定的图层中 + /// + /// + /// + /// + /// + /// + private GSOPoint3d LabelVerticalDistance(GSOLayer markerLayer, GSOPoint3d pntIntersect1, GSOPoint3d pntIntersect2, double distance, bool markerVisible) + { + if (pntIntersect1 == null || pntIntersect2 == null) + { + return new GSOPoint3d(); + } + + GSOGeoPolyline3D disline = new GSOGeoPolyline3D(); + GSOPoint3ds point3Ds = new GSOPoint3ds(); + point3Ds.Add(pntIntersect1); + point3Ds.Add(pntIntersect2); + disline.AddPart(point3Ds); + GSOSimpleLineStyle3D style = new GSOSimpleLineStyle3D(); //创建线的风格 + //设置透明度及颜色,FromArgb()中的四个参数分别为alpha、red、green、blue,取值范围为0到255 + style.LineColor = Color.GreenYellow; + style.LineWidth = 3; //设置线的宽度为3 + style.VertexVisible = true; //显示线的节点 + disline.Style = style; //把风格添加到线上 + disline.AltitudeMode = EnumAltitudeMode.Absolute; + + GSOFeature line = new GSOFeature(); + line.Geometry = disline; + + GSOGeoMarker dismarker = new GSOGeoMarker(); + dismarker.X = pntIntersect1.X; + dismarker.Y = pntIntersect1.Y; + dismarker.Z = (pntIntersect1.Z + pntIntersect2.Z) / 2; + + string disStr = distance.ToString("0.00"); + if (disStr != "0.00") + { + dismarker.Text = distance.ToString("0.00") + "米"; + } + else + { + dismarker.Text = "交叉"; + } + dismarker.AltitudeMode = EnumAltitudeMode.Absolute; + GSOMarkerStyle3D styleMarker = new GSOMarkerStyle3D(); + GSOTextStyle styleText = new GSOTextStyle(); + styleText.IsSizeFixed = true; + styleText.ForeColor = Color.White; + styleText.FontSize = 20; + styleMarker.TextStyle = styleText; + dismarker.Style = styleMarker; + + GSOFeature marker = new GSOFeature(); + marker.Geometry = dismarker; + + line.Visible = marker.Visible = markerVisible; + + markerLayer.AddFeature(line); + markerLayer.AddFeature(marker); + + return dismarker.Position; + } + #region wxl + /// + /// wxl重构,碰撞分析 + /// + /// + /// + /// + private void CollisionAnalysis(GSOFeature selectedFeature, List pipelineLayerNames) + { + List result = DoublePanelAnalysis.CollisionAnalysis(globeControl1, selectedFeature, pipelineLayerNames); + if (result == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + + string caption = selectedFeature.Dataset.Caption; + foreach (FeatureAnalysisInfo featureAnalysisInfo in result) + { + string feat2Caption = featureAnalysisInfo.feature.Dataset.Caption; + featureAnalysisInfo.feature.HighLight = true; + var idx = dataGridViewX5.Rows.Add(); + dataGridViewX5.Rows[idx].Cells[0].Value = caption; + dataGridViewX5.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX5.Rows[idx].Cells[2].Value = feat2Caption; + dataGridViewX5.Rows[idx].Cells[3].Value = featureAnalysisInfo.feature.Name; + GSOGeoPolyline3D line2 = featureAnalysisInfo.feature.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + featureAnalysisInfo.feature.Name) == false) + { + GSOGeoMarker dismarker = new GSOGeoMarker(); + dismarker.X = featureAnalysisInfo.point1.X; + dismarker.Y = featureAnalysisInfo.point1.Y; + dismarker.Z = (featureAnalysisInfo.point1.Z + featureAnalysisInfo.point1.Z) / 2; + dismarker.AltitudeMode = EnumAltitudeMode.Absolute; + m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + featureAnalysisInfo.feature.Name, dismarker.Position);//添加飞行位置记录 + } + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + + } + /// + /// wxl重构,垂直净距分析 + /// + /// + /// + /// + private void VerticalDistanceAnalysis(GSOFeature selectedFeature, List pipelineLayerNames, double verticalDistance) + { + List result = DoublePanelAnalysis.VerticalDistanceAnalysis(globeControl1, selectedFeature, pipelineLayerNames, + verticalDistance); + if (result == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + string caption = selectedFeature.Dataset.Caption; + foreach (FeatureAnalysisInfo featureAnalysisInfo in result) + { + GSOFeature feat2 = featureAnalysisInfo.feature; + string feat2Caption = feat2.Dataset.Caption; + feat2.HighLight = true; + var idx = dataGridViewX3.Rows.Add(); + dataGridViewX3.Rows[idx].Cells[0].Value = caption; + dataGridViewX3.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX3.Rows[idx].Cells[2].Value = feat2Caption; // feat2.Dataset.Caption;一致 + dataGridViewX3.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX3.Rows[idx].Cells[4].Value = featureAnalysisInfo.distance.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + string markerInfo = featureAnalysisInfo.distance.ToString("0.00") + "米"; + GSOPoint3d markerPosition = DoublePanelAnalysis.MakeLabel(layerTemp, featureAnalysisInfo.point1, featureAnalysisInfo.point2, markerInfo, true); + if (m_FeaturesWithBianhao.ContainsKey(selectedFeature.Name + "-" + feat2.Name) == false) + { + m_FeaturesWithBianhao.Add(selectedFeature.Name + "-" + feat2.Name, markerPosition); //添加飞行位置记录 + } + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + } + + #endregion + + /// + /// 垂直净距分析中 表格行的 双击定位 功能。 与覆土分析的实现方法不同,主要原因是需要标注垂距 + /// + /// + /// + private void dataGridViewX3_MouseDoubleClick(object sender, MouseEventArgs e) // + { + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX3.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex > -1) + { + string key = dataGridViewX3.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX3.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim(); + if (m_FeaturesWithBianhao.ContainsKey(key)) + { + globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5); + } + } + } + } + + /// + /// 水平净距分析 功能界面中 开始分析按钮 的事件处理 + /// + /// + /// + private void buttonX1_Click_shuiping(object sender, EventArgs e) // + { + if (!checkBoxX7.Checked && !checkBoxX8.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX4.Text.Trim() == "") + { + MessageBox.Show("净距标准不能为空!", "提示"); + return; + } + double dJingJuBiaoZhun = 0; + if (!double.TryParse(textBoxX4.Text.Trim(), out dJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的净距标准!", "提示"); + return; + } + if (dataGridViewX8.Rows.Count <= 0) + { + MessageBox.Show("请选中要进行水平净距分析的管线!", "提示"); + return; + } + + featCount.Clear(); + featLenth.Clear(); + listBox3.Items.Clear(); + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + dataGridViewX9.Rows.Clear(); + Cursor = Cursors.WaitCursor; + for (int i = 0; i < dataGridViewX8.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX8.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; + HorizontalDistanceAnalysis(selectedFeature, Utility.m_PipelineLayerNames, dJingJuBiaoZhun); + } + if (dataGridViewX9.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合净距标准的管线!", "提示"); + } + + for (int i = 0; i < Utility.m_PipelineLayerNames.Count&&featCount.Count>0; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && + featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBox3.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + #region wxl 水平净距分析重构 + /// + /// 计算指定feature对象与除了该feature所在图层之外的 所有管线图层中的所有feature对象 的水平距离 并记录符合要求的管线 功能 + /// + /// + /// + /// + private void HorizontalDistanceAnalysis(GSOFeature selectedFeature, List _pipelineLayerNames, double dis) + { + + Dictionary featureMap = DoublePanelAnalysis.HorizontalDistanceAnalysis(globeControl1,selectedFeature, + _pipelineLayerNames, dis); + if (featureMap == null) + { + selectState = 0; + MessageBox.Show("请选择一条管线!"); + return; + } + foreach (KeyValuePair kvp in featureMap) + { + GSOFeature feat2 = kvp.Key; + feat2.HighLight = true; + string feat2Caption = feat2.Dataset.Caption; + int idx = dataGridViewX9.Rows.Add(); + dataGridViewX9.Rows[idx].Tag = feat2; + dataGridViewX9.Rows[idx].Cells[0].Value = selectedFeature.Dataset.Caption; + dataGridViewX9.Rows[idx].Cells[1].Value = selectedFeature.Name; + dataGridViewX9.Rows[idx].Cells[2].Value = feat2Caption; + dataGridViewX9.Rows[idx].Cells[3].Value = feat2.Name; + dataGridViewX9.Rows[idx].Cells[4].Value = kvp.Value.ToString("0.00"); + GSOGeoPolyline3D line2 = feat2.Geometry as GSOGeoPolyline3D; + if (line2 == null) continue; + if (featCount.ContainsKey(feat2Caption)) + { + featCount[feat2Caption] = featCount[feat2Caption] + 1; + } + else + { + featCount.Add(feat2Caption, 1); + } + if (featLenth.ContainsKey(feat2Caption)) + { + featLenth[feat2Caption] = featLenth[feat2Caption] + line2.GetSpaceLength(true, 6378137); + } + else + { + featLenth.Add(feat2Caption, line2.GetSpaceLength(true, 6378137)); + } + } + } + #endregion + + /// + /// 水平净距分析 功能界面中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX9_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX9.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + GSOFeature rowFeature = dataGridViewX9.Rows[hittestinfo.RowIndex].Tag as GSOFeature; + if (rowFeature == null) return; + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); + } + else + { + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + /// + /// 碰撞分析 功能界面中 开始分析按钮 事件处理 + /// + /// + /// + private void buttonX5_Click(object sender, EventArgs e) + { + if (!checkBoxX3.Checked && !checkBoxX4.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (dataGridViewX4.Rows.Count > 0) + { + featLenth.Clear(); + featCount.Clear(); + listBox2.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + dataGridViewX5.Rows.Clear(); + clearFeatureHighLight(); + m_FeaturesWithBianhao.Clear(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + Cursor = Cursors.WaitCursor; + if (checkBoxX3.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewX4.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewX4.Rows[i].Tag as GSOFeature; + if (selectedFeature == null) continue; + selectState = 1; +// VerticalDistanceAnalysis("碰撞分析", selectedFeature, Utility.m_PipelineLayerNames, 0, 0.0); + CollisionAnalysis(selectedFeature,Utility.m_PipelineLayerNames); + } + } + else if (checkBoxX4.Checked) // 选择图层 + { + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + //GSOFeatureDataset fdataset = flayer.Dataset as GSOFeatureDataset; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; + CollisionAnalysis(feats[i], Utility.m_PipelineLayerNames); +// VerticalDistanceAnalysis("碰撞分析", feats[i], Utility.m_PipelineLayerNames, 0, 0.0); + } + } + + if (featCount.Count > 0) + { + foreach (string pipelineLayer in Utility.m_PipelineLayerNames) + { + if (featCount.ContainsKey(pipelineLayer) && featLenth.ContainsKey(pipelineLayer)) + { + listBox2.Items.Add(pipelineLayer + ":" + featCount[pipelineLayer] + "条,共" + featLenth[pipelineLayer].ToString("0.00") + "米"); + } + } + } + if (dataGridViewX5.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有发生碰撞的管线!", "提示"); + } + } + else + { + MessageBox.Show("请选中要进行碰撞分析的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + /// + /// 碰撞分析功能界面中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX5_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX5.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + string key = dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[1].Value.ToString().Trim() + "-" + dataGridViewX5.Rows[hittestinfo.RowIndex].Cells[3].Value.ToString().Trim(); + if (m_FeaturesWithBianhao.ContainsKey(key)) + { + globeControl1.Globe.JumpToPosition(m_FeaturesWithBianhao[key], EnumAltitudeMode.Absolute, 5); + } + } + /// + /// 覆土分析功能操作界面中的 选择管线 复选框选中状态改变事件处理 + /// + /// + /// + private void checkBoxX5_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX5.Checked) + { + comboBoxEx3.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx3.Enabled = false; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + trackflag = "ftAnalysis"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx3.Enabled = true; + } + } + /// + /// 覆土分析功能操作界面中的 选择图层 复选框选中状态改变事件处理 + /// + /// + /// + private void checkBoxX6_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx3.Enabled = checkBoxX6.Checked; + if (checkBoxX6.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + trackflag = ""; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + comboBoxEx3.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 覆土分析功能操作界面中的 图层下拉框选中项改变事件处理 + /// + /// + /// + private void comboBoxEx3_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx3.SelectedIndex <= -1) return; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); + if (layer == null) + return; + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + GSOFeatures feats = flayer.GetAllFeatures(); + + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX6.Rows.Add(); + dataGridViewX6.Rows[idx].Cells[0].Value = comboBoxEx3.SelectedItem.ToString(); + dataGridViewX6.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 覆土分析功能操作界面中的 开始分析 按钮事件处理 + /// + /// + /// + private void buttonX9_Click(object sender, EventArgs e) + { + if (!checkBoxX5.Checked && !checkBoxX6.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxX3.Text.Trim() == "") + { + MessageBox.Show("覆土深度不能为空!", "提示"); + return; + } + double dFuTuShenDu = 0; + if (!double.TryParse(textBoxX3.Text.Trim(), out dFuTuShenDu)) + { + MessageBox.Show("请输入正确的覆土深度!", "提示"); + return; + } + + if (dataGridViewX6.Rows.Count > 0) + { + layerTemp.RemoveAllFeature(); + dataGridViewX7.Rows.Clear(); + clearFeatureHighLight(); + Cursor = Cursors.WaitCursor; + + if (checkBoxX5.Checked) // 覆土分析 选择管线 + { + for (int i = 0; i < dataGridViewX6.Rows.Count; i++) + { + GSOFeature rowFeature = dataGridViewX6.Rows[i].Tag as GSOFeature; + if (rowFeature == null) continue; + string featureName = isFeatureContainsBianhao(rowFeature) ? rowFeature.GetValue(featureIDFieldName).ToString() : rowFeature.Name; + + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) + { + continue; + } + GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; + if (style == null) + { + continue; + } + if (line.PartCount <= 0) continue; + GSOPoint3ds pts = line[0]; + GSOPoint3d pt = new GSOPoint3d(); + + for (int m = 0; m < pts.Count; m++) + { + if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim())) + { + rowFeature.HighLight = true; + int idx = dataGridViewX7.Rows.Add(); + dataGridViewX7.Rows[idx].Tag = rowFeature; + dataGridViewX7.Rows[idx].Cells[0].Value = rowFeature.Dataset.Caption; + dataGridViewX7.Rows[idx].Cells[1].Value = featureName; + dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00"); + + pt.X = pts[m].X; + pt.Y = pts[m].Y; + pt.Z = 0; + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + break; + } + } + } + } + else if (checkBoxX6.Checked) // 覆土分析 选择图层 + { + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx3.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null)return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + GSOFeature f = feats[i]; + string featureName = ""; + featureName = isFeatureContainsBianhao(feats[i]) ? feats[i].GetValue(featureIDFieldName).ToString() : feats[i].Name; + GSOGeoPolyline3D line = f.Geometry as GSOGeoPolyline3D; + if (line == null) continue; + GSOPipeLineStyle3D style = line.Style as GSOPipeLineStyle3D; + if (style == null || line.PartCount <= 0) continue; + GSOPoint3ds pts = line[0]; + GSOPoint3d pt = new GSOPoint3d(); + for (int m = 0; m < pts.Count; m++) + { + if (Math.Abs(pts[m].Z + (style.Radius)) < Convert.ToDouble(textBoxX3.Text.Trim())) + { + f.HighLight = true; + int idx = dataGridViewX7.Rows.Add(); + dataGridViewX7.Rows[idx].Tag = f; + dataGridViewX7.Rows[idx].Cells[0].Value = layer.Caption; + dataGridViewX7.Rows[idx].Cells[1].Value = featureName; + dataGridViewX7.Rows[idx].Cells[2].Value = Math.Abs((pts[m].Z + (style.Radius))).ToString("0.00"); + + pt.X = pts[m].X; + pt.Y = pts[m].Y; + pt.Z = 0; + LabelVerticalDistance(layerTemp, pts[m], pt, Convert.ToDouble(dataGridViewX7.Rows[idx].Cells[2].Value), true); + + break; + } + } + } + } + globeControl1.Refresh(); + if (dataGridViewX7.Rows.Count == 0) + { + MessageBox.Show("所有管线满足覆土净距标准!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + MessageBox.Show("请选中要进行覆土分析的管线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + Cursor = Cursors.Default; + } + /// + /// 覆土分析中 表格的 双击定位 功能 + /// + /// + /// + private void dataGridViewX7_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left) return; + DataGridView.HitTestInfo hittestinfo = dataGridViewX7.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex <= -1) return; + GSOFeature rowFeature = dataGridViewX7.Rows[hittestinfo.RowIndex].Tag as GSOFeature; + if (rowFeature == null) return; + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3D = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3D, EnumAltitudeMode.Absolute, 5); + } + else + { + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + /// + /// 覆土分析功能操作界面中的 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX10_Click(object sender, EventArgs e) + { + if (dataGridViewX7.Rows.Count > 0) + { + ExportExcel("覆土分析", dataGridViewX7, null); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 覆土分析功能操作界面底部的 关闭 按钮事件处理 + /// + /// + /// + private void buttonX11_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel4.Visible = false; + checkBoxX5.Checked = false; + checkBoxX6.Checked = false; + comboBoxEx3.SelectedIndex = -1; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + layerTemp.RemoveAllFeature(); + + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + globeControl1.Refresh(); + + //Refresh(); + } + /// + /// 垂直净距分析 功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX2_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX1.Checked = false; + checkBoxX2.Checked = false; + comboBoxEx1.SelectedIndex = -1; + comboBoxEx1.Enabled = false; + textBoxX2.Text = "1"; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + listBox1.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 水平净距分析 功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX15_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX7.Checked = false; + checkBoxX8.Checked = false; + comboBoxEx4.SelectedIndex = -1; + comboBoxEx4.Enabled = false; + textBoxX4.Text = "1"; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + listBox3.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 垂直净距分析功能界面中 关闭按钮 事件处理 + /// + /// + /// + private void buttonX3_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel2.Visible = false; + checkBoxX1.Checked = false; + checkBoxX2.Checked = false; + comboBoxEx1.SelectedIndex = -1; + dataGridViewX2.Rows.Clear(); + dataGridViewX3.Rows.Clear(); + if (layerTemp != null) + { + layerTemp.RemoveAllFeature(); + } + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + /// + /// 水平净距分析功能界面中 删除缓冲区按钮 事件处理 + /// + /// + /// + private void buttonX14_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel5.Visible = false; + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + dataGridViewX8.Rows.Clear(); + dataGridViewX9.Rows.Clear(); + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + /// + /// 导出指定DataGridView控件中的内容 + /// + /// + /// + private void ExportExcel(string type, DataGridView _dataGridView, ListBox _listBox) + { + if (_dataGridView.Rows.Count <= 0) return; + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "Excel files (*.xls)|*.xls"; + dlg.FilterIndex = 0; + dlg.RestoreDirectory = true; + //dlg.CreatePrompt = true; + dlg.Title = "保存为Excel文件"; + dlg.FileName = type + "-" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; + if (dlg.ShowDialog() == DialogResult.OK) + { + Stream myStream = dlg.OpenFile(); + StreamWriter sw = new StreamWriter(myStream, Encoding.GetEncoding(-0)); + string columnTitle = ""; + try + { + if (_listBox != null) + { + string strList = ""; + for (int i = 0; i < _listBox.Items.Count; i++) + { + strList += _listBox.Items[i] + @"/"; + } + sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd") + " 结果:" + strList); + } + else + { + sw.WriteLine("内容:" + type + " 日期:" + DateTime.Now.ToString("yyyy-MM-dd")); + } + //写入列标题 + for (int i = 0; i < _dataGridView.ColumnCount; i++) + { + if (i > 0) + { + columnTitle += "\t"; + } + columnTitle += _dataGridView.Columns[i].HeaderText; + } + sw.WriteLine(columnTitle); + + //写入列内容 + for (int j = 0; j < _dataGridView.Rows.Count; j++) + { + string columnValue = ""; + for (int k = 0; k < _dataGridView.Columns.Count; k++) + { + if (k > 0) + { + columnValue += "\t"; + } + if (_dataGridView.Rows[j].Cells[k].Value == null) + { + columnValue += ""; + } + else + { + columnValue += _dataGridView.Rows[j].Cells[k].Value.ToString().Trim(); + } + } + + sw.WriteLine(columnValue); + } + sw.Close(); + myStream.Close(); + if (MessageBox.Show("导出Excel文件成功!是否打开?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + Process.Start(dlg.FileName); + } + } + catch (Exception ex) + { + //MessageBox.Show(ex.ToString()); + } + finally + { + sw.Close(); + myStream.Close(); + } + } + } + /// + /// 垂直净距分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX4_Click(object sender, EventArgs e) + { + if (dataGridViewX3.Rows.Count > 0) + { + ExportExcel("垂直净距分析", dataGridViewX3, listBox1); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 水平净距分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX4_Click_shuiping(object sender, EventArgs e) + { + if (dataGridViewX9.Rows.Count > 0) + { + ExportExcel("水平净距分析", dataGridViewX9, listBox3); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 碰撞分析功能界面中 选择管线复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX3_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + if (checkBoxX3.Checked) + { + comboBoxEx2.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxEx2.Enabled = false; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + trackflag = "collision"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxEx2.Enabled = true; + } + } + /// + /// 碰撞分析功能界面中 选择图层复选框 选中状态改变事件处理 + /// + /// + /// + private void checkBoxX4_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight(); + comboBoxEx2.Enabled = checkBoxX4.Checked; + if (checkBoxX4.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + + comboBoxEx2.SelectedIndex = -1; + + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 碰撞分析功能界面中 选择图层下拉框 选中项改变事件处理 + /// + /// + /// + private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxEx2.SelectedIndex <= -1) return; + listBox2.Items.Clear(); + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx2.SelectedItem.ToString()); + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) return; + GSOFeatures feats = flayer.GetAllFeatures(); + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewX4.Rows.Add(); + dataGridViewX4.Rows[idx].Cells[0].Value = comboBoxEx2.SelectedItem.ToString(); + dataGridViewX4.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + /// + /// 清除所有图层中的所有feature对象的高亮状态 功能 + /// + private void clearFeatureHighLight() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (!(layer is GSOFeatureLayer)) continue; + GSOFeatures feats = layer.GetAllFeatures(); + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feat = feats[j]; + feat.HighLight = false; + GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; + if (lineStyle == null) continue; + lineStyle.ArrowVisible = false; + feat.Geometry.SetModified(true); + } + } + for (int i = 0; i < globeControl2.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl2.Globe.Layers[i]; + if (!(layer is GSOFeatureLayer)) continue; + GSOFeatures feats = layer.GetAllFeatures(); + for (int j = 0; j < feats.Length; j++) + { + GSOFeature feat = feats[j]; + feat.HighLight = false; + } + } + + if (globeControl1.Globe.Action == EnumAction3D.SelectObject) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + } + /// + /// 碰撞分析功能界面中 清除分析结果按钮 事件处理 + /// + /// + /// + private void buttonX8_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + comboBoxEx2.Enabled = false; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + listBox2.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 碰撞分析功能界面中 导出Excel按钮 事件处理 + /// + /// + /// + private void buttonX6_Click(object sender, EventArgs e) + { + if (dataGridViewX5.Rows.Count > 0) + { + ExportExcel("碰撞分析", dataGridViewX5, listBox2); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 碰撞分析 功能界面中 关闭按钮 事件处理 + /// + /// + /// + private void buttonX7_Click_1(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel2.Visible = false; + checkBoxX3.Checked = false; + checkBoxX4.Checked = false; + comboBoxEx2.SelectedIndex = -1; + dataGridViewX4.Rows.Clear(); + dataGridViewX5.Rows.Clear(); + if (buttonItem1.Checked) + sideBar1.ExpandedPanel = sideBarPanelItem3; + else + sideBar1.Visible = false; + Refresh(); + } + /// + /// 覆土分析 功能界面中的 清除分析结果 按钮事件处理 + /// + /// + /// + private void buttonX16_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxX5.Checked = false; + checkBoxX6.Checked = false; + comboBoxEx3.SelectedIndex = -1; + comboBoxEx3.Enabled = false; + textBoxX3.Text = "1"; + dataGridViewX6.Rows.Clear(); + dataGridViewX7.Rows.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 开始分析按钮 分析绘制的七线和管线的距离是否符合标准 + /// + /// + /// + private void buttonStartAnalysis_Click(object sender, EventArgs e) + { + if (!checkBoxSelectPipeline.Checked && !checkBoxSelectLayer.Checked) + { + MessageBox.Show("请确定是选择管线还是选择图层!", "提示"); + return; + } + if (textBoxVerticalDistance.Text.Trim() == "") + { + MessageBox.Show("垂直净距标准不能为空!", "提示"); + return; + } + if (textBoxHorizontalDistance.Text.Trim() == "") + { + MessageBox.Show("水平净距标准不能为空!", "提示"); + return; + } + double dVerticalJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxVerticalDistance.Text.Trim(), out dVerticalJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的垂直净距标准!", "提示"); + return; + } + double dHorizontalJingJuBiaoZhun = 0.0; + if (!double.TryParse(textBoxHorizontalDistance.Text.Trim(), out dHorizontalJingJuBiaoZhun)) + { + MessageBox.Show("请输入正确的水平净距标准!", "提示"); + return; + } + + if (dataGridViewLineList.Rows.Count > 0) + { + featCount.Clear(); + featLenth.Clear(); + listBoxStasticsResult.Items.Clear(); + layerTemp.RemoveAllFeature(); + //polygonJingJuAnalysises.RemoveAll(); + clearFeatureHighLight(); + dataGridViewAnalysisResult.Rows.Clear(); + m_FeaturesWithBianhao.Clear(); + Cursor = Cursors.WaitCursor; + if (checkBoxSelectPipeline.Checked) // 选择管线 + { + for (int i = 0; i < dataGridViewLineList.Rows.Count; i++) + { + GSOFeature selectedFeature = dataGridViewLineList.Rows[i].Tag as GSOFeature; + if (selectedFeature != null) + { + selectState = 1; +// VerticalDistanceAnalysis("间距分析", selectedFeature, Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析 + } + } + } + else if (checkBoxSelectLayer.Checked) // 选择图层 + { + if (comboBoxLayer.SelectedItem == null) + { + MessageBox.Show("请选择一个图层!", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); + if (layer == null) + { + return; + } + + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) + { + return; + } + + GSOFeatures feats = flayer.GetAllFeatures(); + if (feats == null) + { + return; + } + for (int i = 0; i < feats.Length; i++) + { + selectState = 1; +// VerticalDistanceAnalysis("间距分析", feats[i], Utility.m_PipelineLayerNames, dVerticalJingJuBiaoZhun, dHorizontalJingJuBiaoZhun);//分析 + } + } + if (featCount.Count > 0) + { + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (featCount.ContainsKey(Utility.m_PipelineLayerNames[i]) && featLenth.ContainsKey(Utility.m_PipelineLayerNames[i])) + { + listBoxStasticsResult.Items.Add(Utility.m_PipelineLayerNames[i] + ":" + featCount[Utility.m_PipelineLayerNames[i]] + "条,共" + featLenth[Utility.m_PipelineLayerNames[i]].ToString("0.00") + "米"); + } + } + } + if (dataGridViewAnalysisResult.Rows.Count == 0 && selectState == 1) + { + MessageBox.Show("没有不符合间距分析标准的管线!", "提示"); + } + } + else + { + MessageBox.Show("请选中要进行间距分析的管线!", "提示"); + } + globeControl1.Refresh(); + Cursor = Cursors.Default; + } + /// + /// 间距分析 清除分析结果 + /// + /// + /// + private void buttonClearAnalysisResult_Click(object sender, EventArgs e) + { + trackflag = ""; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + + checkBoxSelectLayer.Checked = false; + checkBoxSelectPipeline.Checked = false; + comboBoxLayer.SelectedIndex = -1; + comboBoxLayer.Enabled = false; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + listBoxStasticsResult.Items.Clear(); + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 导出Excel按钮 将间距分析的结果以Excel表格的形式导出 + /// + /// + /// + private void buttonExportExcel_Click(object sender, EventArgs e) + { + if (dataGridViewAnalysisResult.Rows.Count > 0) + { + ExportExcel("间距分析", dataGridViewAnalysisResult, listBoxStasticsResult); + } + else + { + MessageBox.Show("表格内容为空!", "提示"); + } + } + /// + /// 间距分析 关闭按钮 + /// + /// + /// + private void buttonClosePanel_Click(object sender, EventArgs e) + { + trackflag = ""; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panelSpacingAnalysis.Visible = false; + checkBoxSelectPipeline.Checked = false; + checkBoxSelectLayer.Checked = false; + comboBoxLayer.SelectedIndex = -1; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + + sideBar1.Visible = false; + Refresh(); + } + /// + /// 间距分析 分析结果表格双击定位 + /// + /// + /// + private void dataGridViewAnalysisResult_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) + { + if (e.Button == MouseButtons.Left && e.RowIndex > -1) + { + GSOFeature rowFeature = dataGridViewAnalysisResult.Rows[e.RowIndex].Tag as GSOFeature; + if (rowFeature != null) + { + if (rowFeature.Geometry != null && rowFeature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line = rowFeature.Geometry as GSOGeoPolyline3D; + if (line == null) return; + double length = line.GetSpaceLength(true, 6378137); + GSOGeoPolyline3D lineLine = line.GetSegment(0, length / 2); + GSOPoint3d point3d = lineLine[lineLine.PartCount - 1][lineLine[lineLine.PartCount - 1].Count - 1]; + + globeControl1.Globe.JumpToPosition(point3d, EnumAltitudeMode.Absolute, 5); + } + else + globeControl1.Globe.JumpToFeature(rowFeature, 5); + } + } + } + /// + /// 间距分析 选择管线复选框 + /// + /// + /// + private void checkBoxSelectPipeline_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + if (checkBoxSelectPipeline.Checked) + { + comboBoxLayer.SelectedItem = null; + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + comboBoxLayer.Enabled = false; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + trackflag = "spacing"; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + else + { + comboBoxLayer.Enabled = true; + } + } + /// + /// 间距分析 选择图层复选框 + /// + /// + /// + private void checkBoxSelectLayer_CheckedChanged(object sender, EventArgs e) + { + clearFeatureHighLight();//清除高亮 + comboBoxLayer.Enabled = checkBoxSelectLayer.Checked; + if (checkBoxSelectLayer.Checked) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + trackflag = ""; + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + + comboBoxLayer.SelectedIndex = -1; + } + globeControl1.Globe.ClearAnalysis(); + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 间距分析 选择图层下拉框 + /// + /// + /// + private void comboBoxLayer_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxLayer.SelectedIndex > -1) + { + dataGridViewLineList.Rows.Clear(); + dataGridViewAnalysisResult.Rows.Clear(); + listBoxStasticsResult.Items.Clear(); + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxLayer.SelectedItem.ToString()); + GSOFeatureLayer flayer = layer as GSOFeatureLayer; + if (flayer == null) + return; + GSOFeatures feats = flayer.GetAllFeatures(); + if (feats == null) + return; + for (int i = 0; i < feats.Length; i++) + { + int idx = dataGridViewLineList.Rows.Add(); + dataGridViewLineList.Rows[idx].Cells[0].Value = comboBoxLayer.SelectedItem.ToString(); + dataGridViewLineList.Rows[idx].Cells[1].Value = feats[i].Name; + } + } + } + /// + /// 碰撞分析 + /// + /// + /// + private void buttonItemFX1_1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "碰撞分析"); + + dataGridViewX4.Size = new Size(195, 120); + dataGridViewX5.Size = new Size(195, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞分析"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 覆土分析 + /// + /// + /// + private void buttonItemFX1_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "覆土分析"); + dataGridViewX6.Size = new Size(195, 120); + dataGridViewX7.Size = new Size(195, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土分析"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 间距分析 + /// + /// + /// + private void buttonItemFX1_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "间距分析"); + + dataGridViewLineList.Size = new Size(185, 120); + dataGridViewAnalysisResult.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "间距分析"; + trackflag = "spacing"; + controlContainerItem5.Control = panelSpacingAnalysis; + panelSpacingAnalysis.Dock = DockStyle.Fill; + panelSpacingAnalysis.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + + Refresh(); + } + /// + /// 垂直净距分析 + /// + /// + /// + private void buttonItemFX1_4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "垂直净距分析"); + dataGridViewX2.Size = new Size(185, 92); + dataGridViewX3.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距分析"; + trackflag = "vertical"; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距分析 + /// + /// + /// + private void buttonItemFX1_5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平净距分析"); + dataGridViewX8.Size = new Size(185, 120); + dataGridViewX9.Size = new Size(185, 120); + + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距分析"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 碰撞审查 + /// + /// + /// + private void buttonItemSH1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH1.Text); + + dataGridViewX4.Size = new Size(185, 92); + dataGridViewX5.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "碰撞审查"; + trackflag = "collision"; + controlContainerItem5.Control = panel2; + panel2.Dock = DockStyle.Fill; + panel2.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + + Refresh(); + } + /// + /// 覆土审查 + /// + /// + /// + private void buttonItemSH2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH2.Text); + + dataGridViewX6.Size = new Size(185, 92); + dataGridViewX7.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "覆土审查"; + trackflag = "ftAnalysis"; + controlContainerItem5.Control = panel4; + panel4.Visible = true; + panel4.Dock = DockStyle.Fill; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 水平净距审查 + /// + /// + /// + private void buttonItemSH3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH3.Text); + + dataGridViewX8.Size = new Size(190, 92); + dataGridViewX9.Size = new Size(190, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "水平净距审查"; + trackflag = "horizontal"; + controlContainerItem5.Control = panel5; + panel5.Dock = DockStyle.Fill; + panel5.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + /// + /// 垂直净距审查 + /// + /// + /// + private void buttonItemSH4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH4.Text); + + dataGridViewX2.Visible = true; + dataGridViewX3.Visible = true; + dataGridViewX2.Size = new Size(185, 92); + dataGridViewX3.Size = new Size(185, 120); + + layerTemp.RemoveAllFeature(); + clearFeatureHighLight(); + + globeControl1.Refresh(); + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "垂直净距审查"; + trackflag = "vertical"; + //globeControl1.Globe.Action = EnumAction3D.SelectObject; + panel2.Visible = false; + panel3.Visible = false; + panel5.Visible = false; + panel4.Visible = false; + controlContainerItem5.Control = panel1; + panel1.Dock = DockStyle.Fill; + panel1.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + #endregion + + /// + /// 添加指定路径下的数据 功能 + /// + /// + /// + private object AddLayerData(string strDataPath) + { + object objRes = null; + string extension = Path.GetExtension(strDataPath); + if (extension != null && extension.ToLower().Equals(".kml")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer == null) return objRes; + CheckDatasetGeoReference(layer.Dataset, ""); + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + else if (GSOUtility.IsDatasetSupportTerrain(strDataPath)) + { + GSOTerrain terrain = globeControl1.Globe.Terrains.Add(strDataPath); + objRes = terrain; + if (terrain == null) return objRes; + TreeNode node = new TreeNode(); + node.Tag = terrain; + node.Text = terrain.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = terrain.Visible; + layerManagerNode.Nodes.Insert(0, node); + newlayername = terrain.Caption; + } + else if (extension != null && extension.ToLower().Equals(".dxf")) + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + objRes = layer; + if (layer == null) return objRes; + 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; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + else + { + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + + objRes = layer; + if (layer == null) + { + MessageBox.Show("layer is null"); + return objRes; + } + 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; + layerManagerNode.Nodes.Insert(0, node); + newlayername = layer.Caption; + } + return objRes; + } + /// + /// 连接数据库 菜单事件处理 + /// + /// + /// + private void ConnectDB(object sender, EventArgs e) + { + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 根据指定图层创建图层节点并将节点添加到图层管理节点的子节点集合中 + /// + /// + private void addNodeToLayerManagerNode(GSOLayer layer) + { + if (layer == null) return; + CheckDatasetGeoReference(layer.Dataset, ""); + + TreeNode node = new TreeNode(); + node.Tag = layer; + node.Text = layer.Dataset.Caption; + node.ImageIndex = 0; + node.SelectedImageIndex = 0; + node.Checked = layer.Visible; + + if (layerManagerNode.Nodes.Contains(node)) return; + layerManagerNode.Nodes.Insert(0, node); + layerManagerNode.Expand(); + } + + /// + /// 图层节点树中 节点 右键单击事件处理 + /// + /// + /// + private void layerMarkerTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Button != MouseButtons.Right||e.Node.Parent==null) return; + if (e.Node.Parent.Text.Equals("标注管理") ) + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else if (e.Node.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip2.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip2.Tag = e.Node; + } + else + { + if (!(e.Node.Tag is GSOFeature)||e.Node.Parent.Parent==null) return; + if (e.Node.Parent.Parent.Text.Equals("标注管理")) + { + layerMarkerTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerMarkerTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + else if (e.Node.Parent.Parent.Text.Equals("传感器管理")) + { + layerSensorTree.SelectedNode = e.Node; + contextMenuStrip3.Show(layerSensorTree, e.X, e.Y); + contextMenuStrip3.Tag = e.Node; + } + } + } + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 刷新列表 菜单 + /// + /// + /// + private void toolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + if (node == null) return; + TreeNode parentNode = node.Parent; + + if (parentNode.Text.Equals("标注管理") || parentNode.Text.Equals("传感器管理")) + { + RefreshTreeNodeLayerFeatureList(node); + } + } + + /// + /// 给指定的图层节点添加代表feature对象的子节点 + /// + /// + private void RefreshTreeNodeLayerFeatureList(TreeNode layerTreeNode) + { + layerTreeNode.Nodes.Clear(); + GSOLayer layer = (GSOLayer)layerTreeNode.Tag; + // 只将类型为内存数据集的图层列出,如果是其它类型的数据集可能数据量太大,没发显示在树控件中 + if (layer.Dataset is GSOFeatureDataset) + { + VisitFeature3Ds(layer.GetAllFeatures(), layerTreeNode); + } + } + + /// + /// 标注管理、传感器管理 图层目录树的右键菜单中的 移除所有 菜单 + /// + /// + /// + private void toolStripMenuItem2_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip3.Tag as TreeNode; + if (node == null) return; + GSOFeature feature3D = node.Tag as GSOFeature; + if (feature3D == null) return; + feature3D.Delete(); + globeControl1.Globe.Refresh(); + node.Remove(); + } + /// + /// 图层目录树的 节点对应的复选框选中状态改变事件处理 + /// + /// + /// + private void layerMarkerTree_AfterCheck(object sender, TreeViewEventArgs e) + { + if (e.Action != TreeViewAction.Unknown) + { + //wxl优化标注管理树形结构 + TreeUtils.TreeNodeCheckedChange(globeControl1,e.Node); + } + } + + /// + /// 标注管理、传感器管理 目录树中的feature节点的右键菜单中的 删除 菜单 + /// + /// + /// + private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = contextMenuStrip2.Tag as TreeNode; + GSOLayer l = globeControl1.Globe.Layers.GetLayerByCaption(node.Text); + if (l == null) return; + l.RemoveAllFeature(); + node.Nodes.Clear(); + globeControl1.Refresh(); + } + //定时检查传感器的状态 待完善 + public Timer timerOfSensor = null; + /// + /// 一键审核---导入数据 + /// + /// + /// + private void buttonItem127_Click_2(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "打开数据"); + + 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); + if (shds == null) + { + MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, shds, true); + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + catch (Exception ex) + { + LogError.PublishError(ex); + MessageBox.Show("内存过载请清理内存,并重新启动规划分析!", "提示"); + } + } + /// + ///自动导出图片 + /// + /// + /// + private void buttonItem130_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "导出审核图"); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 一键审核功能 + /// + /// + /// + private void buttonItem128_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem128.Text); + if (boolfrmShResult) + {//关闭等待窗口,否则会一直存在下去 + MessageBox.Show("正在审核或关闭上次审核结果才能进行审核"); + return; + } + boolfrmShResult = true; + frmSh = new FrmYJSHTC(globeControl1, globeControl2, layerTree);//layerManagerNode + if (frmSh.ShowDialog() == DialogResult.OK) + { + frmWait = new FrmWait("一键审核……"); + frmWait.Location = new Point(Width - frmWait.Width - 10, Height - frmWait.Height - 50); + frmWait.Owner = this; + frmWait.Show(); + Thread thread = new Thread(doWork); + thread.IsBackground = true; + thread.Start(); + } + } + + void doWork() + { + FrmShResult frmShResult; + if (frmSh.rukuLayer != null) + { + try + { + this.Invoke((EventHandler)delegate + { + TreeUtils.AddNodeToManagerNode(layerManagerNode, frmSh.rukuLayer); + }); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "提示"); + } + + shlayername = frmSh.rukuLayer.Name; + globeControl1.Refresh(); + } + + frmShResult = new FrmShResult(shlayername, globeControl1, Utility.m_PipelineLayerNames); + frmShResult.Location = new Point(Width - frmShResult.Width - 10, Height - frmShResult.Height - 50); + frmShResult.Owner = this; + frmShResult.analysis(); + + try + { + this.Invoke((EventHandler)delegate + { + frmShResult.Show(); + returnShTap(); + }); + } + catch (Exception ex) + { + MessageBox.Show("系统运行错误:" + ex, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } +// boolfrmShResult = true; + } + + void returnShTap() + { + frmWait.Close(); + ribbonTabItem11.Checked = true; + globeControl1.Globe.Action = EnumAction3D.ActionNull; + splitContainer1.Panel2Collapsed = true; + + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + /// + /// 清除渲染结果 + /// + public void ClearRedlineAnalyseResult() + { + for (int i = 0; i < globeControl1.Globe.Layers.Count; i++) + { + GSOLayer layer = globeControl1.Globe.Layers[i]; + if (layer.Caption == "tempLgdData") + { + layer.RemoveAllFeature(); + } + } + + layerTemp.RemoveAllFeature(); + globeControl1.Refresh(); + } + /// + /// 审核入库 + /// + /// + /// + private void buttonItem133_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "审核入库"); + FrmShRK frmShrk = new FrmShRK(globeControl1); + frmShrk.Show(); + } + /// + /// 模拟设计修改 + /// + /// + /// + private void buttonItem134_Click_1(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "模拟设计修改"); + + frmModify = new FrmMnModify(globeControl1, shlayername, shresultLists); + + if (boolfrmModify) return; + frmModify.Owner = this; + frmModify.Location = new Point(Width - frmModify.Width - 10, Height - frmModify.Height - 50); + frmModify.Show(); + boolfrmModify = true; + } + /// + /// 一键审核中调节透明度 + /// + /// + /// + private void sliderItem1_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem1.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem1.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + + if (layer != null) + layer.Opaque = 100 - sliderItem1.Value; + optiValue = sliderItem1.Value; + } + /// + /// 红线审核中的透明度分析 + /// + /// + /// + private void sliderItem3_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem3.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem3.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + if (layer != null) + layer.Opaque = 100 - sliderItem3.Value; + optiValue = sliderItem3.Value; + } + #region yanxiaowei + //初始化DataGridViewX1控件 + public delegate void DataGridViewDelegate(DataTable dt, string strLable, string strLayer, bool initDataGrid); + /// + /// 代理函数,操作DatgridViewX1 + /// + /// + /// + public void InitDataGridViewX1(DataTable dt, string strLable, string strLayer, bool initDataGrid) + { + if (initDataGrid) + { + dataGridViewX1.DataSource = dt; + panelOfTable.Visible = true; + toolStripNumbers.Text = strLable; + dataGridViewX1.Tag = strLayer; + } + else + { + dataGridViewX1.DataSource = null; + dataGridViewX1.Refresh(); + panelOfTable.Visible = false; + toolStripNumbers.Text = ""; + dataGridViewX1.Tag = ""; + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); //清除双击产生的标注 + } + } + FrmAnalysisGuiHuaResult from; + /// + /// 主窗体下方属性表格 双击定位 功能 + /// + /// + /// + private void dataGridViewX1_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (!redSH) + { + if (e.Button == MouseButtons.Left) + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex < 0) return; + string featureName = ""; + if (dataGridViewX1.Columns.Contains("编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); + } + else if (dataGridViewX1.Columns.Contains("标识器编号")) + { + featureName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["标识器编号"].Value.ToString(); + } + featureName = featureName.Trim(); + + GSOLayer layer = null; + layer = globeControl1.Globe.Layers.GetLayerByCaption(dataGridViewX1.Tag.ToString()); + + if (layer == null) return; + + GSOFeatures features = layer.GetFeatureByName(featureName, false); + if (features.Length == 0) return; + GSOFeature rowFeature = features[0]; + + ClassSearchAnalysis.AddMakerToLineFeature(globeControl1, rowFeature); + } + } + else + { + if (e.Button == MouseButtons.Left) + { + if (from != null && !from.IsDisposed) + { + try + { + from.Close(); + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + try + { + DataGridView.HitTestInfo hittestinfo = dataGridViewX1.HitTest(e.X, e.Y); + if (hittestinfo.RowIndex < 0) return; + string layerName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["管线类型"].Value.ToString(); + string redLineName = dataGridViewX1.Rows[hittestinfo.RowIndex].Cells["红线编号"].Value.ToString(); + FrmAnalysisGuiHuaResult frm = new FrmAnalysisGuiHuaResult(globeControl1, layerName, redLineName); + frm.Location = new Point(Width - frm.Width - 10, Height - frm.Height - 20); + frm.Show(this); + from = frm; + } + catch (Exception ex) + { + LogError.PublishError(ex); + } + } + } + } + /// + /// 空间查询 + /// + /// + /// + private void 空间查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "空间查询"); + + trackflag = "PipelineSpatialQuery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 关键字查询 + /// + /// + /// + private void 关键字查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "关键字查询"); + + FrmKeywordQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 编号查询 + /// + /// + /// + private void 编号查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "编号查询"); + + FrmCodingQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 坐标查询 + /// + /// + /// + private void 坐标查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "坐标查询"); + + FrmSetLatLonPos.ShowForm(globeControl1); + } + /// + /// 附属物查询 + /// + /// + /// + private void 附属物查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物查询"); + + FrmFittingQuery.ShowForm(globeControl1, Utility.instrumenLayerNames, InitDataGridViewX1); + } + /// + /// 管径查询 + /// + /// + /// + private void 管径查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径查询"); + + FrmDiameterQuery.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 材质查询 + /// + /// + /// + private void 材质查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质查询"); + + FrmMaterialSel.ShowForm(globeControl1, Utility.m_PipelineLayerNames, InitDataGridViewX1); + } + /// + /// 基本查询 + /// + /// + /// + private void 基本查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "基本查询"); + + FrmBasicQuery.ShowForm(globeControl1, InitDataGridViewX1); + } + /// + /// 复合查询 + /// + /// + /// + private void 复合查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "复合查询"); + + FrmQuerySQL.ShowForm(globeControl1, InitDataGridViewX1); + } + /// + /// 关联查询 + /// + /// + /// + private void 关联查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "关联查询"); + + if (globeControl1.Globe.SelObjectCount != 1) + { + MessageBox.Show("请选中一个对象!", "提示"); + return; + } + double valueAllowance = 1.0; + + for (int j = 0; j < globeControl1.Globe.SelObjectCount; j++) + { + GSOFeature feature = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(j, out feature, out layer); + + if (feature == null && feature.Geometry == null || (feature.Geometry.Type == EnumGeometryType.GeoPolygon3D + || feature.Geometry.Type == EnumGeometryType.GeoWater)) + return; + ClassSearchAnalysis.ResultRelationAnalysis(globeControl1, feature, Utility.valueLayerNames, Utility.workwellLayerNames, + Utility.instrumenLayerNames, Utility.pipefittingLayerNames, Utility.m_PipelineLayerNames, valueAllowance); + } + } + #endregion + /// + /// 清除分析(完善) + /// + /// + /// + private void buttonItemClear_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "清除分析"); + + globeControl1.Globe.ClearMeasure(); + layerTemp.RemoveAllFeature(); + 高度量算ToolStripMenuItem1.Checked = false; + + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + + globeControl1.Globe.MemoryLayer.RemoveAllFeature(); + globeControl2.Globe.MemoryLayer.RemoveAllFeature(); + globeControl1.Globe.ClearAnalysis(); + + // 清除净距分析结果 + buttonX2_Click(null, null); + buttonX8_Click(null, null); + buttonX15_Click(null, null); + buttonX16_Click(null, null); + buttonClearAnalysisResult_Click(null, null); + + NetworkAnalysisTool.ClearAllTopAnalysis(globeControl1); + + globeControl1.Globe.UnderGroundFloor.Visible = false;//隐藏地下网格线 + + // ClearUpDownTraceAnalysis(); //清除上下游分析 + globeControl1.Globe.RemoveAllPits();//清除所有坑 + MarkTools.removeAllMarker(globeControl1);//清除所有标注 + #region wxl 这段不清楚什么用处,注释掉,对系统没有影响 + + // if (layerMarkerTree != null && layerMarkerTree.Nodes.Count > 0) + // { + // for (int i = 0; i < layerMarkerTree.Nodes[0].Nodes.Count; i++) + // { + // layerMarkerTree.Nodes[0].Nodes[i].Nodes.Clear(); + // } + // } + #endregion + + clearFeatureHighLight();//取消管线高亮 + + GSOLayer layerGround = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layerGround != null) + { + layerGround.Visible = true; + } + globeControl1.Refresh(); + globeControl2.Refresh(); + ClearRedlineAnalyseResult(); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 管线长度全区域统计 + /// + /// + /// + private void 管线长度统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + FrmAllPipelineStatis frm = new FrmAllPipelineStatis(globeControl1, null, InitDataGridViewX1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 管线长度绘制区域统计 + /// + /// + /// + private void 管线长度统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管线长度统计"); + + trackflag = "PipelineDistanceStatistics"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 阀门数量全区域统计 + /// + /// + /// + private void 阀门数量统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + FrmValveStatistics frm = new FrmValveStatistics(globeControl1, null, InitDataGridViewX1); + frm.Show(this); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + /// + /// 阀门数量绘制区域统计 + /// + /// + /// + private void 阀门数量统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "阀门数量统计"); + + trackflag = "valvequery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 井盖数量全区域统计 + /// + /// + /// + private void 井盖数量统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + FrmAllWorkWellStatis frm = new FrmAllWorkWellStatis(globeControl1, null, InitDataGridViewX1); + frm.Show(this); + } + /// + /// 井盖数量绘制区域统计 + /// + /// + /// + private void 井盖数量统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "井盖数量统计"); + + trackflag = "workwellquery"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + } + /// + /// 管径分段统计全区域统计 + /// + /// + /// + private void 管径分段统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 管径分段统计绘制区域统计 + /// + /// + /// + private void 管径分段统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分段统计"); + + trackflag = null; + Frmpipediameterstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 埋深分段统计全区域统计 + /// + /// + /// + private void 埋深分段统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 埋深分段统计绘制区域统计 + /// + /// + /// + private void 埋深分段统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "埋深分段统计"); + trackflag = null; + FrmpipeDeepstatis.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 管径分类统计全区域统计 + /// + /// + /// + private void 管径分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 管径分类统计绘制区域统计 + /// + /// + /// + private void 管径分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "管径分类汇总"); + + trackflag = null; + FrmpipeDiametergather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 材质分类统计全区域统计 + /// + /// + /// + private void 材质分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 0); + } + /// + /// 材质分类统计绘制区域统计 + /// + /// + /// + private void 材质分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "材质分类汇总"); + + trackflag = null; + FrmpipeMaterialGather.ShowForm(globeControl1, Utility.m_PipelineLayerNames, 1); + } + /// + /// 附属物分类统计全区域统计 + /// + /// + /// + private void 附属物分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 0); + } + /// + /// 附属物分类统计绘制区域统计 + /// + /// + /// + private void 附属物分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分类汇总"); + + trackflag = null; + FrmAccessoriesgather.ShowForm(globeControl1, Utility.instrumenLayerNames, 1); + } + #region Predaotr,断面分析 + /// + /// 横断面分析 + /// + /// + /// + private void 横断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.HDM_Analysis; + } + /// + /// 纵断面分析 + /// + /// + /// + private void 纵断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 1) + { + MessageBox.Show("请选择一条或者多条管线!", "提示", MessageBoxButtons.OK, + MessageBoxIcon.Information); + return; + } + GSOFeatures selectFeatures = new GSOFeatures(); + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature; + GSOLayer layer; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + if (feature != null && feature.Geometry != null && feature.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + selectFeatures.Add(feature); + } + } + List feats = SectionAnalysisTool.ZDMAnalysis(selectFeatures); + if (feats == null || feats.Count < 1) return; + FrmProfileAnalysis frm = new FrmProfileAnalysis(globeControl1, feats); + frm.Show(this); + } + /// + /// 道路断面分析 + /// + /// + /// + private void 道路断面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.DLDM_Analysis; + } + /// + /// 基线剖面分析 + /// + /// + /// + private void 基线剖面分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + trackPolylineEndMode = EnumTrackPolylineEndMode.JXPM_Analysis; + } + #endregion + /// + /// 创建拓扑 + /// + /// + /// + private void 创建拓扑ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建拓扑"); + + FrmGenAndFaMenTopu frm = new FrmGenAndFaMenTopu(globeControl1, Utility.m_PipelineLayerNames, Utility.valueLayerNames); + frm.Show(this); + } + #region Predator :拓扑分析 + /// + /// 上游分析 + /// + /// + /// + private void 上游分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "上游分析"); + NetworkTraceUpDown(true); + } + /// + /// 下游分析 + /// + /// + /// + private void 下游分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "下游分析"); + NetworkTraceUpDown(false); + } + /// + /// 上下游追踪 功能 + /// + /// + private void NetworkTraceUpDown(Boolean bTraceUp) + { + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.TraceUpDownAnalysis(bTraceUp, + selLineFeature, selLayer); + } + /// + /// 流向分析 + /// + /// + /// + private void 流向分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "流向分析"); + + FrmFlow frm = new FrmFlow(globeControl1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 关阀分析 + /// + /// + /// + private void 关阀分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 1) + { + MessageBox.Show("请选中至少一根管线!!"); + 流向分析ToolStripMenuItem.Checked = false; + return; + } + GSOLayer resLayer = null; + GSOFeature resFeature = null; + globeControl1.Globe.GetSelectObject(0, out resFeature, out resLayer); + + String pipeLayerName = resLayer.Caption; + String pipeLayerNamePrefix = pipeLayerName.Substring(0, pipeLayerName.IndexOf("管线")); + GSOLayer valveLayer = globeControl1.Globe.Layers[pipeLayerNamePrefix + "阀门"]; + if (valveLayer == null) + { + MessageBox.Show("无" + pipeLayerNamePrefix + "阀门图层", "提示"); + return; + } + + GSOFeatures valveFeats = NetworkAnalysisTool.CloseValvesAnalysis(resFeature, + resLayer, valveLayer); + + if (valveFeats != null) + { + FrmCloseValves frm = new FrmCloseValves(globeControl1, valveFeats); + frm.Show(this); + } + else + { + MessageBox.Show("未找到关闭阀门"); + } + } + /// + /// 连通分析 + /// + /// + /// + private void 连通分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + if (globeControl1.Globe.SelObjectCount < 2) + { + MessageBox.Show("请选中至少两个管线!!"); + 连通分析ToolStripMenuItem.Checked = false; + return; + } + GSOFeature selFeat0, selFeat1; + GSOLayer layer0, layer1; + globeControl1.Globe.GetSelectObject(0, out selFeat0, out layer0); + globeControl1.Globe.GetSelectObject(1, out selFeat1, out layer1); + + if (!layer0.IsSameInnerObject(layer1)) + { + MessageBox.Show("不在同一个图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + 连通分析ToolStripMenuItem.Checked = false; + return; + } + NetworkAnalysisTool.ConnexityAnalysis(selFeat0, selFeat1, layer0); + } + /// + /// 爆管分析 + /// + /// + /// + private void 爆管分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + NetworkTraceUpDown(true); //上游追踪: + + GSOFeature selLineFeature = globeControl1.Globe.SelectedObject; + if (selLineFeature == null || selLineFeature.Geometry == null || selLineFeature.Geometry.Type != EnumGeometryType.GeoPolyline3D) + { + MessageBox.Show("请点击“编辑”—“选中对象”选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + GSOLayer selLayer = globeControl1.Globe.SelectedObjectLayer; + + NetworkAnalysisTool.ExplodeAnalysis(globeControl1, selLineFeature, selLayer); + + 关阀分析ToolStripMenuItem_Click(sender, e); //关阀分析: + } + #endregion + /// + /// 多边形开挖 + /// + /// + /// + private void 多边形开挖ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "多边形开挖"); + + trackflag = "pit"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; //是这个么?是的,在模型上 + } + /// + /// 挖方量分析 + /// + /// + /// + private void 挖方量分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "挖方量分析"); + + trackflag = "digFillAnalysis"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + globeControl1.Globe.TrackPolygonTool.TrackMode = EnumTrackMode.SpaceTrack; + ActionToolMenuChecked(); + } + /// + /// 沿线开挖 + /// + /// + /// + private void 沿线开挖ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "沿线开挖"); + + if (!沿线开挖ToolStripMenuItem.Checked) + { + FrmDigPitSetting dlg = new FrmDigPitSetting(m_dDigPitValue, m_bDigPitByDepth, m_dDigPitWidthAlongLine); + if (dlg.ShowDialog() == DialogResult.OK) + { + m_dDigPitValue = dlg.m_dDigPitValue; + m_bDigPitByDepth = dlg.m_bDigPitByDepth; + m_dDigPitWidthAlongLine = dlg.m_dDigPitWidthAlongLine; + trackflag = "LineDigPit"; + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = true; + globeControl1.Globe.TrackPolylineTool.TrackMode = EnumTrackMode.SpaceTrack; + 沿线开挖ToolStripMenuItem.Checked = true; + } + } + else + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + 沿线开挖ToolStripMenuItem.Checked = false; + globeControl1.Globe.TrackPolylineTool.VerticalLineVisible = false; + } + ActionToolMenuChecked(); + } + /// + /// 创建隧道 + /// + /// + /// + private void 创建隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "创建隧道"); + + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + GSOLayer tunnel = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (tunnel == null) + MessageBox.Show("场景中未加载隧道图层!", "提示"); + else + { + globeControl1.Globe.DestLayerFeatureAdd = tunnel; + tunnel.Editable = true; + enumDesignMode = EnumDesignMode.AddTunnel; + + } + } + /// + /// 隐藏隧道 + /// + /// + /// + private void 隐藏隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "隐藏隧道"); + + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption("隧道"); + if (layer != null) + { + layer.Visible = !layer.Visible; + } + } + /// + /// 删除隧道 + /// + /// + /// + private void 删除隧道ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "删除隧道"); + + if (globeControl1.Globe.SelObjectCount > 0) + { + int tunnelCount = 0; + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature f = null; + GSOLayer layer = null; + globeControl1.Globe.GetSelectObject(i, out f, out layer); + if (f == null || f.Dataset.Caption != "隧道") continue; + tunnelCount++; + f.Delete(); + if (layer != null) + { + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + } + globeControl1.Refresh(); + } + if (tunnelCount == 0) + { + MessageBox.Show("请选中要删除的隧道!", "提示"); + } + } + else + { + MessageBox.Show("请选中要删除的隧道!", "提示"); + } + } + /// + /// 通视分析 + /// + /// + /// + private void 通视分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "通视分析"); + + globeControl1.Globe.Action = globeControl1.Globe.Action != EnumAction3D.VisibilityAnalysis ? EnumAction3D.VisibilityAnalysis : EnumAction3D.ActionNull; + } + /// + /// 可视域分析 + /// + /// + /// + private void 可视域分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "可视域分析"); + + globeControl1.Globe.Action = EnumAction3D.ViewshedAnalysis; + } + /// + /// 可视包络分析 + /// + /// + /// + private void 可视包络分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "可视包络分析"); + + globeControl1.Globe.Action = EnumAction3D.ViewEnvelopeAnalysis; + } + /// + /// 缓冲区分析 + /// + /// + /// + private void 缓冲区分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "缓冲区分析"); + + GSOFeature feat = globeControl1.Globe.SelectedObject; + if (feat == null) + { + MessageBox.Show("请选择要分析的要素!"); + return; + } + if (feat.Geometry.Type == EnumGeometryType.GeoPolyline3D) + { + GSOGeoPolyline3D line1 = feat.Geometry as GSOGeoPolyline3D; + if (line1 == null) + { + MessageBox.Show("请选择一条管线!"); + return; + } + + FrmBufferAnalysis frm = new FrmBufferAnalysis(globeControl1, line1, layerTemp); + frm.Show(this); + } + else + { + FrmBufferAnalysisBSQ frm = new FrmBufferAnalysisBSQ(globeControl1, layerTemp, bsqPT); + frm.Show(this); + } + + } + /// + /// 附属物分析 + /// + /// + /// + private void 附属物分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "附属物分析"); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + FrmAccessoryAnalysis dlg = new FrmAccessoryAnalysis(globeControl1, layerTemp); + dlg.Show(this); + } + /// + /// 无源淹没分析 + /// + /// + /// + private void 无源淹没分析ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "无源淹没分析"); + + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + trackflag = "FloodAnalysis"; + } + /// + /// 水平距离 + /// + /// + /// + private void 水平距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平距离"); + + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + 高度量算ToolStripMenuItem1.Checked = false; + } + /// + /// 垂直距离 + /// + /// + /// + private void 垂直距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "垂直距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureHeight; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + } + /// + /// 空间距离 + /// + /// + /// + private void 空间距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "空间距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = true; + } + /// + /// 地表距离 + /// + /// + /// + private void 地表距离ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "地表距离"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureDistance; + globeControl1.Globe.DistanceRuler.SpaceMeasure = false; + } + /// + /// 高度量算 + /// + /// + /// + private void 高度量算ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "高度量算"); + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + 高度量算ToolStripMenuItem1.Checked = !高度量算ToolStripMenuItem1.Checked; + if (!高度量算ToolStripMenuItem1.Checked) return; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + /// + /// 水平面积 + /// + /// + /// + private void 水平面积ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "水平面积"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureArea; + globeControl1.Globe.AreaRuler.SpaceMeasure = true; + } + /// + /// 地表面积 + /// + /// + /// + private void 地表面积ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "地表面积"); + + 高度量算ToolStripMenuItem1.Checked = false; + globeControl1.Globe.Action = EnumAction3D.MeasureArea; + globeControl1.Globe.AreaRuler.SpaceMeasure = false; + + } + + # region Fan 重构标注代码 + /// + /// 标高标注 + /// + /// + /// + private void 标高标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Altitude, ""); + } + /// + /// 管径标注 + /// +// GSOFeature radiusMarkerFeature; + private void 管径标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) //wxl增加为空判断,下面方法同理 + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Diameter, ""); + } + /// + /// 埋深标注 + /// + /// + /// + private void 埋深标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null||selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Depth, ""); + + } + /// + /// 坐标标注 + /// + /// + /// + private void 坐标标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Location, ""); + } + /// + /// 距离标注 + /// +// bool distanceMarker; + private void 距离标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, 距离标注ToolStripMenuItem.Text); + + globeControl1.Globe.Action = EnumAction3D.TrackPolyline; + } + /// + /// 自定义标注 + /// + /// + /// + private void 自定义标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmCustomLabel frm = new FrmCustomLabel(globeControl1, l, f); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Custom, frm.labelText); + } + } + /// + /// 扯旗标注 + /// + /// + /// + private void 扯旗标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmMarker frm = new FrmMarker(); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Flag, frm.markerContent); + } + } + /// + /// 坡度标注 + /// + /// + /// + private void 坡度标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature resFeature = FeatureStatisticsService.GetSelectedPipeline(globeControl1); + if (resFeature == null) + { + MessageBox.Show("请选中一根管线", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + GSOGeoPolyline3D selLine = resFeature.Geometry as GSOGeoPolyline3D; + if (selLine == null || selLine[0].Count <= 1) + { + return; + } + + MarkTools.getInstance().showMarker(resFeature, + globeControl1, EnumMarkLayer.Mark_Slope, ""); + } + /// + /// 属性标注 + /// + /// + /// + private void 属性标注ToolStripMenuItem_Click(object sender, EventArgs e) + { + GSOFeature f = globeControl1.Globe.SelectedObject; + GSOLayer l = globeControl1.Globe.SelectedObjectLayer; + FrmPropertiesMarker frm = new FrmPropertiesMarker(globeControl1, l, f); + if (frm.ShowDialog() == DialogResult.OK) + { + MarkTools.getInstance().showMarker(f, globeControl1, EnumMarkLayer.Mark_Property, frm.labelText); + } + } + /// + /// 标注管理 + /// + /// + /// + private void 标注管理ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, 标注管理ToolStripMenuItem.Text); + + 标注管理ToolStripMenuItem.Checked = !标注管理ToolStripMenuItem.Checked; + string[] markerStrs = new string[10]; + markerStrs[0] = "标高标注"; + markerStrs[1] = "管径标注"; + markerStrs[2] = "埋深标注"; + markerStrs[3] = "坐标标注"; + markerStrs[4] = "坡度标注"; + markerStrs[5] = "属性标注"; + markerStrs[6] = "自定义标注"; + markerStrs[7] = "距离标注"; + markerStrs[8] = "红线工具"; + markerStrs[9] = "扯旗标注"; + + if (标注管理ToolStripMenuItem.Checked) + { + sideBar1.Visible = true; + sideBarPanelItem3.Visible = true; + buttonItem1.Checked = true; + controlContainerItem3.Visible = true; + sideBarPanelItem4.Visible = true; + sideBarPanelItem4.Text = "标注管理"; + panel2.Visible = false; + panel1.Visible = false; + panel4.Visible = false; + panel5.Visible = false; + controlContainerItem5.Control = panel3; + panel3.Dock = DockStyle.Fill; + panel3.Visible = true; + sideBar1.ExpandedPanel = sideBarPanelItem4; + sideBar1.Refresh(); + Refresh(); + } + else + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + sideBarPanelItem4.Visible = false; + panel3.Visible = false; + + if (buttonItem1.Checked) + { + sideBar1.ExpandedPanel = sideBarPanelItem3; + } + else + { + sideBar1.Visible = false; + } + + Refresh(); + } + } + + #endregion + /// + /// 飞行到目标点 + /// + /// + /// + private void 飞行到目标点ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "飞行到目标点"); + + FrmSetFlytoPos.ShowForm(globeControl1); + } + /// + /// 自定义飞行 + /// + /// + /// + private void 自定义飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "自定义飞行"); + + GSOGeoPolyline3D line = null; + GSOFeature f = globeControl1.Globe.SelectedObject; + if (f != null) + { + line = f.Geometry as GSOGeoPolyline3D; + } + + if (line == null) + { + MessageBox.Show("请先选中一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + globeControl1.Globe.Action = EnumAction3D.SelectObject; + return; + } + FrmFlySetDlg dlg = new FrmFlySetDlg(); + dlg.dFlyAboveLine = m_dFlyAboveLine; + dlg.dFlyAloneLineSpeed = m_dFlyAlongLineSpeed; + dlg.dFlyAloneLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + if (dlg.ShowDialog() == DialogResult.OK) + { + m_dFlyAboveLine = dlg.dFlyAboveLine; + m_dFlyAlongLineSpeed = dlg.dFlyAloneLineSpeed; + m_dFlyAlongLineRotateSpeed = dlg.dFlyAloneLineRotateSpeed; + globeControl1.Globe.FlyAlongLineSpeed = m_dFlyAlongLineSpeed; + globeControl1.Globe.FlyAlongLineRotateSpeed = m_dFlyAlongLineRotateSpeed; + globeControl1.Globe.FlyEyeAlongWithLine(line, m_dFlyAboveLine, 85, true, 0, false); + } + } + /// + /// 绕中心点飞行 + /// + /// + /// + private void 绕中心点飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绕中心点飞行"); + + globeControl1.Globe.FlyAroundCenter(10000, EnumFlyRepeatValueType.MiliSeconds); + globeControl1.Globe.CurFlyID = 1; + } + /// + /// 绕眼睛飞行 + /// + /// + /// + private void 绕眼睛飞行ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绕眼睛飞行"); + + globeControl1.Globe.FlyAroundEye(720, EnumFlyRepeatValueType.Degrees); + globeControl1.Globe.CurFlyID = 2; + } + /// + /// 权限管理 + /// + /// + /// + private void buttonItemXT1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT1.Text); + + FrmUserRoleMgr frm = new FrmUserRoleMgr(); + frm.ShowDialog(); + } + /// + /// 数据库管理 + /// + /// + /// + private void buttonItemXT2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT2.Text); + + //查看数据库列表 + FrmDbManager frm = new FrmDbManager(); + frm.ShowDialog(); + } + /// + /// 用户列表 + /// + /// + /// + private void buttonItemXT3_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT3_1.Text); + + FrmUserManager frm = new FrmUserManager(); + frm.ShowDialog(); + } + /// + /// 创建新用户 + /// + /// + /// + private void buttonItemXT3_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT3_2.Text); + + FrmUserAdd frm = new FrmUserAdd(-1); + frm.ShowDialog(); + } + /// + /// 人员修改 + /// + /// + /// + private void buttonItemXT4_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT4_2.Text); + + FrmAppUSER appUser = new FrmAppUSER(); + appUser.ShowDialog(); + } + /// + /// 增加人员 + /// + /// + /// + private void buttonItemXT4_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemXT4_1.Text); + + FrmAppUSERRESET appUserReset = new FrmAppUSERRESET(); + appUserReset.ShowDialog(); + } + /// + /// 热点功能统计 + /// + /// + /// + private void buttonItemZTT2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT2.Text); + + FrmHotFuncStat frmhfs = new FrmHotFuncStat(); + frmhfs.ShowDialog(); + } + + private void buttonItemZTT3_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_1.Text); + + FrmAPP appfrm = new FrmAPP("专题图申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT3_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("专题图审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT3_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT3_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("专题图审核"); + appregion.ShowDialog(); + } + + private void buttonItemZTT4_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_1.Text); + + FrmAPP appfrm = new FrmAPP("打印申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT4_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("打印审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT4_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT4_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("打印审核"); + appregion.ShowDialog(); + } + + private void buttonItemZTT5_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_1.Text); + + FrmAPP appfrm = new FrmAPP("拷贝申请"); + appfrm.ShowDialog(); + } + + private void buttonItemZTT5_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_2.Text); + + FrmAPPFORASK appForask = new FrmAPPFORASK("拷贝审核"); + appForask.ShowDialog(); + } + + private void buttonItemZTT5_3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemZTT5_3.Text); + + FrmAPPregion appregion = new FrmAPPregion("拷贝审核"); + appregion.Show(); + } + private void buttonItemSPSZ_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSPSZ.Text); + + FrmLayerControl frm = new FrmLayerControl(globeControl1, globeControl2); + frm.Show(this); + } + /// + /// 综合规划区域审查 + /// + /// + /// + private void buttonItemSH5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSH5.Text); + FrmCityServerLineAnalysis frm = new FrmCityServerLineAnalysis(globeControl1, Utility.m_PipelineLayerNames); + frm.Show(this); + } + /// + /// 数据质量检查 + /// + /// + /// + private void buttonItemSJGL2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL2.Text); + FrmValiData frm = new FrmValiData(globeControl1); + frm.ShowDialog(); + + /* + ValidateInfo validateInfo = ValidateConfig.LoadConfig(); + String ss = ""; + */ + } + /// + /// 数据预处理 + /// + /// + /// + private void buttonItemSJGL3_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL3.Text); + + FrmEditShapeFile frm = new FrmEditShapeFile(globeControl1); + frm.ShowDialog(this); + } + /// + /// 连接数据库 + /// + /// + /// + private void buttonItemSJGL4_1_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_1.Text); + + FrmDatabaseParaSetting frm = new FrmDatabaseParaSetting(globeControl1); + if (frm.ShowDialog() == DialogResult.OK) + { + ds = FrmDatabaseParaSetting.ds; + if (ds != null) + { + ds.IsCloseSaved = false; + } + } + } + /// + /// 管线入库 + /// + /// + /// + private void buttonItemSJGL4_2_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_2.Text); + + if (ds == null) + { + MessageBox.Show("请先连接数据库", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + ConnectDB(null, null); + } + if (ds == null) + return; + FrmPipelineModelDB frm = new FrmPipelineModelDB(globeControl1, ds, false); + + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + /// + /// 附属物入库 + /// + /// + /// + private void buttonItemSJGL4_3_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL4_3.Text); + + if (ds == null) + { + MessageBox.Show("请先连接数据库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + + ConnectDB(null, null); + } + if (ds == null) + return; + FrmAddWellShp frm = new FrmAddWellShp(globeControl1, ds); + + if (frm.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(frm.rukuLayer); + } + } + /// + /// 坐标转换 + /// + /// + /// + private void buttonItemSJGL5_Click(object sender, EventArgs e) + { + //保存日志 + LogManager.saveLog(Utility.userName, buttonItemSJGL5.Text); + + FrmProject frm = new FrmProject(); + frm.ShowDialog(); + } + /// + /// 元数据基本管理 + /// + /// + /// + private void buttonItemSJGL6_1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL6_1.Text); + + FrmMetadata frmmd = new FrmMetadata(); + frmmd.ShowDialog(); + } + /// + /// 元数据查询管理 + /// + /// + /// + private void buttonItemSJGL6_2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL6_2.Text); + + FrmMetadataStat frmmds = new FrmMetadataStat(); + frmmds.ShowDialog(); + } + /// + /// 操作日志管理 + /// + /// + /// + private void buttonItemSJGL7_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL7.Text); + + FrmLogOper frmlo = new FrmLogOper(); + frmlo.ShowDialog(); + } + /// + /// 数据字典管理 + /// + /// + /// + private void buttonItemSJGL8_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL8.Text); + + FrmMDDictory frmmdd = new FrmMDDictory(); + frmmdd.ShowDialog(); + } + /// + /// 数据库备份 + /// + /// + /// + private void buttonItemSJGL9_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL9.Text); + + //新 + FrmBACKORACLE backOracle = new FrmBACKORACLE(); + backOracle.Show(); + } + #region 模拟规划:Fan + /// + /// 创建管段 + /// + /// + /// + private void buttonItemBJ1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建管段"); + + frmPipeSetEdit frm = new frmPipeSetEdit(globeControl1, Utility.m_PipelineLayerNames); + if (frm.ShowDialog() == DialogResult.OK) + { + enumDesignMode = EnumDesignMode.AddPipe; + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + } + } + /// + /// 创建附属物 + /// + /// + /// + private void buttonItemBJ2_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建附属物"); + + FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.instrumenLayerNames, "附属物"); + if (frm.ShowDialog() == DialogResult.OK) + { + GSOLayer featureAddLayer = TreeNodeFeatureLayer(); + if (featureAddLayer == null) return; + FrmAddInstrument dlg = new FrmAddInstrument(globeControl1, featureAddLayer); + dlg.Show(this); + } + } + /// + /// 创建特征管点 + /// + /// + /// + private void buttonItemBJ3_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "创建特征管点"); + + FrmSetGoalLayer frm = new FrmSetGoalLayer(globeControl1, Utility.pipefittingLayerNames, "管点"); + if (frm.ShowDialog() == DialogResult.OK) + { + GSOLayer featureAddLayer = TreeNodeFeatureLayer(); + if (featureAddLayer == null) return; + FrmAddPipeFitting dlg = new FrmAddPipeFitting(globeControl1, featureAddLayer); + dlg.Show(this); + } + } + /// + /// 绘制城市七线 + /// + /// + /// + + private void buttonItemBJ4_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "绘制城市七线"); + + FrmCitySevenLineType frm = new FrmCitySevenLineType(); + if (frm.ShowDialog() == DialogResult.OK) + { + globeControl1.Globe.Action = EnumAction3D.DrawPolyline; + enumDesignMode = EnumDesignMode.AddCitySevenLine; + + CitySevenLine citySevenLine = new CitySevenLine(frm.citySevenLineName, + frm.citySevenLineType); + globeControl1.Tag = citySevenLine; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(frm.citySevenLineType); + if (layer == null) return; + globeControl1.Globe.DestLayerFeatureAdd = layer; + layer.Editable = true; + } + } + #endregion + /// + /// 选中对象 + /// + /// + /// + private void buttonItemBJ5_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "选中对象"); + + globeControl1.Globe.Action = EnumAction3D.SelectObject; + } + /// + /// 平移对象 + /// + /// + /// + private void 平移对象ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "平移对象"); + + globeControl1.Globe.Action = EnumAction3D.MoveObject; + } + /// + /// 升降对象 + /// + /// + /// + private void 升降对象ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "升降对象"); + + globeControl1.Globe.Action = EnumAction3D.ElevateObject; + } + /// + /// 旋转对象 + /// + /// + /// + private void 旋转对象ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "旋转对象"); + + globeControl1.Globe.Action = EnumAction3D.RotateObject; + } + /// + /// 连接管段 + /// + /// + /// + private void 连接管段ToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "连接管段"); + + if (globeControl1.Globe.SelObjectCount < 2) + { + MessageBox.Show("对不起,请至少选中2个对象!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + globeControl1.Globe.InsertJointPipeline(false); + } + /// + /// 后退 + /// + /// + /// + private void 后退ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "后退"); + globeControl1.Globe.UnDoEdit(); + } + /// + /// 前进 + /// + /// + /// + private void 前进ToolStripMenuItem_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "前进"); + + globeControl1.Globe.ReDoEdit(); + } + /// + /// 导出CAD + /// + /// + /// + private void 导出CADToolStripMenuItem_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "导出CAD"); + + #region 导出成dxf格式 + List listVectorNames = new List(); + for (int i = 0; i < Utility.m_PipelineLayerNames.Count; i++) + { + if (Utility.m_PipelineLayerNames[i] == "移动" || Utility.m_PipelineLayerNames[i] == "联通" + || Utility.m_PipelineLayerNames[i] == "电信" || Utility.m_PipelineLayerNames[i] == "共通" + || Utility.m_PipelineLayerNames[i] == "有线电视" || Utility.m_PipelineLayerNames[i] == "交通信号" + || Utility.m_PipelineLayerNames[i] == "供电") + { + continue; + } + if (!listVectorNames.Contains(Utility.m_PipelineLayerNames[i])) + { + listVectorNames.Add(Utility.m_PipelineLayerNames[i]); + } + } + for (int i = 0; i < Utility.valueLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.valueLayerNames[i])) + { + listVectorNames.Add(Utility.valueLayerNames[i]); + } + } + for (int i = 0; i < Utility.workwellLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.workwellLayerNames[i])) + { + listVectorNames.Add(Utility.workwellLayerNames[i]); + } + } + for (int i = 0; i < Utility.instrumenLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.instrumenLayerNames[i])) + { + listVectorNames.Add(Utility.instrumenLayerNames[i]); + } + } + for (int i = 0; i < Utility.pipefittingLayerNames.Count; i++) + { + if (!listVectorNames.Contains(Utility.pipefittingLayerNames[i])) + { + listVectorNames.Add(Utility.pipefittingLayerNames[i]); + } + } + + FrmExportCADS frm = new FrmExportCADS(globeControl1, listVectorNames);//Utility.m_PipelineLayerNames); + frm.ShowDialog(); + #endregion + } + /// + /// 导出矢量 + /// + /// + /// + private void 导出文件ToolStripMenuItem1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, "导出矢量"); + + List listVectorNames = new List(); + foreach (string pipeline in Utility.m_PipelineLayerNames) + { + if (!listVectorNames.Contains(pipeline)) + { + listVectorNames.Add(pipeline); + } + } + foreach (string valve in Utility.valueLayerNames) + { + if (!listVectorNames.Contains(valve)) + { + listVectorNames.Add(valve); + } + } + foreach (string workwell in Utility.workwellLayerNames) + { + if (!listVectorNames.Contains(workwell)) + { + listVectorNames.Add(workwell); + } + } + foreach (string instrument in Utility.instrumenLayerNames) + { + if (!listVectorNames.Contains(instrument)) + { + listVectorNames.Add(instrument); + } + } + foreach (string pipefitting in Utility.pipefittingLayerNames) + { + if (!listVectorNames.Contains(pipefitting)) + { + listVectorNames.Add(pipefitting); + } + } + FrmExportVector frm = new FrmExportVector(globeControl1, listVectorNames); + frm.ShowDialog(); + } + + /// + /// 删除模型 + /// + /// + /// + private void buttonItemBJ13_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, "删除模型"); + var selObjCount = globeControl1.Globe.SelObjectCount; + if (selObjCount == 0) + { + MessageBox.Show("请选中要删除的模型!", "提示"); + return; + } + int delSuccessCount = 0; + for (int i = 0; i < selObjCount; i++) + { + GSOFeature f; + GSOLayer layer; + globeControl1.Globe.GetSelectObject(i, out f, out layer); + if (layer != null) + globeControl1.Globe.AddToEditHistroy(layer, f, EnumEditType.Delete); + bool result = FeatureTools.DeleteFeature(f); + if (result) delSuccessCount++; + globeControl1.Refresh(); + + + } + + MessageBox.Show("成功删除"+delSuccessCount+"个模型!", "提示"); + globeControl1.Globe.Action = EnumAction3D.ActionNull; + } + + /// 红线审核 + /// + /// + /// + private void buttonItemHX2_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemHX2.Text); + RedLineAnalysisTool.redLineResultList.Clear(); + + GSOFeatures selectFeatures = new GSOFeatures(); + GSOLayer layer = null; + for (int i = 0; i < globeControl1.Globe.SelObjectCount; i++) + { + GSOFeature feature = null; + globeControl1.Globe.GetSelectObject(i, out feature, out layer); + selectFeatures.Add(feature); + } + try + { + RedLineAnalysisTool.redLineResultList = + RedLineAnalysisTool.Anaylysis(selectFeatures, Utility.m_PipelineLayerNames, globeControl1); + + if (RedLineAnalysisTool.redLineResultList == null || RedLineAnalysisTool.redLineResultList.Count != 0) + addRedLineDataToDataGridView(RedLineAnalysisTool.redLineResultList, dataGridViewX1); + else + { + MessageBox.Show("没有侵入地块红线的管线数据!", "提示"); + dataGridViewX1.DataSource = null; + panelOfTable.Visible = false; + } + } + catch (Exception ex) + { + redSH = false; + LogHelper.WriteLog(typeof(MainFrm), ex); + } + } + void addRedLineDataToDataGridView(List dt, DataGridView dataGridView) + { + DataTable table=new DataTable(); + table.Columns.Add("红线编号"); + table.Columns.Add("管线类型"); + table.Columns.Add("侵占面积/m³"); + table.Columns.Add("侵入长度/m"); + table.Columns.Add("侵入管线长度"); + table.Columns.Add("侵入附属物个数"); + + for (int i = 0; i < dt.Count; i++) + { + DataRow row = table.NewRow(); + row[0] = dt[i].RedLineName; + row[1] = dt[i].LayerName; + row[2] = dt[i].MinArea.ToString("0.00"); + row[3] = dt[i].Length.ToString("0.00"); + row[4] = dt[i].LineFeaturesInRedLine == null ? 0 : dt[i].LineFeaturesInRedLine.Length; + row[5] = dt[i].PointFeaturesInRedLine == null ? 0 : dt[i].PointFeaturesInRedLine.Length; + table.Rows.Add(row); + } + + dataGridView.DataSource = table; + redSH = true; + panelOfTable.Visible = true; + panelOfTable.Height = 200; + toolStripNumbers.Text = "红线审核 |共有:" + dataGridView.Rows.Count + "条"; + toolStripDropDownButton3.Visible = true; + } + + /// + /// 主窗体 下方的工具条中的 导出.xls文件 按钮事件处理 + /// + /// + /// + private void toolStripDropDownButton3_Click(object sender, EventArgs e) + { + if (dataGridViewX1.Rows.Count == 0) + { + MessageBox.Show("表格内容为空!", "提示"); + return; + } + string strSaveFile; + SaveFileDialog savefiledialog = new SaveFileDialog(); + savefiledialog.Filter = "Excel文件|*.xls,*.xlsx"; + savefiledialog.AddExtension = true; + savefiledialog.FileName = "红线审核"; + if (savefiledialog.ShowDialog() == DialogResult.OK) + strSaveFile = savefiledialog.FileName; + else return; + + ExpEXCEL.ExpToExcelWithManySheet(dataGridViewX1, strSaveFile, "红线审核"); + MessageBox.Show("导出成功!"); + + } + + /// + /// 双屏对比的地面透明度设置 + /// + /// + /// + private void sliderItem2_ValueChanged(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, sliderItem2.Text); + + globeControl1.Globe.GroundOpaque = 100 - sliderItem2.Value; + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + { + layer.Opaque = 100 - sliderItem2.Value; + } + layer = globeControl2.Globe.Layers.GetLayerByCaption(Utility.roadLayerName);//("180fd"); + if (layer != null) + { + layer.Opaque = 100 - sliderItem2.Value; + } + globeControl2.Globe.GroundOpaque = 100 - sliderItem2.Value; + + optiValue = sliderItem2.Value; + } + /// + /// 数据管理导入文件 + /// + /// + /// + private void buttonItemSJGL1_Click(object sender, EventArgs e) + { + //日志记录 + LogManager.saveLog(Utility.userName, buttonItemSJGL1.Text); + + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "矢量数据(*.shp)|*.shp|栅格数据(*.lrp)|*.lrp|栅格缓存(*.lrc)|*.lrc|KML数据(*.kml)|*.kml|矢量数据(*.lgd)|*.lgd|矢量缓存(*.gft)|*.gft|CAD文件(*.dxf)|*.dxf|全部支持格式(*.lrp,*.tif,*.img,*.lrc,*.kml,*.lgd,*.shp,*.gft,*.dxf)|*.lrp;*.tif;*.img;*.lrc;*.kml;*.lgd;*.shp;*.gft;*.dxf"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) + { + try + { + for (int i = 0; i < dlg.FileNames.Length; i++) + { + AddLayerData(dlg.FileNames[i]); + } + layerManagerNode.Expand(); + + //放大到新导入的图层 + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + GSOFeatures features = lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), + EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } + } + catch (Exception ex) + { + LogHelper.WriteLog(typeof(MainFrm), ex); + } + } + } + /// + /// 导入红线(完善) + /// + /// + /// + private void buttonItemHX1_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemHX1.Text); + + GSODataSource dataSpace = globeControl1.Globe.DataManager.OpenOracleDataSource(Utility.DBServer.Trim() + "/" + Utility.dbdatabase.Trim(), "", "", Utility.userID, Utility.DBPassword); + string filepath = ""; + //日志记录 + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "矢量数据(*.shp)|*.shp|矢量数据(*.lgd)|*.lgd|CAD数据(*.dxf)|*.dxf|全部支持格式(*.lgd,*.shp,*.dxf)|*.lgd;*.shp;*.dxf;"; + dlg.Multiselect = true; + + #region 临时图层显示 + if (dlg.ShowDialog() == DialogResult.OK) + { + #region + + for (int i = 0; i < dlg.FileNames.Length; i++) + { + string strDataPath = dlg.FileNames[i]; + + GSOLayer layer = globeControl1.Globe.Layers.Add(strDataPath); + if (layer == null) + {//wxl + LogHelper.WriteLog(typeof(MainFrm), "buttonItemHX1_Click操作中," + strDataPath + "的layer为空"); + continue; + } + GSOFeatures redFeatures = layer.GetAllFeatures(); + redlinelayername = layer.Caption; + layerRedRegion = layer; +// CheckDatasetGeoReference(layer.Dataset, strDataPath); + bool checkresult = CheckDatasetGeoReference(layer.Dataset, strDataPath); + if (!checkresult) continue;//wxl 没通过检查,跳过此次循环 + 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(); + //wxlwhy 为何不直接用之前的layer? + //放大到红线 +// GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(redlinelayername); +// GSOLayer lyr = layer; + GSOSimpleLineStyle3D redlinestyle = new GSOSimpleLineStyle3D(); + redlinestyle.LineColor = Color.Red; + redlinestyle.LineWidth = 5; + layer.Style = redlinestyle; + + if (redlinelayername != "") + { +// GSOFeatures features = lyr.GetAllFeatures(); +// redFeatures = features; + GSORect2d rd = layer.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; + + GSOLayer roadlayer = globeControl1.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); //("180fd"); + if (roadlayer != null) + { + roadlayer.Opaque = 100 - sliderGroundTransSet1.Value; + } + + /////////////////////////////////////////////////////////////////////////////////////////// + globeControl1.Globe.Layers.MoveTo(0, globeControl1.Globe.Layers.Count - 1); + globeControl1.Refresh(); + } + + IModelBuilder modelBuilder = new RedLineBuilder(); + + modelBuilder.batchInsert(dataSpace, redDt, redFeatures); + + } + + #endregion + + } + #endregion + } + /// + /// 定位 + /// + /// + /// + private void buttonItemLocation_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemLocation.Text); + + FrmFlyToPosition fly = new FrmFlyToPosition(globeControl1, globeControl2); + fly.Show(this); + } + /// + /// 红线审核 + /// + /// + /// + private void ribbonTabItem6_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.FlyToPosition(new GSOPoint3d(120.610963, 31.188121, 50), EnumAltitudeMode.Absolute, -4, 50, 800); + globeControl1.Globe.FlyToPointSpeed = 10000000; + globeControl1.Globe.Action = EnumAction3D.SelectObject; + globeControl1.Refresh(); + + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + + //zhanshi = false; + redSH = true; + splitContainer1.Panel2Collapsed = true; + legendSG.Visible = false; + legendSC.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = true; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 基础工具 + /// + /// + /// + private void ribbonTabItem1_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 一键审核 + /// + /// + /// + private void ribbonTabItem11_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + panelOfTable.Visible = false; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /// + /// 双屏对比 + /// + /// + /// + private void ribbonTabItem9_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent += globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent += globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + + splitContainer1.Panel2Collapsed = false; + //zhanshi = true; + redSH = false; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + sliderItem2.Value = 100 - globeControl1.Globe.GroundOpaque; + globeControl2.Globe.GroundOpaque = globeControl1.Globe.GroundOpaque; + legendSC.Visible = true; + legendSG.Visible = true; + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 文档管理 + /// + /// + /// + private void ribbonTabItem4_MouseDown(object sender, MouseEventArgs e) + { + try + { + + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 基础管理 + /// + /// + /// + private void ribbonTabItem14_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer != null) + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + /// + /// 权限管理 + /// + /// + /// + private void ribbonTabItem2_MouseDown(object sender, MouseEventArgs e) + { + try + { + globeControl1.BeforeSceneRenderEvent -= globeControl1_BeforeSceneRenderEvent; + globeControl2.BeforeSceneRenderEvent -= globeControl2_BeforeSceneRenderEvent; + + globeControl1.Globe.Action = EnumAction3D.ActionNull; + panelOfTable.Visible = false; + //zhanshi = false; + redSH = false; + splitContainer1.Panel2Collapsed = true; + dataGridViewX1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + legendSC.Visible = false; + legendSG.Visible = false; + ClearGZData(); + + GSOLayer redLayer = globeControl1.Globe.Layers.GetLayerByCaption("红线"); + if (redLayer == null) return; + redLayer.Visible = false; + } + catch (Exception ex) + { + //MessageBox.Show("系统运行错误:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + //GSOFeature dpFeatuer = null; + /// + /// 双屏分析,点击管段分析 + /// + /// + /// + private void buttonItem8_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem8.Text); + + int width = Width; + FrmCompareFeature.ShowForm(globeControl1, globeControl2, width); + } + /// + /// 红线审核导出图片 + /// + /// + /// + private void buttonItemDCTP_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemDCTP.Text); + + Point pt1 = new Point(Convert.ToInt32(0), Convert.ToInt32(0)); + Point pt2 = new Point(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)); + + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "输出JPEG(*.jpg)|*.jpg|输出PNG(*.png)|*.png|输出BMP(*.bmp)|*.bmp|输出BMP(*.gif)|*.gif"; + if (dlg.ShowDialog() == DialogResult.OK) + { + string extension = Path.GetExtension(dlg.FileName);//扩展名 + switch (extension) + { + case ".jpg": + myImg.Save(dlg.FileName, ImageFormat.Jpeg); + break; + case ".png": + myImg.Save(dlg.FileName, ImageFormat.Png); + break; + case ".bmp": + myImg.Save(dlg.FileName, ImageFormat.Bmp); + break; + case ".gif": + myImg.Save(dlg.FileName, ImageFormat.Gif); + break; + default: + break; + } + } + } + /// + /// 标识器全区域统计 + /// + /// + /// + private void 标识器分类统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + globeControl1.Globe.Action = EnumAction3D.ActionNull; + FrmBSQStatis bsqStatis = new FrmBSQStatis(globeControl1, null); + bsqStatis.Show(this); + } + /// + /// 标识器绘制区域统计 + /// + /// + /// + private void 标识器分类统计ToolStripMenuItem1_Click(object sender, EventArgs e) + { + trackflag = "BSQDuoBianXiangStatis"; + globeControl1.Globe.Action = EnumAction3D.TrackPolygon; + } + + private void btn_check_history_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_check_history.Text); + + if (FrmCheckHistory.isOpen) + return; + FrmCheckHistory frm = new FrmCheckHistory(globeControl1, globeControl2); + frm.addNode += addNodeToLayerManagerNode; + frm.Show(); + } + + private void buttonItem查看数据_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItem查看数据.Text); + + FrmThreeOracle tr = new FrmThreeOracle(globeControl1); + + if (tr.ShowDialog() == DialogResult.OK) + { + addNodeToLayerManagerNode(tr.rukuLayer); + globeControl1.Refresh(); + } + } + /// + /// 规划数据入库 + /// + /// + /// + private void buttonItemGHRK_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemGHRK.Text); + + FrmGHRK ghrk = new FrmGHRK(globeControl1, layerManagerNode); + ghrk.Show(this); + } + + private void btn_user_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_user_info.Text); + + if (FrmSysUserInfoManger.IS_OPEN) return; + FrmSysUserInfoManger frm = new FrmSysUserInfoManger(); + frm.ShowDialog(); + } + + private void btn_role_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_role_info.Text); + + if (!FrmRoleInfoManager.IS_OPEN) + { + FrmRoleInfoManager frm = new FrmRoleInfoManager(); + frm.ShowDialog(); + } + } + + private void btn_resc_info_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_resc_info.Text); + + if (SysRescInfoManager.IS_OPEN) return; + SysRescInfoManager frm = new SysRescInfoManager(); + frm.ShowDialog(); + } + + private void btn_role_resc_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_role_resc.Text); + + if (FrmRoleRescManager.IS_OPEN) return; + FrmRoleRescManager frm = new FrmRoleRescManager(); + frm.ShowDialog(); + } + + private void btn_user_role_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_user_role.Text); + + if (!FrmUserRole.IS_OPEN) + { + FrmUserRole frm = new FrmUserRole(); + frm.ShowDialog(); + } + } + + //文档管理 操作 + private void btn_document_info_Click(object sender, EventArgs e) + { + + LogManager.saveLog(Utility.userName, btn_document_info.Text); + if (FormDocumentManager.IS_OPEN) return; + Cursor = Cursors.WaitCursor; + FormDocumentManager frm = new FormDocumentManager(); + frm.changeCursor += changeCursorToDefault; + frm.ShowDialog(); + } + + private void changeCursorToDefault() + { + Cursor = Cursors.Default; + } + + private void buttonItemexp_CAD_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, buttonItemexp_CAD.Text); + + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Filter = "支持格式(*.dwg)|*.dwg"; + dlg.Multiselect = true; + if (dlg.ShowDialog() == DialogResult.OK) + { + foreach (string strDataPath in dlg.FileNames) + { + AddLayerData(strDataPath); + } + } + + GSOLayer lyr = globeControl1.Globe.Layers.GetLayerByCaption(newlayername); + if (newlayername != "") + { + lyr.GetAllFeatures(); + GSORect2d rd = lyr.LatLonBounds; + GSOPoint2d rdcenter = rd.Center; + + globeControl1.Globe.JumpToPosition(new GSOPoint3d(rdcenter.X, rdcenter.Y, 0), EnumAltitudeMode.Absolute, 100); + + globeControl1.Refresh(); + } + } + + private void btn_password_edit_Click(object sender, EventArgs e) + { + LogManager.saveLog(Utility.userName, btn_password_edit.Text); + + if (!FrmChangePassword.IS_OPEN) + { + FrmChangePassword frm = new FrmChangePassword(); + frm.ShowDialog(); + } + } + + private void 导出CADToolStripMenuItem1_Click(object sender, EventArgs e) + { + TreeNode node = layerNodeContexMenu.Tag as TreeNode; + if (node == null) + { + MessageBox.Show("请在左侧节点集中选择要导出的图层", "提示"); + return; + } + GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(node.Text.Trim()); + if (layer != null && layer.GetAllFeatures().Length > 0) + { + string strProjectName = Utility.projectStr; + if (strProjectName == "") return; + SaveFileDialog dlg = new SaveFileDialog(); + dlg.Filter = "*.dwg|*.dwg|*.dxf|*.dxf"; + dlg.FileName = layer.Caption; + if (dlg.ShowDialog(this) != DialogResult.OK) return; + globeControl1.Globe.MemoryLayer.SaveAs(dlg.FileName); + GSOLayer newlayer = globeControl1.Globe.Layers.Add(dlg.FileName); + newlayer.RemoveAllFeature(); + int featureCount = layer.GetAllFeatures().Length; + for (int i = 0; i < featureCount; i++) + { + GSOFeature feature = layer.GetAt(i); + if (feature == null || feature.Geometry == null) continue; + switch (feature.Geometry.Type) + { + case EnumGeometryType.GeoPolyline3D: + feature.Geometry.Style = new GSOSimpleLineStyle3D(); + break; + case EnumGeometryType.GeoPolygon3D: + feature.Geometry.Style = new GSOSimplePolygonStyle3D(); + break; + } + newlayer.AddFeature(feature); + } + newlayer.Save(); + newlayer.Dataset.DataSource.RemoveDataset(newlayer.Dataset); + globeControl1.Globe.Layers.Remove(newlayer); + MessageBox.Show("导出CAD完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + else + { + MessageBox.Show("要导出的图层为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } + + private void buttonItemGBJC_Click(object sender, EventArgs e) + { + FrmGBJC gb = new FrmGBJC(globeControl1, globeControl2); + gb.Show(this); + } + + #region 右屏管纵数据控制 + private void 五十米主干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = true; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 三十六米次干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = true; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 四十二米次干道ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = true; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 二十四米一块板ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = true; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 二十四米三块板ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = true; + } + + private void 二十四米停车带ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = true; + lendendGZ24_3.Visible = false; + } + + private void 二十六米大堤路ToolStripMenuItem_Click(object sender, EventArgs e) + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = true; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + + private void 清除管纵数据ToolStripMenuItem_Click(object sender, EventArgs e) + { + ClearGZData(); + } + + private void ClearGZData() + { + lendendGZ50.Visible = false; + lendendGZ42.Visible = false; + lendendGZ36.Visible = false; + lendendGZ26.Visible = false; + lendendGZ24_1.Visible = false; + lendendGZ24_2.Visible = false; + lendendGZ24_3.Visible = false; + } + #endregion + + private void buttonItemPasswordReset_Click(object sender, EventArgs e) + { + Frm_password_reset reset = new Frm_password_reset(); + reset.Show(); + } + + private void pictureBox1_Paint(object sender, PaintEventArgs e) + { + string welcomeUser = "欢迎您:" + Utility.userName; + e.Graphics.DrawString(welcomeUser, new Font("宋体", 12), new SolidBrush(Color.Black), Width - 180, 50); + } + + } +} \ No newline at end of file diff --git a/getpipeLineFields.cs b/getpipeLineFields.cs index 9bf6f37..561caaf 100644 --- a/getpipeLineFields.cs +++ b/getpipeLineFields.cs @@ -4,22 +4,20 @@ namespace Cyberpipe { - class getpipeLineFields + class GetpipeLineFields { - public static string getFields(string caption, GSOGlobeControl m_globeControl) + public static string GetFields(string caption, GSOGlobeControl mGlobeControl) { - GSODataset ds; - GSOFeatureDataset sourcefDataset; - GSOLayer m_layer = m_globeControl.Globe.Layers.GetLayerByCaption(caption);//获取当前选择的layer图层 - if (m_layer == null) return ""; - ds = m_layer.Dataset; - sourcefDataset = ds as GSOFeatureDataset; + GSOLayer mLayer = mGlobeControl.Globe.Layers.GetLayerByCaption(caption);//获取当前选择的layer图层 + if (mLayer == null) return ""; + GSODataset ds = mLayer.Dataset; + GSOFeatureDataset sourcefDataset = ds as GSOFeatureDataset; + if (sourcefDataset == null) return ""; sourcefDataset.Open(); string fields = ""; for (int j = 0; j < sourcefDataset.FieldCount; j++) { - GSOFieldAttr fieldef = sourcefDataset.GetField(j); string fieldName = fieldef.Name; if (fieldName.Contains("高程") || fieldef.Name.Contains("埋深") || @@ -46,14 +44,12 @@ } - public static string getFieldsForBubble(string caption, GSOGlobeControl m_globeControl) + public static string GetFieldsForBubble(string caption, GSOGlobeControl mGlobeControl) { - GSODataset ds; - GSOFeatureDataset sourcefDataset; - GSOLayer m_layer = m_globeControl.Globe.Layers.GetLayerByCaption(caption);//获取当前选择的layer图层 - if (m_layer == null) return ""; - ds = m_layer.Dataset; - sourcefDataset = ds as GSOFeatureDataset; + GSOLayer mLayer = mGlobeControl.Globe.Layers.GetLayerByCaption(caption); //获取当前选择的layer图层 + if (mLayer == null) return ""; + GSODataset ds = mLayer.Dataset; + GSOFeatureDataset sourcefDataset = ds as GSOFeatureDataset; if (sourcefDataset == null) return ""; sourcefDataset.Open(); string fields = ""; @@ -62,13 +58,6 @@ GSOFieldAttr fieldef = sourcefDataset.GetField(j); string fieldName = fieldef.Name; - if (fieldName.Contains("高程") || fieldef.Name.Contains("埋深") || - fieldef.Name.Contains("沟道宽") || fieldef.Name.Contains("沟道高") || - fieldef.Name.Contains("间隙") || fieldef.Name.Contains("井深") || - fieldef.Name.Contains("深度") || fieldef.Name.Contains("高度")) - { - fieldName = fieldName + "_米"; - } if (j < sourcefDataset.FieldCount - 1) { fields += fieldName + ","; @@ -80,42 +69,5 @@ return fields; } - public static string get_Fields(string caption, GSOGlobeControl m_globeControl) - { - GSODataset ds; - GSOFeatureDataset sourcefDataset; - GSOLayer m_layer = m_globeControl.Globe.Layers.GetLayerByCaption(caption);//获取当前选择的layer图层 - if (m_layer == null) - return ""; - ds = m_layer.Dataset; - sourcefDataset = ds as GSOFeatureDataset; - sourcefDataset.Open(); - string fields = ""; - for (int j = 0; j < sourcefDataset.FieldCount; j++) - { - - GSOFieldAttr fieldef = sourcefDataset.GetField(j); - if (j < sourcefDataset.FieldCount - 1) - { - fields += fieldef.Name + ","; - } - else - fields += fieldef.Name; - - string fieldName = fieldef.Name; - - - if (j < sourcefDataset.FieldCount - 1) - { - fields += fieldName + ","; - } - else - fields += fieldName; - - } - return fields; - } - - } }