Search for a Path

Land Desktop Map 3D Samples

 
Search for a Path
 
 
 

This method takes two arguments: the start and end points specified by the user. It does the following:

  1. Determine that the start and end points are not the same, and if they are, return.
  2. Add the start point to the ready list and add the boundary points of LineStrings directly connected to the start point to the not ready list. This is described in topic Initialize the Start Point.
  3. Add the end point to the target list with information about the end point and points on LineStrings directly connected to the end point. This is described in topic Initialize the End Point.
  4. Loops through the not ready list as long it contains points and does the following:
    • Removes the first point from the not ready list, adds it to the ready list, and keeps a local copy for processing.
      NoteThe first time through the loop the point processed has coordinates (1905922, 472443); it is a boundary point of link ‘A’.
      NoteThe second time through the loop the point processed has coordinates (1906072, 472441); it is a boundary point of link ‘B’.
      NoteThe third time through the loop the point processed has coordinates (1905929, 472103); it is a boundary point of links ‘F’ and ‘C’.
    • Determines that this point is close to one of the points in the target list, adds it to the ready list and breaks out of the loop processing the not ready list.
      NoteThe target list has three points whose coordinates are the boundary points of link ‘B’ and one of the boundary points of link ‘C’, namely, the one whose coordinates are (1905929, 472103).
      NoteThe program breaks out of the loop on the third iteration.
    • Determines that this intermediate point is not close to one of the points in the target list.
    • Retrieves the distance between the intermediate point and its previous point. This value will become an argument to the RelaxPoint method call.
      NoteIn the first iteration the intermediate point is (1905922, 472443) whose previous point is the start point (1905927, 472596) and the value of the current distance property is 156. This represents the distance between the intermediate point and the start point.
      NoteIn the second iteration the intermediate point is (1906072, 472441) whose previous point is (1905922, 472443), and the value of the current distance property is 309. This represents the distance between this intermediate point and the start point.
    • Gets the links connected to this intermediate point. This is described in topic Get Neighbor Links.
      NoteIn the first iteration the neighbor links to the intermediate point with coordinates (1905922, 472443) are ‘D’, ‘E’, ‘A’, and ‘F’. During the course of processing these links, the following points are added to the not ready list: (1905112, 472448), (1906072, 472441), and (1905929, 472103).
      NoteIn the second iteration the neighbor link to the intermediate point with coordinates (1906072, 472441) is ‘D’.
    • For each link returned by previous step do the following:
      • Get the next point from the link. This is described in the topic Get Next Point From Link. The arguments passed in are the intermediate point, the neighboring link, false indicating that the intermediate point is not the start or end point of the trace, and two null point references. In this situation only the first of the two null point references may be returned with a valid reference.
        NoteIn the first use of this loop there are four links: ‘D’, ‘E’, ‘A’, and ‘F’. The non-null point reference returned from processing the ‘D’ link has coordinates (1905112, 472448). The non-null point reference returned from processing the ‘E’ link has coordinates (1906072, 472441). The non-null point reference returned from processing the ‘A’ link has coordinates (1905927, 472596). The non-null point reference returned from processing the ‘F’ link has coordinates (1905929, 472103).
        NoteIn the second use of this loop there is one link: ‘D’.
      • The RelaxPoint method is called with the following arguments: the non-null point reference returned by GetNextPointFromLink, the intermediate link, the ready list, the not ready list and the distance between the intermediate point and its previous point. What happens is described in the topic Relax the Point.
        NoteIn the first call of the first use of this loop the non-null point reference is (1905112, 472448) and its prevous point is (1905922, 472443), that is, the boundary points of link ‘D’.
        NoteIn the second call of the first use of this loop the non-null point reference is (1906072, 472441) and its previous point is (1905922, 472443), that is, the boundary points of link ‘E’.
        NoteIn the third call of the first use of this loop the non-null point reference is (1905927, 47259896) and its previous point is (1905922, 472443), that is the boundary points of link ‘A’.
        NoteIn the fourth call of the first use of this loop the non-null reference point is 1905929, 472103) and its previous point is (1905922, 472443), that is the boundary points of link ‘F’.
        NoteIn the first call of the second use of this loop the non-null reference is (1905922, 472443).
  5. Uses the points in the ready list and the network trace end point to construct the shortest path. This is described in the topic Assemble the Shortest Path.