Package org.graphstream.ui.geom

Examples of org.graphstream.ui.geom.Point3


      v0 = Float.parseFloat(n0);
      v1 = Float.parseFloat(n1);
      v2 = Float.parseFloat(n2);

      return new Point3(v0, v1, v2);
    }

    throw new NumberFormatException("value '" + value
        + "' not in a valid point3 format");
  }
View Full Code Here


    if (gg.getNodeCount() > 0) {
      if (autofit) {
        gg.computeBounds();

        Point3 lo = gg.getMinPos();
        Point3 hi = gg.getMaxPos();

        renderer.getCamera().setBounds(lo.x, lo.y, lo.z, hi.x, hi.y,
            hi.z);
      }
View Full Code Here

    // NOP
  }

  public void edgeAdded(String graphId, long timeId, String edgeId,
      String fromNodeId, String toNodeId, boolean directed) {
    Point3 p0 = nodePos.get(fromNodeId);
    Point3 p1 = nodePos.get(toNodeId);

    if (p0 != null && p1 != null) {
      out.printf("  <g id=\"%s\">%n", edgeId);
      out.printf("    <line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\"/>%n",
          p0.x, p0.y, p1.x, p1.y);
View Full Code Here

  public void graphCleared(String graphId, long timeId) {
    // NOP
  }

  public void nodeAdded(String graphId, long timeId, String nodeId) {
    nodePos.put(nodeId, new Point3());
  }
View Full Code Here

  }

  // Utility

  protected void setNodePos(String nodeId, String attribute, Object value) {
    Point3 p = nodePos.get(nodeId);

    if (p == null) {
      p = new Point3((float) Math.random(), (float) Math.random(), 0f);
      nodePos.put(nodeId, p);
    }

    if (attribute.equals("x")) {
      if (value instanceof Number)
View Full Code Here

  protected void outputNodes() {
    Iterator<? extends String> keys = nodePos.keySet().iterator();

    while (keys.hasNext()) {
      String key = keys.next();
      Point3 pos = nodePos.get(key);

      out.printf("  <g id=\"%s\">%n", key);
      out.printf("    <circle cx=\"%f\" cy=\"%f\" r=\"4\"/>%n", pos.x,
          pos.y);
      out.printf("  </g>%n");
View Full Code Here

   */
  protected void computeGraphMetrics() {
    graph.computeBounds();

    synchronized (views) {
      Point3 lo = graph.getMinPos();
            Point3 hi = graph.getMaxPos();
      for (final View view : views.values()) {
                Camera camera = view.getCamera();
                if (camera != null) {
                    camera.setBounds(lo.x, lo.y, lo.z, hi.x, hi.y, hi.z);
                }
View Full Code Here

   *            The node to consider.
   * @return A newly allocated point containing the (x,y,z)
   *         position of the node.
   */
  public static Point3 nodePointPosition(Node node) {
    Point3 pos = new Point3();

    nodePosition(node, pos);

    return pos;
  }
View Full Code Here

      Number oo[] = (Number[]) o;
      if(oo.length > 0) xyz[0] = oo[0].doubleValue();
      if(oo.length > 1) xyz[1] = oo[1].doubleValue();
      if(oo.length > 2) xyz[2] = oo[2].doubleValue();
    } else if(o instanceof Point3) {
      Point3 oo = (Point3) o;
      xyz[0] = oo.x;
      xyz[1] = oo.y;
      xyz[2] = oo.z;
    } else if(o instanceof Vector3) {
      Vector3 oo = (Vector3) o;
View Full Code Here

      Number oo[] = (Number[]) o;
      if(oo.length > 0) pos.x = oo[0].doubleValue();
      if(oo.length > 1) pos.y = oo[1].doubleValue();
      if(oo.length > 2) pos.z = oo[2].doubleValue();
    } else if(o instanceof Point3) {
      Point3 oo = (Point3) o;
      pos.x = oo.x;
      pos.y = oo.y;
      pos.z = oo.z;
    } else if(o instanceof Vector3) {
      Vector3 oo = (Vector3) o;
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.