Print

Print


hi,
There may be a bug in the class of NetworkPortrayal2D. 
the following is from NetworkPortrayl2D's hitOrDraw  method:

protected void hitOrDraw(Graphics2D graphics, DrawInfo2D info, Bag putInHere)
   ........................
   ........................
    for(int y=0;y<edges.numObjs;y++)
    {
          Edge edge = (Edge)edges.objs[y];
          Double2D locStop = field.getObjectLocation(edge.to());              /////// here's the bug  !!!!!!!!!
          ..........................................................
          .........................................................          

         newinfo.secondPoint.x = (info.draw.x + (xScale) * locStop.x);
         .........................................................
    }
}

if the network is undirected,   Double2D locStop = field.getObjectLocation(edge.to()) will get a wrong second point location, because edge.to()  is not necessary the other end of this edge. In other words,   edge.to() may return  the first network node if the network is undirected.  
This bug will cause some display errors. For example,in a undirected network,  when i wanna draw an edge label, the label will appear in two different positions. 




--
Best wishes!

Lin Sen
Network Key Lab, Institute of Computing Technology ,Chinese Academy of Science
Address£ºF-707, Qingnian Department, Zhongguancun East Road, Beijing, P.R.C.
Post£º10000
Tel£º1521-064-9236