Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add access to Links to AbstractExampleGraph #284

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@

import javax.annotation.Nonnull;

import org.mastodon.mamut.model.Link;
import org.mastodon.mamut.model.Model;
import org.mastodon.mamut.model.ModelGraph;
import org.mastodon.mamut.model.Spot;
import org.mastodon.mamut.model.branch.BranchLink;
import org.mastodon.mamut.model.branch.BranchSpot;
import org.mastodon.mamut.model.branch.ModelBranchGraph;

Expand Down Expand Up @@ -70,6 +72,12 @@ public BranchSpot getBranchSpot(@Nonnull Spot spot)
return modelBranchGraph.getBranchVertex( spot, modelBranchGraph.vertexRef() );
}

public BranchLink getBranchLink( @Nonnull Link link )
{
rebuiltGraphIfRequired();
return modelBranchGraph.getBranchEdge( link, modelBranchGraph.edgeRef() );
}

private void rebuiltGraphIfRequired()
{
if ( ! branchGraphRequiresRebuild )
Expand All @@ -87,9 +95,10 @@ protected Spot addNode( @Nonnull String label, int timepoint, double[] xyz )
return spot;
}

protected void addEdge( @Nonnull Spot source, @Nonnull Spot target )
protected Link addEdge( @Nonnull Spot source, @Nonnull Spot target )
{
modelGraph.addEdge( source, target );
Link link = modelGraph.addEdge( source, target );
branchGraphRequiresRebuild = true;
return link;
}
}
Loading