Tuesday, November 15, 2011 2:22 PMHi
I have some work to do on the web and your library would seem to be everything I need - but I can't get what I need to work from the samples.
I want to provide the boundaries of the web page - i.e. 1000 wide x 600 high - and then supply nodes and edges and for it to calculate where best to place the nodes.
Probably wrongly I'm attempting to set the BoundingBox width and height values - but also done top, left, bottom, right - then I'm adding 2 nodes and an edge connecting them and calling CalculateLayout on the GeometryGraph object and the BoundingBox values are getting reset by the call and when I use the Node points to draw my output, the nodes get drawn off the bottom of the screen.
Also I'm using the CSS values of top and left to place the nodes on the form because I need to use DIVs in HTML to render the topology style graph I'm writing.
Would you have something that could help with my problem please?
Tuesday, November 15, 2011 11:11 PMOwner
You are right. CalculateLayout will reset GeometryGraph.BoundingBox. Usually the GeometryGraph will be too big, or too small, or too wide, or to narrow for your drawing area. Please have a look at the DrawingFromMsaglGraph sample. In this sample the function SetGraphicsTransform sets the transform for the Graphics object in order to correctly position the GeometryGraph on the form. You should follow the same idea in my opinion.
- Marked As Answer by Lev NachmansonOwner Tuesday, November 15, 2011 11:11 PM
Wednesday, November 16, 2011 3:47 PM
OK but the ASP.net page is not going to have this Graphics object so are you suggesting I create one to let the transform happen? A kind of dummy canvas to work out the output then.
And then I need to call CalculateLayout using the GeometryGraph but to ignore that and then write another method passing in the output to get the coordinates of where this canvas draws them to decide how to position my Divs on the page?
Have I got the basic idea of what you're suggesting there?
Wednesday, November 16, 2011 6:21 PMOwner
Yes, that the idea. You would need to transform the GeometryGraph coordinates to fit into your rectangle. Unfortunately, in this version of MSAGL I don't have a method that creates a graph fitting into a given rectangle in advance.