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

Update grapher after changes #342

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
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 @@ -186,6 +186,9 @@ public class GrapherInitializer< V extends Vertex< E > & HasTimepoint & HasLabel

// Label listener
appModel.getModel().getGraph().addVertexLabelListener( vertex -> panel.entitiesAttributesChanged() );

// Add a listener to detect changes in the graph and trigger a re-plot of the Grapher View
model.getGraph().addGraphChangeListener( frame::plot );
}

void setOnClose( final MamutViewI view )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public class DataDisplayFrame< V extends Vertex< E > & HasTimepoint & HasLabel,

private final GrapherSidePanel sidePanel;

private final FeatureModel featureModel;

public DataDisplayFrame(
final DataGraph< V, E > graph,
final FeatureModel featureModel,
Expand Down Expand Up @@ -107,12 +109,14 @@ public DataDisplayFrame(
final Class< V > vertexClass = graph.getGraphIdBimap().vertexIdBimap().getRefClass();
final Class< E > edgeClass = graph.getGraphIdBimap().edgeIdBimap().getRefClass();

this.featureModel = featureModel;

/*
* Side panel.
*/

sidePanel = new GrapherSidePanel( nSources, contextChooser );
sidePanel.getBtnPlot().addActionListener( e -> dataDisplayPanel.plot( sidePanel.getGraphConfig(), featureModel ) );
sidePanel.getBtnPlot().addActionListener( e -> plot() );

final FeatureModelListener featureModelListener = () -> sidePanel.setFeatures(
FeatureUtils.collectFeatureMap( featureModel, vertexClass ),
Expand Down Expand Up @@ -182,4 +186,9 @@ public GrapherSidePanel getVertexSidePanel()
{
return sidePanel;
}

public void plot()
{
dataDisplayPanel.plot( sidePanel.getGraphConfig(), featureModel );
}
}
Loading