提交 0f0da1be 编写于 作者: M Mathieu Bastian

Minor debug with graph visible

上级 1b4080c7
......@@ -97,14 +97,15 @@ public class ContextPanel extends javax.swing.JPanel {
@Override
public void run() {
Graph visibleGraph = model.getGraph(model.getVisibleView());
Graph fullGraph = model.getGraph(model.getVisibleView());
Graph visibleGraph = model.getGraphVisible();
Graph fullGraph = model.getGraph();
final int nodesFull = fullGraph.getNodeCount();
final int nodesVisible = visibleGraph.getNodeCount();
final int edgesFull = fullGraph.getEdgeCount();
final int edgesVisible = visibleGraph.getEdgeCount();
final GraphType graphType = model.isDirected() ? GraphType.DIRECTED : model.isUndirected() ? GraphType.UNDIRECTED : GraphType.MIXED;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String visible = NbBundle.getMessage(ContextPanel.class, "ContextPanel.visible");
String nodeText = String.valueOf(nodesVisible);
......
......@@ -69,7 +69,7 @@ public class ContextRefreshThread extends TimerTask {
private void initObserver() {
if (observer == null || observer.isDestroyed()) {
observer = graphModel.getGraphObserver(graphModel.getGraph(graphModel.getVisibleView()), false);
observer = graphModel.getGraphObserver(graphModel.getGraphVisible(), false);
}
}
......
......@@ -228,7 +228,7 @@ public class YifanHuLayout extends AbstractLayout implements Layout {
if (graphModel == null) {
return;
}
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
energy = Float.POSITIVE_INFINITY;
for (Node n : graph.getNodes()) {
n.setLayoutData(new ForceVector());
......@@ -247,7 +247,7 @@ public class YifanHuLayout extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
for (Node n : nodes) {
......
......@@ -46,10 +46,9 @@ import java.util.List;
import org.gephi.graph.api.Edge;
import org.gephi.graph.api.Graph;
import org.gephi.graph.api.Node;
import org.gephi.layout.plugin.AbstractLayout;
import org.gephi.layout.plugin.ForceVectorUtils;
import org.gephi.layout.plugin.ForceVectorNodeLayoutData;
import org.gephi.layout.plugin.ForceVectorUtils;
import org.gephi.layout.spi.Layout;
import org.gephi.layout.spi.LayoutBuilder;
import org.gephi.layout.spi.LayoutProperty;
......@@ -103,7 +102,7 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
this.graph = graphModel.getGraph(graphModel.getVisibleView());
this.graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
Edge[] edges = graph.getEdges().toArray();
......
......@@ -95,7 +95,7 @@ public class ForceAtlas2 implements Layout {
public void initAlgo() {
speed = 1.;
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
......@@ -124,7 +124,7 @@ public class ForceAtlas2 implements Layout {
if (graphModel == null) {
return;
}
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
......@@ -384,7 +384,7 @@ public class ForceAtlas2 implements Layout {
int nodesCount = 0;
if (graphModel != null) {
nodesCount = graphModel.getGraph(graphModel.getVisibleView()).getNodeCount();
nodesCount = graphModel.getGraphVisible().getNodeCount();
}
// Tuning
......
......@@ -85,7 +85,7 @@ public class FruchtermanReingold extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
this.graph = graphModel.getGraph(graphModel.getVisibleView());
this.graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
Edge[] edges = graph.getEdges().toArray();
......
......@@ -87,7 +87,7 @@ public class LabelAdjust extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
this.graph = graphModel.getGraph(graphModel.getVisibleView());
this.graph = graphModel.getGraphVisible();
graph.readLock();
Node[] nodes = graph.getNodes().toArray();
......
......@@ -76,7 +76,7 @@ public class RandomLayout extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
for (Node n : graph.getNodes()) {
n.setX((float) (-size / 2 + size * random.nextDouble()));
n.setY((float) (-size / 2 + size * random.nextDouble()));
......
......@@ -73,7 +73,7 @@ public class RotateLayout extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
double sin = Math.sin(getAngle() * Math.PI / 180);
double cos = Math.cos(getAngle() * Math.PI / 180);
double px = 0f;
......
......@@ -73,7 +73,7 @@ public class ScaleLayout extends AbstractLayout implements Layout {
@Override
public void goAlgo() {
graph = graphModel.getGraph(graphModel.getVisibleView());
graph = graphModel.getGraphVisible();
double xMean = 0, yMean = 0;
for (Node n : graph.getNodes()) {
xMean += n.x();
......
......@@ -113,7 +113,7 @@ public class ActionsToolbar extends JToolBar {
color = resetColorButton.getColor();
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph(gm.getVisibleView());
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.setR(color.getRed() / 255f);
n.setG(color.getGreen() / 255f);
......@@ -139,7 +139,7 @@ public class ActionsToolbar extends JToolBar {
public void actionPerformed(ActionEvent e) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph(gm.getVisibleView());
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.setSize(size);
}
......@@ -171,7 +171,7 @@ public class ActionsToolbar extends JToolBar {
public void actionPerformed(ActionEvent evt) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph(gm.getVisibleView());
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes().toArray()) {
n.getTextProperties().setColor(null);
}
......@@ -191,7 +191,7 @@ public class ActionsToolbar extends JToolBar {
public void actionPerformed(ActionEvent evt) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph(gm.getVisibleView());
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.getTextProperties().setVisible(true);
}
......@@ -211,7 +211,7 @@ public class ActionsToolbar extends JToolBar {
public void actionPerformed(ActionEvent e) {
GraphController gc = Lookup.getDefault().lookup(GraphController.class);
GraphModel gm = gc.getGraphModel();
Graph graph = gm.getGraph(gm.getVisibleView());
Graph graph = gm.getGraphVisible();
for (Node n : graph.getNodes()) {
n.getTextProperties().setSize(1f);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册