Package org.graphstream.ui.geom

Examples of org.graphstream.ui.geom.Point3


        else
          delta = camera.getGraphDimension() * 0.01f;

        delta *= camera.getViewPercent();

        Point3 p = camera.getViewCenter();
        camera.setViewCenter(p.x - delta, p.y, 0);
      }
    } else if (event.getKeyCode() == KeyEvent.VK_RIGHT) {
      if ((event.getModifiers() & KeyEvent.ALT_MASK) != 0) {
        double r = camera.getViewRotation();
        camera.setViewRotation(r + 5);
      } else {
        double delta = 0;

        if ((event.getModifiers() & KeyEvent.SHIFT_MASK) != 0)
          delta = camera.getGraphDimension() * 0.1f;
        else
          delta = camera.getGraphDimension() * 0.01f;

        delta *= camera.getViewPercent();

        Point3 p = camera.getViewCenter();
        camera.setViewCenter(p.x + delta, p.y, 0);
      }
    } else if (event.getKeyCode() == KeyEvent.VK_UP) {
      double delta = 0;

      if ((event.getModifiers() & KeyEvent.SHIFT_MASK) != 0)
        delta = camera.getGraphDimension() * 0.1f;
      else
        delta = camera.getGraphDimension() * 0.01f;

      delta *= camera.getViewPercent();

      Point3 p = camera.getViewCenter();
      camera.setViewCenter(p.x, p.y + delta, 0);
    } else if (event.getKeyCode() == KeyEvent.VK_DOWN) {
      double delta = 0;

      if ((event.getModifiers() & KeyEvent.SHIFT_MASK) != 0)
        delta = camera.getGraphDimension() * 0.1f;
      else
        delta = camera.getGraphDimension() * 0.01f;

      delta *= camera.getViewPercent();

      Point3 p = camera.getViewCenter();
      camera.setViewCenter(p.x, p.y - delta, 0);
    }
  }
View Full Code Here


     * double)
     */
    public Point3 transformPxToGu(double x, double y) {
        Point2D.Double p = new Point2D.Double(x, y);
        xT.transform(p, p);
        return new Point3(p.x, p.y, 0);
    }
View Full Code Here

     * @see org.graphstream.ui.swingViewer.util.Camera#transform(double, double)
     */
    public Point3 transformGuToPx(double x, double y, double z) {
        Point2D.Double p = new Point2D.Double(x, y);
        Tx.transform(p, p);
        return new Point3(p.x, p.y, 0);
    }
View Full Code Here

  public double getZ() {
    return z;
  }

  protected Point3 getPosition() {
    return new Point3(x, y, z);
  }
View Full Code Here

      fpsLog.printf("%.3f   %d   %.3f%n", fps, time, (sumFps / steps));
    }
  }

  public void moveElementAtPx(GraphicElement element, double x, double y) {
    Point3 p = camera.transformPxToGu(camera.getMetrics().viewport[0] + x,
        camera.getMetrics().viewport[1] + y);
    element.move(p.x, p.y, element.getZ());
  }
View Full Code Here

    String label = element.getLabel();
   
    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;
View Full Code Here

    int nedges = graph.getEdgeCount();
    double avgDist = 0;
    double edgesDists[] = new double[nedges];
    for(int i=0; i<nedges; i++) {
      Edge edge = graph.getEdge(i);
      Point3 posFrom = GraphPosLengthUtils.nodePointPosition(edge.getNode0());
      Point3 posTo   = GraphPosLengthUtils.nodePointPosition(edge.getNode1());
      edgesDists[i= posFrom.distance(posTo);
      avgDist       += edgesDists[i];
    }
    avgDist /= nedges;
    // Nothing happened to the graph so the order remains.
View Full Code Here

TOP

Related Classes of org.graphstream.ui.geom.Point3

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.