[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtkusers
Subject:    [vtkusers] JFrame and vtkRenderWindow Panel InfoVis
From:       "Bladek, Anthony" <Anthony.Bladek () pnl ! gov>
Date:       2010-03-31 18:09:49
Message-ID: CAC238A56749FD4D8CB10BF161D9AF489225DEE4A8 () EMAIL06 ! pnl ! gov
[Download RAW message or body]

Thanks again.  I found those examples just after I wrote so I apologize for jumping \
the gun.  I followed the examples and got the JFrame and the Panel showing up just \
fine but there is no graph in the panel.   I just get the background image. I have \
tried the various ways that I have seen from the various examples \
(vtkRenderWindowPanel directly inside a JFrame,  vtkRenderWindowPanel inside a \
JPanel, which is inside a JFrame) but I still only get a background image.  The only \
difference I can see is that for this early test I did not create a class that \
extends JFrame. I just instantiated a JFrame directly in my main program.  I also \
only have one panel, neither of which should make a difference (I would think.)

My JFrame also refuses to close when the red X is clicked which I also don't \
understand but am ignoring assuming it is related to the fact I can't see my \
tree/graph. 

Any help pointing out my problem would be greatly appreciated.

Code below

//snip
Input to graphView is the output from GroupLeafVertices and worked just fine when \
displaying a vtkGraphLayoutView directly

		vtkGraphLayoutView graphView = new vtkGraphLayoutView();
		graphView.AddRepresentationFromInputConnection(vertices1.GetOutputPort()); 
		vtkRenderWindowPanel panel = new vtkRenderWindowPanel(graphView.GetRenderWindow());
		// configure the graphView	
		graphView.SetVertexLabelArrayName("Destination");
		graphView.SetEdgeLabelArrayName("Session Count");
		graphView.SetVertexLabelFontSize(14);
		graphView.VertexLabelVisibilityOn();
		graphView.SetEdgeLabelVisibility(true); 
		graphView.SetLayoutStrategyToCommunity2D();
		graphView.SetEdgeColorArrayName("Session Count"); 
		graphView.ColorEdgesOn(); 	
		graphView.ResetCamera();
	
		// set the size and background of the vtkRenderWindowPanel
		panel.setSize(600,600);
		panel.GetRenderer().SetBackground(0.8,0.8,0.8); 
		// get the JFrame
		final JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// set up in the interior JPanel
		JPanel mainPanel = new JPanel(); 
		mainPanel.setSize(600,600); 
		mainPanel.setBackground(Color.white);
		mainPanel.add(panel); 
		mainPanel.setVisible(true);
		

		frame.getContentPane().add("Center", mainPanel); 
		frame.setTitle("Test Tree"); 
		frame.getContentPane().setVisible(true);
		graphView.Update();
		panel.Render();
		graphView.ResetCamera(); 
	 	graphView.Render();
		frame.pack();
		frame.setVisible(true); 
		
		
		frame.addWindowListener(new WindowAdapter() {
		      @Override
		      public void windowClosing(WindowEvent e) {
		        // Calling vtkGlobalJavaHash.DeleteAll() will clean up
		        // VTK references before the Java program exits.
		        vtkGlobalJavaHash.DeleteAll();
		        frame.dispose(); 
		        System.exit(0); 
		      }
		    });
}

//end snip....
-----Original Message-----
From: Jeff Baumes [mailto:jeff.baumes@kitware.com] 
Sent: Wednesday, March 31, 2010 7:06 AM
To: Bladek, Anthony
Cc: vtkusers@vtk.org
Subject: Re: [vtkusers] Titan and graph/tree Infoviz

Take a look at the examples in

VTK-git/Examples/Infovis/Java

Jeff

On Tue, Mar 30, 2010 at 6:36 PM, Bladek, Anthony <Anthony.Bladek@pnl.gov> wrote:
> Jeff,
> Thanks for the help.  That worked great.  Now I have several other questions, if \
> you don't mind.  Is it possible to display a graph in a vtkPanel?  I've got some \
> great views using vtkGraphLayoutView but I need to integrate them along with some \
> other components into an application and I can't find an example with vtkPanel that \
> doesn't just add an image or shape to a panel. Do I need to use another method to \
> display my graph in a vtkPanel? (vtkGraphToPolyData?) 
> Along those same lines, I have also read that vtkPanel wrapper has some bugs which \
> make the SWING applications they are in crash during interaction. As far as I can \
> tell from the users group, they are in the process of fixing them. 
> On the other hand, I don't see any wrappers (or at least it is not in my vtk.jar) \
> for the QT to VTK methods. Are there any and I just didn't check the right box in \
> CMake?  If they exist, I thought I could use Jambi (QT in java) to get my interface \
> up and running. 
> I guess the bottom-line is what do recommend for integrating vtk and java into a \
> real application with multiple controls and panels as opposed to just creating a \
> graph and interacting with it in a single view (which is what I have done so far)? 
> Thanks...
> 
> Anthony
> 
> 
> 
> -----Original Message-----
> From: Jeff Baumes [mailto:jeff.baumes@kitware.com]
> Sent: Saturday, March 27, 2010 4:26 PM
> To: Bladek, Anthony
> Cc: vtkusers@vtk.org
> Subject: Re: [vtkusers] Titan and graph/tree Infoviz
> 
> Try adding the lines
> 
> reader.OutputPedigreeIdsOn();
> reader.GeneratePedigreeIdsOn();
> 
> This will add pedigree ids to your table, and the error should go
> away. GroupLeafVertices needs an array with ids in it to help in
> bookkeeping.
> 
> Jeff
> 
> On Fri, Mar 26, 2010 at 4:36 PM, Bladek, Anthony <Anthony.Bladek@pnl.gov> wrote:
> > All,
> > I am a new to vtk and the Titan extensions I am having trouble producing
> > a tree visualization.  Specifically, I am trying to use vtkGroupLeafVertices
> > based upon a table of data.  Much like the example shown in the slides from
> > Information_Visualization_in_VTK.ppt  (A Titan presentation) I have 3
> > columns in a table and I want the first level of the tree (past the root) to
> > be drawn from one column of the table and the next level to be drawn from
> > another column. As far as I can find there are no examples on how to set up
> > and use vtkGroupLeafVertices so I am at a bit of loss on how to start.    I
> > am using the java wrappers for VTK and here is what I have so far.
> > 
> > //snip
> > // read in the csv file
> > vtkDelimitedTextReader reader = new
> > vtkDelimitedTextReader();
> > reader.DetectNumericColumnsOn();
> > reader.SetFieldDelimiterCharacters(",");
> > reader.SetFileName(OutputConnectionCountGraphCSVFileName);
> > reader.SetHaveHeaders(true);
> > reader.Update();
> > 
> > // create a table
> > vtkTable table = reader.GetOutput();
> > int numCols = table.GetNumberOfColumns();
> > System.out.println("number of columns: " + numCols);
> > // turn it into a tree
> > vtkTableToTreeFilter treeFilter = new
> > vtkTableToTreeFilter();
> > treeFilter.SetInputConnection(reader.GetOutputPort());
> > treeFilter.Update();
> > vtkTree tree = new vtkTree();
> > tree = treeFilter.GetOutput();
> > 
> > int vertCount = tree.GetNumberOfVertices();
> > int edgeCount = tree.GetNumberOfEdges();
> > 
> > // group the vertices here
> > //don't have actually any idea how to set this up.
> > // code below produces error "Pedigree ids not assigned to
> > vertices on input graph."
> > // must be missing something.
> > vtkGroupLeafVertices vertices = new
> > vtk.vtkGroupLeafVertices();
> > vertices.SetInputConnection(treeFilter.GetOutputPort());
> > //input the tree
> > vertices.SetInputArrayToProcess(0,0,0,0, "Session
> > Count");//group by number of connections
> > vertices.SetInputArrayToProcess(1,0,0,0, "Source"); // then
> > by source
> > vertices.SetInputArrayToProcess(1,0,0,0, "Destination");
> > then by destination
> > vertices.Update();
> > 
> > //.. Put the vertices into the layout or view or ??
> > // end snip
> > 
> > Any help or any example to follow would be greatly appreciated.
> > 
> > Thanks.
> > 
> > Anthony
> > 
> > _______________________________________________
> > Powered by www.kitware.com
> > 
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > 
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > 
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> > 
> > 
> 
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: \
http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic