Exemplo n.º 1
0
        void list_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            ScreenDescription scr  = (ScreenDescription)e.Item;
            NPage             page = (NPage)Activator.CreateInstance(scr.type);

            Navigation.PushAsync(page);
        }
Exemplo n.º 2
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            // plotter commands
            NBasicShapeFactory basicShapes = new NBasicShapeFactory();

            // create a rounded rect
            NShape rectShape = basicShapes.CreateShape(ENBasicShape.Rectangle);

            rectShape.SetBounds(50, 50, 100, 100);
            rectShape.Text = "Move me close to the star";
            rectShape.GetPortByName("Top").GlueMode = ENPortGlueMode.Outward;
            activePage.Items.Add(rectShape);

            // create a star
            NShape pentagramShape = basicShapes.CreateShape(ENBasicShape.Pentagram);

            pentagramShape.SetBounds(310, 310, 100, 100);
            activePage.Items.Add(pentagramShape);
        }
Exemplo n.º 3
0
        public virtual void Init(Type et)
        {
            _pEnum      = RFManager.Ins.GetPageEnmu(this.name);
            m_transform = transform;
            m_ani       = this.GetComponent <Animator>();
            m_panel     = this.GetComponent <CanvasGroup>();

            if (et != null)
            {
                Dictionary <string, int> dic = new Dictionary <string, int>();
                string[] s = Enum.GetNames(et);
                for (int i = 0; i < s.Length; ++i)
                {
                    dic.Add(s[i], i);
                }

                foreach (RFWidget child in m_transform.GetComponentsInChildren(typeof(RFWidget), true))
                {
                    if (dic.ContainsKey(child.name))
                    {
                        m_widgets[dic[child.name]] = child.GetComponent(child.m_type.ToString());
                    }
                }
            }
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            string[] tableDescription = new string[] { "Table in Auto Size Mode", "Table in Auto Height Mode", "Table in Fit To Shape Mode" };
            ENTableBlockResizeMode[] tableBlockResizeMode = new ENTableBlockResizeMode[] { ENTableBlockResizeMode.AutoSize, ENTableBlockResizeMode.AutoHeight, ENTableBlockResizeMode.FitToShape };

            double y = 100;

            for (int i = 0; i < 3; i++)
            {
                NShape shape = new NShape();
                shape.SetBounds(new NRectangle(100, y, 300, 300));

                y += 200;

                // create table
                NTableBlock tableBlock = CreateTableBlock(tableDescription[i]);

                tableBlock.Content.AllowSpacingBetweenCells = false;
                tableBlock.ResizeMode = tableBlockResizeMode[i];
                shape.TextBlock       = tableBlock;

                drawing.ActivePage.Items.AddChild(shape);
            }
        }
Exemplo n.º 5
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            NBasicShapeFactory basicShapesFactory = new NBasicShapeFactory();

            double padding = 10;
            double sizeX   = 160;
            double sizeY   = 160;

            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 4; y++)
                {
                    NShape shape1 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);
                    shape1.SetBounds(padding + x * (padding + sizeX), padding + y * (padding + sizeY), sizeX, sizeY);
                    shape1.TextBlock         = new NTextBlock();
                    shape1.TextBlock.Padding = new NMargins(20);
                    shape1.TextBlock.Text    = "The quick brown fox jumps over the lazy dog";
                    drawing.ActivePage.Items.Add(shape1);
                }
            }
        }
Exemplo n.º 6
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            NBasicShapeFactory basicShapesFactory = new NBasicShapeFactory();

            NShape shape1 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape1.SetBounds(10, 10, 600, 1000);

            NTextBlock textBlock = new NTextBlock();

            shape1.TextBlock  = textBlock;
            textBlock.Padding = new NMargins(20);
            textBlock.Content.Blocks.Clear();
            textBlock.Content.HorizontalAlignment = ENAlign.Left;
            AddFormattedTextToContent(textBlock.Content);
            drawing.ActivePage.Items.Add(shape1);
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            NBasicShapeFactory basicShapesFactory = new NBasicShapeFactory();

            NShape shape1 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape1.SetBounds(10, 10, 381, 600);

            NTextBlock textBlock1 = new NTextBlock();

            shape1.TextBlock = textBlock1;
            textBlock1.Content.Blocks.Clear();
            AddFormattedTextToContent(textBlock1.Content);
            drawing.ActivePage.Items.Add(shape1);

            NShape shape2 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape2.SetBounds(401, 10, 381, 600);
            NTextBlock textBlock2 = new NTextBlock();

            shape2.TextBlock = textBlock2;
            textBlock2.Content.Blocks.Clear();
            AddFormattedTextWithImagesToContent(textBlock2.Content);
            drawing.ActivePage.Items.Add(shape2);
        }
Exemplo n.º 8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            string connection = Configuration.GetConnectionString("DefaultConnection");

            services.AddDbContext <ApplicationContext>(options => options.UseSqlServer(connection));

            // установка конфигурации подключения
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>     //CookieAuthenticationOptions
            {
                options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/Login");
            });
            services.AddControllersWithViews();

            services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confstring.GetConnectionString("DefaultConnection")));
            services.AddTransient <IAFunctions, FunctionsRepository>();
            services.AddTransient <IFunctionsManager, CategoryRepository>();
            services.AddTransient <IAllOrders, OrdersRepository>();
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => NPage.GetCart(sp));

            services.AddMvc();

            services.AddMemoryCache();
            services.AddSession();
            services.AddControllersWithViews();

            services.AddDbContext <ApplicationContext>(options =>
                                                       options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity <Order, IdentityRole>()
            .AddEntityFrameworkStores <ApplicationContext>();

            services.AddControllersWithViews();
        }
Exemplo n.º 9
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // switch selected edit mode to geometry
            // this instructs the diagram to show geometry handles for the selected shapes.
            m_DrawingDocument.Content.ActivePage.SelectionEditMode = ENSelectionEditMode.Geometry;
            drawing.ScreenVisibility.ShowGrid = false;

            // plotter commands
            CreateDescriptionPair(0, 0, CreateLineTo(), "Line To");
            CreateDescriptionPair(0, 1, CreateArcTo(), "Arc To");
            CreateDescriptionPair(0, 2, CreateCubicBezierTo(), "Cubic Bezier To");
            CreateDescriptionPair(0, 3, CreateCircularArcTo(), "Circular Arc To");
            CreateDescriptionPair(0, 4, CreateEllipticalArcTo(), "Elliptical Arc To");

            // draw box commands
            CreateDescriptionPair(1, 0, CreateDrawRectangle(), "Draw Rectangle");
            CreateDescriptionPair(1, 1, CreateDrawEllipse(), "Draw Ellipse");
            CreateDescriptionPair(1, 2, CreateDrawPolygon(0), "Draw Polygon");
            CreateDescriptionPair(1, 3, CreateDrawPolyline(0), "Draw Polyline");
            CreateDescriptionPair(1, 4, CreateDrawPolygon(1), "Draw Polygon With Tension");
            CreateDescriptionPair(1, 5, CreateDrawPolyline(1), "Draw Polyline With Tension");
            CreateDescriptionPair(1, 6, CreateDrawPath(), "Draw Path");
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            const double width    = 40;
            const double height   = 40;
            const double distance = 80;

            NBasicShapeFactory basicShapes = new NBasicShapeFactory();
            NPage activePage = m_DrawingDocument.Content.ActivePage;

            int[]    from        = new int[] { 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6 };
            int[]    to          = new int[] { 2, 3, 4, 4, 5, 8, 6, 7, 5, 8, 10, 8, 9, 10 };
            NShape[] shapes      = new NShape[10];
            int      vertexCount = shapes.Length;
            int      edgeCount   = from.Length;
            int      count       = vertexCount + edgeCount;

            for (int i = 0; i < count; i++)
            {
                if (i < vertexCount)
                {
                    int j = vertexCount % 2 == 0 ? i : i + 1;
                    shapes[i] = basicShapes.CreateShape(ENBasicShape.Rectangle);

                    if (vertexCount % 2 != 0 && i == 0)
                    {
                        shapes[i].SetBounds(new NRectangle(
                                                (width + (distance * 1.5)) / 2,
                                                distance + (j / 2) * (distance * 1.5),
                                                width,
                                                height));
                    }
                    else
                    {
                        shapes[i].SetBounds(new NRectangle(
                                                width / 2 + (j % 2) * (distance * 1.5),
                                                height + (j / 2) * (distance * 1.5),
                                                width,
                                                height));
                    }

                    activePage.Items.Add(shapes[i]);
                }
                else
                {
                    NRoutableConnector edge = new NRoutableConnector();
                    edge.UserClass = "Connector";
                    activePage.Items.Add(edge);
                    edge.GlueBeginToShape(shapes[from[i - vertexCount] - 1]);
                    edge.GlueEndToShape(shapes[to[i - vertexCount] - 1]);
                }
            }

            // arrange diagram
            ArrangeDiagram();

            // fit active page
            m_DrawingDocument.Content.ActivePage.ZoomMode = ENZoomMode.Fit;
        }
Exemplo n.º 11
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();
            }
        }
Exemplo n.º 12
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();
            }
        }
Exemplo n.º 13
0
        //	public void AddPage (string name, RFPage page) {
        //		m_pages[name] = page;
        //	}

        public GameObject GetPage(NPage page)
        {
            if (m_pages.ContainsKey(page))
            {
                return(m_pages[page].gameObject);
            }
            return(null);
        }
Exemplo n.º 14
0
        private void ImportMap()
        {
            NPage page = m_DrawingDocument.Content.ActivePage;

            page.Items.Clear();

            // Import the map to the drawing document
            m_MapImporter.Import(m_DrawingDocument, page.Bounds);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Overriden to create the family tree template
        /// </summary>
        /// <param name="document">document in which to create the template</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            NPoint pt;
            NShape node;
            NShape edge = null;
            NPage  page = document.Content.ActivePage;

            // determine the elements dimensions
            double childrenWidth = m_nChildrenCount * m_VerticesSize.Width + (m_nChildrenCount - 1) * m_fHorizontalSpacing;
            double parentsWidth  = m_VerticesSize.Width * 2 + m_fHorizontalSpacing;

            // determine the template dimensions
            double     templateWidth  = Math.Max(childrenWidth, parentsWidth);
            NRectangle templateBounds = new NRectangle(m_Origin.X, m_Origin.Y, templateWidth, m_VerticesSize.Height * 2 + m_fVerticalSpacing);
            NPoint     center         = templateBounds.Center;

            // create the parent nodes
            NShape father = CreateVertex(m_VerticesShape);

            pt = new NPoint(center.X - (m_VerticesSize.Width + m_fHorizontalSpacing / 2), templateBounds.Y);
            father.SetBounds(new NRectangle(pt, m_VerticesSize));
            page.Items.AddChild(father);

            NShape mother = CreateVertex(m_VerticesShape);

            pt = new NPoint(center.X + m_fHorizontalSpacing / 2, templateBounds.Y);
            mother.SetBounds(new NRectangle(pt, m_VerticesSize));
            page.Items.AddChild(mother);

            // create the children
            if (m_nChildrenCount > 0)
            {
                double childrenY = templateBounds.Y + m_VerticesSize.Height + m_fVerticalSpacing;
                for (int i = 0; i < m_nChildrenCount; i++)
                {
                    // create the child
                    node = CreateVertex(m_VerticesShape);
                    pt   = new NPoint(i * (m_VerticesSize.Width + m_fHorizontalSpacing), childrenY);
                    node.SetBounds(new NRectangle(pt, m_VerticesSize));
                    page.Items.AddChild(node);

                    // attach it to the parents
                    edge = CreateEdge(ENConnectorShape.BottomToTop1);
                    page.Items.AddChild(edge);

                    edge.GlueBeginToGeometryIntersection(father);
                    edge.GlueEndToShape(node);

                    edge = CreateEdge(ENConnectorShape.BottomToTop1);
                    page.Items.AddChild(edge);

                    edge.GlueBeginToGeometryIntersection(mother);
                    edge.GlueEndToShape(node);
                }
            }
        }
Exemplo n.º 16
0
 public bool IsPageActive(NPage page)
 {
     if (m_pages.ContainsKey(page))
     {
         return(m_pages[page].gameObject.activeSelf);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 17
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
                NBrainstormingShapeFactory factory = new NBrainstormingShapeFactory();
                factory.DefaultSize = new NSize(60, 60);

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

                // Arrange them
                NList <NShape> shapes        = activePage.GetShapes(false);
                NLayoutContext layoutContext = new NLayoutContext();
                layoutContext.BodyAdapter  = new NShapeBodyAdapter(m_DrawingDocument);
                layoutContext.GraphAdapter = new NShapeGraphAdapter();
                layoutContext.LayoutArea   = activePage.GetContentEdge();

                NTableFlowLayout tableLayout = new NTableFlowLayout();
                tableLayout.HorizontalSpacing = 30;
                tableLayout.VerticalSpacing   = 50;
                tableLayout.Direction         = ENHVDirection.LeftToRight;
                tableLayout.MaxOrdinal        = 5;

                tableLayout.Arrange(shapes.CastAll <object>(), layoutContext);

                // size page to content
                activePage.Layout.ContentPadding = new NMargins(40);
                activePage.SizeToContent();
            }
            finally
            {
                m_DrawingDocument.HistoryService.Resume();
            }
        }
Exemplo n.º 18
0
        protected override void InitDiagram()
        {
            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            activePage.Items.Add(CreateSampleLine1());
            activePage.Items.Add(CreateSampleLine2());
            activePage.Items.Add(CreateSamplePolyline1());
            activePage.Items.Add(CreateSamplePolyline2());
            activePage.Items.Add(CreateSampleLineDoubleBridge());
        }
Exemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NBuffer"/> class.
        /// </summary>
        /// <param name="numberOfPages">The number of pages the buffer consists of.</param>
        /// <param name="pageSize">The size of each page, denoting the number of integer arrays that can be stored.</param>
        public NBuffer(int numberOfPages, int pageSize)
        {
            m_numPages = numberOfPages;
            m_pageSize = pageSize;

            m_pages = new NPage[m_numPages];
            for (int i = 0; i < m_numPages; i++)
            {
                m_pages[i] = new NPage(m_pageSize);
            }
        }
Exemplo n.º 20
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

            // hide ports and grid
            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            drawing.ScreenVisibility.ShowPorts = false;
            drawing.ScreenVisibility.ShowGrid  = false;
        }
Exemplo n.º 21
0
 public T GetWidget <T>(NPage page, string widgetName)
 {
     if (m_pages.ContainsKey(page))
     {
         return((T)m_pages[page].GetWidget <T>(widgetName));
     }
     else
     {
         return(default(T));
     }
 }
Exemplo n.º 22
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = (NStackPanel)base.CreateExampleControls();

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

            NEditor editor = NDesigner.GetDesigner(activePage.LineJumps).CreateStateEditor(activePage.LineJumps);

            stack.Add(editor);

            return(stack);
        }
Exemplo n.º 23
0
        private void ImportMap()
        {
            NPage page = m_DrawingDocument.Content.ActivePage;

            page.Items.Clear();
            page.Bounds = new NRectangle(0, 0, 10000, 10000);

            // Import the map to the drawing document
            m_MapImporter.Import(m_DrawingDocument, page.Bounds);

            // Size page to content
            page.SizeToContent();
        }
        protected override void InitDiagram()
        {
            base.InitDiagram();

            NBasicShapeFactory factory = new NBasicShapeFactory();
            NShape             shape   = factory.CreateShape(ENBasicShape.Rectangle);

            shape.SetBounds(100, 100, 150, 100);

            NPage activePage = m_DrawingDocument.Content.ActivePage;

            activePage.Items.Add(shape);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Arranges the shapes in the active page.
        /// </summary>
        protected virtual void ArrangeDiagram()
        {
            // get all top-level shapes that reside in the active page
            NPage          activePage = m_DrawingDocument.Content.ActivePage;
            NList <NShape> shapes     = activePage.GetShapes(false);

            // create a layout context and use it to arrange the shapes using the current layout
            NDrawingLayoutContext layoutContext = new NDrawingLayoutContext(m_DrawingDocument, activePage);

            m_Layout.Arrange(shapes.CastAll <object>(), layoutContext);

            // size the page to the content size
            activePage.SizeToContent();
        }
        protected override void InitDiagram()
        {
            NPage activePage = m_DrawingDocument.Content.ActivePage;

            // Create a barcode widget
            NMatrixBarcode barcode = new NMatrixBarcode(ENMatrixBarcodeSymbology.QrCode, "https://www.nevron.com");

            // Create a shape and place the barcode widget in it
            NShape shape = new NShape();

            shape.SetBounds(100, 100, 100, 100);
            shape.Widget = barcode;
            activePage.Items.Add(shape);
        }
Exemplo n.º 27
0
        protected override void InitDiagram()
        {
            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            // 1. Create some shape factories
            NBasicShapeFactory     basicShapesFactory     = new NBasicShapeFactory();
            NConnectorShapeFactory connectorShapesFactory = new NConnectorShapeFactory();

            // 2. Create and add some shapes
            NShape shape1 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape1.SetBounds(new NRectangle(50, 50, 100, 100));
            activePage.Items.Add(shape1);

            NShape shape2 = basicShapesFactory.CreateShape(ENBasicShape.Rectangle);

            shape2.SetBounds(new NRectangle(400, 50, 100, 100));
            activePage.Items.Add(shape2);

            // 3. Connect the shapes
            NShape connector = connectorShapesFactory.CreateShape(ENConnectorShape.Line);

            activePage.Items.Add(connector);
            connector.GlueBeginToShape(shape1);
            connector.GlueEndToShape(shape2);

            // Add 2 outward ports to the connector
            NPort port1 = new NPort(0.3, 0.3, true);

            port1.GlueMode = ENPortGlueMode.Outward;
            connector.Ports.Add(port1);

            NPort port2 = new NPort(0.7, 0.7, true);

            port2.GlueMode = ENPortGlueMode.Outward;
            connector.Ports.Add(port2);

            // Attach label shapes to the outward ports of the connector
            NShape labelShape1 = CreateLabelShape("Label 1");

            activePage.Items.Add(labelShape1);
            labelShape1.GlueMasterPortToPort(labelShape1.Ports[0], port1);

            NShape labelShape2 = CreateLabelShape("Label 2");

            activePage.Items.Add(labelShape2);
            labelShape2.GlueMasterPortToPort(labelShape2.Ports[0], port2);
        }
Exemplo n.º 28
0
 /// <summary>
 /// Reads a number of n-tuples from a binary reader to an n-tuple buffer page. This will
 /// attempt to read a much n-tuples as fit on the given page.
 /// </summary>
 /// <param name="reader">The binary reader.</param>
 /// <param name="count">The length of each n-tuple.</param>
 /// <param name="page">The n-tuple buffer page.</param>
 private static void ReadToPage(BinaryReader reader, int count, NPage page)
 {
     page.Clear();
     for (int i = 0; i < page.Size; i++)
     {
         if (reader.BaseStream.Position >= reader.BaseStream.Length)
         {
             break;
         }
         else
         {
             page[i] = Read(reader, count);
         }
     }
 }
Exemplo n.º 29
0
        protected override void InitDiagram()
        {
            base.InitDiagram();

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

            // hide the grid
            drawing.ScreenVisibility.ShowGrid = false;

            // create a AND shape
            NShape andShape = CreateAndShape();

            andShape.SetBounds(300, 100, 150, 100);
            activePage.Items.Add(andShape);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Overriden to create the rectangular grid template in the specified document
        /// </summary>
        /// <param name="document">document in which to create the template</param>
        protected override void CreateTemplate(NDrawingDocument document)
        {
            NPage  page = document.Content.ActivePage;
            NShape edge = null;
            NShape vertex;

            NShape[,] vertexGrid = new NShape[m_nRows, m_nColumns];

            for (int row = 0; row < m_nRows; row++)
            {
                for (int col = 0; col < m_nColumns; col++)
                {
                    // create the vertex
                    vertex = CreateVertex(m_VerticesShape);
                    vertex.SetBounds(new NRectangle(m_Origin.X + col * (m_VerticesSize.Width + m_fHorizontalSpacing),
                                                    m_Origin.Y + row * (m_VerticesSize.Height + m_fVerticalSpacing),
                                                    m_VerticesSize.Width, m_VerticesSize.Height));
                    page.Items.AddChild(vertex);

                    // connect it with its X and Y predecessors
                    if (m_bConnectGrid == false)
                    {
                        continue;
                    }

                    vertexGrid[row, col] = vertex;

                    // connect X
                    if (col > 0)
                    {
                        edge = CreateEdge(ENConnectorShape.Line);
                        page.Items.AddChild(edge);
                        edge.GlueBeginToGeometryIntersection(vertexGrid[row, col - 1]);
                        edge.GlueEndToShape(vertex);
                    }

                    // connect Y
                    if (row > 0)
                    {
                        edge = CreateEdge(ENConnectorShape.Line);
                        page.Items.AddChild(edge);
                        edge.GlueBeginToGeometryIntersection(vertexGrid[row - 1, col]);
                        edge.GlueEndToShape(vertex);
                    }
                }
            }
        }