Package org.graphstream.ui.graphicGraph

Examples of org.graphstream.ui.graphicGraph.GraphicSprite


  }

  @Override
  protected void renderElement(StyleGroup group, Graphics2D g, Camera camera,
      GraphicElement element) {
    GraphicSprite sprite = (GraphicSprite) element;
    Point2D.Double pos = ((DefaultCamera) camera).getSpritePosition(sprite,
        new Point2D.Double(), StyleConstants.Units.GU);

    shape.setFrame(pos.x - w2, pos.y - h2, width, height);
    g.fill(shape);
View Full Code Here


   
    if (label != null && group.getTextMode() != StyleConstants.TextMode.HIDDEN
        && group.getTextVisibilityMode() != StyleConstants.TextVisibilityMode.HIDDEN) {

      Point3 p = null;
      GraphicSprite s = null;
      Point2D.Double pos = null;

      if (element instanceof GraphicSprite) {
        s   = (GraphicSprite) element;
        pos = ((DefaultCamera) camera).getSpritePosition(s,
          new Point2D.Double(), StyleConstants.Units.GU);
      }

      if (pos != null && s.getUnits() == Units.PX) {
        double w = camera.getMetrics().lengthToPx(group.getSize(),
            0);
        p = camera.transformGuToPx(pos.x, pos.y, 0);
        p.x += w/2;
      } else if (s != null && s.getUnits() == Units.PERCENTS) {
        double w = camera.getMetrics().lengthToPx(group.getSize(),
            0);
        p = camera.transformGuToPx(camera.getMetrics().viewport[2] * pos.x,
          camera.getMetrics().viewport[3] *  pos.y, 0);
        p.x += (w/2);
View Full Code Here

    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);
    assertEquals(2, S2.getY(),0);
    assertEquals(3, S2.getZ(),0);

    assertEquals(3, gs3.getX(),0);
    assertEquals(2, gs3.getY(),0);
    assertEquals(1, gs3.getZ(),0);
  }
View Full Code Here

        if (B != null)
          B.addAttribute("xyz", 2, 1, 0);
        if (C != null)
          C.addAttribute("xyz", 3, 2, 1);

        GraphicSprite S1 = graphic.getSprite("S1");
        GraphicSprite S2 = graphic.getSprite("S2");

        if (S2 != null) {
          S2.addAttribute("ui.foobar", "foobar");
          S2.setPosition(1, 2, 3, Style.Units.GU);
        }

        if (S1 != null)
          S1.setPosition(0.5f);
View Full Code Here

TOP

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

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.