Package org.graphstream.ui.graphicGraph

Examples of org.graphstream.ui.graphicGraph.GraphicGraph


      Resolution resolution, OutputPolicy outputPolicy) {
    this.resolution = resolution;
    this.outputType = type;
    this.filePrefix = prefix;
    this.counter = 0;
    this.gg = new GraphicGraph(prefix);
    this.postRenderers = new LinkedList<PostRenderer>();
    this.layoutPolicy = LayoutPolicy.NO_LAYOUT;
    this.layout = null;
    this.optLayout = null;
    this.layoutPipeIn = null;
View Full Code Here


   * @param source
   *            The source of graph events.
   */
  public Viewer(ProxyPipe source) {
    graphInAnotherThread = true;
    init(new GraphicGraph(newGGId()), source, (Source) null);
  }
View Full Code Here

   */
  public Viewer(Graph graph, ThreadingModel threadingModel) {
    switch (threadingModel) {
    case GRAPH_IN_GUI_THREAD:
      graphInAnotherThread = false;
      init(new GraphicGraph(newGGId()), (ProxyPipe) null, graph);
      enableXYZfeedback(true);
      break;
    case GRAPH_IN_ANOTHER_THREAD:
      graphInAnotherThread = true;
     
      ThreadProxyPipe tpp = new ThreadProxyPipe();
      tpp.init(graph, true);

      init(new GraphicGraph(newGGId()), tpp, (Source) null);
      enableXYZfeedback(false);
      break;
    case GRAPH_ON_NETWORK:
      throw new RuntimeException("TO DO, sorry !:-)");
    }
View Full Code Here

  protected static String formatId(String id) {
    return "node" + id.replaceAll("\\W", "_");
  }

  public FileSinkTikZ() {
    buffer = new GraphicGraph("tikz-buffer");
  }
View Full Code Here

    protected Timer timer;

    public InTheSwingThread(ThreadProxyPipe input) {
      fromMain = input;
      graphic = new GraphicGraph("gg");
      timer = new Timer(40, this);

      timer.setRepeats(true);
      timer.setCoalesce(true);
      input.addSink(graphic);
View Full Code Here

    // ****************************************************************************************
    // Now we can begin the real test. We ensure the timer in the Swing
    // graph stopped and check
    // If the two graphs (main and graphic) synchronized correctly.

    GraphicGraph graphic = viewerThread.graphic;

    assertTrue(viewerThread.isStopped());
    assertFalse(main.hasAttribute("ui.EQUIP"));
    assertFalse(graphic.hasAttribute("ui.EQUIP"));
    assertTrue(main.hasAttribute("ui.STOP"));
    assertTrue(graphic.hasAttribute("ui.STOP"));

    assertEquals(3, graphic.getStep(), 0);
    assertEquals(2, main.getStep(), 0); // We do not listen at elements events
                      // the step 3
                      // of the graphic graph did not
                      // reached us.
    // Assert all events passed toward the graphic graph.

    assertEquals(3, graphic.getNodeCount());
    assertEquals(3, graphic.getEdgeCount());
    assertEquals(3, graphic.getSpriteCount());
    assertNotNull(graphic.getNode("A"));
    assertNotNull(graphic.getNode("B"));
    assertNotNull(graphic.getNode("C"));
    assertNotNull(graphic.getEdge("AB"));
    assertNotNull(graphic.getEdge("BC"));
    assertNotNull(graphic.getEdge("CA"));
    assertNotNull(graphic.getSprite("S1"));
    assertNotNull(graphic.getSprite("S2"));
    assertEquals("bar", graphic.getNode("A").getAttribute("ui.foo"));
    assertEquals("foo", graphic.getNode("B").getAttribute("ui.bar"));
    // assertNull( graphic.getNode("C").getAttribute( "truc" ) ); // Should
    // not pass the attribute filter.
    assertEquals("bar", graphic.getSprite("S1").getAttribute("ui.foo"));
    assertEquals("bar", sman.getSprite("S1").getAttribute("ui.foo"));

    // Assert attributes passed back to the graph from the graphic graph.

    Object xyz1[] = { 4, 3, 2 };
    Object xyz2[] = { 2, 1, 0 };
    Object xyz3[] = { 3, 2, 1 };

    assertArrayEquals(xyz1, (Object[]) main.getNode("A")
        .getAttribute("xyz"));
    assertArrayEquals(xyz2, (Object[]) main.getNode("B")
        .getAttribute("xyz"));
    assertArrayEquals(xyz3, (Object[]) main.getNode("C")
        .getAttribute("xyz"));

    assertEquals("foobar", S2.getAttribute("ui.foobar"));

    GraphicSprite gs3 = graphic.getSprite("S3");

    assertEquals(0.5f, S1.getX(),0);
    assertEquals(0, S1.getY(),0);
    assertEquals(0, S1.getZ(),0);
    assertEquals(1, S2.getX(),0);
View Full Code Here

TOP

Related Classes of org.graphstream.ui.graphicGraph.GraphicGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.