Exemplo n.º 1
0
        private void CreateStroke()
        {
            // create an arrow head style which uses a custom shape
            NArrowheadStyle defaultStyle = new NArrowheadStyle(
                ArrowheadShape.Custom,
                "Double Opened Arrow",
                new NSizeL(13, 13),
                new NColorFillStyle(Color.OrangeRed),
                new NStrokeStyle(1, Color.Black));

            // create a polyline which uses this arrowhead style
            NPointF[] points = new NPointF[] {
                new NPointF(290, 50),
                new NPointF(207, 199),
                new NPointF(40, 50),
                new NPointF(234, 95),
                new NPointF(94, 184)
            };

            NPolylineShape polyline = new NPolylineShape(points);

            polyline.Style.StartArrowheadStyle = defaultStyle.Clone() as NArrowheadStyle;
            polyline.Style.EndArrowheadStyle   = defaultStyle.Clone() as NArrowheadStyle;

            document.ActiveLayer.AddChild(polyline);
        }
Exemplo n.º 2
0
        private NMaster CreateGeneralizationMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Generalization";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Arrow, string.Empty, ArrowSize, ConFillStyle, strokeStyle);

            NStyle.SetStartArrowheadStyle(c, arrowheadStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
        private void CreateCurveShape(int row, int col)
        {
            NRectangleF cell  = GetGridCell(row, col);
            Color       color = GetPredefinedColor(5);

            int xdeviation = (int)cell.Width / 4;
            int ydeviation = (int)cell.Height / 4;

            NPointF[] points = new NPointF[]
            {
                new NPointF(cell.X + Random.Next(xdeviation), cell.Y + Random.Next(ydeviation)),
                new NPointF(cell.Right - Random.Next(xdeviation), cell.Y + Random.Next(ydeviation)),
                new NPointF(cell.Right - Random.Next(xdeviation), cell.Bottom - Random.Next(ydeviation)),
                new NPointF(cell.X + Random.Next(xdeviation), cell.Bottom - Random.Next(ydeviation)),
                new NPointF(cell.X + Random.Next((int)cell.Width), cell.Y + Random.Next((int)cell.Height))
            };

            // create curve
            NCurveShape curve = new NCurveShape(points, 1);

            // set stroke style
            curve.Style.StrokeStyle = new NStrokeStyle(2, color, LinePattern.DashDotDot);

            // set arrowheads style
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.QuillArrow,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            curve.Style.StartArrowheadStyle = arrowheadStyle;

            arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.SunkenArrow,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            curve.Style.EndArrowheadStyle = arrowheadStyle;

            // add to the active layer
            document.ActiveLayer.AddChild(curve);

            // add description
            cell = GetGridCell(row + 1, col);
            NTextShape text = new NTextShape("Curve with dash-dot-dot style and QuillArrow and SunkenArrow arrowheads", cell);

            document.ActiveLayer.AddChild(text);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Shows the end arrowhead style editor for the specified styleable node
        /// </summary>
        /// <param name="styleable"></param>
        protected void ShowEndArrowheadStyleEditor(INStyleable styleable)
        {
            if (styleable == null)
            {
                return;
            }

            NArrowheadStyle arrowheadStyle    = styleable.ComposeEndArrowheadStyle();
            NArrowheadStyle newArrowheadStyle = null;

            if (NArrowheadStyleTypeEditor.Edit(arrowheadStyle, out newArrowheadStyle, false, arrowheadStyle != NStyle.GetEndArrowheadStyle(styleable)))
            {
                NStyle.SetEndArrowheadStyle(styleable, newArrowheadStyle);
                document.RefreshAllViews();
            }
        }
Exemplo n.º 5
0
        private NMaster CreateCompositionMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Composition";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.Losangle, string.Empty, LosangleSize, new NColorFillStyle(Color.Silver), (NStrokeStyle)strokeStyle.Clone());

            NStyle.SetStartArrowheadStyle(c, arrowheadStyle);

            arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone());
            NStyle.SetEndArrowheadStyle(c, arrowheadStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
Exemplo n.º 6
0
        private NMaster CreateAssociationMaster()
        {
            NStep3Connector c = new NStep3Connector(new NPointF(0, 0), new NPointF(100, 50), true);

            c.Name = "UML Association";

            NStrokeStyle    strokeStyle    = (NStrokeStyle)document.ComposeStrokeStyle().Clone();
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(ArrowheadShape.OpenedArrow, string.Empty, ArrowSize, ConFillStyle, (NStrokeStyle)strokeStyle.Clone());

            NStyle.SetEndArrowheadStyle(c, arrowheadStyle);

            strokeStyle.Pattern = LinePattern.Dash;
            NStyle.SetStrokeStyle(c, strokeStyle);

            return(new NMaster(c, NGraphicsUnit.Pixel, c.Name, "Drag me on the drawing"));
        }
        private void CreateBezierShape(int row, int col)
        {
            NRectangleF cell  = GetGridCell(row, col);
            Color       color = GetPredefinedColor(4);

            // create bezier
            NBezierCurveShape bezier = new NBezierCurveShape(cell.Location, new NPointF(cell.Right, cell.Bottom));

            // set stroke style
            bezier.Style.StrokeStyle = new NStrokeStyle(2, color, LinePattern.Solid);

            // set arrowheads style
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.ManyOptional,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            bezier.Style.StartArrowheadStyle = arrowheadStyle;

            arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.Many,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            bezier.Style.EndArrowheadStyle = arrowheadStyle;

            // add to the active layer
            document.ActiveLayer.AddChild(bezier);

            // add description
            cell = GetGridCell(row + 1, col);
            NTextShape text = new NTextShape("Bezier curve with solid style and ManyOptional and Many arrowheads", cell);

            document.ActiveLayer.AddChild(text);
        }
        private void CreateEllipticalArcShape(int row, int col)
        {
            NRectangleF cell  = GetGridCell(row, col);
            Color       color = GetPredefinedColor(2);

            // create arc
            NEllipticalArcShape arc = new NEllipticalArcShape(new NPointF(cell.X, cell.Y), new NPointF(cell.Right, cell.Bottom));

            // set stroke style
            arc.Style.StrokeStyle = new NStrokeStyle(2, color, LinePattern.Dot);

            // set arrowheads style
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.ClosedFork,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            arc.Style.StartArrowheadStyle = arrowheadStyle;

            arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.DoubleArrow,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            arc.Style.EndArrowheadStyle = arrowheadStyle;

            // add to the active layer
            document.ActiveLayer.AddChild(arc);

            // add description
            cell = GetGridCell(row + 1, col);
            NTextShape text = new NTextShape("Elliptical arc with dots style and ClosedFork and DoubleArrow arrowheads", cell);

            document.ActiveLayer.AddChild(text);
        }
        private void CreateLineShape(int row, int col)
        {
            // create line
            NRectangleF cell  = GetGridCell(row, col);
            Color       color = GetPredefinedColor(0);

            NLineShape line = new NLineShape(cell.X, cell.Y, cell.Right, cell.Bottom);

            // set stroke style
            line.Style.StrokeStyle = new NStrokeStyle(1, color, LinePattern.Dash);

            // set arrowheads style
            NArrowheadStyle arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.Circle,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            line.Style.StartArrowheadStyle = arrowheadStyle;

            arrowheadStyle = new NArrowheadStyle(
                ArrowheadShape.Arrow,
                "",
                new NSizeL(12, 12),
                new NColorFillStyle(color),
                new NStrokeStyle(1, Color.Black));

            line.Style.EndArrowheadStyle = arrowheadStyle;

            // add to the active layer
            document.ActiveLayer.AddChild(line);

            // add description
            cell = GetGridCell(row + 1, col);
            NTextShape text = new NTextShape("Line with dash style and Circle and Arrow arrowheads", cell);

            document.ActiveLayer.AddChild(text);
        }