Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

36
LINES

< > BotCompany Repo | #1007169 // Test GraphStream with sprites (labels) [dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 970K of libraries. Click here for Pure Java version (63L/1K/2K).

!7

lib 1007168 // graphstream core 1.3

import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import org.graphstream.ui.spriteManager.*; // SpriteManager

p {
  Graph graph = new SingleGraph("Graph with sprites");

  graph.addNode("A");
  graph.addNode("B");
  graph.addNode("C");
  graph.addEdge("AB", "A", "B");
  graph.addEdge("BC", "B", "C");
  graph.addEdge("CA", "C", "A");
  
  SpriteManager sm = new SpriteManager(graph);
  /* This shows another node labelled "(0,0)" floating around.
	Sprite C = sm.addSprite("C");
	C.setPosition(0, 0, 0);
	C.setAttribute("ui.label", "(0,0)");
	*/
	Sprite s = sm.addSprite("Label for A");
	s.setPosition(0, 0, 0);
	s.setAttribute("ui.label", "Node A");
	s.attachToNode("A");
	
  s = sm.addSprite("Label for Edge AB");
	s.setAttribute("ui.label", "Edge AB");
	s.setPosition(0.5);
	s.attachToEdge("AB");

  graph.display();
}

Author comment

Began life as a copy of #1007167

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007169
Snippet name: Test GraphStream with sprites (labels) [dev.]
Eternal ID of this version: #1007169/6
Text MD5: ca4f39198b24624f8e9210af88874ac1
Transpilation MD5: 68d675585f88a7434e139f469e933f9a
Author: stefan
Category: javax / imaging
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-10 14:50:42
Source code size: 928 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 527 / 606
Version history: 5 change(s)
Referenced in: [show references]