예제 #1
0
        public void ApplyState(History history)
        {
            history.Current          = Cur;
            history.Enable           = E;
            history.Locked           = L;
            history.MaxUndoStepCount = US;
            history.Commands.Clear();
            history.TrackingEnabled = T;
            for (int i = 0; i < C.Count; i++)
            {
                if (!String.IsNullOrEmpty(C[i].D))
                {
                    var serializer = new JsonVOSerializer();

                    Command command = null;
                    switch (C[i].T)
                    {
                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.LayerAddedCommand":
                        command = serializer.Deserialize <RedoUndo.LayerAddedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.LayerRemovedCommand":
                        command = serializer.Deserialize <RedoUndo.LayerRemovedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.LayerMovedCommand":
                        command = serializer.Deserialize <RedoUndo.LayerMovedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.VObjectAddedCommand":
                        command = serializer.Deserialize <RedoUndo.VObjectAddedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.VObjectChangedCommand":
                        command = serializer.Deserialize <RedoUndo.VObjectChangedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.VObjectRemovedCommand":
                        command = serializer.Deserialize <RedoUndo.VObjectRemovedCommand>(C[i].D);
                        break;

                    case "Aurigma.GraphicsMill.AjaxControls.VectorObjects.RedoUndo.VObjectMovedCommand":
                        command = serializer.Deserialize <RedoUndo.VObjectMovedCommand>(C[i].D);
                        break;

                    default:
                        command = new UnknownCommand()
                        {
                            Type = C[i].T, Data = C[i].D
                        };
                        break;
                    }

                    if (command != null)
                    {
                        history.Commands.Add(command);
                    }
                }
            }
        }
예제 #2
0
 internal Color GetFillColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_fillColor) ? serializer.Deserialize <Color>(_fillColor) : new RgbColor(Fill));
 }
예제 #3
0
 internal Color GetBorderColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_borderColor) ? serializer.Deserialize <Color>(_borderColor) : new RgbColor(Stroke));
 }
예제 #4
0
        public void FromSvg(ICanvas canvas, SvgDocument svgDoc)
        {
            canvas.Layers.Clear();

            foreach (var attr in svgDoc.CustomAttributes)
            {
                if (attr.NamespaceUri == XmlNamespace.AurigmaVectorObjects)
                {
                    switch (attr.LocalName)
                    {
                    case "print-color-management-enabled":
                        canvas.PrintColorManagementEnabled = attr.GetValue() == "true";
                        break;

                    case "preview-color-management-enabled":
                        canvas.PreviewColorManagementEnabled = attr.GetValue() == "true";
                        break;

                    case "preview-target-color-space":
                        ColorSpace value;
                        if (Common.TryParseEnum(attr.GetValue(), out value) && value != ColorSpace.Unknown)
                        {
                            canvas.PreviewTargetColorSpace = value;
                        }
                        break;

                    case "tags":
                        var tags = _serializer.Deserialize <Dictionary <string, object> >(attr.GetValue());
                        foreach (var key in tags.Keys)
                        {
                            canvas.Tags[key] = tags[key];
                        }
                        break;
                    }
                }
            }

            foreach (var childSvgNode in svgDoc.ChildNodes)
            {
                var svgLayerNode = childSvgNode as SvgVoLayer;
                if (svgLayerNode == null)
                {
                    continue;
                }

                var layer = FromSvg(svgLayerNode);
                canvas.Layers.Add(layer);
            }

            canvas.WorkspaceWidth  = svgDoc.ViewBox.Width;
            canvas.WorkspaceHeight = svgDoc.ViewBox.Height;
        }
예제 #5
0
 internal Color GetHorizontalLineColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_horizontalLineColor) ? serializer.Deserialize <Color>(_horizontalLineColor) : new RgbColor(HorizontalLineColor));
 }
예제 #6
0
 internal Color GetVerticalLineColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_verticalLineColor) ? serializer.Deserialize <Color>(_verticalLineColor) : new RgbColor(VerticalLineColor));
 }
예제 #7
0
 internal Color GetTextColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_textColor) ? serializer.Deserialize <Color>(_textColor) : new RgbColor(TextColor));
 }
예제 #8
0
 internal Color GetAltColor(JsonVOSerializer serializer)
 {
     return(!string.IsNullOrEmpty(_altColor) ? serializer.Deserialize <Color>(_altColor) : new RgbColor(AltStroke));
 }