Nevron Forum

Problem in connecting one circle with other 5 circle

https://www.nevron.com/Forum/Topic6308.aspx

By shubham katyal 1 - Tuesday, March 27, 2012

 

Hi Support,

I am creating Five Free Vertices(circle),when i am trying to connect 4 Vertices with one left vertices then it inly shows 3 vertices.i dont know whats happenig.I am providing you my code below.

Thanks & Regards

Shubham

9243483753

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using Nevron.Diagram.Layout;

using Nevron.Diagram;

using Nevron.Diagram.Batches;

using Nevron.Dom;

using Nevron.GraphicsCore;

using Nevron.Diagram.Shapes;

using Nevron.Diagram.DataStructures;

using Nevron.Diagram.Filters;

using Nevron.Diagram.WebForm;

using Nevron.UI.WebForm.Controls;

using System.Collections;

using System.Drawing;

using Drawing.Surface;

using NUnit.Framework;

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

NBusinessProcessShapesFactory businessProcessShapesFactory = new NBusinessProcessShapesFactory();

// we will be using basic circle shapes with default size of (30, 30)

NBasicShapesFactory basicShapesFactory = new NBasicShapesFactory();

basicShapesFactory.DefaultSize = new NSizeF(60, 60);

NDrawingDocument document = NDrawingView1.Document;

NShape fixedShapes2 = CreateCircle(basicShapesFactory);

// fixedShapes2.Location = new NPointF(20, 60);

document.ActiveLayer.AddChild(fixedShapes2);

NShape fixedShapes = CreateCircle(basicShapesFactory);

document.ActiveLayer.AddChild(fixedShapes);

NLineShape lineShape = new NLineShape();

document.ActiveLayer.AddChild(lineShape);

lineShape.FromShape = fixedShapes2;

lineShape.ToShape = fixedShapes;

NShape fixedShapes3 = CreateCircle(basicShapesFactory);

document.ActiveLayer.AddChild(fixedShapes3);

NLineShape lineShape1 = new NLineShape();

document.ActiveLayer.AddChild(lineShape1);

lineShape1.FromShape = fixedShapes2;

lineShape1.ToShape = fixedShapes3;

NShape fixedShapes4 = CreateCircle(basicShapesFactory);

//fixedShapes4.Location = new NPointF(300, 100);

document.ActiveLayer.AddChild(fixedShapes4);

NLineShape lineShape2 = new NLineShape();

document.ActiveLayer.AddChild(lineShape2);

lineShape2.FromShape = fixedShapes2;

lineShape2.ToShape = fixedShapes4;

NShape fixedShapes10 = CreateCircle(basicShapesFactory);

fixedShapes4.Location = new NPointF(300, 100);

document.ActiveLayer.AddChild(fixedShapes10);

NLineShape lineShape10 = new NLineShape();

document.ActiveLayer.AddChild(lineShape10);

lineShape10.FromShape = fixedShapes;

lineShape10.ToShape = fixedShapes10;

NBatchReorder batchReorder = new NBatchReorder(document);

batchReorder.Build(document.ActiveLayer.Children(NFilters.Shape1D));

batchReorder.SendToBack(false);

PerformLayout(null);

/* //NShape fixedShapes2 = CreateCircle(basicShapesFactory);

fixedShapes2.Location = new NPointF(20, 60);

document.ActiveLayer.AddChild(fixedShapes2);

NShape fixedShapes = CreateCircle(basicShapesFactory);

fixedShapes.Location = new NPointF(800, 400);

document.ActiveLayer.AddChild(fixedShapes);

NLineShape lineShape = new NLineShape();

document.ActiveLayer.AddChild(lineShape);

lineShape.FromShape = fixedShapes2;

lineShape.ToShape = fixedShapes;

NShape fixedShapes3 = CreateCircle(basicShapesFactory);

fixedShapes3.Location = new NPointF(100, 200);

document.ActiveLayer.AddChild(fixedShapes3);

NLineShape lineShape1 = new NLineShape();

document.ActiveLayer.AddChild(lineShape1);

lineShape1.FromShape = fixedShapes2;

lineShape1.ToShape = fixedShapes3;

NShape fixedShapes4 = CreateCircle(basicShapesFactory);

fixedShapes4.Location = new NPointF(300,100);

document.ActiveLayer.AddChild(fixedShapes4);

NLineShape lineShape2 = new NLineShape();

document.ActiveLayer.AddChild(lineShape2);

lineShape2.FromShape = fixedShapes2;

lineShape2.ToShape = fixedShapes4; */

document.SizeToContent();

}

protected NShape CreateCircle(NBasicShapesFactory basicShapesFactory)

{

int i = 0;

//create the fixed vertices

NShape[] fixedShapes = new NShape[1];

fixedShapes[i] = basicShapesFactory.CreateShape(BasicShapes.Circle);

((NDynamicPort)fixedShapes[i].Ports.GetChildByName("Center", -1)).GlueMode = DynamicPortGlueMode.GlueToLocation;

fixedShapes[i].Style.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant3, Color.FromArgb(251, 203, 156), Color.FromArgb(247, 150, 56));

fixedShapes[i].Style.StrokeStyle = new NStrokeStyle(1, Color.FromArgb(68, 90, 108));

// setting the ForceXMoveable and ForceYMoveable properties to false

// specifies that the layout cannot move the shape in both X and Y directions

fixedShapes[i].LayoutData.ForceXMoveable = true;

fixedShapes[i].LayoutData.ForceYMoveable = true;

fixedShapes[i].Style.FillStyle = new NImageFillStyle(Server.MapPath("~/Images/man1.jpg"));

return fixedShapes[i];

}

private void PerformLayout(Hashtable args)

{

NBarycenterLayout layout = new NBarycenterLayout();

layout.FixedVertexPlacement.Mode = FixedVertexPlacementMode.PredefinedEllipseRim;

layout.FixedVertexPlacement.PredefinedEllipseBounds = new NRectangleF(200,100,300,300);

// get the shapes to layout

NNodeList shapes = NDrawingView1.Document.ActiveLayer.Children(NFilters.Shape2D);

// layout the shapes

layout.Layout(shapes, new NDrawingLayoutContext(NDrawingView1.Document));

// resize document to fit all shapes

NDrawingView1.Document.SizeToContent();

}

}