private void LoadClassify() { try { this.cmbClassify.Properties.Items.Clear(); DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc != null) { MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fc.GuidString); if (mc != null && mc.SubClasses != null) { this._classifyName = mc.ClassifyField; foreach (SubClass sc in mc.SubClasses) { this.cmbClassify.Properties.Items.Add(sc); } if (this.cmbClassify.Properties.Items.Count > 0) { this.cmbClassify.SelectedIndex = 0; } else { this.cmbClassify.SelectedIndex = -1; } } } } } catch (Exception ex) { } }
public float EffectivenessAgainst(DeltemonClass delt) { MajorClass m1 = delt.deltdex.major1; MajorClass m2 = delt.deltdex.major2; return(EffectivenessValue(GetEffectivenessAgainst(m1, m2))); }
private static void SetFeatureClassForGroup(MajorClass mc, DFWinForms.LogicTree.GroupLayerClass group, Dictionary <string, IFeatureClass> dicfc, Dictionary <string, DF2DFeatureClass> dict) { if (mc == null || string.IsNullOrEmpty(mc.ClassifyField) || string.IsNullOrEmpty(mc.Fc2D)) { return; } string[] arrayFc2D = mc.Fc2D.Split(';'); if (arrayFc2D == null || arrayFc2D.Count() == 0) { return; } dict.Clear(); foreach (string fc2D in arrayFc2D) { foreach (KeyValuePair <string, IFeatureClass> kv in dicfc)//在<要素类ID,要素类>字典里找到MajorClass对应的要素类,添加到dict中 { if (kv.Key == fc2D) { dict[kv.Key] = new DF2DFeatureClass(kv.Value); DF2DFeatureClassManager.Instance.Add(dict[kv.Key]); break; } } } if (group is TreeNodeMajorClass2D) { (group as TreeNodeMajorClass2D).FeatureClasses = dict; //设置MajorClass的要素类为dict } }
private void btnEdit_Click(object sender, EventArgs e) { if (currentLayer != null) { string name = this.teName.Text.Trim(); string alias = this.teAlias.Text.Trim(); string classifyfield = this.teClassifyField.Text.Trim(); if (string.IsNullOrEmpty(name)) { XtraMessageBox.Show("名称不能为空!", "提示"); return; } if (currentLayer is TreeNodeLogicGroup && currentLayer.CustomValue is LogicGroup) { LogicGroup lg = currentLayer.CustomValue as LogicGroup; if (lg.Name != name) { if (dictGroups.ContainsKey(name)) { XtraMessageBox.Show("已存在该组!", "提示"); return; } dictGroups.Remove(lg.Name); } lg.Name = name; lg.Alias = alias; TreeNodeLogicGroup treenode = currentLayer as TreeNodeLogicGroup; treenode.Name = string.IsNullOrEmpty(lg.Alias) ? lg.Name : lg.Alias; treenode.CustomValue = lg; dictGroups[name] = lg; } else if (currentLayer is TreeNodeMajorClass && currentLayer.CustomValue is MajorClass) { if (string.IsNullOrEmpty(classifyfield)) { XtraMessageBox.Show("分组字段不能为空!", "提示"); return; } MajorClass mc = currentLayer.CustomValue as MajorClass; if (mc.Name != name) { if (dictMCs.ContainsKey(name)) { XtraMessageBox.Show("已存在该大类!", "提示"); return; } dictMCs.Remove(mc.Name); } mc.Name = name; mc.Alias = alias; mc.ClassifyField = classifyfield; TreeNodeMajorClass treenode = currentLayer as TreeNodeMajorClass; treenode.Name = string.IsNullOrEmpty(mc.Alias) ? mc.Name : mc.Alias; treenode.CustomValue = mc; dictMCs[name] = mc; } } }
private void ClassQuery(MajorClass mc, MajorClass mctemp, ISpatialFilter filter, IGeometry geo) { if (mc == null || filter == null || geo == null) { return; } string[] arrFc3DId = mc.Fc3D.Split(';'); if (arrFc3DId == null) { return; } foreach (SubClass sc in mc.SubClasses) { if (!sc.Visible3D) { continue; } bool bHave = false; foreach (string fc3DId in arrFc3DId) { DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId); if (dffc == null) { continue; } FacilityClass facc = dffc.GetFacilityClass(); IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null || facc == null) { continue; } filter.WhereClause = "GroupId = " + sc.GroupId; int count = fc.GetCount(filter); if (count == 0) { continue; } bHave = true; bHaveRes = true; if (bHave) { break; } } if (bHave) { SubClass sctemp = new SubClass(sc.Name, sc.GroupId, sc.Parent); sctemp.Visible3D = sc.Visible3D; mctemp.SubClasses.Add(sctemp); } } }
private void RecurSaveData(TreeNodeLogicGroup parentLayer, XmlDocument document, XmlNode parentNode) { if (parentLayer == null || parentNode == null) { return; } for (int i = 0; i < parentLayer.GetLayerCount(); i++) { IBaseLayer layer = parentLayer.GetLayerByIndex(i); if (!(layer is TreeNodeLogicGroup) && !(layer is TreeNodeMajorClass)) { continue; } if (layer is TreeNodeLogicGroup) { TreeNodeLogicGroup treenode = layer as TreeNodeLogicGroup; if (!(treenode.CustomValue is LogicGroup)) { continue; } LogicGroup lg = treenode.CustomValue as LogicGroup; XmlElement element = document.CreateElement("LogicGroup"); element.SetAttribute("name", lg.Name); element.SetAttribute("alias", lg.Alias); XmlNode lgNode = parentNode.AppendChild(element); RecurSaveData(treenode, document, lgNode); } if (layer is TreeNodeMajorClass) { TreeNodeMajorClass treenode = layer as TreeNodeMajorClass; if (treenode.CustomValue is MajorClass) { MajorClass mc = treenode.CustomValue as MajorClass; XmlElement element = document.CreateElement("MajorClass"); element.SetAttribute("name", mc.Name); element.SetAttribute("alias", mc.Alias); element.SetAttribute("classifyfield", mc.ClassifyField); element.SetAttribute("fc2D", mc.Fc2D); element.SetAttribute("fc3D", mc.Fc3D); XmlNode mcNode = parentNode.AppendChild(element); foreach (SubClass sc in mc.SubClasses) { XmlElement ele1 = document.CreateElement("SubClass"); ele1.SetAttribute("name", sc.Name); ele1.SetAttribute("groupid", sc.GroupId.ToString()); mcNode.AppendChild(ele1); } } } } }
public Effectiveness GetEffectivenessAgainst(MajorClass m1, MajorClass m2) { if (majorType.zeroDamage.Contains(m1) || majorType.zeroDamage.Contains(m2)) { return(Effectiveness.Ineffective); } float effectiveness = 1f; if (majorType.veryEffective.Contains(m1)) { effectiveness *= 2f; } if (majorType.veryEffective.Contains(m2)) { effectiveness *= 2f; } if (majorType.uneffective.Contains(m1)) { effectiveness *= 0.5f; } if (majorType.uneffective.Contains(m2)) { effectiveness *= 0.5f; } if (effectiveness == 4.0f) { return(Effectiveness.VeryStrong); } else if (effectiveness == 2.0f) { return(Effectiveness.Strong); } else if (effectiveness == 1.0f) { return(Effectiveness.Average); } else if (effectiveness == 0.5f) { return(Effectiveness.Weak); } else if (effectiveness == 0.25f) { return(Effectiveness.VeryWeak); } else { throw new System.Exception("Effectiveness incorrectly calculated. Value = " + effectiveness); } }
// Add or remove major from query public void AddRemoveMajorFromQuery(int i) { MajorClass tmp = majorQuery.Find(major => major.majorName == majorList[i].majorName); if (tmp == null) { majorQuery.Add(majorList[i]); MajorContentTransform.GetChild(i).GetComponent <Image>().color = majorList[i].background; } else { majorQuery.Remove(majorList[i]); MajorContentTransform.GetChild(i).GetComponent <Image>().color = Color.white; } }
private static void SetSubClass(MajorClass mc, DFWinForms.LogicTree.GroupLayerClass group, Dictionary <string, DF2DFeatureClass> dict, Dictionary <string, IFeatureLayer> dicFLs) { foreach (SubClass sc in mc.SubClasses) { TreeNodeSubClass2D tnsc = new TreeNodeSubClass2D() { Name = sc.Name, CustomValue = sc, ClassifyField = mc.ClassifyField, DictFLs = dicFLs }; tnsc.FeatureClasses = dict; group.Add(tnsc); tnsc.Visible = true; } group.CollapseAll(); }
/// <summary> /// Update Major Class Entity /// </summary> /// <param name="webModel"></param> /// <param name="model"></param> private static MajorClass UpdateModel(MajorClassEditViewModel webModel, MajorClass model) { model.Name = webModel.Name; model.MajorCode = Convert.ToInt32((webModel.MajorCode)); model.IsEnabled = (int)webModel.IsEnabled == 1; model.MajorName = webModel.MajorName; model.SessionNum = webModel.SessionNum; model.Wechat = webModel.Wechat; model.QQ = webModel.QQ; model.InstructorId = Convert.ToInt64(webModel.InstructorId); model.DepartmentId = Convert.ToInt64(webModel.DepartmentId); model.ModifiedOn = DateTime.Now; model.ModifiedId = CurrentUser.UserId; model.ModifiedBy = CurrentUser.UserOID; model.ModifiedName = CurrentUser.UserName; return(model); }
private void RecursiveRegionAnalysis(List <LogicGroup> listlg, LogicGroup lgtemp, ISpatialFilter filter, IGeometry geo) { if (listlg == null) { return; } foreach (LogicGroup lg in listlg) { LogicGroup lgtemp1 = new LogicGroup(lg.Name, lg.Alias, lg.Parent); lgtemp.LogicGroups.Add(lgtemp1); RecursiveRegionAnalysis(lg.LogicGroups, lgtemp1, filter, geo); foreach (MajorClass mc in lg.MajorClasses) { MajorClass mctemp = new MajorClass(mc.Name, mc.Alias, mc.ClassifyField, mc.Fc2D, mc.Fc3D, mc.Parent); ClassQuery(mc, mctemp, filter, geo); lgtemp.MajorClasses.Add(mctemp); } } }
/// <summary> /// Returns the Major/Minor device class as a string. /// </summary> /// <returns></returns> public override string ToString() { #if PCL // PCL is missing GetFields() but it doesn't matter since the PCL is only a placeholder return(MinorClass.ToString()); #else string majorClassName = MajorClass.ToString(); if (MajorClass != BluetoothMajorClass.Miscellaneous) { if (MinorClass == BluetoothMinorClass.Uncategorized) { // return just the Major class return(majorClassName); } #if WINDOWS_PHONE_APP || NETSTANDARD1_4 foreach (FieldInfo fi in typeof(BluetoothMinorClass).GetRuntimeFields()) #else foreach (FieldInfo fi in typeof(BluetoothMinorClass).GetFields()) #endif { string minorName = fi.Name; if (minorName.StartsWith(majorClassName)) { if ((int)fi.GetValue(null) == (int)MinorClass) { // return the correct Minor class return(minorName); } } } } // if it doesn't match a known major/minor class return the raw value return(RawValue.ToString("X8")); #endif }
private void logicBaseTree1_OnHitTest(MouseButtons button, int x, int y, IBaseLayer layer) { currentLayer = layer; if (layer is TreeNodeLogicGroup && layer.CustomValue is LogicGroup) { LogicGroup lg = layer.CustomValue as LogicGroup; this.teName.Text = lg.Name; this.teAlias.Text = lg.Alias; this.layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } else if (layer is TreeNodeMajorClass && layer.CustomValue is MajorClass) { MajorClass mc = layer.CustomValue as MajorClass; this.teName.Text = mc.Name; this.teAlias.Text = mc.Alias; this.teClassifyField.Text = mc.ClassifyField; this.layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } }
private void RegionAnalysis() { resRootLogicGroups.Clear(); resRootMajorClasses.Clear(); IGeometry geo = this._drawTool.GetGeo().Clone2(gviVertexAttribute.gviVertexAttributeNone); if (geo == null) { return; } ISpatialFilter filter = new SpatialFilter(); filter.Geometry = geo; filter.SpatialRel = gviSpatialRel.gviSpatialRelContains; filter.GeometryField = "FootPrint"; foreach (LogicGroup lg in LogicDataStructureManage3D.Instance.RootLogicGroups) { LogicGroup lgtemp = new LogicGroup(lg.Name, lg.Alias, lg.Parent); resRootLogicGroups.Add(lgtemp); RecursiveRegionAnalysis(lg.LogicGroups, lgtemp, filter, geo); foreach (MajorClass mc in lg.MajorClasses) { MajorClass mctemp = new MajorClass(mc.Name, mc.Alias, mc.ClassifyField, mc.Fc2D, mc.Fc3D, mc.Parent); lgtemp.MajorClasses.Add(mctemp); ClassQuery(mc, mctemp, filter, geo); } } foreach (MajorClass mc in LogicDataStructureManage3D.Instance.RootMajorClasses) { MajorClass mctemp = new MajorClass(mc.Name, mc.Alias, mc.ClassifyField, mc.Fc2D, mc.Fc3D, mc.Parent); resRootMajorClasses.Add(mctemp); ClassQuery(mc, mctemp, filter, geo); } }
private void OnFinishedDraw() { if (this._drawTool != null && this._drawTool.GeoType == DrawType.SelectOne && this._drawTool.GetSelectFeatureLayerPickResult() != null && this._drawTool.GetSelectPoint() != null) { try { IFeatureLayer fl = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer; if (fl == null) { return; } FacilityClass facc = Dictionary3DTable.Instance.GetFacilityClassByDFFeatureClassID(fl.FeatureClassId.ToString()); if (facc == null || facc.Name != "PipeLine") { XtraMessageBox.Show("您选中的不是管线设施,请选择管线设施。", "提示"); return; } DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fl.FeatureClassId.ToString()); if (dffc == null || dffc.GetFeatureClass() == null) { return; } IImagePointSymbol ips = new ImagePointSymbol(); ips.Size = SystemInfo.Instance.SymbolSize; ips.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\accidentPoint.png"); IPoint intersectPoint = this._drawTool.GetSelectPoint(); _rPoint = d3.ObjectManager.CreateRenderPoint(intersectPoint, ips, d3.ProjectTree.RootID); _rPoint.MinVisibleDistance = 499; _rPoint.MaxVisibleDistance = 99999; _particleEffect = d3.ObjectManager.CreateParticleEffect(d3.ProjectTree.RootID); MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fl.FeatureClassId.ToString()); if (mc != null) { this.teCarrierType.Text = mc.ToString(); } if (mc != null && (mc.Name == "PS" || mc.Name == "GS")) { _particleEffect.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\water.png"); _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedMoveDirection; //_particleEffect.setTextureTileRange(8, 8, 63, 63); _particleEffect.EmissionMinRate = 1600; _particleEffect.EmissionMaxRate = 1300; _particleEffect.EmissionMinAngle = 0; _particleEffect.EmissionMaxAngle = 0.025 * Math.PI; // 改成一个圆 _particleEffect.EmissionMinMoveSpeed = 25; _particleEffect.EmissionMaxMoveSpeed = 30; _particleEffect.EmissionMinRotationSpeed = 0; _particleEffect.EmissionMaxRotationSpeed = 0; _particleEffect.ParticleMinLifeTime = 4.5; _particleEffect.ParticleMaxLifeTime = 5.5; _particleEffect.EmissionMinParticleSize = 0.2; _particleEffect.EmissionMaxParticleSize = 0.25; _particleEffect.EmissionMinScaleSpeed = 0; _particleEffect.EmissionMaxScaleSpeed = 0; _particleEffect.ParticleBirthColor = 0xffffffff; _particleEffect.ParticleDeathColor = 0x00ffffff; _particleEffect.VerticalAcceleration = 5; _particleEffect.Damping = 0.5; _particleEffect.WindAcceleration = 0; _particleEffect.WindDirection = 0; IEulerAngle v3t = new EulerAngle(); v3t.Set(90, 45, 0); _particleEffect.EmissionDirectionEulerAngle = v3t; } else { _particleEffect.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\smoke1.png"); _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedCamera; _particleEffect.SetTextureTileRange(8, 8, 63, 63); // 58,58位置的图有问题 _particleEffect.EmissionMinRate = 20; _particleEffect.EmissionMaxRate = 30; _particleEffect.EmissionMinAngle = 0; _particleEffect.EmissionMaxAngle = 3.14 * 2.0; // 改成一个圆 _particleEffect.EmissionMinMoveSpeed = 0; _particleEffect.EmissionMaxMoveSpeed = 1; _particleEffect.EmissionMinRotationSpeed = -1; _particleEffect.EmissionMaxRotationSpeed = 1; _particleEffect.ParticleMinLifeTime = 10; _particleEffect.ParticleMaxLifeTime = 12; _particleEffect.EmissionMinParticleSize = 0.75; _particleEffect.EmissionMaxParticleSize = 0.9; _particleEffect.EmissionMinScaleSpeed = 1.5; _particleEffect.EmissionMaxScaleSpeed = 1.85; _particleEffect.ParticleBirthColor = 0xffffffff; _particleEffect.ParticleDeathColor = 0x00ffffff; _particleEffect.VerticalAcceleration = -2; _particleEffect.Damping = 0; _particleEffect.WindAcceleration = 0; _particleEffect.WindDirection = 0; } _particleEffect.MinVisibleDistance = 0; _particleEffect.MaxVisibleDistance = 500; _particleEffect.Start(-1); IPoint pttemp = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint; IVector3 v3 = new Vector3(); v3.Set(intersectPoint.X, intersectPoint.Y, intersectPoint.Z); pttemp.Position = v3; _particleEffect.SetCircleEmitter(pttemp, 0); this._drawTool.End(); } catch (Exception ex) { } finally { } } }
private void btn_ok_Click(object sender, EventArgs e) { try { if (this._dt.Rows.Count == 0) { return; } if (!this.ceConnectMajorClass.Checked && !this.ceConnectFacility.Checked) { return; } WaitForm.Start("二维数据关联设置启动...", "请稍后"); CheckRowGroup(); WaitForm.SetCaption("设施类关联设置进行中..."); // 设置设施类 HashSet <FacilityClass> listFac = _checkFacCList; if (listFac != null && this.ceConnectFacility.Checked) { foreach (FacilityClass fac in listFac) { string strTemp = ""; foreach (DataRow dr in this._dt.Rows) { if (!(bool)dr["CheckState"]) { continue; } IFeatureClass featureClass = dr["FeatureClass"] as IFeatureClass; if (featureClass == null) { continue; } FacilityClass fcc = dr["FacilityClass"] as FacilityClass; if (fcc == fac) { strTemp += featureClass.FeatureClassID + ";"; } } if (this._facDoc != null) { XmlNode node = this._facDoc.SelectSingleNode(".//FacilityClass[@name=\"" + fac.Name + "\"]"); if (node != null) { if (node.Attributes["fc2D"] == null) { XmlAttribute attr = this._facDoc.CreateAttribute("fc2D"); node.Attributes.Append(attr); } node.Attributes["fc2D"].Value = strTemp; } this._facDoc.Save(this._xmlFacFilePath); } } } //设施大类所属 WaitForm.SetCaption("所属大类关联设置进行中..."); HashSet <MajorClass> listMC = _checkMCList; if (listMC != null && this.ceConnectMajorClass.Checked) { foreach (MajorClass mc in listMC) { string strTemp = ""; List <IFeatureClass> listFc = new List <IFeatureClass>(); foreach (DataRow dr in this._dt.Rows) { if (!(bool)dr["CheckState"]) { continue; } IFeatureClass featureClass = dr["FeatureClass"] as IFeatureClass; if (featureClass == null) { continue; } MajorClass mcc = dr["MajorClass"] as MajorClass; if (mcc == mc) { strTemp += featureClass.FeatureClassID + ";"; listFc.Add(featureClass); } } if (this._logicDoc != null) { XmlNode node = this._logicDoc.SelectSingleNode(".//MajorClass[@name=\"" + mc.Name + "\"]"); if (node != null) { if (node.Attributes["fc2D"] == null) { XmlAttribute attr = this._logicDoc.CreateAttribute("fc2D"); node.Attributes.Append(attr); } node.Attributes["fc2D"].Value = strTemp; } this._logicDoc.Save(this._xmlLogicFilePath); for (int i = node.ChildNodes.Count - 1; i >= 0; i--) { XmlNode childNode = node.ChildNodes[i]; node.RemoveChild(childNode); } //二级分组 WaitForm.SetCaption("小类分组中..."); IQueryFilter filter = null; IFeatureCursor cursor = null; IFeature pFeature = null; HashSet <string> hsValues = new HashSet <string>(); try { foreach (IFeatureClass fc in listFc) { WaitForm.SetCaption("要素类【" + (string.IsNullOrEmpty(fc.AliasName) ? fc.FeatureClassID.ToString() : fc.AliasName) + "】分组中..."); IFields pFields = fc.Fields; int index = pFields.FindField(mc.ClassifyField); if (index == -1) { continue; } filter = new QueryFilter(); filter.SubFields = mc.ClassifyField; cursor = fc.Search(filter, true); while ((pFeature = cursor.NextFeature()) != null) { if (pFeature.get_Value(index) != null) { hsValues.Add(pFeature.get_Value(index).ToString()); } } if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (pFeature != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeature); pFeature = null; } } // // 重设groupid // WaitForm.SetCaption("启动重置GroupId..."); // foreach (IFeatureClass fc in listFc) // { // WaitForm.SetCaption("要素类【" + (string.IsNullOrEmpty(fc.AliasName) ? fc.FeatureClassID.ToString() : fc.AliasName) + "】重置GroupId中..."); // filter = new QueryFilter(); // filter.SubFields = "GroupId,oid"; // int groupid = 0; // foreach (string str in hsValues) // { // filter.WhereClause = mc.ClassifyField + " = '" + str + "'"; // cursor = fc.Update(filter, false); // while ((pFeature = cursor.NextFeature()) != null) // { // pFeature.set_Value(0, groupid); // cursor.UpdateFeature(pFeature); // } // groupid++; // } // } } catch { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (pFeature != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeature); pFeature = null; } if (filter != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(filter); pFeature = null; } } WaitForm.SetCaption("分组信息写入配置文件中..."); foreach (string str in hsValues) { XmlElement ele = this._logicDoc.CreateElement("SubClass"); ele.SetAttribute("name", str); node.AppendChild(ele); } this._logicDoc.Save(this._xmlLogicFilePath); } } } WaitForm.Stop(); XtraMessageBox.Show("设置成功!", "提示"); } catch (Exception ex) { WaitForm.Stop(); XtraMessageBox.Show("设置失败!", "提示"); } }
private void btnCreate_Click(object sender, EventArgs e) { string name = this.teName.Text.Trim(); string alias = this.teAlias.Text.Trim(); string classifyfield = this.teClassifyField.Text.Trim(); if (string.IsNullOrEmpty(name)) { XtraMessageBox.Show("名称不能为空!", "提示"); return; } if (type == 1) { if (dictGroups.ContainsKey(name)) { XtraMessageBox.Show("已存在该组!", "提示"); return; } LogicGroup lg = null; if (currentLayer != null && currentLayer is TreeNodeLogicGroup) { lg = new LogicGroup(name, alias, currentLayer.CustomValue as LogicGroup); } else { lg = new LogicGroup(name, alias, null); } TreeNodeLogicGroup treenode = new TreeNodeLogicGroup() { Name = string.IsNullOrEmpty(lg.Alias) ? lg.Name : lg.Alias, CustomValue = lg }; if (currentLayer != null && currentLayer is TreeNodeLogicGroup) { (currentLayer as GroupLayerClass).Add2(treenode); } else { treenode.OwnNode = this.logicBaseTree1.TreeList.AppendNode(new object[] { treenode.Name }, (TreeListNode)null); } dictGroups[name] = lg; } if (type == 2) { if (dictMCs.ContainsKey(name)) { XtraMessageBox.Show("已存在该大类!", "提示"); return; } if (string.IsNullOrEmpty(classifyfield)) { XtraMessageBox.Show("分组字段不能为空!", "提示"); return; } MajorClass mc = null; if (currentLayer != null && currentLayer is TreeNodeLogicGroup) { mc = new MajorClass(name, alias, classifyfield, "", "", currentLayer.CustomValue as LogicGroup); } else { mc = new MajorClass(name, alias, classifyfield, "", "", null); } TreeNodeMajorClass treenode = new TreeNodeMajorClass() { Name = string.IsNullOrEmpty(mc.Alias) ? mc.Name : mc.Alias, CustomValue = mc }; if (currentLayer != null && currentLayer is TreeNodeLogicGroup) { (currentLayer as GroupLayerClass).Add2(treenode); } else { treenode.OwnNode = this.logicBaseTree1.TreeList.AppendNode(new object[] { treenode.Name }, (TreeListNode)null); } dictMCs[name] = mc; } }
private void OnFinishedDraw() { if (this._drawTool != null) { if (this.radioGroup1.SelectedIndex == 0) { if (this._drawTool.GetSelectFeatureLayerPickResult() != null && this._drawTool.GetSelectPoint() != null) { IFeatureLayerPickResult pr = this._drawTool.GetSelectFeatureLayerPickResult(); string g = pr.FeatureLayer.FeatureClassId.ToString(); string facName = Dictionary3DTable.Instance.GetFacilityClassNameByDFFeatureClassID(g); if (facName != "PipeLine") { XtraMessageBox.Show("您选择的不是管线设施。", "提示"); return; } DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(g); if (dffc == null) { return; } int fid = pr.FeatureId; MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(g); if (mc == null) { return; } _num++; IPoint interPoint = this._drawTool.GetSelectPoint(); ISimplePointSymbol sps = new SimplePointSymbol(); sps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16); sps.Size = SystemInfo.Instance.SymbolSize; IRenderPoint rp = d3.ObjectManager.CreateRenderPoint(interPoint, sps, d3.ProjectTree.RootID); this._dict[_num] = rp.Guid; ILabel label = d3.ObjectManager.CreateLabel(d3.ProjectTree.RootID); IPoint pt = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pt.SetCoords(interPoint.X, interPoint.Y, interPoint.Z + 1, 0, 0); label.Position = pt; label.Text = _num.ToString(); TextSymbol ts = new TextSymbol(); TextAttribute ta = new TextAttribute(); ta.TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16); ta.TextSize = SystemInfo.Instance.TextSize; ts.TextAttribute = ta; label.TextSymbol = ts; this._dictLabel[_num] = label.Guid; DataRow dr = this._dt.NewRow(); dr["Num"] = _num; dr["PipeType"] = mc; dr["Fid"] = fid; dr["FeatureClass"] = dffc.GetFeatureClass(); dr["InterPoint"] = interPoint; this._dt.Rows.Add(dr); } } if (this.radioGroup1.SelectedIndex == 1) { if (this._drawTool.GetGeo() != null) { WaitForm.Start("正在进行相交查询...", "请稍后"); IPolyline line = this._drawTool.GetGeo() as IPolyline; IPolyline l = line.Clone2(gviVertexAttribute.gviVertexAttributeNone) as IPolyline; List <DF3DFeatureClass> listdffc = DF3DFeatureClassManager.Instance.GetFeatureClassByFacilityClassName("PipeLine"); if (listdffc == null) { return; } foreach (DF3DFeatureClass dffc in listdffc) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fc.GuidString); if (mc == null) { continue; } if (this._dt.Rows.Count > 0) { if (this._dt.Rows[0]["PipeType"] != null && this._dt.Rows[0]["PipeType"] is MajorClass) { if (mc.Name != (this._dt.Rows[0]["PipeType"] as MajorClass).Name) { continue; } } } ISpatialFilter filter = new SpatialFilter(); filter.Geometry = l; filter.GeometryField = "FootPrint"; filter.SpatialRel = gviSpatialRel.gviSpatialRelIntersects; int counttemp = fc.GetCount(filter); if (counttemp == 0) { continue; } IFdeCursor cursor = null; IRowBuffer row = null; try { IFieldInfoCollection fields = fc.GetFields(); cursor = fc.Search(filter, true); while ((row = cursor.NextRow()) != null) { IPolyline geo = row.GetValue(fields.IndexOf("FootPrint")) as IPolyline; IPolyline geoShape = row.GetValue(fields.IndexOf("Shape")) as IPolyline; if (geo == null || geoShape == null || geo.GeometryType != gviGeometryType.gviGeometryPolyline || geoShape.GeometryType != gviGeometryType.gviGeometryPolyline) { continue; } if ((l as IRelationalOperator2D).Intersects2D(geo)) { IPoint intersectPointTemp = (l as ITopologicalOperator2D).Intersection2D(geo) as IPoint; double height = geoShape.StartPoint.Z + (geoShape.EndPoint.Z - geoShape.StartPoint.Z) * Math.Sqrt((geo.StartPoint.X - intersectPointTemp.X) * (geo.StartPoint.X - intersectPointTemp.X) + (geo.StartPoint.Y - intersectPointTemp.Y) * (geo.StartPoint.Y - intersectPointTemp.Y)) / geo.Length; IPoint intersectPoint = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ); intersectPoint.Z = height; intersectPoint.X = intersectPointTemp.X; intersectPoint.Y = intersectPointTemp.Y; int fid = int.Parse(row.GetValue(0).ToString()); _num++; ISimplePointSymbol sps = new SimplePointSymbol(); sps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16); sps.Size = SystemInfo.Instance.SymbolSize; IRenderPoint rp = d3.ObjectManager.CreateRenderPoint(intersectPoint, sps, d3.ProjectTree.RootID); this._dict[_num] = rp.Guid; ILabel label = d3.ObjectManager.CreateLabel(d3.ProjectTree.RootID); IPoint pt = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pt.SetCoords(intersectPoint.X, intersectPoint.Y, intersectPoint.Z + 1, 0, 0); label.Position = pt; label.Text = _num.ToString(); TextSymbol ts = new TextSymbol(); TextAttribute ta = new TextAttribute(); ta.TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16); ta.TextSize = SystemInfo.Instance.TextSize; ts.TextAttribute = ta; label.TextSymbol = ts; this._dictLabel[_num] = label.Guid; DataRow dr = this._dt.NewRow(); dr["Num"] = _num; dr["PipeType"] = mc; dr["Fid"] = fid; dr["FeatureClass"] = fc; dr["InterPoint"] = intersectPoint; this._dt.Rows.Add(dr); } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } WaitForm.Stop(); } } } }
private bool SaveData(string fileName) { try { XmlDocument document = new XmlDocument(); XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "utf-8", null); document.AppendChild(newChild); XmlNode node = document.CreateElement("LogicDataStructure"); document.AppendChild(node); List <IBaseLayer> logicBaseTree1GetRootLayers = this.logicBaseTree1.GetRootLayers(); if (logicBaseTree1GetRootLayers != null) { foreach (IBaseLayer layer in logicBaseTree1GetRootLayers) { if (!(layer is TreeNodeLogicGroup) && !(layer is TreeNodeMajorClass)) { continue; } if (layer is TreeNodeLogicGroup) { TreeNodeLogicGroup treenode = layer as TreeNodeLogicGroup; if (!(treenode.CustomValue is LogicGroup)) { continue; } LogicGroup lg = treenode.CustomValue as LogicGroup; XmlElement element = document.CreateElement("LogicGroup"); element.SetAttribute("name", lg.Name); element.SetAttribute("alias", lg.Alias); XmlNode lgNode = node.AppendChild(element); RecurSaveData(treenode, document, lgNode); } if (layer is TreeNodeMajorClass) { TreeNodeMajorClass treenode = layer as TreeNodeMajorClass; if (treenode.CustomValue is MajorClass) { MajorClass mc = treenode.CustomValue as MajorClass; XmlElement element = document.CreateElement("MajorClass"); element.SetAttribute("name", mc.Name); element.SetAttribute("alias", mc.Alias); element.SetAttribute("classifyfield", mc.ClassifyField); element.SetAttribute("fc2D", mc.Fc2D); element.SetAttribute("fc3D", mc.Fc3D); XmlNode mcNode = node.AppendChild(element); foreach (SubClass sc in mc.SubClasses) { XmlElement ele1 = document.CreateElement("SubClass"); ele1.SetAttribute("name", sc.Name); ele1.SetAttribute("groupid", sc.GroupId.ToString()); mcNode.AppendChild(ele1); } } } } } document.Save(fileName); return(true); } catch (Exception ex) { XtraMessageBox.Show("保存数据失败!", "提示"); return(false); } }
private void RecursiveLoadData(XmlNodeList list, LogicGroup parent, GroupLayerClass parentLayer) { if (list == null) { return; } foreach (XmlNode node in list) { if (node.Name == "LogicGroup") { string fieldName = "", fieldAliasName = ""; if (node.Attributes["name"] != null) { fieldName = node.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(fieldName)) { continue; } } if (node.Attributes["alias"] != null) { fieldAliasName = node.Attributes["alias"].Value.Trim(); } LogicGroup lg = new LogicGroup(fieldName, fieldAliasName, parent); if (dictGroups.ContainsKey(lg.Name)) { continue; } dictGroups[lg.Name] = lg; parent.LogicGroups.Add(lg); TreeNodeLogicGroup treenode = new TreeNodeLogicGroup() { Name = string.IsNullOrEmpty(lg.Alias) ? lg.Name : lg.Alias, CustomValue = lg }; parentLayer.Add2(treenode); RecursiveLoadData(node.ChildNodes, lg, parentLayer); } if (node.Name == "MajorClass") { string fieldName = "", fieldAliasName = "", classifyFieldName = "", fc2D = "", fc3D = ""; if (node.Attributes["name"] != null) { fieldName = node.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(fieldName)) { continue; } } if (node.Attributes["alias"] != null) { fieldAliasName = node.Attributes["alias"].Value.Trim(); } if (node.Attributes["classifyfield"] != null) { classifyFieldName = node.Attributes["classifyfield"].Value.Trim(); } if (node.Attributes["fc2D"] != null) { fc2D = node.Attributes["fc2D"].Value.Trim(); } if (node.Attributes["fc3D"] != null) { fc3D = node.Attributes["fc3D"].Value.Trim(); } MajorClass mc = new MajorClass(fieldName, fieldAliasName, classifyFieldName, fc2D, fc3D, parent); if (dictMCs.ContainsKey(mc.Name)) { continue; } dictMCs[mc.Name] = mc; parent.MajorClasses.Add(mc); foreach (XmlNode cnode in node.ChildNodes) { if (cnode.Name != "SubClass") { continue; } string scname = "", scgroupid = ""; if (cnode.Attributes["name"] != null) { scname = cnode.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(scname)) { continue; } } if (cnode.Attributes["groupid"] != null) { scgroupid = cnode.Attributes["groupid"].Value.Trim(); } int groupid = 0; if (!int.TryParse(scgroupid, out groupid)) { groupid = 0; } SubClass sc = new SubClass(scname, groupid, mc); mc.SubClasses.Add(sc); } TreeNodeMajorClass treenode = new TreeNodeMajorClass() { Name = string.IsNullOrEmpty(mc.Alias) ? mc.Name : mc.Alias, CustomValue = mc }; parentLayer.Add2(treenode); } } }
public void LoadData(string fileName) { if (string.IsNullOrEmpty(fileName)) { return; } try { if (!File.Exists(fileName)) { string path = System.IO.Path.GetDirectoryName(fileName) + "\\"; if (!Directory.Exists(path)) { DirectoryInfo di = Directory.CreateDirectory(path); if (di == null) { return; } } XmlDocument document = new XmlDocument(); XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "utf-8", null); document.AppendChild(newChild); XmlNode node = document.CreateElement("LogicDataStructure"); document.AppendChild(node); document.Save(fileName); } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); if (xmlDoc == null) { return; } XmlNode root = xmlDoc.SelectSingleNode("LogicDataStructure"); if (root == null) { return; } foreach (XmlNode node in root.ChildNodes) { if (node.Name == "LogicGroup") { string fieldName = "", fieldAliasName = ""; if (node.Attributes["name"] != null) { fieldName = node.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(fieldName)) { continue; } } if (node.Attributes["alias"] != null) { fieldAliasName = node.Attributes["alias"].Value.Trim(); } LogicGroup lg = new LogicGroup(fieldName, fieldAliasName, null); if (dictGroups.ContainsKey(lg.Name)) { continue; } dictGroups[lg.Name] = lg; TreeNodeLogicGroup treenode = new TreeNodeLogicGroup() { Name = string.IsNullOrEmpty(lg.Alias) ? lg.Name : lg.Alias, CustomValue = lg }; treenode.OwnNode = this.logicBaseTree1.TreeList.AppendNode(new object[] { treenode.Name }, (TreeListNode)null); RecursiveLoadData(node.ChildNodes, lg, treenode); } if (node.Name == "MajorClass") { string fieldName = "", fieldAliasName = "", classifyFieldName = "", fc2D = "", fc3D = ""; if (node.Attributes["name"] != null) { fieldName = node.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(fieldName)) { continue; } } if (node.Attributes["alias"] != null) { fieldAliasName = node.Attributes["alias"].Value.Trim(); } if (node.Attributes["classifyfield"] != null) { classifyFieldName = node.Attributes["classifyfield"].Value.Trim(); } if (node.Attributes["fc2D"] != null) { fc2D = node.Attributes["fc2D"].Value.Trim(); } if (node.Attributes["fc3D"] != null) { fc3D = node.Attributes["fc3D"].Value.Trim(); } MajorClass mc = new MajorClass(fieldName, fieldAliasName, classifyFieldName, fc2D, fc3D, null); if (dictMCs.ContainsKey(mc.Name)) { continue; } dictMCs[mc.Name] = mc; foreach (XmlNode cnode in node.ChildNodes) { if (cnode.Name != "SubClass") { continue; } string scname = "", scgroupid = ""; if (cnode.Attributes["name"] != null) { scname = cnode.Attributes["name"].Value.Trim(); if (string.IsNullOrEmpty(scname)) { continue; } } if (cnode.Attributes["groupid"] != null) { scgroupid = cnode.Attributes["groupid"].Value.Trim(); } int groupid = 0; if (!int.TryParse(scgroupid, out groupid)) { groupid = 0; } SubClass sc = new SubClass(scname, groupid, mc); mc.SubClasses.Add(sc); } TreeNodeMajorClass treenode = new TreeNodeMajorClass() { Name = string.IsNullOrEmpty(mc.Alias) ? mc.Name : mc.Alias, CustomValue = mc }; treenode.OwnNode = this.logicBaseTree1.TreeList.AppendNode(new object[] { treenode.Name }, (TreeListNode)null); } } } catch (Exception ex) { } }
public override void Run(object sender, EventArgs e) { int i = 0, k; string strDicValue; string strPntID; IFeatureClass Pntfc; IFeatureClass Arcfc; IFeatureCursor pFeaCursor; IQueryFilter pFilter = new QueryFilterClass(); IFeature pFea; string[] arrFc2DId; mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmSelType frmType = new frmSelType(); if (frmType.ShowDialog() == DialogResult.OK) { try { List <DF2DFeatureClass> pPntlist = new List <DF2DFeatureClass>(); List <DF2DFeatureClass> pArclist = new List <DF2DFeatureClass>(); m_arrPipeType = frmType.PipeType; for (i = 0; i < m_arrPipeType.Count; i++) { MajorClass mc = m_arrPipeType[i] as MajorClass; arrFc2DId = mc.Fc2D.Split(';'); if (arrFc2DId == null) { continue; } foreach (string fc2DId in arrFc2DId) { DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId); if (dffc == null) { continue; } IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } if (dffc.GetFacilityClassName() == "PipeNode") { pPntlist.Add(dffc); continue; } if (dffc.GetFacilityClassName() == "PipeLine") { pArclist.Add(dffc); continue; } } } if ((pPntlist == null) || (pArclist == null)) { return; } Dictionary <IFeatureClass, DataTable> dict = new Dictionary <IFeatureClass, DataTable>(); WaitForm.Start("开始数据一致性检查..", "请稍候"); int count = 0; foreach (DF2DFeatureClass Pntdfcc in pPntlist) { DataTable dt = GetDataTableByStruture(); DF2DFeatureClass Arcdfcc = pArclist[count]; Pntfc = Pntdfcc.GetFeatureClass(); Arcfc = Arcdfcc.GetFeatureClass(); if (Pntfc == null && Arcfc == null) { return; } WaitForm.SetCaption("正在检查图层:" + " " + Pntfc.AliasName); FacilityClass fac = Pntdfcc.GetFacilityClass(); if (fac == null) { continue; } FacilityClass facc = Arcdfcc.GetFacilityClass(); if (facc == null) { continue; } //List<DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection; DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("LinkType"); if (fi == null) { continue; } DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("Detectid"); if (fi1 == null) { continue; } DFDataConfig.Class.FieldInfo fi2 = facc.GetFieldInfoBySystemName("StartNo"); if (fi2 == null) { continue; } DFDataConfig.Class.FieldInfo fi3 = facc.GetFieldInfoBySystemName("EndNo"); if (fi3 == null) { continue; } DFDataConfig.Class.FieldInfo fi4 = fac.GetFieldInfoBySystemName("UState"); if (fi4 == null) { continue; } // DFDataConfig.Class.FieldInfo fi5 = facc.GetFieldInfoBySystemName("source"); // if (fi5 == null) continue; pFeaCursor = Pntfc.Search(null, true); while ((pFea = pFeaCursor.NextFeature()) != null) { bool b1 = false, b2 = false; strPntID = pFea.get_Value(Pntfc.FindField(fi1.Name)).ToString(); strDicValue = pFea.get_Value(Pntfc.FindField(fi.Name)).ToString(); if (strDicValue == "三通" || strDicValue == "三分支") { k = 3; } else if (strDicValue == "四通" || strDicValue == "四分支") { k = 4; } else if (strDicValue == "五通" || strDicValue == "五分支") { k = 5; } else if (strDicValue == "六通" || strDicValue == "六分支") { k = 6; } else if (strDicValue == "七通" || strDicValue == "七分支") { k = 7; } else if (strDicValue == "八通" || strDicValue == "八分支") { k = 8; } else { k = 2; } pFilter.WhereClause = fi2.Name + " = '" + strPntID + "' or " + fi3.Name + " = '" + strPntID + "'"; if (Arcfc.FeatureCount(pFilter) != k) { b1 = true; } if (Pntfc.FindField(fi4.Name) != -1 && Arcfc.FindField(fi4.Name) != -1) { pFilter.WhereClause = "(" + fi2.Name + " = '" + strPntID + "' or " + fi3.Name + " = '" + strPntID + "') and " + fi4.Name + " <> '" + strDicValue + "'"; if (Arcfc.FeatureCount(pFilter) > 0) { b2 = true; } } DataRow dr = dt.NewRow(); dr["ErrorFeatureID"] = pFea.OID; dr["FeatureofClass"] = Pntfc.AliasName; dr["FeatureofLayer"] = (Pntfc as IDataset).Name; dr["FeatureClass"] = Pntfc; if (b1 && b2) { dr["ErrorType"] = "多通多分支与管点连接管线数量不一致;管点与相连接管线的使用状态不一致"; } else if (b1 && !b2) { dr["ErrorType"] = "多通多分支与管点连接管线数量不一致"; } else if (!b1 && b2) { dr["ErrorType"] = "管点与相连接管线的使用状态不一致"; } dt.Rows.Add(dr); //Console.WriteLine(pFea.OID + " " + Pntfc.AliasName); } if (dt.Rows.Count > 0) { dict[Pntfc] = dt; } count++; } WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } catch (System.Exception ex) { } } }
public void Add(MajorClass mClass) { MajorClasses.Add(mClass); updateCount(); DBHelper.AddMajorClass(mClass); }
private void LoadData(string pFileName) { geoFeatureLayer.Clear(); annoLayers.Clear(); IMapDocument pMapDocument = new MapDocument(); pMapDocument.Open(pFileName, ""); IMap map = pMapDocument.ActiveView.FocusMap; for (int i = 0; i < map.LayerCount; i++) { ILayer layer = map.get_Layer(i); ReadMapLayer(layer); } if (geoFeatureLayer.Count > 0) { foreach (IGeoFeatureLayer gfl in geoFeatureLayer) { DataRow dr = _dt.NewRow(); dr["FeatureClassAlias"] = gfl.FeatureClass.AliasName; dr["FeatureClassName"] = gfl.Name; dr["FeatureClass"] = gfl.FeatureClass; dr["CheckState"] = true; FacilityClass facC = DF2DData.Class.Dictionary2DTable.Instance.GetFacilityClassByDFFeatureClassID(gfl.FeatureClass.FeatureClassID.ToString()); if (facC != null) { dr["FacilityClass"] = facC; } else { foreach (FacilityClass facTemp in FacilityClassManager.Instance.GetAllFacilityClass()) { if (gfl.FeatureClass.AliasName.Contains(facTemp.Alias)) { dr["FacilityClass"] = facTemp; break; } } } MajorClass mc = LogicDataStructureManage2D.Instance.GetMajorClassByDFFeatureClassID(gfl.FeatureClass.FeatureClassID.ToString()); if (mc != null) { dr["MajorClass"] = mc; } else { foreach (MajorClass mcTemp in LogicDataStructureManage2D.Instance.GetAllMajorClass()) { if (gfl.FeatureClass.AliasName.Contains(mcTemp.Alias)) { dr["MajorClass"] = mcTemp; break; } } } this._dt.Rows.Add(dr); } } if (annoLayers.Count > 0) { foreach (IAnnotationLayer gfl in annoLayers) { DataRow dr = _dt.NewRow(); IFeatureLayer fl = gfl as IFeatureLayer; if (fl == null) { continue; } IFeatureClass featureClass = fl.FeatureClass; if (featureClass == null) { continue; } dr["FeatureClassAlias"] = featureClass.AliasName; dr["FeatureClassName"] = (gfl as ILayer).Name; dr["FeatureClass"] = featureClass; dr["CheckState"] = true; FacilityClass facC = DF2DData.Class.Dictionary2DTable.Instance.GetFacilityClassByDFFeatureClassID(featureClass.FeatureClassID.ToString()); if (facC != null) { dr["FacilityClass"] = facC; } else { foreach (FacilityClass facTemp in FacilityClassManager.Instance.GetAllFacilityClass()) { if (featureClass.AliasName.Contains(facTemp.Alias)) { dr["FacilityClass"] = facTemp; break; } } } MajorClass mc = LogicDataStructureManage2D.Instance.GetMajorClassByDFFeatureClassID(featureClass.FeatureClassID.ToString()); if (mc != null) { dr["MajorClass"] = mc; } else { foreach (MajorClass mcTemp in LogicDataStructureManage2D.Instance.GetAllMajorClass()) { if (featureClass.AliasName.Contains(mcTemp.Alias)) { dr["MajorClass"] = mcTemp; break; } } } this._dt.Rows.Add(dr); } } }
//public void ShowProperty() //{ // try // { // _dtShow.Rows.Clear(); // if (_dt == null || _dt.Rows.Count < _num) return; // this.bsiInfo.Caption = "浏览 " + _num + "/" + _dt.Rows.Count; // DataRow dr = _dt.Rows[_num - 1]; // for (int i = 0; i < _dt.Columns.Count; i++) // { // String columnName = _dt.Columns[i].ColumnName; // if (columnName == null) continue; // if (dr[columnName] == null || dr[columnName].ToString() == "") continue; // string value = dr[columnName].ToString(); // double dTemp = 0.0; // string dStrTemp = ""; // bool bDouble = double.TryParse(value, out dTemp); // if (bDouble) dStrTemp = dTemp.ToString("0.00"); // else dStrTemp = value; // DataRow drnew = _dtShow.NewRow(); // drnew["Property"] = columnName; // drnew["Value"] = dStrTemp; // _dtShow.Rows.Add(drnew); // } // } // catch (System.Exception ex) // { // } //} private void ShowProperty() { try { if (_currentClass == null) { return; } _dtShow.Rows.Clear(); DataTable dt = _dict[_currentClass]; if (dt == null || dt.Rows.Count < _num) { return; } if (dt.Rows.Count == 0 || dt.Rows.Count == 1) { this.bbiFirst.Enabled = false; this.bbiPreviousOne.Enabled = false; this.bbiNextOne.Enabled = false; this.bbiLastOne.Enabled = false; } else { if (_num == 1) { this.bbiFirst.Enabled = false; this.bbiPreviousOne.Enabled = false; this.bbiNextOne.Enabled = true; this.bbiLastOne.Enabled = true; } else if (_num == dt.Rows.Count) { this.bbiFirst.Enabled = true; this.bbiPreviousOne.Enabled = true; this.bbiNextOne.Enabled = false; this.bbiLastOne.Enabled = false; } else { this.bbiFirst.Enabled = true; this.bbiPreviousOne.Enabled = true; this.bbiNextOne.Enabled = true; this.bbiLastOne.Enabled = true; } } this.bsiInfo.Caption = "浏览 " + _num + "/" + dt.Rows.Count; DataRow dr = dt.Rows[_num - 1]; for (int i = 0; i < dt.Columns.Count; i++) { DataRow drnew = _dtShow.NewRow(); drnew["Property"] = dt.Columns[i].Caption; drnew["Value"] = dr[dt.Columns[i].ColumnName]; _dtShow.Rows.Add(drnew); } #region 定位 DF2DApplication app = DF2DApplication.Application; if (app == null || app.Current2DMapControl == null) { return; } if (_currentClass == "建筑物" || _currentClass == "构筑物") { FacilityClass fac; if (_currentClass == "建筑物") { fac = FacilityClassManager.Instance.GetFacilityClassByName("Building"); } else { fac = FacilityClassManager.Instance.GetFacilityClassByName("Structure"); } if (fac != null) { string[] fc2D = fac.Fc2D.Split(';'); DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2D[0]); if (dffc == null) { return; } IFeatureClass fc = dffc.GetFeatureClass(); IFeatureLayer fl = dffc.GetFeatureLayer(); if (fc == null) { return; } int oid = int.Parse(dr["oid"].ToString()); IFeature feature = fc.GetFeature(oid); app.Current2DMapControl.ActiveView.FocusMap.ClearSelection(); app.Current2DMapControl.ActiveView.FocusMap.SelectFeature(fl as ILayer, feature); app.Current2DMapControl.ActiveView.Refresh(); IGeometry geo = feature.Shape; IEnvelope pEnv = geo.Envelope; IPoint pPoint = new PointClass(); pPoint.PutCoords((pEnv.XMax + pEnv.XMin) / 2, (pEnv.YMax + pEnv.YMin) / 2); app.Current2DMapControl.MapScale = 500; app.Current2DMapControl.CenterAt(pPoint); } } else { MajorClass mc = LogicDataStructureManage2D.Instance.GetMajorClassBySubClassName(_currentClass); if (mc != null && !string.IsNullOrEmpty(mc.Fc2D)) { string[] arrFc2DId = mc.Fc2D.Split(';'); if (arrFc2DId == null) { return; } foreach (string fc2DId in arrFc2DId) { DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId); if (dffc == null) { continue; } FacilityClass fac = dffc.GetFacilityClass(); if (fac == null || fac.Name != dt.TableName) { continue; } IFeatureClass fc = dffc.GetFeatureClass(); IFeatureLayer fl = dffc.GetFeatureLayer(); if (fc == null) { continue; } int oid = int.Parse(dr["oid"].ToString()); IFeature feature = fc.GetFeature(oid); app.Current2DMapControl.ActiveView.FocusMap.ClearSelection(); app.Current2DMapControl.ActiveView.FocusMap.SelectFeature(fl as ILayer, feature); app.Current2DMapControl.ActiveView.Refresh(); IGeometry geo = feature.Shape; IEnvelope pEnv = geo.Envelope; IPoint pPoint = new PointClass(); pPoint.PutCoords((pEnv.XMax + pEnv.XMin) / 2, (pEnv.YMax + pEnv.YMin) / 2); app.Current2DMapControl.MapScale = 500; app.Current2DMapControl.CenterAt(pPoint); } } } #endregion } catch (Exception ex) { } }
public override void Run(object sender, EventArgs e) { string[] arrFc2DId; mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmSelType frmType = new frmSelType(); if (frmType.ShowDialog() == DialogResult.OK) { List <DF2DFeatureClass> list = new List <DF2DFeatureClass>(); m_arrPipeType = frmType.PipeType; for (int i = 0; i < m_arrPipeType.Count; i++) { MajorClass mc = m_arrPipeType[i] as MajorClass; arrFc2DId = mc.Fc2D.Split(';'); if (arrFc2DId == null) { continue; } foreach (string fc2DId in arrFc2DId) { DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId); if (dffc == null || dffc.GetFacilityClassName() != "PipeLine") { continue; } IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } //if (fc.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) //{ list.Add(dffc); //} } } Dictionary <IFeatureClass, DataTable> dict = new Dictionary <IFeatureClass, DataTable>(); WaitForm.Start("开始拓扑检查..", "请稍候"); foreach (DF2DFeatureClass dffc in list) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } FacilityClass fac = dffc.GetFacilityClass(); if (fac == null) { continue; } List <DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection; DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("StartHeight2D"); int index = fc.FindField(fi.Name); WaitForm.SetCaption("正在检查图层:" + " " + fc.AliasName); if (fi == null || index == -1) { continue; } DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("EndHeight"); int index1 = fc.FindField(fi1.Name); if (fi1 == null || index1 == -1) { continue; } DFDataConfig.Class.FieldInfo fi2 = fac.GetFieldInfoBySystemName("StartDep"); int index2 = fc.FindField(fi2.Name); if (fi2 == null || index2 == -1) { continue; } DFDataConfig.Class.FieldInfo fi3 = fac.GetFieldInfoBySystemName("EndDep"); int index3 = fc.FindField(fi3.Name); if (fi3 == null || index3 == -1) { continue; } DataTable dt = GetDataTableByStruture(); IFeatureCursor pFeaCursor = fc.Search(null, true); IFeature pFea = pFeaCursor.NextFeature(); while (pFea != null) { //Console.WriteLine(pFea.OID + " " + fc.AliasName); bool b1 = false, b2 = false; string obj = pFea.get_Value(index).ToString(); string obj1 = pFea.get_Value(index1).ToString(); if (obj != "" && obj1 != "") { double d; if (!double.TryParse(obj1, out d)) { d = 0.0; } if (Math.Abs(double.Parse(obj) - double.Parse(obj1)) > 1) { b1 = true; } } string obj2 = pFea.get_Value(index2).ToString(); string obj3 = pFea.get_Value(index3).ToString(); /* if (obj3 != null) continue;*/ if ((obj2 != "") && (obj3 != "")) { double d; if (!double.TryParse(obj2, out d)) { d = 0.0; } if (Math.Abs(double.Parse(obj2) - double.Parse(obj3)) > 0.5) { b2 = true; } } if (b1 && b2) { DataRow dr = dt.NewRow(); dr["ErrorFeatureID"] = pFea.OID; dr["FeatureofClass"] = fc.AliasName; dr["FeatureofLayer"] = (fc as IDataset).Name; dr["FeatureClass"] = fc; if (b1 && b2) { dr["ErrorType"] = "管线起止点高程差值超出规范值;管线起止点埋深差值超出规范值"; } else if (b1 && !b2) { dr["ErrorType"] = "管线起止点高程差值超出规范值"; } else if (b2 && !b1) { dr["ErrorType"] = "管线起止点埋深差值超出规范值"; } dt.Rows.Add(dr); } pFea = pFeaCursor.NextFeature(); } if (dt.Rows.Count > 0) { dict[fc] = dt; } } WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } }
private void CircleQuery() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } WaitForm.Start("正在搜索...", "请稍后"); try { FacilityClass fac = FacilityClassManager.Instance.GetFacilityClassByName("PipeNode"); if (fac == null) { return; } DFDataConfig.Class.FieldInfo field = fac.GetFieldInfoBySystemName("Additional"); if (field == null) { return; } ISpatialFilter filter = new SpatialFilterClass(); filter.SubFields = "oid,Geometry,FootPrint"; string configFH = Config.GetConfigValue("FireHydrantName"); string fireHydrantName = "'" + configFH + "'"; filter.WhereClause = field.Name + " in (" + fireHydrantName + ")"; filter.Geometry = this._drawTool.GetGeo().Clone2(gviVertexAttribute.gviVertexAttributeNone); filter.GeometryField = "FootPrint"; filter.SpatialRel = gviSpatialRel.gviSpatialRelContains; List <DF3DFeatureClass> list = DF3DFeatureClassManager.Instance.GetFeatureClassByFacilityClassName("PipeNode"); if (list == null) { return; } foreach (DF3DFeatureClass dffc in list) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fc.GuidString); if (mc != null && mc.Name != "GS") { continue; } IFdeCursor cursor = null; IRowBuffer row = null; try { cursor = fc.Search(filter, false); while ((row = cursor.NextRow()) != null) { if (!row.IsNull(1)) { IGeometry geo = row.GetValue(1) as IGeometry; switch (geo.GeometryType) { case gviGeometryType.gviGeometryPoint: IPoint pt = geo as IPoint; IPOI poi = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi.X = pt.X; poi.Y = pt.Y; poi.Z = pt.Z + 2; poi.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\fireHydrant.png"); poi.Size = SystemInfo.Instance.SymbolSize; poi.ShowName = false; IRenderPOI rpoi = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi); this._listRGuid.Add(rpoi.Guid); continue; case gviGeometryType.gviGeometryModelPoint: IModelPoint pt1 = geo as IModelPoint; IPOI poi1 = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi1.X = pt1.X; poi1.Y = pt1.Y; poi1.Z = pt1.Z + 2; poi1.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\fireHydrant.png"); poi1.Size = SystemInfo.Instance.SymbolSize; poi1.ShowName = false; IRenderPOI rpoi1 = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi1); this._listRGuid.Add(rpoi1.Guid); continue; } } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } } catch (Exception ex) { } finally { WaitForm.Stop(); } }
private static void AddSubClass(MajorClass mc, GroupLayerClass group, Dictionary <string, IFeatureClass> fcs, string geoColumnName) { if (mc == null || string.IsNullOrEmpty(mc.ClassifyField) || string.IsNullOrEmpty(mc.Fc3D)) { return; } string[] arrayFc3DGuids = mc.Fc3D.Split(';'); if (arrayFc3DGuids == null || arrayFc3DGuids.Count() == 0) { return; } // 给每个大类节点关联上所有的要素类,并记录上所有要素类 Dictionary <string, DF3DFeatureClass> dict = new Dictionary <string, DF3DFeatureClass>(); foreach (string fc3DGuid in arrayFc3DGuids) { foreach (KeyValuePair <string, IFeatureClass> kv in fcs) { if (kv.Key == fc3DGuid) { dict[kv.Key] = new DF3DFeatureClass(kv.Value); DF3DFeatureClassManager.Instance.Add(dict[kv.Key]); break; } } } if (group is TreeNodeMajorClass) { (group as TreeNodeMajorClass).FeatureClasses = dict; } // 可视化所有的要素类 DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } AxRenderControl d3 = app.Current3DMapControl; Dictionary <string, IFeatureLayer> dictLayers = new Dictionary <string, IFeatureLayer>(); foreach (DF3DFeatureClass dffc in dict.Values) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } IGeometryRender geoRender = new SimpleGeometryRender(); geoRender.RenderGroupField = "GroupId"; IFeatureLayer fl = d3.ObjectManager.CreateFeatureLayer(fc, geoColumnName, null, geoRender, d3.ProjectTree.RootID); if (fl != null) { dictLayers[fl.Guid.ToString()] = fl; dffc.SetFeatureLayer(fl); } } // 给每个大类节点划分二级子类 foreach (SubClass sc in mc.SubClasses) { TreeNodeSubClass tnsc = new TreeNodeSubClass() { Name = sc.Name, CustomValue = sc }; tnsc.FeatureLayers = dictLayers; tnsc.FeatureClasses = dict; tnsc.Visible = true; group.Add(tnsc); } group.Visible = true; group.CollapseAll(); }
public DF2DMajorClass(MajorClass mj, TreeNodeMajorClass2D treeLayer) { this.treeLayer = treeLayer; this.majorClass = mj; listLayer = new List <ILayer>(); }
private void btnAnalysis_Click(object sender, EventArgs e) { try { if (this._dt.Rows.Count < 2) { XtraMessageBox.Show("点数少于2个", "提示"); return; } IPoint startPt = this._dt.Rows[0]["InterPoint"] as IPoint; if (startPt == null) { return; } WaitForm.Start("正在进行纵断面分析...", "请稍后"); DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } string road1 = ""; string road2 = ""; bool bAlert = false; double hmax = double.MinValue; double hmin = double.MaxValue; List <PPLine> pplines = new List <PPLine>(); foreach (DataRow dr in this._dt.Rows) { IFeatureClass fc = dr["FeatureClass"] as IFeatureClass; MajorClass mc = dr["PipeType"] as MajorClass; if (fc == null || mc == null) { continue; } DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc.GuidString); if (dffc == null) { continue; } FacilityClass fac = dffc.GetFacilityClass(); if (fac == null || fac.Name != "PipeLine") { continue; } IFieldInfoCollection fields = fc.GetFields(); int indexShape = fields.IndexOf("Shape"); if (indexShape == -1) { continue; } int indexFootPrint = fields.IndexOf("FootPrint"); if (indexFootPrint == -1) { continue; } DFDataConfig.Class.FieldInfo fiDiameter = fac.GetFieldInfoBySystemName("Diameter"); if (fiDiameter == null) { continue; } int indexDiameter = fields.IndexOf(fiDiameter.Name); if (indexDiameter == -1) { continue; } DFDataConfig.Class.FieldInfo fiRoad = fac.GetFieldInfoBySystemName("Road"); int indexRoad = -1; if (fiRoad != null) { indexRoad = fields.IndexOf(fiRoad.Name); } DFDataConfig.Class.FieldInfo fiHLB = fac.GetFieldInfoBySystemName("HLB"); int indexHLB = -1; if (fiHLB != null) { indexHLB = fields.IndexOf(fiHLB.Name); } int indexClassify = fields.IndexOf(mc.ClassifyField); int fid = int.Parse(dr["Fid"].ToString()); IFdeCursor cursor = null; IRowBuffer row = null; try { IQueryFilter filter = new QueryFilter(); filter.WhereClause = "oid=" + fid; cursor = fc.Search(filter, false); if ((row = cursor.NextRow()) != null) { if (indexRoad != -1 && !row.IsNull(indexRoad)) { if (road2 == "") { road1 = row.GetValue(indexRoad).ToString(); road2 = row.GetValue(indexRoad).ToString(); } else { road1 = row.GetValue(indexRoad).ToString(); if (road1 != road2) { if (!bAlert) { XtraMessageBox.Show("跨越多条道路,当前只绘制在【" + road2 + "】上的管线纵断面图。", "提示"); bAlert = true; } continue; } } } double startSurfHeight = double.MaxValue; double endSurfHeight = double.MaxValue; if (!app.Current3DMapControl.Terrain.IsRegistered) { DFDataConfig.Class.FieldInfo fiStartSurfHeight = fac.GetFieldInfoBySystemName("StartSurfHeight"); if (fiStartSurfHeight == null) { continue; } int indexStartSurfHeight = fields.IndexOf(fiStartSurfHeight.Name); if (indexStartSurfHeight == -1) { continue; } DFDataConfig.Class.FieldInfo fiEndSurfHeight = fac.GetFieldInfoBySystemName("EndSurfHeight"); if (fiEndSurfHeight == null) { continue; } int indexEndSurfHeight = fields.IndexOf(fiEndSurfHeight.Name); if (indexEndSurfHeight == -1) { continue; } if (!row.IsNull(indexStartSurfHeight)) { startSurfHeight = double.Parse(row.GetValue(indexStartSurfHeight).ToString()); } if (!row.IsNull(indexEndSurfHeight)) { endSurfHeight = double.Parse(row.GetValue(indexEndSurfHeight).ToString()); } } if (!row.IsNull(indexShape) && !row.IsNull(indexFootPrint)) { object objFootPrint = row.GetValue(indexFootPrint); object objShape = row.GetValue(indexShape); if (objFootPrint is IPolyline && objShape is IPolyline) { IPolyline polylineFootPrint = objFootPrint as IPolyline; IPolyline polylineShape = objShape as IPolyline; PPLine ppline = new PPLine(); if (indexClassify == -1 || row.IsNull(indexClassify)) { ppline.facType = mc.Name; } else { ppline.facType = row.GetValue(indexClassify).ToString(); } if (!row.IsNull(indexDiameter)) { string diameter = row.GetValue(indexDiameter).ToString(); if (diameter.Trim() == "") { continue; } ppline.dia = diameter; int indexDia = diameter.IndexOf('*'); if (indexDia != -1) { ppline.isrect = true; int iDia1; bool bDia1 = int.TryParse(diameter.Substring(0, indexDia), out iDia1); if (!bDia1) { continue; } int iDia2; bool bDia2 = int.TryParse(diameter.Substring(indexDia + 1, diameter.Length - indexDia - 1), out iDia2); if (!bDia2) { continue; } ppline.gj.Add(iDia1); ppline.gj.Add(iDia2); } else { ppline.isrect = false; int iDia; bool bDia = int.TryParse(diameter, out iDia); if (!bDia) { continue; } ppline.gj.Add(iDia); ppline.gj.Add(iDia); } } int hlb = 0; if (indexHLB != -1 && !row.IsNull(indexHLB)) { string strhlb = row.GetValue(indexHLB).ToString(); if (strhlb.Contains("内")) { hlb = 1; } else if (strhlb.Contains("外")) { hlb = -1; } else { hlb = 0; } ppline.hlb = hlb; } IPoint ptIntersect = dr["InterPoint"] as IPoint; ppline.interPoint = new PPPoint(ptIntersect.X, ptIntersect.Y, ptIntersect.Z); ppline.clh = GetInterPointHeight(ptIntersect, polylineShape, polylineFootPrint); if (ppline.clh > hmax) { hmax = ppline.clh; } if (ppline.clh < hmin) { hmin = ppline.clh; } if (app.Current3DMapControl.Terrain.IsRegistered) { ppline.cgh = app.Current3DMapControl.Terrain.GetElevation(ptIntersect.X, ptIntersect.Y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase); } else { ppline.cgh = startSurfHeight + (endSurfHeight - startSurfHeight) * Math.Sqrt((polylineFootPrint.StartPoint.X - ptIntersect.X) * (polylineFootPrint.StartPoint.X - ptIntersect.X) + (polylineFootPrint.StartPoint.Y - ptIntersect.Y) * (polylineFootPrint.StartPoint.Y - ptIntersect.Y)) / polylineFootPrint.Length; } if (ppline.cgh > hmax) { hmax = ppline.cgh; } if (ppline.cgh < hmin) { hmin = ppline.cgh; } // 辅助画图 ppline.startPt = new PPPoint(startPt.X, startPt.Y, startPt.Z); pplines.Add(ppline); } } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } WaitForm.Stop(); if (pplines.Count < 2) { XtraMessageBox.Show("点数少于2个", "提示"); return; } pplines.Sort(new PPLineCompare()); double spacesum = 0.0; for (int i = 1; i < pplines.Count; i++) { PPLine line1 = pplines[i - 1]; PPLine line2 = pplines[i]; line2.space = Math.Sqrt((line1.interPoint.X - line2.interPoint.X) * (line1.interPoint.X - line2.interPoint.X) + (line1.interPoint.Y - line2.interPoint.Y) * (line1.interPoint.Y - line2.interPoint.Y)); spacesum += line2.space; } ; var str1 = (pplines[0].interPoint.X / 1000).ToString("0.00"); var str2 = (pplines[0].interPoint.Y / 1000).ToString("0.00"); string mapNum = str2 + "-" + str1; string mapName = SystemInfo.Instance.SystemFullName + "纵断面图"; FrmSectionAnalysis dialog = new FrmSectionAnalysis("纵断面分析结果", 1); dialog.SetInfo(mapName, mapNum, pplines, hmax, hmin, spacesum, road2); dialog.Show(); } catch (Exception ex) { WaitForm.Stop(); } finally { } }