/// <summary>Vergleich erstellen</summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMakeCompare_Click(object sender, EventArgs e) { String cuFile = ClassNPPTools.getCurrentFile(); ClassCADdyPunkte file1 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(cbList1.Text); file1.getPointsFromCurrentCADdy(settings); displayComparePoints.Clear(); ClassCADdyPunkte file2 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(cbList2.Text); file2.getPointsFromCurrentCADdy(settings); ClassNPPTools.switchToFile(cuFile); file1.sortBy(enPointColumn.colPointnumber); file2.sortBy(enPointColumn.colPointnumber); foreach (ClassCADdyPunkt point1 in file1.Punkte) { ClassCADdyPunkt point2 = file2.getPointByName(point1.Punktnummer); if (point2 != null) { displayComparePoints.Add(new ClassCADdyPointCompare(point1, point2, 3, 4)); } } file1.clear(); file1 = null; file2.clear(); file2 = null; this.dgvCompare.Refresh(); }
private void btnCalcTransform_Click(object sender, EventArgs e) { if ((displayTransformPoints.Count > 0) && (transformation != null)) { //foreach (ClassTransformdisplayPoint transp in displayTransformPoints) // transformation.setUsing(transp); } if (transformation == null) { String cuFile = ClassNPPTools.getCurrentFile(); ClassCADdyPunkte file1 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(cbListSrc.Text); file1.getPointsFromCurrentCADdy(settings); ClassCADdyPunkte file2 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(cbListDest.Text); file2.getPointsFromCurrentCADdy(settings); ClassNPPTools.switchToFile(cuFile); transformation = new ClassTransformation(file1, file2, ref language, 3, 4); } else { transformation.calcResiduen(); } if (transformation != null) { displayTransformPoints.Clear(); foreach (ClassTransformPointPair matchPoint in transformation.MatchPoints) { displayTransformPoints.Add(new ClassTransformdisplayPoint(matchPoint, 3, 4)); } tbSigmaXY.Text = ClassConverters.ToString(transformation.SigmaXY, ",", "", 3, true); tbSigmaZ.Text = ClassConverters.ToString(transformation.SigmaZ, ",", "", 3, true); if (transformation.SigmaXY < 0.1) { tbSigmaXY.BackColor = Color.LightGreen; } else if (Double.IsNaN(transformation.SigmaXY)) { tbSigmaXY.BackColor = Color.LightGray; } else { tbSigmaXY.BackColor = Color.Orange; } if (transformation.SigmaZ < 0.1) { tbSigmaZ.BackColor = Color.LightGreen; } else if (Double.IsNaN(transformation.SigmaZ)) { tbSigmaZ.BackColor = Color.LightGray; } else { tbSigmaZ.BackColor = Color.Orange; } btnMakeTransform.Enabled = true; } }
private void btnMakeTransform_Click(object sender, EventArgs e) { if (transformation != null) { transformation.calcTransformation(); if (cbNewPointsNewTab.Checked) { String myNewFile = System.IO.Path.GetDirectoryName(cbListSrc.Text) + @"\" + System.IO.Path.GetFileNameWithoutExtension(cbListSrc.Text) + "_WORLD" + System.IO.Path.GetExtension(cbListSrc.Text); if (ClassNPPTools.getOpenFileNames().Contains(myNewFile)) { ClassNPPTools.closefile(myNewFile, true); } if (System.IO.File.Exists(myNewFile)) { System.IO.File.Delete(myNewFile); } /*System.IO.File.CreateText(myNewFile); * Win32.SendMessage(PluginBase.nppData._nppHandle, (int)NppMsg.NPPM_DOOPEN, 0, myNewFile); */ ClassNPPTools.newfile(myNewFile); ClassCADdyPunkte file2 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(myNewFile); foreach (ClassCADdyPunkt newPoint in transformation.newPoints) { file2.Punkte.Add(newPoint); } file2.formatCurrentToCADdy(settings); file2.clear(); file2 = null; } else { ClassCADdyPunkte file2 = new ClassCADdyPunkte(ref language); ClassNPPTools.switchToFile(cbListDest.Text); file2.getPointsFromCurrentCADdy(settings); foreach (ClassCADdyPunkt newPoint in transformation.newPoints) { file2.Punkte.Add(newPoint); } file2.formatCurrentToCADdy(settings); file2.clear(); file2 = null; } } }