public IToolContext CreateToolContext()
        {
            var editorToolContext = new EditorToolContext()
            {
                ContainerFactory = this
            };

            var hitTest = new HitTest();

            var tools = new ObservableCollection <ITool>();

            var noneTool = new NoneTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    },
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    }
                },
                Settings = new NoneToolSettings()
            };

            var selectionTool = new SelectionTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new SelectionToolSettings()
                {
                    Mode                  = SelectionMode.Point | SelectionMode.Shape,
                    Targets               = SelectionTargets.Shapes,
                    SelectionModifier     = Modifier.Control,
                    ConnectionModifier    = Modifier.Shift,
                    SelectionStyle        = "Selection",
                    ClearSelectionOnClean = false,
                    HitTestRadius         = 7.0,
                    ConnectPoints         = true,
                    ConnectTestRadius     = 10.0,
                    DisconnectPoints      = true,
                    DisconnectTestRadius  = 10.0
                }
            };

            var pointTool = new PointTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PointToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var lineTool = new LineTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new LineToolSettings()
                {
                    ConnectPoints      = true,
                    HitTestRadius      = 7.0,
                    SplitIntersections = false
                }
            };

            var polyLineTool = new PolyLineTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Intersections = new ObservableCollection <IPointShape>(),
                        Settings      = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PolyLineToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var cubicBezierTool = new CubicBezierTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new CubicBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var quadraticBezierTool = new QuadraticBezierTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new QuadraticBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var conicTool = new ConicTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new ConicToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    Weight        = 1.0
                }
            };

            var pathTool = new PathTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new PathToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    FillType      = PathFillType.Winding,
                    IsFilled      = true,
                    IsClosed      = true
                }
            };

            pathTool.Settings.Tools = new ObservableCollection <ITool>
            {
                new LineTool(),
                new CubicBezierTool(),
                new QuadraticBezierTool(),
                new ConicTool(),
                new MoveTool(pathTool)
            };
            pathTool.Settings.CurrentTool = pathTool.Settings.Tools[0];

            var scribbleTool = new ScribbleTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = false,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new ScribbleToolSettings()
                {
                    Simplify = true,
                    Epsilon  = 1.0,
                    FillType = PathFillType.Winding,
                    IsFilled = false,
                    IsClosed = false
                }
            };

            var rectangleTool = new RectangleTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new RectangleToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var ellipseTool = new EllipseTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new EllipseToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var textTool = new TextTool()
            {
                Intersections = new ObservableCollection <IPointIntersection>(),
                Filters       = new ObservableCollection <IPointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = "Guide"
                        }
                    },
                    new LineSnapPointFilter()
                    {
                        Guides   = new ObservableCollection <IBaseShape>(),
                        Settings = new LineSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Target       = LineSnapTarget.Shapes,
                            Mode         = LineSnapMode.Point
                                           | LineSnapMode.Middle
                                           | LineSnapMode.Nearest
                                           | LineSnapMode.Intersection
                                           | LineSnapMode.Horizontal
                                           | LineSnapMode.Vertical,
                            Threshold  = 10.0,
                            GuideStyle = "Guide"
                        }
                    }
                },
                Settings = new TextToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            void SetToolDefaults(ITool tool)
            {
                tool.CurrentIntersection = tool.Intersections.Count > 0 ? tool.Intersections[0] : null;
                tool.CurrentFilter       = tool.Filters.Count > 0 ? tool.Filters[0] : null;
            }

            SetToolDefaults(noneTool);
            SetToolDefaults(selectionTool);
            SetToolDefaults(pointTool);
            SetToolDefaults(lineTool);
            SetToolDefaults(polyLineTool);
            SetToolDefaults(cubicBezierTool);
            SetToolDefaults(quadraticBezierTool);
            SetToolDefaults(conicTool);
            SetToolDefaults(pathTool);
            SetToolDefaults(scribbleTool);
            SetToolDefaults(rectangleTool);
            SetToolDefaults(ellipseTool);
            SetToolDefaults(textTool);

            tools.Add(noneTool);
            tools.Add(selectionTool);
            tools.Add(pointTool);
            tools.Add(lineTool);
            tools.Add(polyLineTool);
            tools.Add(cubicBezierTool);
            tools.Add(quadraticBezierTool);
            tools.Add(conicTool);
            tools.Add(pathTool);
            tools.Add(scribbleTool);
            tools.Add(rectangleTool);
            tools.Add(ellipseTool);
            tools.Add(textTool);

            editorToolContext.Selection        = selectionTool;
            editorToolContext.HitTest          = hitTest;
            editorToolContext.CurrentDirectory = null;
            editorToolContext.Files            = new ObservableCollection <string>();

            editorToolContext.StyleLibrary = null;
            editorToolContext.GroupLibrary = null;

            var pointTemplate = new RectangleShape(new PointShape(-4, -4, null), new PointShape(4, 4, null))
            {
                Points  = new ObservableCollection <IPointShape>(),
                Text    = new Text(),
                StyleId = "PointTemplate"
            };

            pointTemplate.StartPoint.Owner = pointTemplate;
            pointTemplate.Point.Owner      = pointTemplate;

            editorToolContext.PointTemplate = pointTemplate;

            editorToolContext.ContainerViews = new ObservableCollection <IContainerView>();
            editorToolContext.ContainerView  = null;
            editorToolContext.Tools          = tools;
            editorToolContext.CurrentTool    = selectionTool;
            editorToolContext.EditMode       = EditMode.Mouse;

            return(editorToolContext);
        }
Example #2
0
        public LayerContainerViewModel CreateDemoViewModel()
        {
            var hitTest = new HitTest();

            hitTest.Register(new PointHitTest());
            hitTest.Register(new LineHitTest());
            hitTest.Register(new CubicBezierHitTest());
            hitTest.Register(new QuadraticBezierHitTest());
            hitTest.Register(new GroupHitTest());
            hitTest.Register(new PathHitTest());
            hitTest.Register(new RectangleHitTest());
            hitTest.Register(new EllipseHitTest());
            hitTest.Register(new TextHitTest());

            var gridSnapPointFilter = new GridSnapPointFilter()
            {
                Settings = new GridSnapSettings()
                {
                    IsEnabled    = true,
                    EnableGuides = false,
                    Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                    GridSizeX    = 15.0,
                    GridSizeY    = 15.0,
                    GuideStyle   = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var lineSnapPointFilter = new LineSnapPointFilter()
            {
                Settings = new LineSnapSettings()
                {
                    IsEnabled    = true,
                    EnableGuides = false,
                    Target       = LineSnapTarget.Guides | LineSnapTarget.Shapes,
                    Mode         = LineSnapMode.Point
                                   | LineSnapMode.Middle
                                   | LineSnapMode.Nearest
                                   | LineSnapMode.Intersection
                                   | LineSnapMode.Horizontal
                                   | LineSnapMode.Vertical,
                    Threshold  = 10.0,
                    GuideStyle = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var tools = new ObservableCollection <ToolBase>();

            var noneTool = new NoneTool()
            {
                Settings = new NoneToolSettings()
            };

            var selectionTool = new SelectionTool()
            {
                Filters = new List <PointFilter>
                {
                    new GridSnapPointFilter()
                    {
                        Settings = new GridSnapSettings()
                        {
                            IsEnabled    = true,
                            EnableGuides = false,
                            Mode         = GridSnapMode.Horizontal | GridSnapMode.Vertical,
                            GridSizeX    = 15.0,
                            GridSizeY    = 15.0,
                            GuideStyle   = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                        }
                    }
                },
                Settings = new SelectionToolSettings()
                {
                    Mode                  = SelectionMode.Point | SelectionMode.Shape,
                    Targets               = SelectionTargets.Shapes | SelectionTargets.Guides,
                    SelectionModifier     = Modifier.Control,
                    ConnectionModifier    = Modifier.Shift,
                    SelectionStyle        = new ShapeStyle(new ArgbColor(255, 0, 120, 215), new ArgbColor(60, 170, 204, 238), 2.0, true, true),
                    ClearSelectionOnClean = false,
                    HitTestRadius         = 7.0,
                    ConnectPoints         = true,
                    ConnectTestRadius     = 10.0,
                    DisconnectPoints      = true,
                    DisconnectTestRadius  = 10.0
                }
            };

            var guideTool = new GuideTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new GuideToolSettings()
                {
                    GuideStyle = new ShapeStyle(new ArgbColor(128, 0, 255, 255), new ArgbColor(128, 0, 255, 255), 2.0, true, true)
                }
            };

            var pointTool = new PointTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PointToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var lineTool = new LineTool()
            {
                Intersections = new List <PointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Settings = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Settings = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Settings = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new LineToolSettings()
                {
                    ConnectPoints      = true,
                    HitTestRadius      = 7.0,
                    SplitIntersections = false
                }
            };

            var polyLineTool = new PolyLineTool()
            {
                Intersections = new List <PointIntersection>
                {
                    new LineLineIntersection()
                    {
                        Settings = new LineLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new RectangleLineIntersection()
                    {
                        Settings = new RectangleLineSettings()
                        {
                            IsEnabled = true
                        }
                    },
                    new EllipseLineIntersection()
                    {
                        Settings = new EllipseLineSettings()
                        {
                            IsEnabled = true
                        }
                    }
                },
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PolyLineToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var cubicBezierTool = new CubicBezierTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new CubicBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var quadraticBezierTool = new QuadraticBezierTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new QuadraticBezierToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var pathTool = new PathTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new PathToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0,
                    FillRule      = PathFillRule.EvenOdd,
                    IsFilled      = true,
                    IsClosed      = true
                }
            };

            pathTool.Settings.Tools = new ObservableCollection <ToolBase>
            {
                new LineTool(),
                new CubicBezierTool(),
                new QuadraticBezierTool(),
                new MoveTool(pathTool)
            };
            pathTool.Settings.CurrentTool = pathTool.Settings.Tools[0];

            var scribbleTool = new ScribbleTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter
                },
                Settings = new ScribbleToolSettings()
                {
                    Simplify = true,
                    Epsilon  = 1.0,
                    FillRule = PathFillRule.EvenOdd,
                    IsFilled = false,
                    IsClosed = false
                }
            };

            var rectangleTool = new RectangleTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new RectangleToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var ellipseTool = new EllipseTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new EllipseToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            var textTool = new TextTool()
            {
                Filters = new List <PointFilter>
                {
                    lineSnapPointFilter,
                    gridSnapPointFilter
                },
                Settings = new TextToolSettings()
                {
                    ConnectPoints = true,
                    HitTestRadius = 7.0
                }
            };

            tools.Add(noneTool);
            tools.Add(selectionTool);
            tools.Add(guideTool);
            tools.Add(pointTool);
            tools.Add(lineTool);
            tools.Add(polyLineTool);
            tools.Add(cubicBezierTool);
            tools.Add(quadraticBezierTool);
            tools.Add(pathTool);
            tools.Add(scribbleTool);
            tools.Add(rectangleTool);
            tools.Add(ellipseTool);
            tools.Add(textTool);

            var currentTool = tools.FirstOrDefault(t => t.Title == "Selection");

            var presenter = new DefaultShapePresenter()
            {
                Helpers = new Dictionary <Type, ShapeHelper>
                {
                    { typeof(PointShape), new PointHelper() },
                    { typeof(LineShape), new LineHelper() },
                    { typeof(CubicBezierShape), new CubicBezierHelper() },
                    { typeof(QuadraticBezierShape), new QuadraticBezierHelper() },
                    { typeof(PathShape), new PathHelper() },
                    { typeof(RectangleShape), new RectangleHelper() },
                    { typeof(EllipseShape), new EllipseHelper() },
                    { typeof(TextShape), new TextHelper() }
                }
            };

            return(new LayerContainerViewModel()
            {
                Tools = tools,
                CurrentTool = currentTool,
                Mode = EditMode.Mouse,
                Presenter = presenter,
                Renderer = null,
                HitTest = hitTest,
                CurrentContainer = null,
                WorkingContainer = null,
                CurrentStyle = null,
                PointShape = null,
                Capture = null,
                Release = null,
                Invalidate = null,
                Reset = null,
                AutoFit = null,
                StretchNone = null,
                StretchFill = null,
                StretchUniform = null,
                StretchUniformToFill = null
            });
        }