public ClusterAccuracyForm(ClusteringResultsSketch results) { InitializeComponent(); this.results = results; strokeColor = new Dictionary <Substroke, Color>(results.Sketch.Substrokes.Length); FindColors(results); UpdateCurrentResultsNumber(1); this.clusterInkPanel.Enabled = true; clusterInkOverlay = new InkOverlay(); clusterInkOverlay.AttachedControl = this.clusterInkPanel; clusterInkOverlay.Enabled = false; if (currentResultsNumber >= 0) { FillInkOverlay(results.ResultsShape[currentResultsNumber], clusterInkOverlay, clusterInkPanel, paddingOffset, results.StrokeClassifications); } else { FillInkOverlay(new Sketch.Sketch(), clusterInkOverlay, clusterInkPanel, paddingOffset, results.StrokeClassifications); } this.sketchInkPanel.Enabled = true; InkOverlay sketchInkOverlay = new InkOverlay(); sketchInkOverlay.AttachedControl = this.sketchInkPanel; sketchInkOverlay.Enabled = false; FillInkOverlay(results.Sketch, sketchInkOverlay, sketchInkPanel, paddingOffset, results.StrokeClassifications); labelTotalNumErrors.Text += results.NumTotalErrors.ToString(); labelTotalPerfectClusters.Text += results.NumPerfect.ToString(); labelConditionalPerfectClusters.Text += results.NumConditionalPerfect.ToString(); labelSplitErrors.Text += results.NumSplitErrors.ToString(); labelMergeErrors.Text += results.NumMergeErrors.ToString(); labelMergeShape2ShapeErrors.Text += results.NumMergedShapeToShapeErrors.ToString(); labelMergedWire2ShapeErrors.Text += results.NumMergedConnectorToShapeErrors.ToString(); labelMergedText2ShapeErrors.Text += results.NumMergedTextToShapeErrors.ToString(); labelMergeShape2Text.Text += results.NumMergedShapeToTextErrors.ToString(); labelMergeWire2Text.Text += results.NumMergedConnectorToTextErrors.ToString(); labelMergeText2Text.Text += results.NumMergedTextToTextErrors.ToString(); labelMergeNOTBUBBLE.Text += results.NumMergedNOTBUBBLEToShapeErrors.ToString(); double percentage = results.InkMatchingPercentage * 100.0; labelInkMatchingPercentage.Text += percentage.ToString("#0.0") + "%"; percentage = results.InkExtraPercentageTotal * 100.0; labelInkExtraTotalPercentage.Text += percentage.ToString("#0.0") + "%"; percentage = results.InkExtraPercentageBestMatches * 100.0; labelInkExtraFromBestClusters.Text += percentage.ToString("#0.0") + "%"; percentage = results.InkExtraPercentagePartialMatchesNotBest * 100.0; labelInkExtraPartialMatches.Text += percentage.ToString("#0.0") + "%"; percentage = results.InkExtraPercentageCompletelyUnMatched * 100.0; labelInkExtraCompletelyUnmatched.Text += percentage.ToString("#0.0") + "%"; }
private void FindColors(ClusteringResultsSketch results) { Dictionary <Guid, string> strokeClassifications = results.StrokeClassifications; foreach (ClusteringResultsShape shapeResults in results.ResultsShape) { List <Substroke> strokesAdded = new List <Substroke>(); foreach (Substroke s in shapeResults.Shape.SubstrokesL) { string type = GetShapeType(s.ParentShapes[0]); if (strokeClassifications[s.Id] == type && shapeResults.BestCluster.contains(s.Id)) { strokesAdded.Add(s); if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Green); } else { } } else if (strokeClassifications[s.Id] == type && !shapeResults.BestCluster.contains(s.Id)) { strokesAdded.Add(s); if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Red); } else { } } else if (strokeClassifications[s.Id] != type && shapeResults.BestCluster.contains(s.Id)) { strokesAdded.Add(s); if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Fuchsia); } else { } } else if (strokeClassifications[s.Id] != type && !shapeResults.BestCluster.contains(s.Id)) { strokesAdded.Add(s); if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Yellow); } else { } } } foreach (Substroke s in shapeResults.BestCluster.Strokes) { if (!strokesAdded.Contains(s)) { string type = GetShapeType(s.ParentShapes[0]); if (strokeClassifications[s.Id] == type) { if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Red); } else { this.strokeColor.Remove(s); this.strokeColor.Add(s, Color.Red); } } else if (strokeClassifications[s.Id] != type) { if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Orange); } else { this.strokeColor.Remove(s); this.strokeColor.Add(s, Color.Orange); } } } } } foreach (Substroke s in results.Sketch.SubstrokesL) { if (!this.strokeColor.ContainsKey(s)) { this.strokeColor.Add(s, Color.Black); } } }