示例#1
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            m_DrawingDocument.HistoryService.Pause();
            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // Create all shapes
                NArrowShapeFactory factory = new NArrowShapeFactory();
                factory.DefaultSize = new NSize(60, 60);

                int    row = 0, col = 0;
                double cellWidth  = 180;
                double cellHeight = 120;

                for (int i = 0; i < factory.ShapeCount; i++, col++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;
                    shape.Text = factory.GetShapeInfo(i).Name;
                    MoveTextBelowShape(shape);
                    activePage.Items.Add(shape);

                    if (col >= 5)
                    {
                        row++;
                        col = 0;
                    }

                    NPoint beginPoint = new NPoint(50 + col * cellWidth, 50 + row * cellHeight);
                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        NPoint endPoint = beginPoint + new NPoint(cellWidth - 100, cellHeight - 100);
                        shape.SetBeginPoint(beginPoint);
                        shape.SetEndPoint(endPoint);
                    }
                    else
                    {
                        shape.SetBounds(beginPoint.X, beginPoint.Y, shape.Width, shape.Height);
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(40);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
示例#2
0
        protected override void InitDiagram()
        {
            const double XStep = 150;
            const double YStep = 100;

            base.InitDiagram();

            m_DrawingDocument.HistoryService.Pause();
            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // Create all shapes
                NCalloutShapeFactory factory = new NCalloutShapeFactory();
                factory.DefaultSize = new NSize(70, 70);

                double x = 0;
                double y = 0;

                for (int i = 0; i < factory.ShapeCount; i++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;
                    shape.Tooltip             = new NTooltip(factory.GetShapeInfo(i).Name);
                    activePage.Items.Add(shape);

                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        shape.SetBeginPoint(new NPoint(x, y));
                        shape.SetEndPoint(new NPoint(x + shape.Width, y + shape.Height));
                    }
                    else
                    {
                        shape.SetBounds(x, y, shape.Width, shape.Height);
                    }

                    x += XStep;
                    if (x > activePage.Width)
                    {
                        x  = 0;
                        y += YStep;
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(70, 60, 70, 60);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            activePage.Layout.ContentPadding = new NMargins(20);

            // switch selected edit mode to geometry
            // this instructs the diagram to show geometry handles for the selected shapes.
            drawing.ScreenVisibility.ShowGrid = false;

            NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory();

            ENArrowheadShape[] arrowheadShapes = NEnum.GetValues <ENArrowheadShape>();

            double x = 20;
            double y = 0;

            for (int i = 1; i < arrowheadShapes.Length; i++)
            {
                ENArrowheadShape arrowheadShape = arrowheadShapes[i];
                NShape           shape          = connectorShapes.CreateShape(ENConnectorShape.Line);
                drawing.ActivePage.Items.Add(shape);

                // create geometry arrowheads
                shape.Geometry.BeginArrowhead = new NArrowhead(arrowheadShape);
                shape.Geometry.EndArrowhead   = new NArrowhead(arrowheadShape);

                shape.Text = NEnum.GetLocalizedString(arrowheadShape);

                shape.SetBeginPoint(new NPoint(x, y));
                shape.SetEndPoint(new NPoint(x + 350, y));

                y += 30;

                if (i == arrowheadShapes.Length / 2)
                {
                    // Begin a second column of shapes
                    x += 400;
                    y  = 0;
                }
            }

            activePage.SizeToContent();
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            m_DrawingDocument.HistoryService.Pause();
            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                drawing.ScreenVisibility.ShowGrid = false;

                // create all shapes
                NConnectorShapeFactory factory = new NConnectorShapeFactory();
                factory.DefaultSize = new NSize(120, 90);

                int    row = 0, col = 0;
                double cellWidth  = 300;
                double cellHeight = 200;

                for (int i = 0; i < factory.ShapeCount; i++, col++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.Text = factory.GetShapeInfo(i).Name;
                    activePage.Items.Add(shape);

                    if (col >= 4)
                    {
                        row++;
                        col = 0;
                    }

                    NPoint beginPoint = new NPoint(50 + col * cellWidth, 50 + row * cellHeight);
                    NPoint endPoint   = beginPoint + new NPoint(cellWidth - 50, cellHeight - 50);
                    shape.SetBeginPoint(beginPoint);
                    shape.SetEndPoint(endPoint);
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(50);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
示例#5
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            // create all shapes
            NBasicShapeFactory     basicShapes     = new NBasicShapeFactory();
            NConnectorShapeFactory connectorShapes = new NConnectorShapeFactory();

            // create the group
            NGroup group = new NGroup();

            // make some background for the group
            NDrawRectangle drawRect = new NDrawRectangle(0, 0, 1, 1);

            drawRect.Relative = true;
            group.Geometry.Add(drawRect);
            group.Geometry.Fill = new NColorFill(NColor.LightCoral);
            group.SetBounds(new Nov.Graphics.NRectangle(50, 50, 230, 330));

            // create a rectangle that is scaled and repositioned
            NShape rect1 = basicShapes.CreateShape(ENBasicShape.Rectangle);

            rect1.Text = "Scale and Reposition";
            group.Shapes.Add(rect1);
            rect1.ResizeInGroup = ENResizeInGroup.ScaleAndReposition;
            rect1.SetBounds(new Nov.Graphics.NRectangle(10, 10, 100, 100));

            // create a rectangle that is only repositioned
            NShape rect2 = basicShapes.CreateShape(ENBasicShape.Rectangle);

            rect2.Text = "Reposition Only";
            group.Shapes.Add(rect2);
            rect2.ResizeInGroup = ENResizeInGroup.RepositionOnly;
            rect2.SetBounds(new Nov.Graphics.NRectangle(120, 120, 100, 100));

            // create a 1D shape
            NShape arrow = connectorShapes.CreateShape(ENConnectorShape.Single45DegreesArrow);

            arrow.Text = "1D Shape";
            group.Shapes.Add(arrow);
            arrow.SetBeginPoint(new NPoint(10, 250));
            arrow.SetEndPoint(new NPoint(220, 290));

            // add the group
            m_DrawingDocument.Content.ActivePage.Items.Add(group);
        }
示例#6
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            const double XStep = 150;
            const double YStep = 200;

            m_DrawingDocument.HistoryService.Pause();

            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // create all shapes
                NDimensioningEngineeringShapeFactory factory = new NDimensioningEngineeringShapeFactory();
                factory.DefaultSize = new NSize(90, 90);

                double x = 0;
                double y = 0;

                for (int i = 0; i < factory.ShapeCount; i++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;
                    shape.Tooltip             = new NTooltip(factory.GetShapeInfo(i).Name);
                    activePage.Items.Add(shape);

                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        ENDimensioningEngineeringShapes shapeType = (ENDimensioningEngineeringShapes)i;
                        switch (shapeType)
                        {
                        case ENDimensioningEngineeringShapes.VerticalBaseline:
                        case ENDimensioningEngineeringShapes.Vertical:
                        case ENDimensioningEngineeringShapes.VerticalOutside:
                        case ENDimensioningEngineeringShapes.OrdinateVertical:
                        case ENDimensioningEngineeringShapes.OrdinateVerticalMultiple:
                            shape.SetBeginPoint(new NPoint(x + shape.Width, y + shape.Height));
                            shape.SetEndPoint(new NPoint(x + shape.Width, y));
                            break;

                        case ENDimensioningEngineeringShapes.OrdinateHorizontalMultiple:
                        case ENDimensioningEngineeringShapes.OrdinateHorizontal:
                            shape.SetBeginPoint(new NPoint(x, y));
                            shape.SetEndPoint(new NPoint(x + shape.Width, y));
                            break;

                        case ENDimensioningEngineeringShapes.Radius:
                        case ENDimensioningEngineeringShapes.RadiusOutside:
                        case ENDimensioningEngineeringShapes.ArcRadius:
                        case ENDimensioningEngineeringShapes.Diameter:
                        case ENDimensioningEngineeringShapes.DiameterOutside:
                            shape.SetBeginPoint(new NPoint(x, y + shape.Height / 2));
                            shape.SetEndPoint(new NPoint(x + shape.Width, y - shape.Height / 2));
                            break;

                        case ENDimensioningEngineeringShapes.AngleCenter:
                        case ENDimensioningEngineeringShapes.AngleEven:
                        case ENDimensioningEngineeringShapes.AngleOutside:
                        case ENDimensioningEngineeringShapes.AngleUneven:
                            shape.SetBeginPoint(new NPoint(x, y + shape.Width / 2));
                            shape.SetEndPoint(new NPoint(x + shape.Width, y + shape.Width / 2));
                            break;

                        default:
                            shape.SetBeginPoint(new NPoint(x, y));
                            shape.SetEndPoint(new NPoint(x + shape.Width, y + shape.Height));
                            break;
                        }
                    }
                    else
                    {
                        shape.SetBounds(x, y, shape.Width, shape.Height);
                        shape.LocPinY = 1;
                    }

                    x += XStep;
                    if (x > activePage.Width)
                    {
                        x  = 0;
                        y += YStep;
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(50);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
示例#7
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            m_DrawingDocument.HistoryService.Pause();
            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // create all shapes
                NBasicShapeFactory factory = new NBasicShapeFactory();
                factory.DefaultSize = new NSize(120, 90);

                int    row = 0, col = 0;
                double cellWidth  = 240;
                double cellHeight = 150;

                for (int i = 0; i < factory.ShapeCount; i++, col++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;
                    shape.Text = factory.GetShapeInfo(i).Name;
                    MoveTextBelowShape(shape);

                    if (i == (int)ENBasicShape.ThreeDBox)
                    {
                        shape.TextBlock.Padding = new NMargins(0, 15, 0, 0);
                    }
                    else if (i == (int)ENBasicShape.Concentric)
                    {
                        shape.TextBlock.Angle = NAngle.Zero;
                    }

                    activePage.Items.Add(shape);

                    if (col >= 4)
                    {
                        row++;
                        col = 0;
                    }

                    NPoint beginPoint = new NPoint(50 + col * cellWidth, 50 + row * cellHeight);
                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        NPoint endPoint = beginPoint + new NPoint(cellWidth - 50, cellHeight - 50);
                        if (i == (int)ENBasicShape.CenterDragCircle)
                        {
                            beginPoint.Translate(cellWidth / 3, cellHeight / 3);
                            endPoint.Translate(-cellWidth / 3, -cellHeight / 3);
                        }

                        shape.SetBeginPoint(beginPoint);
                        shape.SetEndPoint(endPoint);
                    }
                    else
                    {
                        shape.SetBounds(beginPoint.X, beginPoint.Y, shape.Width, shape.Height);
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(50);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
示例#8
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            const double XStep = 150;
            const double YStep = 200;

            m_DrawingDocument.HistoryService.Pause();

            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // create all shapes
                NDrawingToolShapeFactory factory = new NDrawingToolShapeFactory();
                factory.DefaultSize = new NSize(90, 90);

                double x = 0;
                double y = 0;

                for (int i = 0; i < factory.ShapeCount; i++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;
                    shape.Tooltip             = new NTooltip(factory.GetShapeInfo(i).Name);

                    if (i != (int)ENDrawingToolShapes.SectorNumeric &&
                        i != (int)ENDrawingToolShapes.ArcNumeric &&
                        i != (int)ENDrawingToolShapes.RightTriangle)
                    {
                        shape.Text = factory.GetShapeInfo(i).Name;
                        MoveTextBelowShape(shape);
                    }
                    activePage.Items.Add(shape);

                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        if (i == (int)ENDrawingToolShapes.CircleRadius)
                        {
                            shape.SetBeginPoint(new NPoint(x + shape.Width / 2, y));
                        }
                        else
                        {
                            shape.SetBeginPoint(new NPoint(x, y));
                        }

                        double width = shape.Width;

                        if (i == (int)ENDrawingToolShapes.MultigonEdge)
                        {
                            width = 90;
                        }
                        else if (i == (int)ENDrawingToolShapes.MultigonCenter)
                        {
                            width = 30;
                        }

                        shape.SetEndPoint(new NPoint(x + width, y + shape.Height));
                    }
                    else
                    {
                        shape.SetBounds(x, y, shape.Width, shape.Height);
                        shape.LocPinY = 1;
                    }

                    x += XStep;
                    if (x > activePage.Width)
                    {
                        x  = 0;
                        y += YStep;
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(50);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            m_DrawingDocument.HistoryService.Pause();
            try
            {
                NDrawing drawing    = m_DrawingDocument.Content;
                NPage    activePage = drawing.ActivePage;

                // Hide grid and ports
                drawing.ScreenVisibility.ShowGrid  = false;
                drawing.ScreenVisibility.ShowPorts = false;

                // Create all shapes
                NGenogramShapeFactory factory = new NGenogramShapeFactory();

                int    row = 0, col = 0;
                double cellWidth  = 240;
                double cellHeight = 150;

                for (int i = 0; i < factory.ShapeCount; i++, col++)
                {
                    NShape shape = factory.CreateShape(i);
                    shape.HorizontalPlacement = ENHorizontalPlacement.Center;
                    shape.VerticalPlacement   = ENVerticalPlacement.Center;

                    NTextBlock textBlock = shape.GetFirstDescendant <NTextBlock>();

                    if (textBlock == null ||
                        i == (int)ENGenogramShape.Male ||
                        i == (int)ENGenogramShape.Female ||
                        i == (int)ENGenogramShape.Pet ||
                        i == (int)ENGenogramShape.UnknownGender)
                    {
                        textBlock = (NTextBlock)shape.TextBlock;
                    }

                    textBlock.Text = factory.GetShapeInfo(i).Name;

                    activePage.Items.Add(shape);

                    if (col >= 4)
                    {
                        row++;
                        col = 0;
                    }

                    NPoint beginPoint = new NPoint(50 + col * cellWidth, 50 + row * cellHeight);
                    if (shape.ShapeType == ENShapeType.Shape1D)
                    {
                        NPoint endPoint = beginPoint + new NPoint(cellWidth - 50, cellHeight - 50);

                        shape.SetBeginPoint(beginPoint);
                        shape.SetEndPoint(endPoint);
                    }
                    else
                    {
                        textBlock.SetFx(NTextBlock.PinYProperty, "$Parent.Height + Height + 10");
                        textBlock.ResizeMode = ENTextBlockResizeMode.TextSize;
                        shape.SetBounds(beginPoint.X, beginPoint.Y, shape.Width, shape.Height);
                    }
                }

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(50);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }