private static void AddPlatformBoxStub(ImageFrame frame) { var platformGroup = new PolygonGroup { Name = "Platform", Parent = frame }; platformGroup.Initialize(); frame.AddChild(platformGroup); var attack = new Polygon { Name = "Polygon 1", Parent = platformGroup }; platformGroup.AddChild(attack); }
private static void AddLandingBoxStub(ImageFrame frame) { var landingGroup = new PolygonGroup { Name = "Landing", Parent = frame }; landingGroup.Initialize(); frame.AddChild(landingGroup); var attack = new Polygon { Name = "Polygon 1", Parent = landingGroup}; landingGroup.AddChild(attack); }
private static void AddDefaultFootBox(ImageFrame frame) { var footGroup = new PolygonGroup { Name = "Foot", Parent = frame }; footGroup.Initialize(); frame.AddChild(footGroup); var foot = new Polygon { Name = "Foot", Parent = footGroup }; var bottom = frame.TrimRectangle.Bottom - 1; var left = frame.TrimRectangle.Left; var right = frame.TrimRectangle.Right; var width = frame.TrimRectangle.Width; var tl = new PolyPoint(left + (int)(width * 0.25f), bottom - 2) { Parent = foot }; var tr = new PolyPoint(right - (int)(width * 0.25f), bottom - 2) { Parent = foot }; var br = new PolyPoint(right - (int)(width * 0.25f), bottom) { Parent = foot }; var bl = new PolyPoint(left + (int)(width * 0.25f), bottom) { Parent = foot }; foot.AddChild(tl); foot.AddChild(tr); foot.AddChild(br); foot.AddChild(bl); footGroup.AddChild(foot); }
private static void AddDefaultDepthBox(ImageFrame frame) { var depthGroup = new PolygonGroup { Name = "Depth", Parent = frame }; depthGroup.Initialize(); frame.AddChild(depthGroup); var depth = new Polygon { Name = "Depth", Parent = depthGroup }; var bottom = frame.TrimRectangle.Bottom - 1; var left = frame.TrimRectangle.Left; var right = frame.TrimRectangle.Right; var width = frame.TrimRectangle.Width; var defaultDepthPercentage = (int)(frame.TrimRectangle.Height * 0.125f); const float defaultWidthBorder = 0.9f; // 10% on each side = 80% var tl = new PolyPoint(left + (int)(width * defaultWidthBorder), bottom - defaultDepthPercentage) { Parent = depth }; var tr = new PolyPoint(right - (int)(width * defaultWidthBorder), bottom - defaultDepthPercentage) { Parent = depth }; var br = new PolyPoint(right - (int)(width * defaultWidthBorder), bottom) { Parent = depth }; var bl = new PolyPoint(left + (int)(width * defaultWidthBorder), bottom) { Parent = depth }; depth.AddChild(tl); depth.AddChild(tr); depth.AddChild(br); depth.AddChild(bl); depthGroup.AddChild(depth); }
private static void AddBodyTrace(ImageFrame frame) { using (var ms = new MemoryStream(frame.Data)) { var imageBitmap = Image.FromStream(ms); var errorBuilder = new StringBuilder(); var bodyGroup = new PolygonGroup { Name = "Body", Parent = frame }; bodyGroup.Initialize(); frame.AddChild(bodyGroup); var shape = TraceService.CreateSimpleShape(imageBitmap, 200, errorBuilder); if (shape == null) { frame.FailsAutoTrace = true; return; } var count = 1; foreach (var polygon in shape.Vertices) { var poly = new Polygon { Name = "Polygon " + count, Parent = bodyGroup }; foreach (var point in polygon) { var x = (int)ConvertUnits.ToDisplayUnits(point.X); var y = (int)ConvertUnits.ToDisplayUnits(point.Y); x += (int)(frame.Width * 0.5f); y += (int)(frame.Height * 0.5f); poly.AddChild(new PolyPoint(x, y) { Parent = poly }); } bodyGroup.AddChild(poly); count++; } } }
private static void AddAttackBoxStub(ImageFrame frame) { var attackGroup = new PolygonGroup { Name = "Attack", Parent = frame}; attackGroup.Initialize(); frame.AddChild(attackGroup); var attack = new Polygon { Name = "Polygon 1", Parent = attackGroup }; attackGroup.AddChild(attack); }