public void Draw(CanvasDrawingSession drawingSession)
        {
            Matrix3x2 matrix = this.ViewModel.CanvasTransformer.GetMatrix();

            //@DrawBound
            switch (this.SelectionViewModel.SelectionMode)
            {
            case ListViewSelectionMode.None: break;

            case ListViewSelectionMode.Single:
                ILayer layer2 = this.SelectionViewModel.SelectionLayerage.Self;

                if (layer2.Type == LayerType.Curve)
                {
                    drawingSession.DrawLayerBound(layer2, matrix, this.ViewModel.AccentColor);
                    drawingSession.DrawNodeCollection(layer2.Nodes, matrix, this.ViewModel.AccentColor);
                }
                break;

            case ListViewSelectionMode.Multiple:
                foreach (Layerage layerage in this.SelectionViewModel.SelectionLayerages)
                {
                    ILayer layer = layerage.Self;

                    if (layer.Type == LayerType.Curve)
                    {
                        drawingSession.DrawLayerBound(layer, matrix, this.ViewModel.AccentColor);
                        drawingSession.DrawNodeCollection(layer.Nodes, matrix, this.ViewModel.AccentColor);
                    }
                }
                break;
            }

            switch (this.NodeCollectionMode)
            {
            case NodeCollectionMode.Move:
            case NodeCollectionMode.MoveSingleNodePoint:
            {
                //Snapping
                if (this.IsSnap)
                {
                    this.Snap.Draw(drawingSession, matrix);
                    this.Snap.DrawNode2(drawingSession, matrix);
                }
            }
            break;

            case NodeCollectionMode.RectChoose:
            {
                CanvasGeometry canvasGeometry          = this.TransformerRect.ToRectangle(this.ViewModel.CanvasDevice);
                CanvasGeometry canvasGeometryTransform = canvasGeometry.Transform(matrix);
                drawingSession.DrawGeometryDodgerBlue(canvasGeometryTransform);
            }
            break;
            }
        }
        private void AddDraw(CanvasDrawingSession drawingSession)
        {
            ILayer layer = this.CurveLayer;

            Matrix3x2 matrix    = this.ViewModel.CanvasTransformer.GetMatrix();
            Vector2   lastPoint = Vector2.Transform(this._addLastNode.Point, matrix);
            Vector2   endPoint  = Vector2.Transform(this._addEndNode.Point, matrix);


            //Geometry
            ICanvasBrush      canvasBrush = layer.Style.Stroke.GetICanvasBrush(this.ViewModel.CanvasDevice);
            float             strokeWidth = layer.Style.StrokeWidth;
            CanvasStrokeStyle strokeStyle = layer.Style.StrokeStyle;

            drawingSession.DrawLine(lastPoint, endPoint, canvasBrush, strokeWidth, strokeStyle);


            //Draw
            drawingSession.DrawLine(lastPoint, endPoint, this.ViewModel.AccentColor);
            drawingSession.DrawLayerBound(layer, matrix, this.ViewModel.AccentColor);

            drawingSession.DrawNode3(endPoint);
            drawingSession.DrawNodeCollection(layer.Nodes, matrix, this.ViewModel.AccentColor);


            //Snapping
            if (this.IsSnap)
            {
                this.Snap.Draw(drawingSession, matrix);
                this.Snap.DrawNode2(drawingSession, matrix);
            }
        }
Пример #3
0
        public void Draw(CanvasDrawingSession drawingSession)
        {
            switch (this.Mode)
            {
            case NodeCollectionMode.Preview:
                this.PreviewDraw(drawingSession);
                break;

            case NodeCollectionMode.Add:
            {
                if (this.CurveLayer != null)
                {
                    this.AddDraw(drawingSession);
                }
            }
            break;

            default:
            {
                if (this.CurveLayer != null)
                {
                    ILayer layer = this.CurveLayer;

                    Matrix3x2 matrix = this.ViewModel.CanvasTransformer.GetMatrix();

                    drawingSession.DrawLayerBound(layer, matrix, this.ViewModel.AccentColor);
                    drawingSession.DrawNodeCollection(layer.Nodes, matrix, this.ViewModel.AccentColor);
                }
            }
            break;
            }
        }
        public void Draw(CanvasDrawingSession drawingSession)
        {
            Matrix3x2 matrix = this.ViewModel.CanvasTransformer.GetMatrix();

            //@DrawBound
            switch (this.SelectionViewModel.SelectionMode)
            {
            case ListViewSelectionMode.None:
                break;

            case ListViewSelectionMode.Single:
                ILayer layer2 = this.SelectionViewModel.SelectionLayerage.Self;
                drawingSession.DrawLayerBound(layer2, matrix, this.ViewModel.AccentColor);

                ToolBase.TransformerTool.Draw(drawingSession);     //TransformerTool
                break;

            case ListViewSelectionMode.Multiple:
                foreach (Layerage layerage in this.ViewModel.SelectionLayerages)
                {
                    ILayer layer = layerage.Self;
                    drawingSession.DrawLayerBound(layer, matrix, this.ViewModel.AccentColor);
                }

                ToolBase.TransformerTool.Draw(drawingSession);     //TransformerTool
                break;
            }


            switch (this.CursorMode)
            {
            case CursorMode.None:
            case CursorMode.Transformer:
                ToolBase.TransformerTool.Draw(drawingSession);    //TransformerTool
                break;

            case CursorMode.Move:
                ToolBase.MoveTool.Draw(drawingSession);    //MoveTool
                break;

            case CursorMode.BoxChoose:
                CanvasGeometry geometry = this.BoxRect.ToRectangle(this.ViewModel.CanvasDevice, matrix);
                drawingSession.DrawGeometryDodgerBlue(geometry);
                break;
            }
        }
        public void Draw(CanvasDrawingSession drawingSession)
        {
            Matrix3x2 matrix = this.ViewModel.CanvasTransformer.GetMatrix();

            //@DrawBound
            switch (this.SelectionViewModel.SelectionMode)
            {
            case ListViewSelectionMode.None:
                break;

            case ListViewSelectionMode.Single:
                ILayer layer2 = this.SelectionViewModel.SelectionLayerage.Self;
                drawingSession.DrawLayerBound(layer2, matrix, this.ViewModel.AccentColor);
                break;

            case ListViewSelectionMode.Multiple:
                foreach (Layerage layerage in this.ViewModel.SelectionLayerages)
                {
                    ILayer layer = layerage.Self;
                    drawingSession.DrawLayerBound(layer, matrix, this.ViewModel.AccentColor);
                }
                break;
            }


            switch (this.SelectionViewModel.SelectionMode)
            {
            case ListViewSelectionMode.None:
                break;

            case ListViewSelectionMode.Single:
            case ListViewSelectionMode.Multiple:
            {
                //Snapping
                if (this.IsSnap)
                {
                    this.Snap.Draw(drawingSession, matrix);
                }

                this.Transparency.Draw(drawingSession, matrix, this.ViewModel.AccentColor);
            }
            break;
            }
        }