public BezierCurve(Point p0, Point p1, Point p2, Point p3, ShapeStyle style)
            : base(new Rectangle(
                Math.Min(Math.Min(Math.Min(p0.X, p1.X), p2.X), p3.X),
                Math.Min(Math.Min(Math.Min(p0.Y, p1.Y), p2.Y), p3.Y),
                Math.Max(Math.Max(Math.Max(p0.X, p1.X), p2.X), p3.X) - Math.Min(Math.Min(Math.Min(p0.X, p1.X), p2.X), p3.X),
                Math.Max(Math.Max(Math.Max(p0.Y, p1.Y), p2.Y), p3.Y) - Math.Min(Math.Min(Math.Min(p0.Y, p1.Y), p2.Y), p3.Y)),
                0,
                style,
                "Layer - BezierCurve")
        {
            ControlPoints = new[]
            {
                new GeometryPoint(p0, GeometryPointType.Movable),
                new GeometryPoint(p1, GeometryPointType.Movable),
                new GeometryPoint(p2, GeometryPointType.Movable),
                new GeometryPoint(p3, GeometryPointType.Movable)
            };

            controlPointLinks = new GeometryItem[3];
            controlPointLinks[0].Points[0] = ControlPoints[0];
            controlPointLinks[0].Points[1] = ControlPoints[1];
            controlPointLinks[1].Points[0] = ControlPoints[1];
            controlPointLinks[1].Points[1] = ControlPoints[2];
            controlPointLinks[2].Points[0] = ControlPoints[2];
            controlPointLinks[2].Points[1] = ControlPoints[3];

            EditablegeometryCue.AddRange(ControlPoints);
            EditablegeometryCue.AddRange(controlPointLinks);
        }
 // FIXME DashStyle parameter
 public static ShapeStyle CreateShapeStyle(Color edge, Color fill, float edgeSize)
 {
     var style = new ShapeStyle
     {
         EdgeColor = edge,
         EdgeSize = edgeSize,
         FillColor = fill/*,
         LineDash = DashStyle.Dash*/
     };
     return style;
 }
Example #3
0
        public Circle(Point center, int radius, ShapeStyle style)
            : base(new Rectangle(center.X - radius, center.Y - radius, 2 * radius, 2 * radius),
                  0, style, "Layer - Circle", true)
        {
            RadiusGeometry = new GeometryItem(
                new GeometryPoint(center, GeometryPointType.Movable),
                new GeometryPoint(new Point(center.X + radius, center.Y), GeometryPointType.Movable),
                GeometryItemType.Cue);

            EditablegeometryCue.Add(RadiusGeometry);
        }
Example #4
0
        public Line(Point begin, Point end, ShapeStyle style)
            : base(new Rectangle(
                Math.Min(begin.X, end.X),
                Math.Min(begin.Y, end.Y),
                Math.Abs(begin.X - end.X),
                Math.Abs(begin.Y - end.Y)),
                0,
                style,
                "Layer - Line")
        {
            Begin = new GeometryPoint(begin, GeometryPointType.Movable);
            End = new GeometryPoint(end, GeometryPointType.Movable);

            EditablegeometryCue.Add(Begin);
            EditablegeometryCue.Add(End);
        }
Example #5
0
 public Triangle(Rectangle region, int depthLevel, ShapeStyle style, string displayName)
     : base(region, depthLevel, style, displayName)
 {
     throw new NotImplementedException();
 }
 public SRectangle(Rectangle region, ShapeStyle style)
     : base(region, 0, style, "Layer - Rectangle")
 {
 }
Example #7
0
 public Square(Point location, int side, ShapeStyle style)
     : base(new Rectangle(location.X, location.Y, side, side), 0, style, "Layer - Square")
 {
 }
 public static ShapeBase CreateTriangle(Size size, ShapeStyle style)
 {
     throw new System.NotImplementedException();
 }
 public static ShapeBase CreateSquare(Size size, ShapeStyle style)
 {
     Point location = new Point(size.Width / 3, size.Height / 3);
     int side = size.Width / 4;
     return new Square(location, side, style);
 }
 public static ShapeBase CreateRectangle(Size size, ShapeStyle style)
 {
     Point location = new Point(size.Width / 3, size.Height / 3);
     Rectangle region = new Rectangle(location.X, location.Y, size.Width / 2, size.Height / 2);
     return new SRectangle(region, style);
 }
 public static ShapeBase CreateLine(Size size, ShapeStyle style)
 {
     Point begin = new Point(size.Width / 4, size.Height / 5);
     Point end = new Point(size.Width / 2, size.Height / 4);
     return new Line(begin, end, style);
 }
 public static ShapeBase CreateEllipse(Size size, ShapeStyle style)
 {
     Point location = new Point(size.Width / 3, size.Height / 3);
     return new Ellipse(new Rectangle(location.X, location.Y, size.Width / 5, size.Height / 7), style);
 }
 public static ShapeBase CreateCircle(Size size, ShapeStyle style)
 {
     Point center = new Point(size.Width / 2, size.Height / 2);
     return new Circle(center, size.Width / 7, style);
 }
Example #14
0
 public Diamond(Rectangle region, ShapeStyle style)
     : base(region, 0, style, "Layer - Diamond", true)
 {
     ConstructFrom(region);
     EditablegeometryCue.AddRange(Edges);
 }
Example #15
0
 public Ellipse(Rectangle region, ShapeStyle style)
     : base(region, 0, style, "Layer - Ellipse", true)
 {
     ConstructFrom(region);
     EditablegeometryCue.AddRange(Axes);
 }
Example #16
0
 protected ShapeBase(Rectangle region, int depthLevel, ShapeStyle style, string displayName, bool supportsRegionConstruction = false)
     : base(region, depthLevel, displayName)
 {
     Style = style;
     SupportsRegionConstruction = supportsRegionConstruction;
 }