I'm trying to add a plugin to an existing application which displays a graph that is built from scratch. I've run the example code without a problem, even modified it. However, when using the new graph, it is not displayed and I repeatedly get the following warning:
WARNING: Union with invalid clip region: java.awt.geom.Rectangle2D$Double[x=NaN,y=NaN,w=NaN,h=NaN] <<<< Clip.union(..) [Thread 19]
Sometimes instead of "NaN" there is "INFINITY".
At first I thought it was because I'm using a JPanel and not a JFrame like in the example, but changing to JFrame did not help.
What does this warning mean? What am I doing wrong?
This is my code:
static Visualization graph_visualization;
privateVisualizationgetGraphVisualization(Graphgraph){Visualizationvis=newVisualization();vis.add("graph",graph);vis.setInteractive("graph.edges",null,false);returnvis;}privateVisualizationsetGraphVisualizationParams(Visualizationvis){// draw the "name" label for NodeItemsLabelRendererr=newLabelRenderer(UnderlyingGraph.AUTHOR);r.setRoundedCorner(8,8);// round the corners//draw edgesEdgeRendererer=newEdgeRenderer(Constants.EDGE_TYPE_CURVE);// create a new default renderer factoryDefaultRendererFactoryrf=newDefaultRendererFactory();rf.setDefaultRenderer(r);rf.setDefaultEdgeRenderer(er);vis.setRendererFactory(rf);//adding colorsColorActionfill=newColorAction("graph.nodes",VisualItem.FILLCOLOR,ColorLib.rgb(190,190,255));ColorActiontext=newColorAction("graph.nodes",VisualItem.TEXTCOLOR,ColorLib.gray(0));ColorActionedges=newColorAction("graph.edges",VisualItem.STROKECOLOR,ColorLib.gray(200));// create an action list containing all color assignmentsActionListcolor=newActionList();color.add(fill);color.add(text);color.add(edges);// create an action list with an animated layoutActionListlayout=newActionList(Activity.INFINITY);layout.add(newMyForceDirectedLayout("graph"));layout.add(newRepaintAction());//create size actionsActionListsize=newActionList();size.add(newDataSizeAction("graph.nodes",UnderlyingGraph.DEGREE));size.add(newSizeAction("graph.edges",3));//creating a fixed action to fix lone nodesActionListfixNodes=newActionList();fixNodes.add(newMyItemAction());// add the actions to the visualizationvis.putAction(COLOR,color);vis.putAction(LAYOUT,layout);vis.putAction(SIZE,size);vis.putAction(FIX_NODES,fixNodes);returnvis;}privateDisplaygetGraphDisplay(Visualizationvis){Displayd=newDisplay(vis);d.setSize(720,500);// set display sized.setBounds(0,0,720,500);// drag individual items aroundd.addControlListener(newDragControl());// pan with left-click drag on backgroundd.addControlListener(newPanControl());// zoom with right-click dragd.addControlListener(newZoomControl());// changing item colors when mouse overd.addControlListener(newMyControlAdapter(vis));returnd;}//fixing all nodes without visible edgesprivatestaticvoidsetFixedNodes(Graphgraph,Visualizationvis){Iteratornodes=graph.nodes();while(nodes.hasNext()){Nodenode=(Node)nodes.next();VisualItemvisualNode=vis.getVisualItem("graph.nodes",node);booleanisFixed=true;//checking if an adjacent edge is visibleIteratoredges=node.edges();while(edges.hasNext()){Edgeedge=(Edge)edges.next();VisualItemvisualEdge=vis.getVisualItem("graph.edges",edge);if(visualEdge.isVisible()){isFixed=false;break;}}visualNode.setFixed(isFixed);}}privatevoidshowGraph(){graph_visualization=getGraphVisualization(graph);graph_visualization=setGraphVisualizationParams(graph_visualization);Displaygd=getGraphDisplay(graph_visualization);this.add(gd,BorderLayout.CENTER);this.setVisible(true);this.updateUI();graph_visualization.run(COLOR);graph_visualization.run(LAYOUT);graph_visualization.run(SIZE);graph_visualization.run(FIX_NODES);}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to add a plugin to an existing application which displays a graph that is built from scratch. I've run the example code without a problem, even modified it. However, when using the new graph, it is not displayed and I repeatedly get the following warning:
WARNING: Union with invalid clip region: java.awt.geom.Rectangle2D$Double[x=NaN,y=NaN,w=NaN,h=NaN] <<<< Clip.union(..) [Thread 19]
Sometimes instead of "NaN" there is "INFINITY".
At first I thought it was because I'm using a JPanel and not a JFrame like in the example, but changing to JFrame did not help.
What does this warning mean? What am I doing wrong?
This is my code:
static Visualization graph_visualization;