public static void PublishBeamDataComeEvent(object sender, BeamData e) { if (BeamDataComeEvent != null) { BeamDataComeEvent.Invoke(sender, e); } }
public static void PublishMapDealBeamDataEvent(object sender, BeamData e) { if (MapDealBeamDataEvent != null) { MapDealBeamDataEvent.Invoke(sender, e); } }
public static void GenAsset() { string path = AssetDatabase.GetAssetPath(Selection.activeObject); string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/data" + ".asset"); BeamData t = new BeamData(); AssetDatabase.CreateAsset(t, assetPathAndName); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
// 接收卫星波束数据 private void EventPublisher_BeamDataComeEvent(object sender, BeamData e) { if (e == null) return; if (gridControl1.InvokeRequired) { gridControl1.Invoke(new Action(delegate { if (dt.Rows.Count > dataCount) { dt.Rows.RemoveAt(0); } DataRow row = dt.NewRow(); row["StateId"] = e.SatelliteId; row["BeamId"] = e.BeamId; row["Lng"] = e.Point.Lng; row["Lat"] = e.Point.Lat; row["Alt"] = e.Point.Alt; row["BType"] = e.PointType == 0 ? "卫星" : "波束"; dt.Rows.Add(row); if (bAutoShow == true) { gridView1.FocusedRowHandle = dt.Rows.Count - 1; } })); } else { if (dt.Rows.Count > dataCount) { dt.Rows.RemoveAt(0); } DataRow row = dt.NewRow(); row["StateId"] = e.SatelliteId; row["BeamId"] = e.BeamId; row["Lng"] = e.Point.Lng; row["Lat"] = e.Point.Lat; row["Alt"] = e.Point.Alt; row["BType"] = e.PointType == 0 ? "卫星" : "波束"; dt.Rows.Add(row); if (bAutoShow == true) { gridView1.FocusedRowHandle = dt.Rows.Count - 1; } } }
/// <summary> /// 创建波束对象 /// </summary> private Beam CreateBeam(BeamData beamData, Model3D model) { Beam beam = new Beam(); beam.SatelliteID = beamData.SatelliteId; beam.BeamID = beamData.BeamId; beam.BeamLayerName = beamLayerName; beam.BeamName = string.Format("卫星{0}-波束{1}", beamData.SatelliteId, beamData.BeamId); beam.CenterPoint = beamData.Point; beam.Radius = beamRadius; beam.StepValue = stepValue; beam.FillColor = new RgbColorClass() { RGB = 261231 }; return(beam); }
// Use this for initialization void Start() { // Bend the Beam mfBeam = beam.GetComponent <MeshFilter>(); meshBeam = mfBeam.mesh; verticesBeam = meshBeam.vertices; verticesBeamOrig = meshBeam.vertices; beamData = new List <BeamData> (); bool found = false; for (var i = 0; i < verticesBeam.Length; i++) { for (var k = 0; k < beamData.Count; k++) { if (verticesBeam [i].y <beamData [k].yVal + .01 && verticesBeam [i].y> beamData[k].yVal - .01) { found = true; beamData[k].beamVerts.Add(verticesBeam [i]); beamData[k].indexes.Add(i); break; } } if (!found) { BeamData bD = new BeamData(); bD.yVal = verticesBeam [i].y; bD.beamVerts = new List <Vector3>(); bD.beamVerts.Add(verticesBeam [i]); bD.indexes = new List <int> (); bD.indexes.Add(i); beamData.Add(bD); } found = false; } beamData.Sort(delegate(BeamData a, BeamData b) { return((a.yVal).CompareTo(b.yVal)); }); }
// 处理波束数据 private void DealBeamCover(BeamData e) { if (e.Point.Alt > 0) { return; // 卫星数据,不做处理 } if (mapLogic == null) { return; } // 添加圆图元(波束覆盖) IMFLayer layer = mapLogic.AddLayer(coverLayerName); if (layer == null) { return; } string circleName = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId); string textName = string.Format("卫星{0}-波束{1}_描述", e.SatelliteId, e.BeamId, e.BeamId); if (!beamDic.ContainsKey(e.SatelliteId)) // 新的波束 { Kml kmlCircle = new Kml(); kmlCircle.Placemark.Name = circleName; KmlCircle circle = new KmlCircle(); circle.Position = e.Point; circle.FillColor = Color.FromArgb(50, Color.Green); circle.Radius = 500000; circle.StrokeColor = Color.Blue; circle.StrokeWidth = 1; kmlCircle.Placemark.Graph = circle; layer.AddElement(kmlCircle); // 添加文字图元 Kml kmlText = new Kml(); kmlText.Placemark.Name = textName; string context = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId); kmlText.Placemark.Graph = new KmlText() { Position = e.Point, Content = context, Color = Color.Blue, Font = "宋体", Size = 10 }; IMFElement elementText; if (layer.AddElement(kmlText, out elementText)) { bool visible = zoom >= visibleZoom ? true : false; elementText.SetVisible(visible); } // 添加到字典进行维护 List <int> beamIdList = new List <int>(); beamIdList.Add(e.BeamId); lock (beamDic) { beamDic.Add(e.SatelliteId, beamIdList); } } else { if (!beamDic[e.SatelliteId].Contains(e.BeamId)) // 新的波束 { Kml kmlCircle = new Kml(); kmlCircle.Placemark.Name = circleName; KmlCircle circle = new KmlCircle(); circle.Position = e.Point; circle.FillColor = Color.FromArgb(50, Color.Green); circle.Radius = 500000; circle.StrokeColor = Color.Blue; circle.StrokeWidth = 1; kmlCircle.Placemark.Graph = circle; layer.AddElement(kmlCircle); // 添加文字图元 string context = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId); Kml kmlText = new Kml(); kmlText.Placemark.Name = textName; kmlText.Placemark.Graph = new KmlText() { Position = e.Point, Content = context, Color = Color.Blue, Font = "宋体", Size = 10 }; IMFElement elementText; if (layer.AddElement(kmlText, out elementText)) { bool visible = zoom >= visibleZoom ? true : false; elementText.SetVisible(visible); } lock (beamDic) { // 添加到字典进行维护 beamDic[e.SatelliteId].Add(e.BeamId); } } else { // 更新圆图元(波束覆盖)位置 IMFElement elementCircle = layer.GetElement(circleName); if (elementCircle != null) { IMFCircle circle = elementCircle as IMFCircle; if (circle != null) { circle.UpdatePosition(e.Point); } } // 更新文字图元(描述信息)位置 IMFElement elementText = layer.GetElement(textName); if (elementText != null) { IMFText text = elementText as IMFText; if (text != null) { text.UpdatePosition(e.Point); } } } } }
// 接收波束数据 private void EventPublisher_MapDealBeamDataEvent(object sender, BeamData e) { DealBeamCover(e); }
protected override ModelBIM ImportActive(CountryCode countryCode, RequestedItemsType requestedType) { try { if (_selectedObjects?.Count == 0) { Debug.Fail("Nothing selected"); return(null); } var materials = new Dictionary <string, MatSteelEc2>(); var crossSections = new Dictionary <string, CrossSectionParameter>(); var pointConnections = _selectedObjects.OfType <StructuralPointConnection>().ToList(); var curveMembers = _selectedObjects.OfType <StructuralCurveMember>().ToList(); var assemblies = _selectedObjects.OfType <ElementAssembly>().ToList(); if (pointConnections.Count == 0) { MessageBoxHelper.ShowInformation("please select a PointConnection object to identify the connectionPoint", null); return(null); } // read all nodes (maybe it's esier) var nodes = _integrationBase.ApiCore.DtObjects.GetObjects <StructuralPointConnection>( _integrationBase.CurrentProject.Id, false, false, true); OpenModel openModel = new OpenModel { OriginSettings = new OriginSettings() { CrossSectionConversionTable = IdeaRS.OpenModel.CrossSectionConversionTable.NoUsed, CountryCode = countryCode } }; int ccsId = 1; int matId = 1; int lsId = 1; int memberId = 1; // ConnectionPoint ConnectionPoint connectionPoint = null; foreach (var point in pointConnections) { // ad main node to openModel connectionPoint = new ConnectionPoint(); if (point.NodeId.HasValue) { ConnectionPointId = point.NodeId.Value; } Point3D node = AddNodeToOpenModel(point, openModel, ConnectionPointId); connectionPoint.Node = new ReferenceElement(node); connectionPoint.Id = ConnectionPointId; connectionPoint.Name = string.Format("Conn-{0}", ConnectionPointId); connectionPoint.ProjectFileName = Path.Combine(".\\Connections", connectionPoint.Name + ".ideaCon"); } // try to add Member1D objects if they are not selected by user foreach (var assembly in assemblies) { if (assembly.Connections == null) { continue; } foreach (var c in assembly.Connections) { var ce = c as RelConnectsElements; if (ce == null || curveMembers.Find(x => x.Id == ce.RelatedElement.Value) != null) { continue; } var cm = _integrationBase.ApiCore.DtObjects.GetObjectInternal(ce.RelatedElement.Value) as StructuralCurveMember; if (cm != null) { foreach (var cm1 in pointConnections[0].ConnectsStructuralMembers) { if (cm.Id.ToString() == cm1.RelatingStructuralMember.GetValueOrDefault().ToString()) { curveMembers.Add(cm); } } } } } // create Element1D from StructuralCurveMember foreach (var element in curveMembers) { var matName = element.GetStringProperty(TableNames.contentAttributes, MaterialAttributeId) ?? "S355"; if (!materials.ContainsKey(matName)) { MatSteelEc2 material = new MatSteelEc2(); // set properties material.Id = matId++; material.Name = matName; material.E = 210000000000; material.G = material.E / (2 * (1 + 0.3)); material.Poisson = 0.3; material.UnitMass = 7850; material.SpecificHeat = 0.6; material.ThermalExpansion = 0.000012; material.ThermalConductivity = 45; material.IsDefaultMaterial = false; material.OrderInCode = 0; material.StateOfThermalExpansion = ThermalExpansionState.Code; material.StateOfThermalConductivity = ThermalConductivityState.Code; material.StateOfThermalSpecificHeat = ThermalSpecificHeatState.Code; material.StateOfThermalStressStrain = ThermalStressStrainState.Code; material.StateOfThermalStrain = ThermalStrainState.Code; material.fy = 355000000; material.fu = 510000000; material.fy40 = 335000000; material.fu40 = 470000000; material.DiagramType = SteelDiagramType.Bilinear; // add material to the model openModel.AddObject(material); materials.Add(matName, material); } var crossSection = element.GetStringProperty(TableNames.contentAttributes, CrossSectionAttributeId) ?? "HE200"; crossSection = crossSection.Replace("HE200B", "HEB200"); crossSection = crossSection.Replace("HE240B", "HEB240"); if (!crossSections.ContainsKey(crossSection)) { CrossSectionParameter css = new CrossSectionParameter { Id = ccsId++, Name = crossSection, CrossSectionRotation = 0, CrossSectionType = CrossSectionType.RolledI, Material = new ReferenceElement(materials[matName]) }; css.Parameters.Add(new ParameterString() { Name = "UniqueName", Value = crossSection }); // add cross sections to the model openModel.AddObject(css); crossSections.Add(crossSection, css); } if (element?.ConnectedBy.Count != 2) { continue; } var node = nodes.Find(x => x.Id == element?.ConnectedBy[0].RelatedStructuralConnection.Value); if (node == null) { continue; } Point3D ptA = AddNodeToOpenModel(node, openModel, node.NodeId.GetValueOrDefault()); node = nodes.Find(x => x.Id == element?.ConnectedBy[1].RelatedStructuralConnection.Value); Point3D ptB = AddNodeToOpenModel(node, openModel, node.NodeId.GetValueOrDefault()); var member1d = new Member1D { Id = memberId++, Name = element.Name }; IdeaRS.OpenModel.Geometry3D.PolyLine3D polyLine3D = new IdeaRS.OpenModel.Geometry3D.PolyLine3D { Id = member1d.Id }; var start = new WM.Point3D(ptA.X, ptA.Y, ptA.Z); var end = new WM.Point3D(ptB.X, ptB.Y, ptB.Z); var dirVectort = end - start; GetAngles(dirVectort, out double alpha, out double beta); beta *= -1; CI.Geometry3D.Matrix44 lcsSegmentMatrix = new CI.Geometry3D.Matrix44(); if (!IsZero(beta)) { // gamma pitch lcsSegmentMatrix.Rotate(beta, new CI.Geometry3D.Vector3D(0, 1, 0)); } if (!IsZero(alpha)) { // beta direction lcsSegmentMatrix.Rotate(alpha, new CI.Geometry3D.Vector3D(0, 0, 1)); } IdeaRS.OpenModel.Geometry3D.LineSegment3D ls = new IdeaRS.OpenModel.Geometry3D.LineSegment3D { Id = member1d.Id, StartPoint = new ReferenceElement(ptA), EndPoint = new ReferenceElement(ptB), LocalCoordinateSystem = new IdeaRS.OpenModel.Geometry3D.CoordSystemByVector() { VecX = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisX.DirectionX, Y = lcsSegmentMatrix.AxisX.DirectionY, Z = lcsSegmentMatrix.AxisX.DirectionZ, } , VecY = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisY.DirectionX, Y = lcsSegmentMatrix.AxisY.DirectionY, Z = lcsSegmentMatrix.AxisY.DirectionZ, } , VecZ = new IdeaRS.OpenModel.Geometry3D.Vector3D() { X = lcsSegmentMatrix.AxisZ.DirectionX, Y = lcsSegmentMatrix.AxisZ.DirectionY, Z = lcsSegmentMatrix.AxisZ.DirectionZ, } }, }; polyLine3D.Segments.Add(new ReferenceElement(ls)); openModel.PolyLine3D.Add(polyLine3D); openModel.LineSegment3D.Add(ls); Element1D element1d = new Element1D { Id = member1d.Id, Name = element.Id.ToString(), //element.Name, Its esier for mapping Element1D with bimplus Structuralcurvemember RotationRx = element.GetDoubleProperty(TableNames.contentAttributes, RotationAttributeId) ?? 0, CrossSectionBegin = new ReferenceElement(crossSections[crossSection]), CrossSectionEnd = new ReferenceElement(crossSections[crossSection]), Segment = new ReferenceElement(ls) }; openModel.Element1D.Add(element1d); member1d.Elements1D.Add(new ReferenceElement(element1d)); openModel.Member1D.Add(member1d); if (connectionPoint != null) { ConnectedMember conMb = new ConnectedMember { Id = member1d.Id, MemberId = new ReferenceElement(member1d), IsContinuous = false, }; connectionPoint.ConnectedMembers.Add(conMb); } BeamData beamData = new BeamData { Id = member1d.Id, Name = element1d.Name, OriginalModelId = member1d.Id.ToString(), // member1d.Name, IsAdded = false, MirrorY = false, RefLineInCenterOfGravity = true, }; if (openModel.Connections.Count == 0) { openModel.Connections.Add(new ConnectionData()); } (openModel.Connections[0].Beams ?? (openModel.Connections[0].Beams = new List <BeamData>())).Add(beamData); } // create Member1D from assemblies /* foreach (var assembly in assemblies) * { * var member1d = new Member1D * { * Id = assembly.OrderNumber.GetValueOrDefault(), * Name = assembly.Name * }; * foreach (var c in assembly.Connections) * { * var ce = c as RelConnectsElements; * var element = openModel.Element1D.Find(x => x.Name == ce.RelatedElement.ToString()); * if (element == null) continue; * member1d.Elements1D.Add(new ReferenceElement(element)); * openModel.Member1D.Add(member1d); * } * }*/ /*if (connectionPoint != null) * { * var p0t = pointConnections.Find(x => x.NodeId.GetValueOrDefault() == ConnectionPointId); * if (p0t != null && p0t.ConnectsStructuralMembers != null) * { * foreach (var cm in p0t.ConnectsStructuralMembers) * { * var member = openModel.Element1D.Find(x => x.Name == cm.RelatingStructuralMember.GetValueOrDefault().ToString()); * if (member == null) * continue; * ConnectedMember conMb = new ConnectedMember * { * Id = member.Id, * MemberId = new ReferenceElement(member), * IsContinuous = false, * }; * connectionPoint.ConnectedMembers.Add(conMb); * * // BEAM DATA - definition * BeamData bData = new BeamData * { * Id = conMb.Id, * OriginalModelId = "???", // ass.Id.ToString(), is it important? * IsAdded = false, * MirrorY = false, * RefLineInCenterOfGravity = false, * }; * if (openModel.Connections.Count == 0) * { * openModel.Connections.Add(new ConnectionData { Beams = new List<BeamData>() }); * } * openModel.Connections[0].Beams.Add(bData); * } * } * * }*/ openModel.AddObject(connectionPoint); // important !!! OpenModelResult openModelResult = new OpenModelResult() { ResultOnMembers = new System.Collections.Generic.List <ResultOnMembers>() { new ResultOnMembers() } }; OpenMessages openMessages = new OpenMessages(); return(new ModelBIM() { Items = new List <BIMItemId>() { new BIMItemId() { Id = connectionPoint.Id, Type = BIMItemType.Node } }, Model = openModel, Results = openModelResult, Messages = openMessages, Project = AllplanBimplusDemo.Properties.Settings.Default.IdeaDefaultWorkingDir, }); } catch (Exception e) { MessageBoxHelper.ShowInformation(e.Message, null); return(null); } }
public void RunThread() { Design_Summary = new List <string>(); List <string> BOQ_Summary = new List <string>(); List <string> list = new List <string>(); #region TechSOFT Banner list.Add(""); list.Add(""); list.Add("\t\t**********************************************"); list.Add("\t\t* ASTRA Pro Release 18.0 *"); list.Add("\t\t* TechSOFT Engineering Services *"); list.Add("\t\t* *"); list.Add("\t\t* DESIGN OF RCC FLANGED BEAM *"); list.Add("\t\t* *"); list.Add("\t\t**********************************************"); list.Add("\t\t----------------------------------------------"); list.Add("\t\tTHIS RESULT CREATED ON " + System.DateTime.Now.ToString("dd.MM.yyyy AT HH:mm:ss") + " "); list.Add("\t\t----------------------------------------------"); list.Add(""); list.Add(""); #endregion list.Add(string.Format("")); list.Add(string.Format("")); list.Add(string.Format("(Design Standard : BS 8110 / IS 456)")); list.Add(string.Format("")); int c = 0; int step = 1; MovingLoadAnalysis.frm_ProgressBar.ON("Member Analysis...."); for (int i = 0; i < dgv_beams.RowCount; i++) { MovingLoadAnalysis.frm_ProgressBar.SetValue(i, dgv_beams.RowCount); try { c = 1; BeamData bd = new BeamData(); bd.IsSelect = (bool)dgv_beams[c++, i].Value; if (bd.IsSelect) { Set_Grid_Color(i); c++; bd.BeamNos = dgv_beams[c++, i].Value.ToString(); bd.Continuous_BeamMembers = dgv_beams[c++, i].Value.ToString(); bd.Breadth = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.Depth = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.d1 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.d2 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.d3 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.d4 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); //bd.d5 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); //bd.d6 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); beamDes.Shear_Bar_dia = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AM1 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AM2 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AM3 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AM4 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AV1 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AV2 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); bd.AV3 = MyStrings.StringToDouble(dgv_beams[c++, i].Value.ToString(), 0.0); //All_Beam_Data.Add(bd); beamDes.Beam_Title = bd.BeamNos; beamDes.Beam_Nos = bd.Continuous_BeamMembers; beamDes.Bar_dia1 = bd.d1; beamDes.Bar_dia2 = bd.d2; beamDes.Bar_dia3 = bd.d3; beamDes.Bar_dia4 = bd.d4; //beamDes.Bar_dia5 = bd.d5; //beamDes.Bar_dia6 = bd.d6; beamDes.AM1 = bd.AM1; beamDes.AM2 = bd.AM2; beamDes.AM3 = bd.AM3; beamDes.AM4 = bd.AM4; beamDes.AV1 = bd.AV1; beamDes.AV2 = bd.AV2; beamDes.AV3 = bd.AV3; beamDes.D = bd.Depth * 1000; beamDes.bw = bd.Breadth * 1000; if (beamDes.BOQ == null) { beamDes.BOQ = new Beam_BOQ(); } beamDes.BOQ.Section_B = bd.Breadth; beamDes.BOQ.Section_D = bd.Depth; beamDes.BOQ.Area = bd.Depth * bd.Breadth; //list.AddRange(beamDes.Design_Program_Loop(step++).ToArray()); list.AddRange(beamDes.Design_Program_Loop(i + 1).ToArray()); Design_Summary.Add(string.Format("-------------------------------------")); Design_Summary.Add(string.Format("BEAM = {0}, FLOOR LEVEL = {1:f3} M", beamDes.Beam_Title, beamDes.BOQ.Floor_ELevation)); Design_Summary.Add(string.Format("CONTINUOUS MEMBERS = {0}", beamDes.Beam_Nos)); Design_Summary.AddRange(beamDes.Design_Summary.ToArray()); Design_Summary.Add(string.Format("-------------------------------------")); BOQ_Summary.Add(string.Format("-------------------------------------")); BOQ_Summary.Add(string.Format("BEAM = {0}, FLOOR LEVEL = {1:f3} M", beamDes.Beam_Title, beamDes.BOQ.Floor_ELevation)); BOQ_Summary.Add(string.Format("CONTINUOUS MEMBERS = {0}", beamDes.Beam_Nos)); BOQ_Summary.AddRange(beamDes.BOQ_Summary.ToArray()); BOQ_Summary.Add(string.Format("-------------------------------------")); //beamDes.Calculate_Program_Loop(); dgv_beams[c++, i].Value = beamDes.IS_DESIGN_OK ? "OK" : "NOT OK"; Set_Grid_Color(i, true, beamDes.IS_DESIGN_OK); Add_Beam_BOQ(beamDes.BOQ); } //else // Set_Grid_Color(i); } catch (Exception exx) { } } MovingLoadAnalysis.frm_ProgressBar.OFF(); list.Add(string.Format("")); list.Add(string.Format("-------------------------------------")); list.Add(string.Format("TABLE 1 : PERMISSIBLE_SHEAR_STRESS")); list.Add(string.Format("-------------------------------------")); list.Add(string.Format("")); list.AddRange(Tables.Get_File_Permissible_Shear_Stress().ToArray()); #region End of Report list.Add(""); list.Add("---------------------------------------------------------------------------"); list.Add("--------------------- END OF REPORT --------------------------"); list.Add("---------------------------------------------------------------------------"); #endregion End of Report File.WriteAllLines(beamDes.Report_File, list.ToArray()); string des_sum = Path.Combine(Path.GetDirectoryName(beamDes.Get_Report_File(1)), "BEAM_DESIGN_SUMMARY.TXT"); File.WriteAllLines(des_sum, Design_Summary.ToArray()); des_sum = Path.Combine(Path.GetDirectoryName(beamDes.Get_Report_File(1)), "BEAM_BOQ_SUMMARY.TXT"); File.WriteAllLines(des_sum, BOQ_Summary.ToArray()); }
/// <summary> /// 从日志文件读取数据 /// </summary> private void ReadDataFormLog() { string path = AppDomain.CurrentDomain.BaseDirectory + "波束运动情况"; if (!Directory.Exists(path)) { XtraMessageBox.Show("波束文件不存在!"); return; } string[] fileArr = Directory.GetFiles(path); if (fileArr == null || fileArr.Count() <= 0) { return; } List <FileInfo> fileInfoList = new List <FileInfo>(); foreach (string file in fileArr) { FileInfo fi = new FileInfo(file); fileInfoList.Add(fi); } // 排序 fileInfoList.Sort(ListSort); for (int i = 0; i < fileInfoList.Count; i++) { FileInfo tmpFi = fileInfoList[i]; string tmpFile = tmpFi.FullName; BeamData prevBeamData = null; long prevTime = 0; // 需注意文件与文件之前的数据并不连续 using (StreamReader r = new StreamReader(tmpFile)) { string lineStr; while ((lineStr = r.ReadLine()) != null) { if (lineStr == "") { continue; } //51742533060: 卫星: 31 波束:37 位置:( 115.66, 34.40, 779.44) string timeStr = lineStr.Substring(0, 13); string idStr = lineStr.Substring(20, 3); string beamStr = lineStr.Substring(29, 2); long time = Convert.ToInt64(timeStr.Trim()); int id = Convert.ToInt32(idStr); int beamId = Convert.ToInt32(beamStr); string pointStr = lineStr.Substring(37, 28); string[] pointArr = pointStr.Split(new char[] { ',' }); double longtitude = Convert.ToDouble(pointArr[0]); double latitude = Convert.ToDouble(pointArr[1]); double altitude = Convert.ToDouble(pointArr[2]) * 4000; BeamData beamData = new BeamData(); beamData.SatelliteId = id; beamData.BeamId = beamId; beamData.Point = new MapLngLat() { Alt = altitude, Lng = longtitude, Lat = latitude }; beamData.PointType = altitude > 0 ? 0 : 1; // 第n次取数,与第n-1次进行比较,设置Timer的Interval值,并推送上一包的数据 PushData(beamData); if (prevBeamData != null) { TimeSpan ts = DateTime.FromFileTime(time) - DateTime.FromFileTime(prevTime); if (ts.Ticks > 0) { Thread.Sleep(500); } } prevBeamData = beamData; prevTime = time; } // 推送最后一包数据 if (prevBeamData != null) { PushData(prevBeamData); } } } }
private static void PrintBeam(BeamData data) { Debug.Log($"Position: {data.rootPosition} Direction: {data.rootDirection} Connections: {data.connections}"); }
// 接收波束数据 private void RecvBeamData(BeamData beamData) { EventPublisher.PublishBeamDataComeEvent(this, beamData); }