Esempio n. 1
0
 public BoardShape(MainShape mainShapeDefiner, int userLevel, DateTime creationTime, DateTime lastModifiedTime,
                   string uid, string shapeOwnerId, Operation operation)
 {
     MainShapeDefiner = mainShapeDefiner;
     UserLevel        = userLevel;
     CreationTime     = creationTime;
     LastModifiedTime = lastModifiedTime;
     Uid             = uid;
     ShapeOwnerId    = shapeOwnerId;
     RecentOperation = operation;
 }
Esempio n. 2
0
        /// <summary>
        ///     Creates/ modifies the previous shape.
        /// </summary>
        /// <param name="start">Start of mouse drag.</param>
        /// <param name="end">End of mouse drag.</param>
        /// <param name="prevEllipse">Previous ellipse object to modify.</param>
        /// <returns>Create/modified Ellipse object.</returns>
        public override MainShape ShapeMaker(Coordinate start, Coordinate end, MainShape prevEllipse = null)
        {
            if (prevEllipse == null)
            {
                return(new Ellipse(start.R - end.R, start.C - end.C, start));
            }

            prevEllipse.Height = end.R - prevEllipse.Start.R;
            prevEllipse.Width  = end.C - prevEllipse.Start.C;
            return(prevEllipse);
        }
Esempio n. 3
0
        /// <summary>
        ///     Creates/ modifies the previous shape.
        /// </summary>
        /// <param name="start">Start of mouse drag.</param>
        /// <param name="end">End of mouse drag.</param>
        /// <param name="prevPolyline">Previous Polyline object to modify.</param>
        /// <returns>Create/modified Polyline object.</returns>
        public override MainShape ShapeMaker(Coordinate start, Coordinate end, MainShape prevPolyline = null)
        {
            if (prevPolyline == null)
            {
                return(new Polyline(start.R - end.R, start.C - end.C, start));
            }

            prevPolyline.Height = end.R - prevPolyline.Start.R;
            prevPolyline.Width  = end.C - prevPolyline.Start.C;
            AddToList(end.Clone());
            return(prevPolyline);
        }
Esempio n. 4
0
        public UXShape(UXOperation uxOperation, MainShape s, string shapeId, int checkPointNumber = 0,
                       Operation operationType = Operation.NONE)
        {
            UxOperation           = uxOperation;
            ShapeIdentifier       = s.ShapeIdentifier;
            TranslationCoordinate = s.GetCenter().Clone();
            AngleOfRotation       = s.AngleOfRotation;
            CheckPointNumber      = checkPointNumber;
            OperationType         = operationType;

            var shapeFillBrush = new SolidColorBrush
            {
                Color = Color.FromArgb(Convert.ToByte(s.ShapeFill.R), Convert.ToByte(s.ShapeFill.G),
                                       Convert.ToByte(s.ShapeFill.B), 0)
            };

            if (s.ShapeIdentifier == ShapeType.ELLIPSE)
            {
                var EllipseUXElement = new System.Windows.Shapes.Ellipse();
                EllipseUXElement.Width  = s.Width;
                EllipseUXElement.Height = s.Height;
                EllipseUXElement.Fill   = shapeFillBrush;
                WindowsShape            = EllipseUXElement;
            }
            else if (s.ShapeIdentifier == ShapeType.RECTANGLE)
            {
                var RectangleUXElement = new System.Windows.Shapes.Rectangle();
                RectangleUXElement.Width  = s.Width;
                RectangleUXElement.Height = s.Height;
                RectangleUXElement.Fill   = shapeFillBrush;
                WindowsShape = RectangleUXElement;
            }
            else if (s.ShapeIdentifier == ShapeType.LINE)
            {
                System.Windows.Shapes.Line LineUXElement = new();
                LineUXElement.X1 = s.Start.R;
                LineUXElement.Y1 = s.Start.C;
                LineUXElement.X2 = s.Start.R + s.Height;
                LineUXElement.Y2 = s.Start.R + s.Width;
                WindowsShape     = LineUXElement;
            }
            else
            {
                var PolylineUXElement       = new System.Windows.Shapes.Polyline();
                var PolyLinePointCollection = new PointCollection();
                foreach (var cord in s.GetPoints())
                {
                    PolyLinePointCollection.Add(new Point(cord.R, cord.C));
                }
                PolylineUXElement.Points = PolyLinePointCollection;
                WindowsShape             = PolylineUXElement;
            }

            WindowsShape.StrokeThickness = s.StrokeWidth;

            var StrokeBrush = new SolidColorBrush
            {
                Color = Color.FromArgb(Convert.ToByte(s.StrokeColor.R), Convert.ToByte(s.StrokeColor.G),
                                       Convert.ToByte(s.StrokeColor.B), 0)
            };

            WindowsShape.Stroke = StrokeBrush;
            if (shapeId != null)
            {
                WindowsShape.Uid = shapeId;
            }
        }
Esempio n. 5
0
 /// <summary>
 ///     Creates/modies prevShape based on start and end coordinate of the mouse.
 /// </summary>
 /// <param name="start">The start coordinate of mouse drag.</param>
 /// <param name="end">End coordinate of mouse drag.</param>
 /// <param name="prevShape">Previous shape to modify, if any.</param>
 /// <returns></returns>
 public abstract MainShape ShapeMaker(Coordinate start, Coordinate end, MainShape prevShape = null);