scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
68 stars 17 forks source link

Make node publication API slicker #489

Open ctrueden opened 1 year ago

ctrueden commented 1 year ago

Right now the pattern is:

var v = sciview.addVolume(...)
v.addChild(mesh)
sciview.publishNode(mesh)

Would be nice if there were an API to make this pattern emerge automatically, by rolling the publication into one of the other API calls or some such.

If the idea is to "build up" the volume's structure before publishing the finished product, maybe we could use a builder pattern, or some kotlinesque/functional thing?

var v = sciview.addVolume(...).withConfig { it.addChild(mesh) }

Such that publication happens when the withConfig finishes? There are surely a few different ways to pet this particular cat, just wondering if we can reduce the chance of forgetting to publish after setting things up.

moreApi commented 1 year ago

https://github.com/scenerygraphics/sciview/pull/433 this already cleans up the addVolume methods. Maybe this issue could also be resolved there.

moreApi commented 1 year ago

https://github.com/scenerygraphics/sciview/issues/497 related

kephale commented 9 months ago

I think it might be possible to close this since #497

kephale commented 5 months ago

@ctrueden is this closable?

ctrueden commented 5 months ago

I haven't had time to play with the revised API yet, but would defer to others on whether they think it's friendly enough now.