private void removeDuplicates() { var duplicates = new bool[DrillNodes.Count]; for (var i = 0; i < DrillNodes.Count; i++) { if (!duplicates[i]) { for (var j = 0; j < DrillNodes.Count; j++) { if ((i != j) && (!duplicates[j]) && (sameLocation(DrillNodes[i], DrillNodes[j]))) { duplicates[j] = true; } } } } for (var i = duplicates.Length - 1; i >= 0; i--) { if (duplicates[i]) { DrillNodes.RemoveAt(i); } } ExtLog.AddLine(DrillNodes.Count.ToString("D") + " Uniques"); }
private void removeZeros() { DrillNodes.RemoveAll( dn => (Math.Sqrt(Math.Pow(dn.location.X, 2) + Math.Pow(dn.location.Y, 2)) < NodeEpsilon)); ExtLog.AddLine(DrillNodes.Count.ToString("D") + " Non-Zeros"); }
private void ReadNodes(string filename) { Shapes = new List <rawShapeData>(); try { var f = File.OpenText(filename); SeekShape(f); f.Close(); } catch (IOException ex) { ExtLog.AddLine(ex.Message); DrillNodes.Clear(); } }
private void readCircles(string filename) { var svgReader = SvgDocument.Open(filename); PageHeight = svgReader.Width.Value; PageHeight = svgReader.Height.Value; var circlesEnum = svgReader.Children.FindSvgElementsOf <SvgCircle>(); var circlesList = circlesEnum as IList <SvgCircle> ?? circlesEnum.ToList(); for (var i = 0; i < circlesList.Count; i++) { var pt = new[] { new PointF(circlesList[i].CenterX.Value, circlesList[i].CenterY.Value) }; applyParentsTransforms(pt, circlesList[i].Parent); pt[0].X /= 72; //svgReader.Ppi; pt[0].Y /= 72; //svgReader.Ppi; DrillNodes.Add(new DrillNode(pt[0], i)); } ExtLog.AddLine(DrillNodes.Count.ToString("D") + " Shapes"); }