public override Shape GetShape(ShapeType shapeType) { if (shapeType.Equals(ShapeType.Rectangle)) { return(new RoundedRectangle()); } else if (shapeType.Equals(ShapeType.Square)) { return(new RoundedSquare()); } return(null); }
private ConfusionMatrix <ShapeType> computeRecognitionConfusionMatrix() { ConfusionMatrix <ShapeType> result = new ConfusionMatrix <ShapeType>(); foreach (Sketch.Shape correctShape in _original.Shapes) { if (IGNORE_CLASSIFICATIONS.Contains(correctShape.Classification.ToLower())) { continue; } ShapeType originalType = correctShape.Type; if (originalType.Equals(new ShapeType())) // skip unidentified shapes { continue; } if (_toCompare.ShapesL.Exists(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); })) { Sketch.Shape resultShape = _toCompare.ShapesL.Find(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); }); ShapeType resultType = resultShape.Type; // Record stats result.increment(originalType, resultType); } } return(result); }
private List <Tuple <Shape, ShapeType> > computeRecognitionMistakes() { List <Tuple <Shape, ShapeType> > result = new List <Tuple <Shape, ShapeType> >(); foreach (Sketch.Shape correctShape in _original.Shapes) { ShapeType originalType = correctShape.Type; if (originalType.Equals(new ShapeType())) // skip unidentified shapes { continue; } if (_toCompare.ShapesL.Exists(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); })) { Sketch.Shape resultShape = _toCompare.ShapesL.Find(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); }); ShapeType resultType = resultShape.Type; if (resultType != originalType) { result.Add(Tuple.Create(resultShape, originalType)); } } } return(result); }
private double computeRecognitionQuality() { int totalShapes = 0; int correctShapes = 0; foreach (Sketch.Shape correctShape in _original.Shapes) { ShapeType originalType = correctShape.Type; if (originalType.Equals(new ShapeType())) // skip unidentified shapes { continue; } if (_toCompare.ShapesL.Exists(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); })) { Sketch.Shape resultShape = _toCompare.ShapesL.Find(delegate(Sketch.Shape s) { return(s.GeometricEquals(correctShape)); }); ShapeType resultType = resultShape.Type; totalShapes++; if (resultType == originalType) { correctShapes++; } } } return((double)correctShapes / totalShapes); }
public bool Equals(ShapeFileHeader other) => other != null && FileLength.Equals(other.FileLength) && ShapeType.Equals(other.ShapeType) && BoundingBox.Equals(other.BoundingBox);