private void CreateTreeLayer() { // create the tree layer and modify its styles treeLayer = new NLayer(); treeLayer.Name = "Tree Layer"; treeLayer.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(30, 30, 0)); treeLayer.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0xaa, 0xaa, 0)); treeLayer.Style.ShadowStyle = new NShadowStyle( ShadowType.Solid, Color.FromArgb(50, 0, 0, 0), new NPointL(3, 3), 1, new NLength(1)); // add it to the document and make it the active one document.Layers.AddChild(treeLayer); document.ActiveLayerUniqueId = treeLayer.UniqueId; // create a tree template with pentagons in it NGenericTreeTemplate treeTemplate = new NGenericTreeTemplate(); treeTemplate.VerticesShape = BasicShapes.Pentagon; treeTemplate.Origin = new NPointF(10, 10); // create it treeTemplate.Create(document); }
private void InitDocument() { // create a random tree NGenericTreeTemplate treeTemplate = new NGenericTreeTemplate(); treeTemplate.BranchNodes = 3; treeTemplate.VerticesSize = new NSizeF(90, 90); treeTemplate.Balanced = false; treeTemplate.Levels = 5; treeTemplate.Create(document); // add show-hide subtree decorator for each shape that has children foreach (NShape shape in document.ActiveLayer.Children(NFilters.Shape2D)) { if (shape.GetOutgoingShapes().Count == 0) { continue; } // create the decorators collection shape.CreateShapeElements(ShapeElementsMask.Decorators); NShowHideSubtreeDecorator decorator = new NShowHideSubtreeDecorator(); decorator.Offset = new NSizeF(-11, 11); decorator.Alignment = new NContentAlignment(ContentAlignment.TopLeft); shape.Decorators.AddChild(decorator); } document.AutoBoundsMinSize = new NSizeF(400, 400); DoLayout(); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(192, 194, 194), Color.FromArgb(129, 133, 133)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); // create a stylesheet for the edges NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // generate a simple tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.VerticesSize = new NSizeF(80, 80); tree.EdgesStyleSheetName = "edges"; tree.Create(document); // create a show/hide decorator for all shapes that have children NNodeList shapes = document.ActiveLayer.Descendants(NFilters.Shape2D, -1); int i, count = shapes.Count; for (i = 0; i < count; i++) { NShape shape = (NShape)shapes[i]; if (shape.GetOutgoingShapes().Count == 0) { continue; } shape.CreateShapeElements(ShapeElementsMask.Decorators); NShowHideSubtreeDecorator decorator = new NShowHideSubtreeDecorator(); decorator.Name = "ShowHideSubtree"; shape.Decorators.AddChild(new NShowHideSubtreeDecorator()); } // size the document to the content document.SizeToContent(); }
private void InitDocument(NDrawingDocument document) { // Remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // Adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; // Set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // Create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.LayoutScheme = TreeLayoutScheme.None; tree.Levels = 5; tree.BranchNodes = 2; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyleSheetName = "edges"; tree.Create(document); // Create the layout NSingleCycleLayout layout = new NSingleCycleLayout(); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); }
public void CreateTree(NDrawingDocument document, int levels, int branchNodes) { // Clear the document document.ActiveLayer.RemoveAllChildren(); // Create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Balanced = false; tree.Levels = levels; tree.BranchNodes = branchNodes; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.VerticesSize = new NSizeF(50, 50); tree.VertexSizeDeviation = 1; tree.EdgesStyleSheetName = "edges"; tree.Create(document); }
private void InitDocument() { // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Levels = 4; tree.BranchNodes = 4; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.LayoutScheme = TreeLayoutScheme.None; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.Create(document); // resize document to fit all shapes LayoutButton.PerformClick(); document.SizeToContent(); }
private void InitDocument() { // we do not need history for this example document.HistoryService.Pause(); // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Balanced = false; tree.Levels = 6; tree.BranchNodes = 3; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.VerticesSize = new NSizeF(50, 50); tree.VertexSizeDeviation = 1; tree.Create(document); // resize document to fit all shapes LayoutButton.PerformClick(); document.SizeToContent(); }
private void InitDocument() { // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Levels = 4; tree.BranchNodes = 4; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.LayoutScheme = TreeLayoutScheme.None; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyle.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Circle, "CustomConnectorStart", new NSizeL(6, 6), new NColorFillStyle(Color.FromArgb(129, 133, 133)), new NStrokeStyle(1, Color.FromArgb(68, 90, 108))); tree.EdgesStyle.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.Arrow, "CustomConnectorStart", new NSizeL(6, 6), new NColorFillStyle(Color.FromArgb(129, 133, 133)), new NStrokeStyle(1, Color.FromArgb(68, 90, 108))); tree.Create(document); // resize document to fit all shapes LayoutButton.PerformClick(); document.SizeToContent(); }
protected void CreateTree() { // Clear the document NDrawingDocument document = NThinDiagramControl1.Document; document.ActiveLayer.RemoveAllChildren(); // Create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.LayoutScheme = TreeLayoutScheme.None; tree.Levels = 4; tree.BranchNodes = 4; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyleSheetName = "edges"; tree.Create(document); }
private void InitDocument() { document.Style.TextStyle = new NTextStyle(new Font("Arial", 9), Color.Black); NGraphTemplate template; // create rectangular grid template template = new NRectangularGridTemplate(); template.Origin = new NPointF(10, 23); template.VerticesShape = BasicShapes.Rectangle; template.Create(document); // create tree template template = new NGenericTreeTemplate(); template.Origin = new NPointF(250, 23); template.VerticesShape = BasicShapes.Triangle; template.Create(document); // create elliptical grid template template = new NEllipticalGridTemplate(); template.Origin = new NPointF(10, 250); template.VerticesShape = BasicShapes.Ellipse; template.Create(document); // create a shape with a 1D shape which reflexes it NBasicShapesFactory factory = new NBasicShapesFactory(document); NShape shape = factory.CreateShape((int)BasicShapes.Rectangle); shape.Bounds = new NRectangleF(350, 350, 100, 100); document.ActiveLayer.AddChild(shape); NBezierCurveShape bezier = new NBezierCurveShape(); bezier.StyleSheetName = NDR.NameConnectorsStyleSheet; document.ActiveLayer.AddChild(bezier); bezier.FromShape = shape; bezier.ToShape = shape; bezier.Reflex(); }
private void CreateTree(int maxShapes) { // clear the document NDrawingView1.Document.ActiveLayer.RemoveAllChildren(); // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Balanced = false; tree.Levels = 6; tree.BranchNodes = 3; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.VerticesSize = new NSizeF(50, 50); tree.VertexSizeDeviation = 0; tree.EdgesStyleSheetName = "edges"; tree.Create(NDrawingView1.Document); // make the subtrees of maxShapes random shapes vertically arranged NNodeList shapes = NDrawingView1.Document.ActiveLayer.Children(NFilters.Shape2D); Random rnd = new Random(); List <int> usedNumbers = new List <int>(); int i, index; for (i = 0; i < maxShapes; i++) { do { index = rnd.Next(shapes.Count); }while (usedNumbers.Contains(index)); usedNumbers.Add(index); NShape shape = (NShape)shapes[index]; shape.StyleSheetName = "orange"; shape.LayoutData.TipOverChildrenPlacement = TipOverChildrenPlacement.ColRight; } // resize document to fit all shapes NDrawingView1.Document.SizeToContent(); }
private void InitDocument() { NGraphTemplate template; // create rectangular grid template template = new NRectangularGridTemplate(); template.Origin = new NPointF(10, 23); template.VerticesShape = BasicShapes.Rectangle; template.Create(document); // create tree template template = new NGenericTreeTemplate(); template.Origin = new NPointF(250, 23); template.VerticesShape = BasicShapes.Triangle; template.Create(document); // create elliptical grid template template = new NEllipticalGridTemplate(); template.Origin = new NPointF(10, 250); template.VerticesShape = BasicShapes.Ellipse; template.Create(document); }
private void InitDocument() { NDrawingDocument document = NDrawingView1.Document; // remove the standard frame document.BackgroundStyle.FrameStyle.Visible = false; // adjust the graphics quality document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; // set up visual formatting document.Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56)); document.Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108)); NStyleSheet sheet = new NStyleSheet("edges"); sheet.Style.StartArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); sheet.Style.EndArrowheadStyle = new NArrowheadStyle(ArrowheadShape.None, "", NSizeL.Empty, document.Style.FillStyle, document.Style.StrokeStyle); document.StyleSheets.AddChild(sheet); // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.LayoutScheme = TreeLayoutScheme.None; tree.Levels = 5; tree.BranchNodes = 2; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyleSheetName = "edges"; tree.Create(NDrawingView1.Document); // perform the layout PerformLayout(null); }
protected void CreateTree() { // clear the document NDrawingView1.Document.ActiveLayer.RemoveAllChildren(); // create a tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.LayoutScheme = TreeLayoutScheme.None; tree.Levels = 4; tree.BranchNodes = 4; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.ConnectorType = ConnectorType.Line; tree.VerticesShape = BasicShapes.Circle; tree.VerticesSize = new NSizeF(40, 40); tree.EdgesStyleSheetName = "edges"; tree.Create(NDrawingView1.Document); // resize document to fit all shapes NDrawingView1.Document.SizeToContent(); }
private void RandomButton2_Click(object sender, EventArgs e) { view.LockRefresh = true; document.ActiveLayer.RemoveAllChildren(); // create a test tree NGenericTreeTemplate tree = new NGenericTreeTemplate(); tree.Balanced = false; tree.Levels = 8; tree.BranchNodes = 2; tree.HorizontalSpacing = 10; tree.VerticalSpacing = 10; tree.VerticesSize = new NSizeF(50, 50); tree.VertexSizeDeviation = 1; tree.Create(document); // layout the tree LayoutButton.PerformClick(); view.LockRefresh = false; }