public void ApplyFixes(PlaceholderGeom geom, ScreenModel screenModel, IResizeRule resizeRule) { foreach (Fix fix in fixes) { fix.Apply(geom, screenModel, resizeRule); } }
public void Apply(PlaceholderGeom geom, ScreenModel screenModel, IResizeRule resizeRule) { switch (property) { case FixPropertyType.X: geom.Move(new R3ePoint(value, geom.Position.Y)); break; case FixPropertyType.Y: geom.Move(new R3ePoint(geom.Position.X, value)); break; case FixPropertyType.SIZE: geom.Resize(new R3ePoint(value, value)); break; case FixPropertyType.ANCHOR_X: geom.MoveAnchor(new R3ePoint(value, geom.Anchor.Y)); break; case FixPropertyType.ANCHOR_Y: geom.MoveAnchor(new R3ePoint(geom.Anchor.X, value)); break; case FixPropertyType.WIDTH: // TODO => WPF Size backgroundSize = new Size(screenModel.GetBackgroundImage().Width, screenModel.GetBackgroundImage().Height); double bitmapWidth = resizeRule.GetSize(geom.Size, ScreenView.BASE_RESOLUTION, backgroundSize, geom.BitmapSize, screenModel.Layout == ScreenLayoutType.TRIPLE).Width; double r3eWidth = geom.Size.X * 2 * value * bitmapWidth / backgroundSize.Width; geom.Move(new R3ePoint(geom.Position.X + r3eWidth, geom.Position.Y)); break; case FixPropertyType.HEIGHT: // TODO => WPF backgroundSize = new Size(screenModel.GetBackgroundImage().Width, screenModel.GetBackgroundImage().Height); double bitmapHeight = resizeRule.GetSize(geom.Size, ScreenView.BASE_RESOLUTION, backgroundSize, geom.BitmapSize, screenModel.Layout == ScreenLayoutType.TRIPLE).Height; double r3eHeight = geom.Size.Y * 2 * value * bitmapHeight / backgroundSize.Height; geom.Move(new R3ePoint(geom.Position.X, geom.Position.Y + r3eHeight)); break; default: throw new Exception("Not implemented property type."); } }