private void drawHost(Graphics2D g2){
  Coord loc=node.getLocation();
  if (drawCoverage && node.isRadioActive()) {
    ArrayList<NetworkInterface> interfaces=new ArrayList<NetworkInterface>();
    interfaces.addAll(node.getInterfaces());
    for (    NetworkInterface ni : interfaces) {
      double range=ni.getTransmitRange();
      Ellipse2D.Double coverage;
      coverage=new Ellipse2D.Double(scale(loc.getX() - range),scale(loc.getY() - range),scale(range * 2),scale(range * 2));
      g2.setColor(rangeColor);
      g2.draw(coverage);
    }
  }
  if (drawConnections) {
    g2.setColor(conColor);
    Coord c1=node.getLocation();
    ArrayList<Connection> conList=new ArrayList<Connection>();
    conList.addAll(node.getConnections());
    for (    Connection c : conList) {
      DTNHost otherNode=c.getOtherNode(node);
      Coord c2;
      if (otherNode == null) {
        continue;
      }
      c2=otherNode.getLocation();
      g2.drawLine(scale(c1.getX()),scale(c1.getY()),scale(c2.getX()),scale(c2.getY()));
    }
  }
  g2.setColor(hostColor);
  g2.drawRect(scale(loc.getX() - 1),scale(loc.getY() - 1),scale(2),scale(2));
  if (isHighlighted()) {
    g2.setColor(highlightedNodeColor);
    g2.fillRect(scale(loc.getX()) - 3,scale(loc.getY()) - 3,6,6);
  }
  if (drawNodeName) {
    g2.setColor(hostNameColor);
    g2.drawString(node.toString(),scale(loc.getX()),scale(loc.getY()));
  }
}

private void drawHost ( Graphics2D g2 ) { Coord loc = node . getLocation ( ) ; if ( drawCoverage && node . isRadioActive ( ) ) { ArrayList < NetworkInterface > interfaces = new ArrayList < NetworkInterface > ( ) ; interfaces . addAll ( node . getInterfaces ( ) ) ; for ( NetworkInterface ni : interfaces ) { double range = ni . getTransmitRange ( ) ; Ellipse2D . Double coverage ; coverage = new Ellipse2D . Double ( scale ( loc . getX ( ) - range ) , scale ( loc . getY ( ) - range ) , scale ( range * 2 ) , scale ( range * 2 ) ) ; g2 . setColor ( rangeColor ) ; g2 . draw ( coverage ) ; } } if ( drawConnections ) { g2 . setColor ( conColor ) ; Coord c1 = node . getLocation ( ) ; ArrayList < Connection > conList = new ArrayList < Connection > ( ) ; conList . addAll ( node . getConnections ( ) ) ; for ( Connection c : conList ) { DTNHost otherNode = c . getOtherNode ( node ) ; Coord c2 ; if ( otherNode == null ) { continue ; } c2 = otherNode . getLocation ( ) ; g2 . drawLine ( scale ( c1 . getX ( ) ) , scale ( c1 . getY ( ) ) , scale ( c2 . getX ( ) ) , scale ( c2 . getY ( ) ) ) ; } } g2 . setColor ( hostColor ) ; g2 . drawRect ( scale ( loc . getX ( ) - 1 ) , scale ( loc . getY ( ) - 1 ) , scale ( 2 ) , scale ( 2 ) ) ; if ( isHighlighted ( ) ) { g2 . setColor ( highlightedNodeColor ) ; g2 . fillRect ( scale ( loc . getX ( ) ) - 3 , scale ( loc . getY ( ) ) - 3 , 6 , 6 ) ; } if ( drawNodeName ) { g2 . setColor ( hostNameColor ) ; g2 . drawString ( node . toString ( ) , scale ( loc . getX ( ) ) , scale ( loc . getY ( ) ) ) ; } }
visualize node ' s location , radio ranges and connections
