Node Spacing

Hi Again,

I have a question regarding a node spacing algorithm…

I would like to implement a node spacing algorithm that separates nodes from each other by some user-definable number of pixels (say 10 pixels (height and width) as a starting (default) value). I don’t want the algorithm to drastically change the node layout, I just want to nudge the nodes apart but keep the general node layout intact.

The nodes are all rectangular but of varying heights and widths. I already have a node spacing algorithm that places the nodes in rows/columns but this algorithm really changes the node layout and applies to much white space around some of the smaller nodes. The node spacing algorithm I’m describing would need to operate both for objects on the goview as well as for objects inside of a subgraph - The same algorithm would need to apply in either case.

I got to thinking about how to do this and decided that the algorithm would not be easy, which is why I’m posting here. I’d be happy to know the simple solution if there is one. Does GoDiagrams already have a node spacing algorithm similar to what I’ve described?

Thanks in advance.

R. Houston.

No, I don’t think it does. The closest thing is what GoPalette does, but I don’t know if it’s what you want.

Thanks Walter,

I’m not using the Gopalette, unfortunately, so I’m not sure how I could use that functionality you mention.

How about the ability to apply a background grid to the goview that supports a “snap-to-grid” function? For example, could I introduce a very high fidelity grid (i.e., many rows and columns tightly spaced) to the GoView after objects had already been drawn (on the Goview) and then instruct each object to ‘snap-to-grid’ (at the intersection of a row/column)? Because of the tight spacing between grid rows and grid columns this could effectively nudge the objects apart, provided that I write a method to compute which grid row/column intersection (point) was the best for placing each object. Could something like this work?

Can you think of an even simpler approach for nudging objects apart?


R. Houston

Sure, that would have the effect of lots of small horizontal and vertical “tab stops” that would tend to align similar sized nodes, I would think.