NearestCityToRoad

From CMSC 420

Will return the name and location of the closest city in the spatial map to the specified road in the spatial map. The road is specified by the start and end cities. Since roads are undirected, specifying [start=A,end=B] is identical to specifying [start=B,end=A]. Obviously the city will not be one of the endpoints of the road or this command would be trivial. Ties broken by the city with the asciibetically least name.

Parameters (In output order)[edit]

  • start
  • end

Possible <output>[edit]

The output will contain one city tag which is the nearest city (isolated or not). This is an example of a city tag:

   <city name="city1" x="coordx" y="coordy" color="color1" radius="radius1"/>

Possible <error> types[edit]

  • roadIsNotMapped
  • noOtherCitiesMapped

<success> Example[edit]

   <success>
       <command name="nearestCityToRoad" id="14">
       <parameters>
           <start value="Annapolis"/>
           <end value="Derwood"/>
       </parameters>
       <output>
           <city name="CollegePark" x="20" y="30" color="red" radius="12"/>
       </output>
   </success>