I am moving from a starting point on the screen to a finishing point via the quickest route, which is not as the crow flies. To do this i take each point and check each of the 8 neighbours to see which is the best route. This gives roughly 14500 points to check, which takes 330 seconds. Apart from optimising code, which I have done, is there any other possibility tp speed this up? 30 seconds would be perfect! A tall order.
Okay, here is the code. To use: wait until the map is drawn (if the map will not draw, select a different tile source). Select two points on the map with long click (markers will be shown). Any points are okay, I have not added the "only river" function yet. B4A 3.80 + OSMDroid.
Hi Mark,
inspired by Erel's question on post #4 above, I am inclined to believe list.Size function has to compute each time it's called the actual number of list elements. If this holds true, you may shorten that delay maintaining a separate counter for OpenList. I mean, dim an int var like OpenListSize and manage it yourself when adding/subtracting elements from the list. So when you'll need the number of actual elements you simply read that value from this new var instead of asking a computation to the list object.
Maybe it's worth giving it a try.
Just for info. I rewrote a lot of the code and created just a pathfinding activity. Informatix was correct, the canvas draw + invalidate + doevents killed the speed.
I now have the following speed without obstacles (working on that still!)
We are at destination
Path from:100,100 to 400,250
Using an interval of 1
Total Time: 113.683 secs
iterations: 761
We are at destination
Path from:100,100 to 400,250
Using an interval of 3
Total Time: 11.339 secs
iterations: 192
We are at destination
Path from:100,100 to 400,250
Using an interval of 5
Total Time: 4.02 secs
iterations: 108
We are at destination
Path from:100,100 to 400,250
Using an interval of 7
Total Time: 2.031 secs
iterations: 76