Package org.contikios.contiki.collect

Examples of org.contikios.contiki.collect.Link


    MapNode[] nodes = getNodeList();
    if (!isMap || !hideNetwork) {
      g.setColor(LINK_COLOR);
      for (MapNode n : nodes) {
        for (int j = 0, mu = n.node.getLinkCount(); j < mu; j++) {
          Link link = n.node.getLink(j);
          MapNode linkNode = addMapNode(link.node);
          int x2 = linkNode.x;
          int y2 = linkNode.y;
          g2d.drawLine(n.x, n.y, x2, y2);
          drawArrow(g, n.x, n.y, x2, y2, 3);
          if (!hideNetwork) {
            int xn1, xn2, yn1, yn2;
            if (n.x <= x2) {
              xn1 = n.x; xn2 = x2;
              yn1 = n.y; yn2 = y2;
            } else {
              xn1 = x2; xn2 = n.x;
              yn1 = y2; yn2 = n.y;
            }
            int dx = xn1 + (xn2 - xn1) / 2 + 4;
            int dy = yn1 + (yn2 - yn1) / 2 - fnDescent;
            if (yn2 < yn1) {
              dy += fnHeight - fnDescent;
            }
            g.drawString(
                Double.toString(((int) (link.getETX() * etxFactor * 100 + 0.5)) / 100.0),
                dx, dy);
          }
        }
      }
    }
View Full Code Here


    MapNode[] nodes = getNodeList();
    for (MapNode n : nodes) {

      // Attract connected nodes
      for(int i = 0, jn = n.node.getLinkCount(); i < jn; i++) {
        Link link = n.node.getLink(i);
        MapNode n2 = addMapNode(link.node);
        double vx = n2.x - n.x;
        double vy = n2.y - n.y;
        double dist = Math.sqrt(vx * vx + vy * vy);
        dist = dist == 0 ? 0.00001 : dist;
        double etx = link.getETX() * etxFactor;
        if (etx > 5) etx = 5;
        double factor = (etx * layoutAttract - dist) / (dist * 3);
        double dx = factor * vx;
        double dy = factor * vy;

 
View Full Code Here

TOP

Related Classes of org.contikios.contiki.collect.Link

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.