protected override void Run(string inputPath) { var reader = new ObjectTableManagerReader(inputPath, Encoding.Default); reader.IsIntOrFloatFirst = true; reader.Spliters = new string[] { "," }; reader.HeaderMarkers = new string[] { "#" }; var tables = reader.Read();//.GetDataTable(); var fileName = System.IO.Path.GetFileName(inputPath); foreach (var table in tables) { //var form = new Geo.Winform.DataTableViewForm(table) { Text = table.Name }; //form.Show(); var name = table.Name; //OpenMidForm(new DataTableViewForm(table) ); if (String.Equals(name, "Raw", StringComparison.CurrentCultureIgnoreCase)) { UiToOption(); decoder = new AndroidMeasureDecoder(table, option); decoder.ProgressViewer = this.ProgressBar; decoder.RecordProcessed += decoder_RecordProcessed; var opath = Path.Combine(OutputDirectory, Path.GetFileNameWithoutExtension(inputPath)); decoder.Run(opath); //Geo.Utils.FormUtil.ShowOkAndOpenDirectory(OutputDirectory); } } base.Run(inputPath); }
public override MatrixEquation Read() { ObjectTableManagerReader reader = new ObjectTableManagerReader(Stream); var tables = reader.Read(); var leftSide = tables.Get("L"); var rightSide = tables.Get("R"); var n = Matrix.Parse(leftSide); var u = Matrix.Parse(rightSide); return(new MatrixEquation(n, u, Name)); }
public override MatrixEquationManager Read() { ObjectTableManagerReader reader = new ObjectTableManagerReader(Stream); var tables = reader.Read(); var keys = tables.Keys; List <string> names = new List <string>(); foreach (var item in keys) { var name = MatrixEquationNameBuiler.GetName(item); if (!names.Contains(name)) { names.Add(name); } } MatrixEquationManager manager = new MatrixEquationManager(); foreach (var name in names) { var leftName = MatrixEquationNameBuiler.GetLeftSideName(name); var rightName = MatrixEquationNameBuiler.GetRightSideName(name); var QOfrightName = MatrixEquationNameBuiler.GetInverseWeightNameOfRightSide(name); var left = tables.Get(leftName); var right = tables.Get(rightName); var QofRightSide = tables.Get(QOfrightName); var n = Matrix.Parse(left); var u = Matrix.Parse(right); Matrix q = null; if (QofRightSide != null) { q = Matrix.Parse(QofRightSide); } var eq = new MatrixEquation(n, u, name) { QofU = q }; manager[name] = eq; } return(manager); }
protected override void OnWizardCompleted() { base.OnWizardCompleted(); this.Enabled = false; var filePath = FileOpenWizardPage.FilePath; var spliter = StringWizardPage.Lines; var AioFileOpenTypes = CheckboxWizardPage.GetSelected <AioFileOpenType>(); var reader = new ObjectTableManagerReader(filePath, Encoding.Default); reader.Spliters = spliter; reader.HeaderMarkers = HeaderMarkersWizardPage.Lines; var tables = reader.Read();//.GetDataTable(); var fileName = System.IO.Path.GetFileName(filePath); if (AioFileOpenTypes.Contains(AioFileOpenType.转换为单表并保存)) { tables.WriteAllToFileAndCloseStream(); } if (AioFileOpenTypes.Contains(AioFileOpenType.在新窗口中查看分析)) { foreach (var table in tables) { var form = new Geo.Winform.TableObjectViewForm(table) { Text = table.Name }; form.Show(); } } this.Invoke(new Action(delegate() { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); })); // OpenMidForm(); }
public void ReadAio() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Glog文本表格文件(*.txt;*.txt.xls;*.txt;*.xls)|*.glog;*.txt.xls;*.txt;*.xls|所有文件(*.*)|*.*"; if (openFileDialog.ShowDialog() == DialogResult.OK) { var path = openFileDialog.FileName; var reader = new ObjectTableManagerReader(path, Encoding.Default); reader.Spliters = new string[] { ",", "\t" }; reader.HeaderMarkers = new string[] { "#" }; var tables = reader.Read();//.GetDataTable(); var fileName = System.IO.Path.GetFileName(path); foreach (var table in tables) { //var form = new Geo.Winform.DataTableViewForm(table) { Text = table.Name }; //form.Show(); var name = table.Name; // OpenMidForm(new DataTableViewForm(table)); } } }
public override MatrixEquation Read() { ObjectTableManagerReader reader = new ObjectTableManagerReader(Stream); var tables = reader.Read(); var leftSide = tables.Get(MatrixEquationNameBuiler.L); var rightSide = tables.Get(MatrixEquationNameBuiler.R); var QofRightSide = tables.Get(MatrixEquationNameBuiler.Q); var n = Matrix.Parse(leftSide); var u = Matrix.Parse(rightSide); Matrix q = null; if (QofRightSide != null) { q = Matrix.Parse(QofRightSide); } return(new MatrixEquation(n, u) { QofU = q, Name = this.Name }); }
/// <summary> /// 计算 /// </summary> /// <param name="filePath"></param> public override void Run(string filePath) { ResultTables.Clear(); IsCancel = false; ObjectTableManagerReader reader = new ObjectTableManagerReader(filePath); ObjectTableManager tables = reader.Read(); var approxTable = tables.Get(AdjustName.Approx); var paramNameTable = tables.Get(AdjustName.ParamName); var obsTable = tables.Get(AdjustName.Obs); var rmsOfObsTable = tables.Get(AdjustName.RmsOfObs); var designTable = tables.Get(AdjustName.Design); var transTable = tables.Get(AdjustName.Trans); var rmsOfTransTable = tables.Get(AdjustName.RmsOfTrans); var aprioriTable = tables.Get(AdjustName.Apriori); var rmsOfAprioriTable = tables.Get(AdjustName.RmsOfApriori); int length = obsTable.RowCount; InitProcess(length); Vector approx = null; if (approxTable != null && approxTable.RowCount > 0) { approx = new Vector(approxTable.BufferedValues[0]); } WeightedVector apriori = null; if (aprioriTable != null && aprioriTable.RowCount > 0 && rmsOfAprioriTable != null && rmsOfAprioriTable.RowCount > 0) { apriori = new WeightedVector(new Vector(aprioriTable.BufferedValues[0]), new Matrix(new Vector(rmsOfAprioriTable.BufferedValues[0]))); } for (int i = 0; i < length; i++) { if (IsCancel) { break; } Dictionary <string, Object> obsRow = obsTable.BufferedValues[i]; Dictionary <string, Object> rmsOfObsRow = rmsOfObsTable.BufferedValues[i]; Dictionary <string, Object> designRow = designTable.BufferedValues[i]; Dictionary <string, Object> paramNameRow = paramNameTable.BufferedValues[i]; Vector obs = new Vector(obsRow); Vector RmsOfObs = new Vector(rmsOfObsRow); Vector Design = new Vector(designRow); int obsCount = obsRow.Count; int paramCount = paramNameRow.Count; Matrix RmsOfObsMatrix = new Matrix(RmsOfObs); Matrix designMatrix = new Matrix(Design.OneDimArray, obsCount, paramCount); List <string> paramNames = new List <string>(); foreach (var item in paramNameRow) { paramNames.Add(item.Key); } //平差矩阵生成 ManualAdjustMatrixBuilder matrixBuilder = new ManualAdjustMatrixBuilder(); matrixBuilder.ApproxParam = approx; matrixBuilder.SetCoeffOfDesign(designMatrix) .SetObsMinusApprox(new WeightedVector(obs, RmsOfObsMatrix.Pow(2.0))) .SetParamNames(paramNames); #region 先验值 if (apriori == null) { if (CurrentResult == null) { apriori = CreateInitAprioriParam(paramCount); apriori.ParamNames = paramNames; } else if (!IsParamsChanged(paramNames)) { apriori = CurrentResult.ResultMatrix.Estimated; } else { apriori = SimpleAdjustMatrixBuilder.GetNewWeighedVectorInOrder(paramNames, CurrentResult.ResultMatrix.Estimated); } } matrixBuilder.SetAprioriParam(apriori); apriori = null; #endregion //非必须的转移矩阵 if ((transTable != null && transTable.BufferedValues.Count > i) && (rmsOfTransTable != null && rmsOfTransTable.BufferedValues.Count > i)) { var transRow = transTable.BufferedValues[i]; Vector Trans = new Vector(transRow); var transMatrix = new Matrix(Trans.OneDimArray, paramCount, paramCount); var rmsOfTransRow = rmsOfTransTable.BufferedValues[i]; Vector RmsOfTrans = new Vector(rmsOfTransRow); var rmsOfTransMatrix = new Matrix(RmsOfTrans.OneDimArray, paramCount, paramCount); matrixBuilder.SetTransfer(new WeightedMatrix(transMatrix, rmsOfTransMatrix.Pow(2.0))); } Process(matrixBuilder); PerformProcessStep(); } this.FullProcess(); }