TransformLayoutCore
        (
            IGraph graph,
            LayoutContext originalLayoutContext,
            LayoutContext newLayoutContext
        )
        {
            Debug.Assert(graph != null);
            Debug.Assert(originalLayoutContext != null);
            Debug.Assert(newLayoutContext != null);
            AssertValid();

            // We want the graph to remain stationary, with the polar origin always
            // at the center of the graph rectangle.  Also, no scaling should occur
            // as the window changes size.

            Rectangle oOriginalGraphRectangle =
                originalLayoutContext.GraphRectangle;

            Rectangle oNewGraphRectangle =
                newLayoutContext.GraphRectangle;

            Matrix oMatrix = new Matrix();

            oMatrix.Translate(
                (oNewGraphRectangle.Width - oOriginalGraphRectangle.Width) / 2F,
                (oNewGraphRectangle.Height - oOriginalGraphRectangle.Height) / 2F
                );

            LayoutUtil.TransformVertexLocations(graph, oMatrix);
        }
Example #2
0
        TransformLayoutCore
        (
            IGraph graph,
            LayoutContext originalLayoutContext,
            LayoutContext newLayoutContext
        )
        {
            Debug.Assert(graph != null);
            Debug.Assert(originalLayoutContext != null);
            Debug.Assert(newLayoutContext != null);
            AssertValid();

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

            LayoutUtil.TransformVertexLocations(graph, oTransformationMatrix);
        }