HtmlGroupShape.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace ClearSlideLibrary.HtmlController
  7. {
  8. class HtmlGroupShape : HtmlPresentationElement
  9. {
  10. public HtmlGroupShape(string id, int width, int height,
  11. int top, int left, bool invisible,
  12. bool animatable)
  13. {
  14. base.id = id;
  15. base.top = top;
  16. base.left = left;
  17. base.width = width;
  18. base.height = height;
  19. base.invisible = invisible;
  20. base.animatable = animatable;
  21. }
  22. public override string DrawElement()
  23. {
  24. StringBuilder shapeBuilder = new StringBuilder();
  25. string style = invisible ? "DC0" : "DC1";
  26. //the object has animation.
  27. if (animatable)
  28. {
  29. shapeBuilder.Append("<div id=\"" + id + "\" style=\"top:" + top.ToString() + "px;left:" + left.ToString() +
  30. "px;height:" + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  31. shapeBuilder.Append("<div class=\"" + style + "\" id=\"" + id + "c" + "\">");
  32. shapeBuilder.Append("<img />");
  33. shapeBuilder.Append("</div>");
  34. shapeBuilder.Append("</div>");
  35. }
  36. else
  37. {
  38. shapeBuilder.Append("<div id=\"" + id + "\" style=\"top:" + top.ToString() + "px;left:" + left.ToString() +
  39. "px;height:" + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  40. shapeBuilder.Append("<img/>");
  41. shapeBuilder.Append("</div>");
  42. }
  43. return shapeBuilder.ToString();
  44. }
  45. public override string ToString()
  46. {
  47. Console.WriteLine("The top is:" + top);
  48. Console.WriteLine("The left is:" + left);
  49. Console.WriteLine("The width is:" + width);
  50. Console.WriteLine("The height is:" + height);
  51. return string.Format("[{0}, {1}, {2}, {3}]", top, left, width, height);
  52. }
  53. }
  54. }