예제 #1
0
        private void PerformLayout(Hashtable args)
        {
            // create a layout
            NSpringLayout layout = new NSpringLayout();

            // configure the optional forces
            layout.BounceBackForce.Padding            = 100f;
            layout.GravityForce.AttractionCoefficient = 0.2f;

            // configure the layout
            if (args != null)
            {
                layout.BounceBackForce.Enabled         = Boolean.Parse(args["BounceBackForce"].ToString());
                layout.GravityForce.Enabled            = Boolean.Parse(args["GravityForce"].ToString());
                layout.ElectricalForce.NominalDistance = Single.Parse(args["NominalDistance"].ToString());
                layout.SpringForce.LogBase             = NLayoutsHelper.ParseFloat(args["LogBase"]);
                layout.SpringForce.SpringForceLaw      = (SpringForceLaw)Enum.Parse(typeof(SpringForceLaw), args["SpringForceLaw"].ToString());
            }

            // 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();
        }
예제 #2
0
        private void PerformLayout(Hashtable args)
        {
            // Create the layout
            NSingleCycleLayout layout = new NSingleCycleLayout();

            // Configure the layout
            NLayoutsHelper.ConfigureLayout(layout, args);

            // 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();
        }