none
Graph Bounding Box

    Question

  • Hi Lev,

    I modified the sample project DrawingFromGeometryGraphSample such that it only has 1 node (i.e. the ellipse) and no edges. After calling graph.CalculateLayout, I noticed the bounding box for the graph have UpperLeft and LowerRight coordinates of (-20.5, 530.5) and (20.5 499.5) respectively. How can I make the layout system:

    1. Utilize positive coordinates only.

    2. Optimize space usage (instead of laying out the ellipse all the way out at Y = 530.5, have it layed out somewhere closer to Y = 0)

     

    Thank you

     


    • Edited by exx Wednesday, December 28, 2011 10:57 PM
    Wednesday, December 28, 2011 10:55 PM

Answers

  • Please use the method  GeometryGraph.Translate to move the graph into the positive quadrant.

    It would be graph.Translate(-graph.BoundingBox.LeftBottom). If you want only positive coordinates then you need to shift a bit more.

    You are right; Node.Padding is not used!

    Thanks,

    Lev


    Lev Nachmanson
    Thursday, December 29, 2011 7:00 PM
    Owner

All replies

  • On a related note, how does one use the Node.Padding property? In the same DrawingFromGeometryGraphSample, setting the Padding property on the ellipse:

     

    Node a = new Node("a", new Ellipse(w, h, new P()));
    a.Padding = 100;

     

    does not seem to do anything.

     

    Thanks

    Wednesday, December 28, 2011 11:47 PM
  • Please use the method  GeometryGraph.Translate to move the graph into the positive quadrant.

    It would be graph.Translate(-graph.BoundingBox.LeftBottom). If you want only positive coordinates then you need to shift a bit more.

    You are right; Node.Padding is not used!

    Thanks,

    Lev


    Lev Nachmanson
    Thursday, December 29, 2011 7:00 PM
    Owner
  • You thought of everything :) Thanks a lot Lev
    Friday, December 30, 2011 1:24 AM