public override void Draw(IDiagramPresenter diagramPresenter) { Shape shape = null; if (diagramPresenter.Diagram != null && diagramPresenter.Diagram.Shapes.Count > 0) { shape = diagramPresenter.Diagram.Shapes.TopMost; } if (shape != null) { diagramPresenter.ResetTransformation(); try { foreach (ControlPointId id in shape.GetControlPointIds(ControlPointCapabilities.All)) { if (id == ControlPointId.Reference) { continue; } IndicatorDrawMode drawMode = (SelectedPointId == id) ? IndicatorDrawMode.Highlighted : IndicatorDrawMode.Normal; if (shape.HasControlPointCapability(id, ControlPointCapabilities.Resize)) { diagramPresenter.DrawResizeGrip(drawMode, shape, id); } if (shape.HasControlPointCapability(id, ControlPointCapabilities.Connect | ControlPointCapabilities.Glue)) { diagramPresenter.DrawConnectionPoint(drawMode, shape, id); } if (shape.HasControlPointCapability(id, ControlPointCapabilities.Rotate)) { diagramPresenter.DrawRotateGrip(drawMode, shape, id); } } } finally { diagramPresenter.RestoreTransformation(); } } }
public override void Draw(IDiagramPresenter diagramPresenter) { Shape shape = null; if (diagramPresenter.Diagram != null && diagramPresenter.Diagram.Shapes.Count > 0) shape = diagramPresenter.Diagram.Shapes.TopMost; if (shape != null) { diagramPresenter.ResetTransformation(); try { foreach (ControlPointId id in shape.GetControlPointIds(ControlPointCapabilities.All)) { if (id == ControlPointId.Reference) continue; IndicatorDrawMode drawMode = (SelectedPointId == id) ? IndicatorDrawMode.Highlighted : IndicatorDrawMode.Normal; if (shape.HasControlPointCapability(id, ControlPointCapabilities.Resize)) diagramPresenter.DrawResizeGrip(drawMode, shape, id); if (shape.HasControlPointCapability(id, ControlPointCapabilities.Connect | ControlPointCapabilities.Glue)) diagramPresenter.DrawConnectionPoint(drawMode, shape, id); if (shape.HasControlPointCapability(id, ControlPointCapabilities.Rotate)) diagramPresenter.DrawRotateGrip(drawMode, shape, id); } } finally { diagramPresenter.RestoreTransformation(); } } }
/// <override></override> public override void Draw(IDiagramPresenter diagramPresenter) { if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter"); // Draw preview shape if (PreviewShape != null) { // Draw preview shape and its ControlPoints diagramPresenter.DrawShape(PreviewShape); diagramPresenter.ResetTransformation(); try { foreach (ControlPointId pointId in PreviewShape.GetControlPointIds(ControlPointCapabilities.Glue | ControlPointCapabilities.Resize)) diagramPresenter.DrawResizeGrip(IndicatorDrawMode.Normal, PreviewShape, pointId); } finally { diagramPresenter.RestoreTransformation(); } } // Highlight ConnectionPoints in range if (!CurrentMouseState.IsEmpty) { if (Template.Shape.HasControlPointCapability(ControlPointId.LastVertex, ControlPointCapabilities.Glue)) { if (PreviewShape == null) DrawConnectionTargets(diagramPresenter, Template.Shape, CurrentMouseState.X, CurrentMouseState.Y); else { Point gluePtPos = PreviewShape.GetControlPointPosition(ControlPointId.LastVertex); DrawConnectionTargets(diagramPresenter, PreviewShape, ControlPointId.LastVertex, gluePtPos); } } } }