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(LayerManager.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.DrawWireframe(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); } }
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; } }