예제 #1
0
        private void SendCreateShapeAction(CreateShapeAction action, NetworkStream stream)
        {
            // Shape type | Location | Size | Outline Color | Outline width | Outline dash | Fill Color | Vetices

            // Shape type
            WriteInt((int)action.Shape.GetShapeType(), stream);
            // Location
            WritePointF(action.Shape.Location, stream);
            // Size
            WriteSizeF(action.Shape.Size, stream);
            // Outline Color
            WriteColor(action.Shape.OutlineColor, stream);
            // Outline width
            WriteFloat(action.Shape.OutlineWidth, stream);
            // Outline dash
            WriteInt((int)action.Shape.OutlineDash, stream);
            // Fill Color
            WriteColor(action.Shape.FillColor, stream);

            if (action.Shape.GetShapeType() != ShapeType.Ellipse)
            {
                // vertices count
                WriteInt(action.Shape.Vertices.Count, stream);
                foreach (var vertex in action.Shape.Vertices)
                {
                    WriteVertex(vertex, stream);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Process when draw is finish
        /// </summary>
        /// <param name="obj">The object.</param>
        public void CreateObject(IDrawingObject obj)
        {
            IAction action = null;

            if (obj.GetObjectType() == DrawingObjectType.Shape)
            {
                action = new CreateShapeAction((ShapeBase)obj);
            }
            else if (obj.GetObjectType() == DrawingObjectType.Text)
            {
                var text = obj as TextObject;
                if (text != null)
                {
                    action = new UpdateTextControlAction()
                    {
                        Text     = "",
                        Font     = text.Font,
                        Location = text.Location
                    }
                }
                ;
            }

            SendAction(action);

            if (obj.GetObjectType() == DrawingObjectType.Text)
            {
                action = new CreateTextAction((TextObject)obj);
                SendAction(action);
            }

            _page.AddDrawingObject(obj);
        }