RangeRoads

From CMSC 420
Revision as of 16:22, 30 September 2013 by Rforsythe (talk | contribs) (Created page with "Lists all the roads present in the spatial map that intersect the circle defined by the given radius and point (x, y). Roads which are tangent to the circle are considered in ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Lists all the roads present in the spatial map that intersect the circle defined by the given radius and point (x, y). Roads which are tangent to the circle are considered in the range, i.e. intersection can occur at just one point. x and y are integer coordinates. <success> will result from the existence of at least one <road> that satisfies the range check condition. If none do, then an <error> tag will be the result. If the radius is 0, no roads will ever exist in the range, even if there is a city or road at the range point. If the saveMap attribute is present, the current map will be saved to an image file (see saveMap), with features looking exactly like those of rangeCity.

Parameters (In output order)[edit]

  • x
  • y
  • radius
  • saveMap (optional) - image filename

Possible <output>[edit]

The output will contain one <roadList> tag, which will have one or more <road> child elements. The <road> element will appear as such:

   <road start="city_a" end="city_b"/>

The roads should be printed in asciibetical order of the names according to java.lang.String.compareTo(), with the rule that roads should be compared first by the names of their start points. For two roads with the same starting city, an road is less than another road if its endpoint is asciibetically less than the other road. I

f the saveMap attribute is present, the current map will be saved to an image file (see saveMap) just like in rangeCities.

Possible <error> types[edit]

  • noRoadsExistInRange

<success> Example[edit]

   <success>
       <command id="18" name="rangeRoads"/>
       <parameters>
           <x value="512"/>
           <y value="512"/>
       </parameters>
       <output>
           <roadList>
               <road end="City6" start="City3"/>
               <road end="City5" start="City4"/>
               <road end="City6" start="City5"/>
           </roadList>
       </output>
   </success>