Esempio n. 1
0
        public void SetUp()
        {
            Rectangle oGraphRectangle = new Rectangle(
            Point.Empty, new Size(RectangleWidth, RectangleHeight) );

            m_oLayoutContext = new LayoutContext(oGraphRectangle);
        }
        //*************************************************************************
        //  Constructor: LayOutGraphAsyncArguments()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="LayOutGraphAsyncArguments" /> class.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.
        /// </param>
        //*************************************************************************
        public LayOutGraphAsyncArguments(
            IGraph graph,
            LayoutContext layoutContext
            )
        {
            m_oGraph = graph;
            m_oLayoutContext = layoutContext;

            AssertValid();
        }
        public void SetUp()
        {
            m_oGraph = new Graph();

            Rectangle oRectangle = new Rectangle(21, 34, 56, 78);

            m_oLayoutContext = new LayoutContext(oRectangle);

            m_oLayOutGraphAsyncArguments =
            new LayOutGraphAsyncArguments(m_oGraph, m_oLayoutContext);
        }
        private void CheckLayout(object sender, RoutedEventArgs e)
        {
            // Create a graph.  The graph has no visual representation --
            // it is just a data structure.

            Graph oGraph = new Graph(GraphDirectedness.Directed);
            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection oEdges = oGraph.Edges;

            // Add three vertices.

            IVertex oVertexA = oVertices.Add();
            oVertexA.Name = "Vertex A";
            IVertex oVertexB = oVertices.Add();
            oVertexB.Name = "Vertex B";
            IVertex oVertexC = oVertices.Add();
            oVertexC.Name = "Vertex C";

            // Connect the vertices with directed edges.

            IEdge oEdge1 = oEdges.Add(oVertexA, oVertexB, true);
            IEdge oEdge2 = oEdges.Add(oVertexB, oVertexC, true);
            IEdge oEdge3 = oEdges.Add(oVertexC, oVertexA, true);

            // Lay out the graph within a 100x100 rectangle.  This sets
            // the IVertex.Location property of each vertex.

            ILayout oLayout = new FruchtermanReingoldLayout();
            
            LayoutContext oLayoutContext = new LayoutContext(new System.Drawing.Rectangle(0,0,100,100));

            oLayout.LayOutGraph(oGraph, oLayoutContext);

            // List the results.

            foreach (IVertex oVertex in oVertices)
            {
                MessageBox.Show("The location of " + oVertex.Name + " is " + oVertex.Location.ToString());
                    
            }
        }
        public void TestTransformLayoutBad3()
        {
            // null newLayoutContext.

            try
            {
            IGraph oGraph = new Graph();

            LayoutContext oLayoutContext = new LayoutContext(Rectangle.Empty);

            m_oFruchtermanReingoldLayout.TransformLayout(
                oGraph, oLayoutContext, null);
            }
            catch (ArgumentNullException oArgumentNullException)
            {
            Assert.AreEqual(

                "Microsoft.NodeXL.Layouts.FruchtermanReingoldLayout."
                + "TransformLayout: newLayoutContext argument can't be"
                + " null.\r\n"
                + "Parameter name: newLayoutContext"
                ,
                oArgumentNullException.Message
                );

            throw oArgumentNullException;
            }
        }
        public void TestLayOut()
        {
            const Int32 Vertices = 100;

            IGraph oGraph = new Graph();

            IVertex [] aoVertices = TestGraphUtil.AddVertices(oGraph, Vertices);

            TestGraphUtil.MakeGraphComplete(oGraph, aoVertices, false);

            // Initialize the vertex locations to impossible values.

            const Int32 ImpossibleCoordinate = Int32.MinValue;

            foreach (IVertex oVertex in aoVertices)
            {
            oVertex.Location = new Point(
                ImpossibleCoordinate, ImpossibleCoordinate);
            }

            const Int32 Width = 1000;
            const Int32 Height = 600;

            Rectangle oRectangle = new Rectangle(0, 0, Width, Height);

            LayoutContext oLayoutContext = new LayoutContext(oRectangle);

            m_oFruchtermanReingoldLayout.LayOutGraph(oGraph, oLayoutContext);

            foreach (IVertex oVertex in aoVertices)
            {
            PointF oLocation = oVertex.Location;

            Single fX = oLocation.X;

            Assert.AreNotEqual(fX, ImpossibleCoordinate);
            Assert.IsTrue(fX >= 0);
            Assert.IsTrue(fX <= Width);

            Single fY = oLocation.Y;

            Assert.AreNotEqual(fY, ImpossibleCoordinate);
            Assert.IsTrue(fY >= 0);
            Assert.IsTrue(fY <= Height);
            }
        }
Esempio n. 7
0
 public void TransformLayout(
     IGraph graph,
     LayoutContext previousLayoutContext,
     LayoutContext newLayoutContext
     )
 {
 }
Esempio n. 8
0
        //*************************************************************************
        //  Method: TransformLayout()
        //
        /// <summary>
        /// Transforms the graph's layout to a new size.
        /// </summary>
        ///
        /// <param name="oNewGraphRectangle">
        /// The new size.
        /// </param>
        ///
        /// <returns>
        /// The new LayoutContext object that was used to transform the layout.
        /// </returns>
        //*************************************************************************
        protected LayoutContext TransformLayout(
            Rect oNewGraphRectangle
            )
        {
            AssertValid();

            LayoutContext oNewLayoutContext = new LayoutContext(
            WpfGraphicsUtil.RectToRectangle(oNewGraphRectangle) );

            m_oAsyncLayout.TransformLayout(m_oGraph,
            m_oLastLayoutContext, oNewLayoutContext);

            return (oNewLayoutContext);
        }
Esempio n. 9
0
        //*************************************************************************
        //  Method: GetRowsAndColumns()
        //
        /// <summary>
        /// Gets the number of rows and columns to use in the grid.
        /// </summary>
        ///
        /// <param name="oVerticesToLayOut">
        /// Vertices to lay out.
        /// </param>
        ///
        /// <param name="oLayoutContext">
        /// Provides access to objects needed to lay out the graph.
        /// </param>
        ///
        /// <param name="iRows">
        /// Where the number of grid rows gets stored.  Because the first row of
        /// vertices is drawn on the first horizontal grid line and not on the top
        /// edge of the rectangle, the number of vertices to draw per column is
        /// <paramref name="iRows" /> minus one.
        /// </param>
        ///
        /// <param name="iColumns">
        /// Where the number of grid columns gets stored.  Because the first column
        /// of vertices is drawn on the first vertical grid line and not on the
        /// left edge of the rectangle, the number of vertices to draw per row is
        /// <paramref name="iColumns" /> minus one.
        /// </param>
        //*************************************************************************
        protected void GetRowsAndColumns(
            ICollection<IVertex> oVerticesToLayOut,
            LayoutContext oLayoutContext,
            out Int32 iRows,
            out Int32 iColumns
            )
        {
            Debug.Assert(oVerticesToLayOut != null);
            Debug.Assert(oLayoutContext != null);
            AssertValid();

            #if false

            Some definitions:

            W = rectangle width

            H = rectangle height

            A = rectangle aspect ratio = W / H

            V = number of vertices in graph

            Vrow = number of vertices per row

            Vcol = number of vertices per column

            R = number of grid rows = Vcol + 1

            C = number of grid columns = Vrow + 1

            First simulataneous equation, allowing Vrow and Vcol to be fractional
            for now:

            Vrow * Vcol = V

            Second simulataneous equation:

            C / R = A

            Combining these equations yield this quadratic equation:

             2
            C  + [ (-A - 1) * C ] + [ A * (1 - V) ] = 0
Esempio n. 10
0
    GetNodeXLVertexRadius
    (
        LayoutContext oLayoutContext
    )
    {
        Debug.Assert(oLayoutContext != null);
        AssertValid();

        #if false

        Note:

        At one time, LayoutContext contained a GraphDrawer property, and this
        method used oLayoutContext.GraphDrawer.VertexDrawer.Radius as its
        return value.  This enabled the radius of all the vertices to be
        changed by the user when using the Sugiyama layout, because
        VertexDrawer.Radius contains the radius specified by the user.

        However, when the WPF version of the NodeXL visualization layer was
        created, having a LayoutContext.GraphDrawer property proved to be a
        problem.  GraphDrawer is specific to the old GDI+ version of the
        visualization layer, and embedding it in the LayoutContext object
        prevented all the layout code from being shared by both versions.  The
        GraphDrawer property was therefore removed from LayoutContext, and this
Esempio n. 11
0
    TransformLayoutCore
    (
        IGraph graph,
        LayoutContext originalLayoutContext,
        LayoutContext newLayoutContext
    )
    {
        Debug.Assert(graph != null);
        Debug.Assert(originalLayoutContext != null);
        Debug.Assert(newLayoutContext != null);
        AssertValid();

        // Transform the graph's vertex locations.

        Matrix oTransformationMatrix = LayoutUtil.GetRectangleTransformation(
            originalLayoutContext.GraphRectangle,
            newLayoutContext.GraphRectangle
            );

        base.TransformLayoutCore(graph, originalLayoutContext,
            newLayoutContext);

        // Tranform the geometry metadata added by LayOutGraphCore().

        Object oValue;

        if ( graph.TryGetValue(
            ReservedMetadataKeys.SugiyamaComputedRadius, typeof(Single),
            out oValue) )
        {
            // Transforming the radius in the x-direction only isn't ideal, but
            // doing the transform properly would involve drawing the vertex as
            // an ellipse.

            PointF oTransformedRadius = LayoutUtil.TransformPointF(
                new PointF( (Single)oValue, 0 ), oTransformationMatrix
                );

            graph.SetValue(
                ReservedMetadataKeys.SugiyamaComputedRadius,
                oTransformedRadius.X
                );
        }

        foreach (IEdge oEdge in graph.Edges)
        {
            if ( !oEdge.TryGetValue(
                ReservedMetadataKeys.SugiyamaCurvePoints, typeof( PointF [] ),
                    out oValue
                ) )
            {
                continue;
            }

            PointF [] aoCurvePoints = ( PointF [] )oValue;

            oTransformationMatrix.TransformPoints(aoCurvePoints);

            oEdge.SetValue(ReservedMetadataKeys.SugiyamaCurvePoints,
                aoCurvePoints);

            PointF oEndpoint = (PointF)oEdge.GetRequiredValue(
                ReservedMetadataKeys.SugiyamaEndpoint, typeof(PointF)
                );

            oEdge.SetValue(
                ReservedMetadataKeys.SugiyamaEndpoint,
                LayoutUtil.TransformPointF(oEndpoint, oTransformationMatrix)
                );
        }
    }
Esempio n. 12
0
    LayOutGraphCore
    (
        IGraph graph,
        ICollection<IVertex> verticesToLayOut,
        LayoutContext layoutContext,
        BackgroundWorker backgroundWorker
    )
    {
        Debug.Assert(graph != null);
        Debug.Assert(verticesToLayOut != null);
        Debug.Assert(verticesToLayOut.Count > 0);
        Debug.Assert(layoutContext != null);
        AssertValid();

        // This class does not incorporate GLEE source code to implement the
        // layout.  Instead, it transfers the NodeXL graph to a GLEE graph,
        // tells GLEE to lay out the GLEE graph, then reads the resulting
        // layout geometry from the GLEE graph and stores it as metadata in the
        // NodeXL graph.  Although this involves several copy operations, it
        // uses only the GLEE public interfaces and bypasses all the
        // maintenance headaches that would arise if the GLEE source code were
        // used.
        //
        // Note:
        //
        // This class was written when the NodeXL visualization layer used
        // GDI+.  There were complex families of vertex and edge drawers,
        // including SugiyamaVertexDrawer and EdgeVertexDrawer.  This class
        // stores vertex and edge metadata meant for use by those
        // Sugiyama-specific drawers, which were eliminated when the
        // visualization layer was changed to WPF and the vertex- and edge-
        // drawing code was vastly simplified.  Therefore, the vertex radius
        // and edge curve information stored by this class is currently ignored
        // in the WPF layer.  Vertices are of constant size, and edges are
        // drawn as straight lines.
        // 
        // This could be fixed by modifying the WPF layer to be Sugiyama-aware,
        // but as of June 2009 no one has complained about these problems and
        // so the fix is postponed.

        // Create a GLEE graph.

        Microsoft.Glee.GleeGraph oGleeGraph = new Microsoft.Glee.GleeGraph();

        // Get the vertex radius specified by the SugiyamaVertexDrawer.

        Single fNodeXLVertexRadius = GetNodeXLVertexRadius(layoutContext);

        // Loop through the NodeXL vertices.

        foreach (IVertex oVertex in verticesToLayOut)
        {
            // Create a circle that defines the GLEE node's boundary.  GLEE's
            // layout code does not modify the node's boundary, it just shifts
            // the node's center.

            Microsoft.Glee.Splines.ICurve oCurve =
                Microsoft.Glee.Splines.CurveFactory.CreateEllipse(
                    fNodeXLVertexRadius, fNodeXLVertexRadius,
                    new Microsoft.Glee.Splines.Point(0, 0)
                    );

            // Create a GLEE node that corresponds to the NodeXL node.

            Microsoft.Glee.Node oGleeNode =
                new Microsoft.Glee.Node(oVertex.ID.ToString(), oCurve);

            oGleeGraph.AddNode(oGleeNode);

            // Store the GLEE node as temporary metadata in the NodeXL node.

            oVertex.SetValue(ReservedMetadataKeys.SugiyamaGleeNode, oGleeNode);
        }

        // Loop through the NodeXL edges.

        ICollection<IEdge> oEdgesToLayOut =
            GetEdgesToLayOut(graph, verticesToLayOut);

        foreach (IEdge oEdge in oEdgesToLayOut)
        {
            // Retrieve the NodeXL edge's vertices.

            IVertex [] aoVertices = oEdge.Vertices;

            // Retrieve the corresponding GLEE node for the NodeXL edge's
            // vertices.

            Microsoft.Glee.Node oGleeNode0 =
                NodeXLVertexToGleeNode( aoVertices[0] );

            Microsoft.Glee.Node oGleeNode1 =
                NodeXLVertexToGleeNode( aoVertices[1] );

            // Create a GLEE edge using the two GLEE nodes.

            Microsoft.Glee.Edge oGleeEdge =
                new Microsoft.Glee.Edge(oGleeNode0, oGleeNode1);

            oGleeGraph.AddEdge(oGleeEdge);

            // Store the GLEE edge as temporary metadata in the NodeXL edge.

            oEdge.SetValue(
                ReservedMetadataKeys.SugiyamaGleeEdge, oGleeEdge);
        }

        // Tell GLEE to lay out the GLEE graph.  This shifts the node centers,
        // connects the nodes with lines, and computes the smallest rectangle
        // that contains all the nodes and edges.

        oGleeGraph.CalculateLayout();

        // The rectangle computed by GLEE does not have the dimensions
        // specified by layoutContext.GraphRectangle.  Get a transformation
        // that will map coordinates in the GLEE rectangle to coordinates in
        // the specified NodeXL rectangle.

        Matrix oTransformationMatrix =
            GetTransformationMatrix(oGleeGraph, layoutContext.GraphRectangle);

        // Because of the transformation, the radius of the vertices is no
        // longer the original fNodeXLVertexRadius.  Compute the transformed
        // radius.

        PointF [] aoRadiusPoints = new PointF [] {
            PointF.Empty,
            new PointF(0, fNodeXLVertexRadius)
            };

        oTransformationMatrix.TransformPoints(aoRadiusPoints);

        Double dX = aoRadiusPoints[1].X - aoRadiusPoints[0].X;
        Double dY = aoRadiusPoints[1].Y - aoRadiusPoints[0].Y;

        Single fTransformedNodeXLVertexRadius =
            (Single)Math.Sqrt(dX * dX + dY * dY);

        // Store the computed radius as metadata on the graph, to be retrieved
        // by SugiyamaVertexDrawer.DrawVertex().

        graph.SetValue(ReservedMetadataKeys.SugiyamaComputedRadius,
            fTransformedNodeXLVertexRadius);

        // Loop through the NodeXL vertices again.

        foreach (IVertex oVertex in verticesToLayOut)
        {
            // Retrieve the corresponding GLEE node.

            Microsoft.Glee.Node oGleeNode =
                NodeXLVertexToGleeNode(oVertex);

            oVertex.RemoveKey(ReservedMetadataKeys.SugiyamaGleeNode);

            // Get the shifted node center and transform it to NodeXL
            // coordinates.

            if ( !VertexIsLocked(oVertex) )
            {
                oVertex.Location = GleePointToTransformedPointF(
                    oGleeNode.Center, oTransformationMatrix);
            }
        }

        // Loop through the NodeXL edges again.

        foreach (IEdge oEdge in oEdgesToLayOut)
        {
            // Retrieve the corresponding GLEE edge.

            Microsoft.Glee.Edge oGleeEdge = NodeXLEdgeToGleeEdge(oEdge);

            oEdge.RemoveKey(ReservedMetadataKeys.SugiyamaGleeEdge);

            // Get the GLEE curve that describes most (but not all) of the
            // edge.

            Microsoft.Glee.Splines.Curve oCurve =
                (Microsoft.Glee.Splines.Curve)oGleeEdge.Curve;

            // TODO: In Microsoft.Glee.GraphViewerGdi.GViewer.
            // TransferGeometryFromGleeGraphToGraph() in the GLEE source code,
            // oCurve can apparently be null.  Can it be null here?  For now,
            // assume that the answer is no.

            Debug.Assert(oCurve != null);

            // Convert the curve to an array of PointF objects in NodeXL
            // coordinates.

            PointF [] aoCurvePoints = GleeCurveToTransformedPointFArray(
                oCurve, oTransformationMatrix);

            // Store the array as metadata in the edge, to be retrieved by
            // SugiyamaEdgeDrawer.DrawEdge().

            oEdge.SetValue(
                ReservedMetadataKeys.SugiyamaCurvePoints, aoCurvePoints);

            // Get the endpoint of the curve and transform it to NodeXL
            // coordinates.

            PointF oEndpoint = GleePointToTransformedPointF(
                oGleeEdge.ArrowHeadAtTargetPosition, oTransformationMatrix);

            // Store the endpoint as metadata in the edge, to be retrieved by
            // SugiyamaEdgeDrawer.DrawEdge().

            oEdge.SetValue(ReservedMetadataKeys.SugiyamaEndpoint, oEndpoint);
        }

        return (true);
    }
Esempio n. 13
0
        //*************************************************************************
        //  Method: LayOutGraphCoreSorted()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously using specified
        /// vertices that may be sorted.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCoreSorted(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            if (backgroundWorker != null && backgroundWorker.CancellationPending)
            {
            return (false);
            }

            Int32 iVertices = verticesToLayOut.Count;

            // The vertices are placed at equal angles around the circle's
            // circumference.

            Double dAngleBetweenVerticesRadians =
            (2 * Math.PI) / (Double)iVertices;

            Double dCenterX, dCenterY, dRadius;

            GetRectangleCenterAndHalfSize(layoutContext.GraphRectangle,
            out dCenterX, out dCenterY, out dRadius);

            Double dAngleRadians = 0;

            foreach (IVertex oVertex in verticesToLayOut)
            {
            if ( !VertexIsLocked(oVertex) )
            {
                Double dX = dCenterX + dRadius * Math.Cos(dAngleRadians);
                Double dY = dCenterY + dRadius * Math.Sin(dAngleRadians);

                oVertex.Location = new PointF( (Single)dX, (Single)dY );
            }

            dAngleRadians += dAngleBetweenVerticesRadians;
            }

            return (true);
        }
Esempio n. 14
0
        //*************************************************************************
        //  Method: LayOutGraphCoreSorted()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously using specified
        /// vertices that may be sorted.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCoreSorted(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            if (backgroundWorker != null && backgroundWorker.CancellationPending)
            {
            return (false);
            }

            Int32 iVertices = verticesToLayOut.Count;

            // The vertices are placed at equal angles along the spiral.

            Double dAngleBetweenVertices = MaximumSpiralAngle / (Double)iVertices;

            Double dCenterX, dCenterY, dHalfSize;

            GetRectangleCenterAndHalfSize(layoutContext.GraphRectangle,
            out dCenterX, out dCenterY, out dHalfSize);

            // Parametric equations for a spiral:
            //
            //     dX = dA * dAngle * cos(dAngle)
            //     dY = dA * dAngle * sin(dAngle)
            //
            // where A is a constant.

            double dA = dHalfSize / MaximumSpiralAngle;

            Double dAngle = 0;

            foreach (IVertex oVertex in verticesToLayOut)
            {
            if ( !VertexIsLocked(oVertex) )
            {
                Double dX = dCenterX + dA * dAngle * Math.Cos(dAngle);
                Double dY = dCenterY + dA * dAngle * Math.Sin(dAngle);

                oVertex.Location = new PointF( (Single)dX, (Single)dY );
            }

            dAngle += dAngleBetweenVertices;
            }

            return (true);
        }
Esempio n. 15
0
        private void Build_Universe_Network(string layoutmethod, string netid)
        {
            string SQL;
            string NodeName;
            int NodeID, FromID, ToID, EdgeID;
            double xx2, yy2, size, xx,yy;
            double px, py;
            int comments;
            Random rnd = new Random();

            Graph oGraph = new Graph(GraphDirectedness.Directed);
            IVertexCollection oVertices = oGraph.Vertices;
            IEdgeCollection oEdges = oGraph.Edges;

            // Nuke the Display
            UniverseBackground.Children.Clear();
            // Add the Whiskers Programmatically
            Add_Whiskers();
                                    
            SQL = "select id, nodename,x,y from nodes where networkid = '" + netid + "'";
            OleDbCommand aCommand = new OleDbCommand(SQL, localengine.RepositoryConnection);
            try
            {
                //create the datareader object to connect to table
                OleDbDataReader aReader = aCommand.ExecuteReader();

                //Iterate throuth the database
                while (aReader.Read())
                {
                    NodeID = aReader.GetInt32(0);
                    NodeName = aReader.GetString(1);

                    ListBoxItem li = new ListBoxItem();
                    li.Content = NodeName;
                    li.Tag = NodeID.ToString();
                    NodeList.Items.Add(li); 
                    px = (double)aReader.GetInt32(2);
                    py = (double)aReader.GetInt32(3);
                    
                    

                    IVertex oVertexA = oVertices.Add();
                    oVertexA.Name = NodeName;
                    oVertexA.Tag = NodeID;

                }
                aReader.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
 
            }

            // Connect the edges
            SQL = "select edgeid, fromid, toid from edges where networkid='" + netid + "'";
            aCommandEdge = new OleDbCommand(SQL, localengine.RepositoryConnection);
            
            try
            {
                //create the datareader object to connect to table
                aReaderEdge = aCommandEdge.ExecuteReader();

                //Iterate throuth the database
                while (aReaderEdge.Read())
                {
                    EdgeID = aReaderEdge.GetInt32(0);
                    FromID = aReaderEdge.GetInt32(1);
                    ToID = aReaderEdge.GetInt32(2);

                    xx = Getx(FromID);
                    yy = Gety(FromID);

                    xx2 = Getx(ToID);
                    yy2 = Gety(ToID);

                    Line l = new Line();
                    l.X1 = xx+5;
                    l.Y1 = yy+5;
                    l.X2 = xx2+5;
                    l.Y2 = yy2+5;
                    l.Tag = "EDGE(" + FromID.ToString() + ":" + ToID.ToString() + ")";
                    l.ToolTip = l.Tag;
                    l.Stroke = new SolidColorBrush(Colors.Gray);
                    UniverseBackground.Children.Add(l);

                    IVertex oFrom=null;
                    IVertex oTo=null;

                    foreach (IVertex oVertex in oVertices)
                    {
                        if (oVertex.Tag.ToString() == FromID.ToString())
                        {
                            oFrom = oVertex;
                        }

                        if (oVertex.Tag.ToString() == ToID.ToString())
                        {
                            oTo = oVertex;

                        }

                         
                    }
                    IEdge oEdge1 = oEdges.Add(oFrom, oTo, true);

                }
                //aReaderEdge.Close();
            }
            catch (Exception eEdge)
            {
                MessageBox.Show(eEdge.Message);

            }

            // Apply Layout 
            // ==================================================================
            
            switch(layoutmethod)
            {
                case "Circular Layout":
                    ILayout oLayout_cir = new CircleLayout();
                    LayoutContext oLayoutContext_cir = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_cir.LayOutGraph(oGraph, oLayoutContext_cir);
                break;
                case "Random Layout":
                    ILayout oLayout_rand = new RandomLayout();
                    LayoutContext oLayoutContext_rand = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_rand.LayOutGraph(oGraph, oLayoutContext_rand);
                break;
                case "Sugiyama Layout":
                    ILayout oLayout_Sugi = new SugiyamaLayout();
                    LayoutContext oLayoutContext_Sugi = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_Sugi.LayOutGraph(oGraph, oLayoutContext_Sugi);
                break;
                case "Grid Layout":
                    ILayout oLayout_grid = new GridLayout();
                    LayoutContext oLayoutContext_grid = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_grid.LayOutGraph(oGraph, oLayoutContext_grid);
                break;
                case "Spiral Layout":
                    ILayout oLayout_spiral = new SpiralLayout();
                    LayoutContext oLayoutContext_spiral = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_spiral.LayOutGraph(oGraph, oLayoutContext_spiral);
                break;
                case "Fruchterman/Reingold Layout":
                    ILayout oLayout_Fruch = new FruchtermanReingoldLayout();
                    LayoutContext oLayoutContext_Fruch = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_Fruch.LayOutGraph(oGraph, oLayoutContext_Fruch);
                break;
                case "Sinusoid H Layout":
                    ILayout oLayout_SinH = new SinusoidHorizontalLayout();
                    LayoutContext oLayoutContext_SinH = new LayoutContext(new System.Drawing.Rectangle(0, 0, 5000, 5000));
                    oLayout_SinH.LayOutGraph(oGraph, oLayoutContext_SinH);
                break;
                case "Sinusoid V Layout":
                    ILayout oLayout_SinV = new SinusoidVerticalLayout();
                    LayoutContext oLayoutContext_SinV = new LayoutContext(new System.Drawing.Rectangle(0, 0, 500, 500));
                    oLayout_SinV.LayOutGraph(oGraph, oLayoutContext_SinV);
                break;

            }
           
            // List the results.
            int xoffset=0;
            int yoffset=0;
            Random rc = new Random();
            Random rx = new Random();
            Random ry = new Random();
            Random coin = new Random();
            foreach (IVertex oVertex in oVertices)
            {
                UniversePadPoint p2 = new UniversePadPoint();

                p2.PadName = oVertex.Name;
                xx2 = oVertex.Location.X;
                yy2 = oVertex.Location.Y;
                xx2 = xx2 + xoffset;
                yy2 = yy2 + yoffset;
            // BUG   p2.WhiskX = XWhisker;
            // BUG    p2.WhiskY = YWhisker;

                size = (double)10;
                p2.Render(UniverseBackground, FieldBackground, xx2, yy2, size, (int)oVertex.Tag, oVertex.Name);

                Ellipse re = new Ellipse();
                re.Width = rnd.NextDouble() * 80;
                re.Height = re.Width;
                re.Opacity = 0.25;
                re.Tag = "METRIC";
                re.Fill = new SolidColorBrush(Colors.Blue);
                UniverseBackground.Children.Add(re);
                Canvas.SetLeft(re, xx2-(re.Width/2)+5);
                Canvas.SetTop(re, yy2 - (re.Width / 2)+5);

                                

            }

            foreach (IEdge e2 in oEdges)
            {
                IVertex f1 = e2.BackVertex;
                IVertex t2 = e2.FrontVertex;
                xx = f1.Location.X;
                yy = f1.Location.Y;
                xx2 = t2.Location.X;
                yy2 = t2.Location.Y;

                xx = xx + xoffset;
                yy = yy + yoffset;
                xx2 = xx2 + xoffset;
                yy2 = yy2 + yoffset;

                Line l = new Line();
                l.X1 = xx + 5;
                l.Y1 = yy + 5;
                l.X2 = xx2 + 5;
                l.Y2 = yy2 + 5;
                l.Tag = "EDGE(" + f1.Tag.ToString() + ":" + t2.Tag.ToString() + ")";
                l.ToolTip = l.Tag;
                l.Stroke = new SolidColorBrush(Colors.Gray);
                UniverseBackground.Children.Add(l);
            }

            

        }
Esempio n. 16
0
        //*************************************************************************
        //  Method: LayOutOrDrawGraph()
        //
        /// <summary>
        /// Lays out or draws the graph, depending on the current layout state.
        /// </summary>
        //*************************************************************************
        protected void LayOutOrDrawGraph()
        {
            AssertValid();

            #if TRACE_LAYOUT_AND_DRAW
            Debug.WriteLine("NodeXLControl: LayOutOrDrawGraph(), m_eLayoutState = "
            + m_eLayoutState);
            #endif

            Rect oGraphRectangle = this.GraphRectangle;

            #if TRACE_LAYOUT_AND_DRAW
            Debug.WriteLine("NodeXLControl: LayOutOrDrawGraph(), size = " +
            oGraphRectangle.Width + " , " + oGraphRectangle.Height);
            #endif

            System.Drawing.Rectangle oGraphRectangle2 =
            WpfGraphicsUtil.RectToRectangle(oGraphRectangle);

            switch (m_eLayoutState)
            {
            case LayoutState.Stable:

                break;

            case LayoutState.LayoutRequired:

                Debug.Assert(!m_oAsyncLayout.IsBusy);

                FireLayingOutGraph();

                m_oLastLayoutContext = new LayoutContext(oGraphRectangle2);

                m_eLayoutState = LayoutState.LayingOut;

                if (m_oAsyncLayout is SortableLayoutBase)
                {
                    // If the vertex layout order has been set, tell the layout
                    // object to sort the vertices before laying them out.

                    ( (SortableLayoutBase)m_oAsyncLayout ).VertexSorter =

                        m_oGraph.ContainsKey(
                            ReservedMetadataKeys.SortableLayoutOrderSet) ?

                        new ByMetadataVertexSorter<Single>(
                            ReservedMetadataKeys.SortableLayoutOrder)
                        :
                        null;
                }

                // Start an asynchronous layout.  The m_oAsyncLayout object
                // will fire LayOutGraphIterationCompleted and
                // LayOutGraphCompleted events as it does its work.

                m_oAsyncLayout.LayOutGraphAsync(
                    m_oGraph, m_oLastLayoutContext);

                break;

            case LayoutState.LayingOut:

                break;

            case LayoutState.LayoutIterationCompleted:

                // An iteration of the asynchronous layout has completed and
                // now the graph needs to be drawn.

                m_eLayoutState = LayoutState.LayingOut;

                DrawGraph(oGraphRectangle);

                break;

            case LayoutState.LayoutCompleted:

                // The asynchronous layout has completed and now the graph
                // needs to be drawn.

                m_eLayoutState = LayoutState.Stable;

                // Has the size of the control changed since the layout was
                // started?

                System.Drawing.Rectangle oLastGraphRectangle =
                    m_oLastLayoutContext.GraphRectangle;

                if (
                    oLastGraphRectangle.Width != oGraphRectangle2.Width
                    ||
                    oLastGraphRectangle.Height != oGraphRectangle2.Height
                    )
                {
                    // Yes.  Transform the layout to the new size.

                    #if TRACE_LAYOUT_AND_DRAW
                    Debug.WriteLine("NodeXLControl: Transforming layout.");
                    #endif

                    m_oLastLayoutContext = TransformLayout(oGraphRectangle);
                }

                DrawGraph(oGraphRectangle);

                break;

            case LayoutState.TransformRequired:

                // The control has been resized and now the graph's layout
                // needs to be transformed to the new size.

                m_oLastLayoutContext = TransformLayout(oGraphRectangle);

                m_eLayoutState = LayoutState.Stable;

                DrawGraph(oGraphRectangle);

                break;

            default:

                Debug.Assert(false);
                break;
            }
        }
Esempio n. 17
0
        //*************************************************************************
        //  Constructor: NodeXLControl()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeXLControl" /> class.
        /// </summary>
        //*************************************************************************
        public NodeXLControl()
        {
            m_oGraph = new Graph();
            m_oGraphDrawer = new GraphDrawer(this);

            m_oAsyncLayout = new FruchtermanReingoldLayout();
            OnNewLayout(m_oAsyncLayout);

            m_oLastLayoutContext =
            new LayoutContext(System.Drawing.Rectangle.Empty);

            m_oLastGraphDrawingContext = null;

            m_eLayoutState = LayoutState.Stable;

            m_eMouseMode = MouseMode.Select;
            m_bMouseAlsoSelectsIncidentEdges = true;
            m_bAllowVertexDrag = true;

            m_oVerticesBeingDragged = null;
            m_oMarqueeBeingDragged = null;
            m_oTranslationBeingDragged = null;

            m_oSelectedVertices = new HashSet<IVertex>();
            m_oSelectedEdges = new HashSet<IEdge>();
            m_oCollapsedGroups = new Dictionary<String, IVertex>();
            m_oDoubleClickedVertexInfo = null;

            m_bShowVertexToolTips = false;
            m_oLastMouseMoveLocation = new Point(-1, -1);

            // Create a helper object for displaying vertex tooltips.

            CreateVertexToolTipTracker();
            m_oVertexToolTip = null;

            m_bGraphZoomCentered = false;

            this.AddLogicalChild(m_oGraphDrawer.VisualCollection);

            CreateTransforms();

            // Prevent a focus rectangle from being drawn around the control when
            // it captures keyboard focus.  The focus rectangle does not behave
            // properly when the layout and render transforms are applied --
            // sometimes the rectangle disappears, and sometimes it gets magnified
            // by the render layout.

            this.FocusVisualStyle = null;

            // AssertValid();
        }
Esempio n. 18
0
        //*************************************************************************
        //  Method: LayOutGraphAsync()
        //
        /// <summary>
        /// Lays out a graph asynchronously.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.
        /// </param>
        ///
        /// <remarks>
        /// This method asynchronously lays out the graph <paramref name="graph" />
        /// by setting the <see cref="IVertex.Location" /> property on all of the
        /// graph's vertices, and optionally adding geometry metadata to the graph,
        /// vertices, or edges.  It starts a worker thread and then returns
        /// immediately.
        ///
        /// <para>
        /// The <see cref="LayOutGraphIterationCompleted" /> event may fire
        /// repeatedly while the layout is occurring.  The <see
        /// cref="LayOutGraphCompleted" /> event fires when the layout is complete,
        /// an error occurs, or the layout is cancelled.  <see
        /// cref="LayOutGraphAsyncCancel" /> cancels the layout.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        public void LayOutGraphAsync(
            IGraph graph,
            LayoutContext layoutContext
            )
        {
            AssertValid();

            const String MethodName = "LayOutGraphAsync";

            this.ArgumentChecker.CheckArgumentNotNull(MethodName, "graph", graph);

            this.ArgumentChecker.CheckArgumentNotNull(
            MethodName, "layoutContext", layoutContext);

            if (m_oBackgroundWorker.IsBusy)
            {
            throw new InvalidOperationException(String.Format(

                "{0}.{1}: A layout is already in progress."
                ,
                this.ClassName,
                MethodName
                ) );
            }

            // Save the SynchronizationContext of the calling thread for use by
            // FireLayOutGraphIterationCompleted().

            Debug.Assert(m_oSynchronizationContext == null);

            m_oSynchronizationContext = SynchronizationContext.Current;

            Debug.Assert(m_oSynchronizationContext != null);

            // Start a worker thread, then return immediately.

            m_oBackgroundWorker.RunWorkerAsync(
            new LayOutGraphAsyncArguments(graph, layoutContext) );
        }
Esempio n. 19
0
 public void LayOutGraph(
     IGraph graph,
     LayoutContext layoutContext
     )
 {
 }
Esempio n. 20
0
        //*************************************************************************
        //  Method: LayOutGraphCore()
        //
        /// <summary>
        /// Lays out a graph.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.  The graph is guaranteed to have at least one vertex.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> by setting the
        /// <see cref="IVertex.Location" /> property on all of the graph's
        /// vertices, and optionally adding geometry metadata to the graph,
        /// vertices, or edges.
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// <para>
        /// This is the concrete implementation of an abstract virtual method
        /// defined in <see cref="LayoutBase" />.  It delegates the work to a new,
        /// overloaded abstract virtual method defined in this class.  The new
        /// overload takes an additional BackgroundWorker argument.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override void LayOutGraphCore(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            Debug.Assert(graph.Vertices.Count > 0);
            Debug.Assert(layoutContext.GraphRectangle.Width > 0);
            Debug.Assert(layoutContext.GraphRectangle.Height > 0);

            // Let the derived class do the work.

            LayOutGraphCore(graph, verticesToLayOut, layoutContext, null);
        }
Esempio n. 21
0
        //*************************************************************************
        //  Constructor: LayoutContextTest()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="LayoutContextTest" /> class.
        /// </summary>
        //*************************************************************************
        public LayoutContextTest()
        {
            m_oLayoutContext = null;

            m_oGraphRectangle = Rectangle.Empty;
        }
Esempio n. 22
0
        //*************************************************************************
        //  Method: LayOutGraphOnBackgroundWorker()
        //
        /// <summary>
        /// Lays out a graph on a BackgroundWorker thread.
        /// </summary>
        ///
        /// <param name="oBackgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method.
        /// </param>
        ///
        /// <param name="oDoWorkEventArgs">
        /// Asynchronous event arguments.
        /// </param>
        //*************************************************************************
        protected void LayOutGraphOnBackgroundWorker(
            BackgroundWorker oBackgroundWorker,
            DoWorkEventArgs oDoWorkEventArgs
            )
        {
            Debug.Assert(oBackgroundWorker != null);
            Debug.Assert(oDoWorkEventArgs != null);
            AssertValid();

            Debug.Assert(oDoWorkEventArgs.Argument is LayOutGraphAsyncArguments);

            LayOutGraphAsyncArguments oLayOutGraphAsyncArguments =
            (LayOutGraphAsyncArguments)oDoWorkEventArgs.Argument;

            IGraph oGraph = oLayOutGraphAsyncArguments.Graph;

            LayoutContext oLayoutContext =
            oLayOutGraphAsyncArguments.LayoutContext;

            LayoutContext oAdjustedLayoutContext;

            if ( !GetAdjustedLayoutContext(oGraph, oLayoutContext,
            out oAdjustedLayoutContext) )
            {
            return;
            }

            // Honor the optional LayOutTheseVerticesOnly key on the graph.

            ICollection<IVertex> oVerticesToLayOut = GetVerticesToLayOut(oGraph);
            Int32 iVerticesToLayOut = oVerticesToLayOut.Count;

            if (iVerticesToLayOut == 0)
            {
            return;
            }

            // Binning is supported only if the entire graph is being laid out.

            if (this.SupportsBinning && m_bUseBinning &&
            iVerticesToLayOut == oGraph.Vertices.Count)
            {
            // Lay out the graph's smaller components in bins.

            GraphBinner oGraphBinner = new GraphBinner();
            oGraphBinner.MaximumVerticesPerBin = m_iMaximumVerticesPerBin;
            oGraphBinner.BinLength = m_iBinLength;

            ICollection<IVertex> oRemainingVertices;
            Rectangle oRemainingRectangle;

            if ( oGraphBinner.LayOutSmallerComponentsInBins(oGraph,
                oVerticesToLayOut, oAdjustedLayoutContext,
                out oRemainingVertices, out oRemainingRectangle) )
            {
                // The remaining vertices need to be laid out in the remaining
                // rectangle.

                oVerticesToLayOut = oRemainingVertices;

                oAdjustedLayoutContext =
                    new LayoutContext(oRemainingRectangle);
            }
            else
            {
                // There are no remaining vertices, or there is no space
                // left.

                oVerticesToLayOut = new IVertex[0];
            }
            }

            if (oVerticesToLayOut.Count > 0)
            {
            // Let the derived class do the work.

            if ( !LayOutGraphCore(oGraph, oVerticesToLayOut,
                oAdjustedLayoutContext, oBackgroundWorker) )
            {
                // LayOutGraphAsyncCancel() was called.

                oDoWorkEventArgs.Cancel = true;
                return;
            }

            LayoutMetadataUtil.MarkGraphAsLaidOut(oGraph);
            }
        }
Esempio n. 23
0
        public void TearDown()
        {
            m_oLayoutContext = null;

            m_oGraphRectangle = Rectangle.Empty;
        }
Esempio n. 24
0
        //*************************************************************************
        //  Method: LayOutGraphCoreSorted()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously using specified
        /// vertices that may be sorted.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCoreSorted(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            if (backgroundWorker != null && backgroundWorker.CancellationPending)
            {
            return (false);
            }

            Int32 iVertices = verticesToLayOut.Count;

            // The vertices are placed at equal angles along one cycle of a sine
            // wave.

            Rectangle oRectangle = layoutContext.GraphRectangle;

            Double dWidth = (Double)oRectangle.Width;
            Double dHeight = (Double)oRectangle.Height;
            Double dWidthOrHeight = (m_bIsHorizontal ? dWidth : dHeight);
            Double dHeightOrWidth = (m_bIsHorizontal ? dHeight : dWidth);

            Double dXorYIncrement = dWidthOrHeight / (Double)iVertices;
            Double dAmplitude = dHeightOrWidth / 2.0;
            Double dSinFactor = m_dCycleLength / dWidthOrHeight;

            Single fYorXOffset =
            (m_bIsHorizontal ? oRectangle.Top : oRectangle.Left) +
            (Single)dHeightOrWidth / 2.0F;

            Single fXorYOffset =
            m_bIsHorizontal ? oRectangle.Left : oRectangle.Top;

            Double dXorY = 0;

            foreach (IVertex oVertex in verticesToLayOut)
            {
            if ( !VertexIsLocked(oVertex) )
            {
                Single fYorX = fYorXOffset -
                    (Single)( dAmplitude * Math.Sin(dXorY * dSinFactor) );

                oVertex.Location = m_bIsHorizontal ?

                    new PointF( (Single)dXorY + fXorYOffset, fYorX)
                    :
                    new PointF(fYorX, (Single)dXorY + fXorYOffset);
            }

            dXorY += dXorYIncrement;
            }

            return (true);
        }
        //*************************************************************************
        //  Method: LayOutGraphCore()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.  The graph is guaranteed to have at least one vertex.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCore(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            if (backgroundWorker != null && backgroundWorker.CancellationPending)
            {
            return (false);
            }

            ICollection<IEdge> oEdgesToLayOut =
            GetEdgesToLayOut(graph, verticesToLayOut);

            Int32 iVertices = verticesToLayOut.Count;

            // The MultiScaleLayout class uses a simple scheme where the graph's
            // vertices consist of the integers 0 through N-1, where N is the
            // number of vertices in the graph.  NodeXL uses IVertex objects and
            // the vertex collection isn't indexed.  Work around this
            // incompatibility by creating a dictionary that maps vertices to
            // zero-based vertex indexes.

            Dictionary<IVertex, Int32> oVertexDictionary =
            new Dictionary<IVertex, Int32>(iVertices);

            Int32 iVertexIndex = 0;

            foreach (IVertex oVertex in verticesToLayOut)
            {
            oVertexDictionary.Add(oVertex, iVertexIndex);
            iVertexIndex++;
            }

            // Create and populate a MultiScaleLayout graph.

            MultiScaleLayout.Graph oMultiScaleLayoutGraph =
            new MultiScaleLayout.Graph(iVertices, String.Empty);

            foreach (IEdge oEdge in oEdgesToLayOut)
            {
            IVertex [] aoEdgeVertices = oEdge.Vertices;

            oMultiScaleLayoutGraph.AddEdge(
                oVertexDictionary[ aoEdgeVertices[0] ],
                oVertexDictionary[ aoEdgeVertices[1] ]
                );
            }

            // Lay it out.

            oMultiScaleLayoutGraph.PrepareForUse();

            MultiScaleLayout.GraphLayoutSettings oGraphLayoutSettings =
            new MultiScaleLayout.GraphLayoutSettings(m_iRad,
                m_iLocalIterations, m_iRatio, m_iMinSize);

            oMultiScaleLayoutGraph.MultiScaleLayout(
            ( new Random() ).Next(), oGraphLayoutSettings);

            // Retrieve the laid out vertex coordinates, which are normalized to
            // fall within the range [0,1].

            MultiScaleLayout.PointD [] oMultiScaleLayoutLocations =
            oMultiScaleLayoutGraph.vertexCoords;

            Rectangle oRectangle = layoutContext.GraphRectangle;

            Debug.Assert(oRectangle.Width > 0);
            Debug.Assert(oRectangle.Height > 0);

            Int32 iLeft = oRectangle.Left;
            Int32 iTop = oRectangle.Top;
            Int32 iWidth = oRectangle.Width;
            Int32 iHeight = oRectangle.Height;

            foreach (IVertex oVertex in verticesToLayOut)
            {
            if ( !VertexIsLocked(oVertex) )
            {
                // Convert the normalized coordinates to coordinates within the
                // layout rectangle.

                MultiScaleLayout.PointD oMultiScaleLayoutLocation =
                    oMultiScaleLayoutLocations[ oVertexDictionary[oVertex] ];

                oVertex.Location = new PointF(
                    iLeft + (Single)(oMultiScaleLayoutLocation.x * iWidth),
                    iTop + (Single)(oMultiScaleLayoutLocation.y * iHeight)
                    );
            }
            }

            return (true);
        }
        private void BuildNetwork(object sender, RoutedEventArgs e)
        {
            string cs = "";
            string inserts = "";
            string networkkey = "PAYR";

            Repository localenginecreate = new Repository();
            localenginecreate.Open_Repository();

            // Go grab everything we need, based on the net id
            string DataBaseRoot = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString()).Replace(@"file:\", "") + "\\Friends.db";

            cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Firefly\\List of customers for firefly poc\\List of customers for firefly poc.mdb";
            
            // Node SQL
            string nodeSQL = "select cust_skey, cust_name from cust where cust_type_MDM in ('PLAN', 'PAYR', 'CORP','PHAR', 'UNSP')";
            int nodenameMap;
            int nodeidMap;
            string nodename;
            double nodeid;
            

            


            // Edge SQL
            string edgeSQL = "select from_cust_skey, to_cust_skey from cust_affl WHERE affl_type in ('PLAN_to_PAYR', 'PHAR_to_CORP', 'PAYR_to_CORP', 'CORP_to_CORP')";
            
            int EdgeFromidMap = 0;
            int EdgeToidMap = 1;
            double from;
            double to;
            double nodecount = 0;
            try
            {
                // Set up a network object
                Graph oGraph = new Graph(GraphDirectedness.Directed);
                IVertexCollection oVertices = oGraph.Vertices;
                IEdgeCollection oEdges = oGraph.Edges;

                // connection
                OleDbConnection TestConn = new OleDbConnection(cs);
                TestConn.Open();
                
                OleDbCommand aCommand = new OleDbCommand(nodeSQL, TestConn);

                //create the datareader object to connect to table
                OleDbDataReader aReader = aCommand.ExecuteReader();

                // Get the Nodes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                nodenameMap = 1;
                nodeidMap = 0;
                while (aReader.Read())
                {
                    nodename = aReader.GetString(nodenameMap);
                    nodeid = aReader.GetDouble(nodeidMap);
                    
                    // Add a node...
                    IVertex oVertexA = oVertices.Add();
                    oVertexA.Name = nodename;
                    oVertexA.Tag = nodeid;

                    nodecount++;
                }
                aReader.Close();

                // Get the Edges!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                OleDbCommand aEdgeCommand = new OleDbCommand(edgeSQL, TestConn);

                //create the datareader object to connect to table
                OleDbDataReader aEdgeReader = aEdgeCommand.ExecuteReader();

                EdgeFromidMap = 0;
                EdgeToidMap = 1;

                while (aEdgeReader.Read())
                {
                    from = aEdgeReader.GetDouble(EdgeFromidMap);
                    to = aEdgeReader.GetDouble(EdgeToidMap);
                    
                    // Add an edge
                    IVertex oFrom = null;
                    IVertex oTo = null;

                    foreach (IVertex oVertex in oVertices)
                    {
                        if (oVertex.Tag.ToString() == from.ToString())
                        {
                            oFrom = oVertex;
                        }

                        if (oVertex.Tag.ToString() == to.ToString())
                        {
                            oTo = oVertex;

                        }


                    }
                    IEdge oEdge1 = oEdges.Add(oFrom, oTo, true);

                }
                aEdgeReader.Close();

                // Perform a layout
                // Apply Layout 
                // ==================================================================

                double xdim;
                double ydim;

                xdim = 5000;
                ydim = xdim;
                string layoutmethod = "Fruchterman/Reingold Layout";
                switch (layoutmethod)
                {
                    case "Circular Layout":
                        ILayout oLayout_cir = new CircleLayout();
                        LayoutContext oLayoutContext_cir = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_cir.LayOutGraph(oGraph, oLayoutContext_cir);
                        break;
                    case "Random Layout":
                        ILayout oLayout_rand = new RandomLayout();
                        LayoutContext oLayoutContext_rand = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_rand.LayOutGraph(oGraph, oLayoutContext_rand);
                        break;
                    case "Sugiyama Layout":
                        ILayout oLayout_Sugi = new SugiyamaLayout();
                        LayoutContext oLayoutContext_Sugi = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_Sugi.LayOutGraph(oGraph, oLayoutContext_Sugi);
                        break;
                    case "Grid Layout":
                        ILayout oLayout_grid = new GridLayout();
                        LayoutContext oLayoutContext_grid = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_grid.LayOutGraph(oGraph, oLayoutContext_grid);
                        break;
                    case "Spiral Layout":
                        ILayout oLayout_spiral = new SpiralLayout();
                        LayoutContext oLayoutContext_spiral = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_spiral.LayOutGraph(oGraph, oLayoutContext_spiral);
                        break;
                    case "Fruchterman/Reingold Layout":
                        ILayout oLayout_Fruch = new FruchtermanReingoldLayout();
                        LayoutContext oLayoutContext_Fruch = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_Fruch.LayOutGraph(oGraph, oLayoutContext_Fruch);
                        break;
                    case "Sinusoid H Layout":
                        ILayout oLayout_SinH = new SinusoidHorizontalLayout();
                        LayoutContext oLayoutContext_SinH = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_SinH.LayOutGraph(oGraph, oLayoutContext_SinH);
                        break;
                    case "Sinusoid V Layout":
                        ILayout oLayout_SinV = new SinusoidVerticalLayout();
                        LayoutContext oLayoutContext_SinV = new LayoutContext(new System.Drawing.Rectangle(0, 0, (int)xdim, (int)ydim));
                        oLayout_SinV.LayOutGraph(oGraph, oLayoutContext_SinV);
                        break;

                }


                // Save the Nodes back out to the Firefly database
                // List the results.
                int xoffset = 0;
                int yoffset = 0;
                int size=10;
                double xx2, yy2,xx,yy;
                
                foreach (IVertex oVertex in oVertices)
                {
                    
                    UniversePadPoint p2 = new UniversePadPoint();

                    p2.PadName = oVertex.Name;
                    xx2 = oVertex.Location.X;
                    yy2 = oVertex.Location.Y;
                    xx2 = xx2 + xoffset;
                    yy2 = yy2 + yoffset;
                 
                    size = 10;
                                       
                    inserts = "insert into Nodes(id, nodename, networkid,x,y,z) values (" + oVertex.Tag.ToString() + ", '" + oVertex.Name.ToString() + "', '" + networkkey + "'," + xx2.ToString() + "," + yy2.ToString() + ",0)";
                    OleDbCommand postnode = new OleDbCommand(inserts, localenginecreate.RepositoryConnection);
                    OleDbDataReader Poster = postnode.ExecuteReader();
                    Poster.Close();

                }

                foreach (IEdge e2 in oEdges)
                {
                    IVertex f1 = e2.BackVertex;
                    IVertex t2 = e2.FrontVertex;
                    xx = f1.Location.X;
                    yy = f1.Location.Y;
                    xx2 = t2.Location.X;
                    yy2 = t2.Location.Y;

                    xx = xx + xoffset;
                    yy = yy + yoffset;
                    xx2 = xx2 + xoffset;
                    yy2 = yy2 + yoffset;

                    inserts = "insert into Edges(fromid, toid, networkid) values (" + f1.Tag.ToString() + ", " + t2.Tag.ToString() + ", '" + networkkey + "')";

                    OleDbCommand postedge = new OleDbCommand(inserts, localenginecreate.RepositoryConnection);
                    OleDbDataReader Poster = postedge.ExecuteReader();
                    Poster.Close();

                }

            }

            //Some usual exception handling
            catch (OleDbException eWriteNodes)
            {
                MessageBox.Show(eWriteNodes.Message);
                
            }
            localenginecreate.Close_Repository();
            MessageBox.Show("Done creating network.");

        }
        public void TestTransformLayoutBad()
        {
            // null graph.

            try
            {
            LayoutContext oLayoutContext = new LayoutContext(Rectangle.Empty);

            m_oFruchtermanReingoldLayout.TransformLayout(
                null, oLayoutContext, oLayoutContext);
            }
            catch (ArgumentNullException oArgumentNullException)
            {
            Assert.AreEqual(

                "Microsoft.NodeXL.Layouts.FruchtermanReingoldLayout."
                + "TransformLayout: graph argument can't be null.\r\n"
                + "Parameter name: graph"
                ,
                oArgumentNullException.Message
                );

            throw oArgumentNullException;
            }
        }
Esempio n. 28
0
        //*************************************************************************
        //  Method: LayOutGraphCore()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.  The graph is guaranteed to have at least one vertex.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCore(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            // Sort the vertices if necessary.

            if (m_oVertexSorter != null)
            {
            verticesToLayOut = m_oVertexSorter.Sort(verticesToLayOut);
            }

            return ( LayOutGraphCoreSorted(graph, verticesToLayOut, layoutContext,
            backgroundWorker) );
        }
Esempio n. 29
0
        //*************************************************************************
        //  Method: LayOutGraphCore()
        //
        /// <summary>
        /// Lays out a graph synchronously or asynchronously.
        /// </summary>
        ///
        /// <param name="graph">
        /// Graph to lay out.  The graph is guaranteed to have at least one vertex.
        /// </param>
        ///
        /// <param name="verticesToLayOut">
        /// Vertices to lay out.  The collection is guaranteed to have at least one
        /// vertex.
        /// </param>
        ///
        /// <param name="layoutContext">
        /// Provides access to objects needed to lay out the graph.  The <see
        /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
        /// width and height.
        /// </param>
        ///
        /// <param name="backgroundWorker">
        /// <see cref="BackgroundWorker" /> whose worker thread called this method
        /// if the graph is being laid out asynchronously, or null if the graph is
        /// being laid out synchronously.
        /// </param>
        ///
        /// <returns>
        /// true if the layout was successfully completed, false if the layout was
        /// cancelled.  The layout can be cancelled only if the graph is being laid
        /// out asynchronously.
        /// </returns>
        ///
        /// <remarks>
        /// This method lays out the graph <paramref name="graph" /> either
        /// synchronously (if <paramref name="backgroundWorker" /> is null) or
        /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
        /// by setting the the <see cref="IVertex.Location" /> property on the
        /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
        /// geometry metadata to the graph, vertices, or edges.
        ///
        /// <para>
        /// In the asynchronous case, the <see
        /// cref="BackgroundWorker.CancellationPending" /> property on the
        /// <paramref name="backgroundWorker" /> object should be checked before
        /// each layout iteration.  If it's true, the method should immediately
        /// return false.  Also, <see
        /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
        /// called after each iteration.
        /// </para>
        ///
        /// <para>
        /// The arguments have already been checked for validity.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        protected override Boolean LayOutGraphCore(
            IGraph graph,
            ICollection<IVertex> verticesToLayOut,
            LayoutContext layoutContext,
            BackgroundWorker backgroundWorker
            )
        {
            Debug.Assert(graph != null);
            Debug.Assert(verticesToLayOut != null);
            Debug.Assert(verticesToLayOut.Count > 0);
            Debug.Assert(layoutContext != null);
            AssertValid();

            if (backgroundWorker != null && backgroundWorker.CancellationPending)
            {
            return (false);
            }

            base.RandomizeVertexLocations(verticesToLayOut, layoutContext,
            new Random(), false);

            return (true);
        }
Esempio n. 30
0
 //*************************************************************************
 //  Method: LayOutGraphCoreSorted()
 //
 /// <summary>
 /// Lays out a graph synchronously or asynchronously using specified
 /// vertices that may be sorted.
 /// </summary>
 ///
 /// <param name="graph">
 /// Graph to lay out.
 /// </param>
 ///
 /// <param name="verticesToLayOut">
 /// Vertices to lay out.  The collection is guaranteed to have at least one
 /// vertex.
 /// </param>
 ///
 /// <param name="layoutContext">
 /// Provides access to objects needed to lay out the graph.  The <see
 /// cref="LayoutContext.GraphRectangle" /> is guaranteed to have non-zero
 /// width and height.
 /// </param>
 ///
 /// <param name="backgroundWorker">
 /// <see cref="BackgroundWorker" /> whose worker thread called this method
 /// if the graph is being laid out asynchronously, or null if the graph is
 /// being laid out synchronously.
 /// </param>
 ///
 /// <returns>
 /// true if the layout was successfully completed, false if the layout was
 /// cancelled.  The layout can be cancelled only if the graph is being laid
 /// out asynchronously.
 /// </returns>
 ///
 /// <remarks>
 /// This method lays out the graph <paramref name="graph" /> either
 /// synchronously (if <paramref name="backgroundWorker" /> is null) or
 /// asynchronously (if (<paramref name="backgroundWorker" /> is not null)
 /// by setting the the <see cref="IVertex.Location" /> property on the
 /// vertices in <paramref name="verticesToLayOut" /> and optionally adding
 /// geometry metadata to the graph, vertices, or edges.
 ///
 /// <para>
 /// In the asynchronous case, the <see
 /// cref="BackgroundWorker.CancellationPending" /> property on the
 /// <paramref name="backgroundWorker" /> object should be checked before
 /// each layout iteration.  If it's true, the method should immediately
 /// return false.  Also, <see
 /// cref="AsyncLayoutBase.FireLayOutGraphIterationCompleted()" /> should be
 /// called after each iteration.
 /// </para>
 ///
 /// <para>
 /// The arguments have already been checked for validity.
 /// </para>
 ///
 /// </remarks>
 //*************************************************************************
 protected abstract Boolean LayOutGraphCoreSorted(
     IGraph graph,
     ICollection<IVertex> verticesToLayOut,
     LayoutContext layoutContext,
     BackgroundWorker backgroundWorker
     );