コード例 #1
0
        protected DiagramSelectionBorder CalculateNodeBorder(DiagramNode node)
        {
            var border = new DiagramSelectionBorder();

            var bounds = node.Bounds;

            border.ResizeInfos.Add(new ResizeInfo(bounds.TopLeft, ResizeDirection.DescendingTopLeft));
            border.ResizeInfos.Add(new ResizeInfo(new Point((bounds.Left + bounds.Right) / 2, bounds.Top), ResizeDirection.VerticalTop));
            border.ResizeInfos.Add(new ResizeInfo(bounds.TopRight, ResizeDirection.AscendingTopRight));
            border.ResizeInfos.Add(new ResizeInfo(new Point(bounds.Right, (bounds.Top + bounds.Bottom) / 2), ResizeDirection.HorizontalRight));
            border.ResizeInfos.Add(new ResizeInfo(bounds.BottomRight, ResizeDirection.DescendingBottomRight));
            border.ResizeInfos.Add(new ResizeInfo(new Point((bounds.Left + bounds.Right) / 2, bounds.Bottom), ResizeDirection.VerticalBottom));
            border.ResizeInfos.Add(new ResizeInfo(bounds.BottomLeft, ResizeDirection.AscendingBottomLeft));
            border.ResizeInfos.Add(new ResizeInfo(new Point(bounds.Left, (bounds.Top + bounds.Bottom) / 2), ResizeDirection.HorizontalLeft));

            return border;
        }
コード例 #2
0
        protected override DiagramSelectionBorder CalculateEdgeBorder(DiagramEdge edge)
        {
            var geometry = edge.Geometry as PathGeometry;
            if (geometry == null)
                return null;

            if (geometry.Figures.Count != 2)
                return null;

            var border = new DiagramSelectionBorder(false);

            var mainFigure = geometry.Figures[0];
            var arrowFigure = geometry.Figures[1];
            border.ResizeInfos.Add(new ResizeInfo(mainFigure.StartPoint, ResizeDirection.AllRoundSource));
            border.ResizeInfos.Add(new ResizeInfo((arrowFigure.Segments[1] as LineSegment).Point, ResizeDirection.AllRoundDestination));

            return border;
        }
コード例 #3
0
        protected virtual DiagramSelectionBorder CalculateLabelBorder(DiagramLabel label)
        {
            var textGeometry = label.Geometry as Geometry;
            if (textGeometry == null)
                return null;

            var rectGeometry = textGeometry as RectangleGeometry;
            if (rectGeometry == null)
                return null;

            var border = new DiagramSelectionBorder();

            border.ResizeInfos.Add(new ResizeInfo(rectGeometry.Bounds.TopLeft, ResizeDirection.None));
            border.ResizeInfos.Add(new ResizeInfo(rectGeometry.Bounds.TopRight, ResizeDirection.None));
            border.ResizeInfos.Add(new ResizeInfo(rectGeometry.Bounds.BottomRight, ResizeDirection.None));
            border.ResizeInfos.Add(new ResizeInfo(rectGeometry.Bounds.BottomLeft, ResizeDirection.None));

            return border;
        }