protected virtual void button_showOnMap_Click(object sender, EventArgs e) { if (ShowLayer != null) { if (checkBox_clearCoords.Checked) { this.Coords.Clear(); } if (Coords.Count == 0) { foreach (var path in ParseInputPathes()) { var header = RinexObsFileReader.ReadHeader(path); this.Coords.Add(new NamedRmsXyz(System.IO.Path.GetFileName(path), new RmsedXYZ(header.ApproxXyz))); } } if (Coords == null || Coords.Count == 0) { log.Warn("输入结果为空。"); return; } int start = this.paramVectorRenderControl1.StartIndex; if (start >= Coords.Count) { log.Warn("起始历元编号过大!总结果数 " + Coords.Count + ",起始历元编号:" + start + ", 为了可显示,已经将其设为 0"); start = 0; } PostionResultLayerBuilder builder = new PostionResultLayerBuilder(Coords, start); //builder.AddPt(GnssResults[0].SiteInfo.ApproxXyz, GnssResults[0].SiteInfo.MarkerName + "ApproxPoint"); ShowLayer(builder.Build()); } }
/// <summary> /// 选择并复制文件 /// </summary> /// <param name="inpath"></param> /// <param name="subDirectory">子目录,若有</param> public bool Select(string inpath, string subDirectory = null) { if (IsMatch(inpath)) { var outpath = GetOutputPath(inpath, subDirectory); Gdp.Utils.FileUtil.CheckOrCreateDirectory(Path.GetDirectoryName(outpath)); try { File.Copy(inpath, outpath, true); if (this.Option.IsNavCopy) { var header = RinexObsFileReader.ReadHeader(inpath); if (header.HasNavFile)//同时输出导航文件 { var outpathNav = GetOutputPath(header.NavFilePath, subDirectory); File.Copy(header.NavFilePath, outpathNav, true); } } log.Info(Path.GetFileName(inpath) + " 匹配成功! 复制到 " + outpath); return(true); } catch (Exception ex) { log.Error("复制 " + inpath + " 到 " + outpath + " 发生错误!" + ex.Message); } } else { FailedPathes.Add(inpath); log.Info(Path.GetFileName(inpath) + " 匹配失败!"); } return(false); }
private void Process(string subDir, string inputPath) { try { ShowInfo("processing :" + inputPath); var header = RinexObsFileReader.ReadHeader(inputPath); var siteInfo = header.SiteInfo; var obsInfo = header.ObsInfo; table.NewRow(); if (IsLonLatFirst) { table.AddItem("Lon", siteInfo.ApproxGeoCoord.Lon); table.AddItem("Lat", siteInfo.ApproxGeoCoord.Lat); table.AddItem("Name", siteInfo.SiteName); } else { table.AddItem("Name", siteInfo.SiteName); table.AddItem("Lon", siteInfo.ApproxGeoCoord.Lon); table.AddItem("Lat", siteInfo.ApproxGeoCoord.Lat); } table.AddItem("Height", siteInfo.ApproxGeoCoord.Height); table.AddItem("X", siteInfo.ApproxXyz.X); table.AddItem("Y", siteInfo.ApproxXyz.Y); table.AddItem("Z", siteInfo.ApproxXyz.Z); table.AddItem("ReceiverType", siteInfo.ReceiverType); table.AddItem("ReceiverNumber", siteInfo.ReceiverNumber); table.AddItem("AntennaType", siteInfo.AntennaType); table.AddItem("AntennaNumber", siteInfo.AntennaNumber); this.Invoke(new Action(() => { this.progressBar1.PerformStep(); this.progressBar1.Refresh(); })); } catch (Exception ex) { log.Error("转换出错:\t" + inputPath + "\t, " + ex.Message); } }
protected override void Run(string[] inputPathes) { this.ProgressBar.Init(new List <string> { "统计", "复制或移动" }, inputPathes.Length); foreach (var path in inputPathes) { RinexObsFileHeader header = RinexObsFileReader.ReadHeader(path); var name = Geo.Utils.StringUtil.SubString(header.MarkerName, 0, LabelCharCount); if (IsIgnoreCase) { name = name.ToUpper(); } Result.GetOrCreate(name).Add(path); this.ProgressBar.PerformProcessStep(); } this.ProgressBar.PerformClassifyStep(Result.Data.Count); int counter = 0; foreach (var item in Result.Data) { if (item.Value.Count > 1) { foreach (var path in item.Value) { var toPath = Path.Combine(OutputDirectory, item.Key, Path.GetFileName(path)); Geo.Utils.FileUtil.CopyOrMoveFile(path, toPath, !IsMoveOrCopy, true); counter++; } } this.ProgressBar.PerformProcessStep(); } var info = "发现了 " + counter + " 个同名测站。已 " + (IsMoveOrCopy ? " 移动!!如在默认临时文件夹,请及时移出!!否则重启后将被清空。 " : " 复制 "); log.Info(info); }