mastodon-sc / mastodon

Mastodon – a large-scale tracking and track-editing framework for large, multi-view images.
BSD 2-Clause "Simplified" License
67 stars 20 forks source link

ADD: ability to adjust graph model, not only reset it. #78

Closed xulman closed 2 years ago

xulman commented 5 years ago

The standard way to pause model listeners and "lock" the model for changes is via

new AbstractModelImporter< Model >(pluginAppModel.getAppModel().getModel()) {{ startImport(); }};
//my code here
new AbstractModelImporter< Model >(pluginAppModel.getAppModel().getModel()) {{ finishImport(); }};

But startImport involves cleaning of the model... since I was blind to find how to only update the model without cleaning it first, I propose this PR.

xulman commented 5 years ago

hmm, I haven't actually checked for something like AbstractModelUpdater.... (first ask before shoot, I know... sorry)

xulman commented 3 years ago

Hi, I've revamped this piece. It's been rebased to the latest master.

I could use such "official" way to pause listeners when updating graph, the original code was always clearing the graph. V.

tinevez commented 3 years ago

As suggested by Tobias elsewhere, another option would be to allow for controlling the listeners. Like have something like:

model.listeners().pause(); // pseudo code hein
try
{
    // Add, remove, do plenty of things in bulk
}
finally
{
    model.listeners().resume(); // fire listeners if a change happen.
}

What would you favor?

tinevez commented 2 years ago

@xulman do you still need this?