Nearest N nodes
Previous  Top  Next

(continued from click here)

When you want to know the nearest N objects in a store-theme for every object in a customer-theme, you should use function isocostnodelistN:

For simplicity, we assume access to the coordinates of the point objects in 2 arrays (x1,y1 for customer-theme and x2,y2 for store-theme):

Enter stores into node list
for j = 1 to storetheme.count
  RWnetBase1.Coordinate2node(x2[j],y2[j],node2,dist)
  RWcalc1.nodelistset(j,node2)
next j

for i = 1 to customertheme.count
  RWnetBase1.Coordinate2node(x1[i],y1[i],node1,dist)
Locate 5 nearest objects
  found = RWcalc1.isocostnodelistN(node1,storetheme.count,5,0)
  if found > 0 then
    for j = 1 to found
      index = rwcalc1.NodeListGetNewPos(j);
      node = rwcalc1.nodelistget(index);
      print "Customer "+str$(i)+": "+str$(j)+": "+str$(node)+" "+str$(rwcalc1.getnodecost(node))
    next
  else
    print "Nothing found for customer "+str$(i)
  end if
  print " "
next i