RangeCities
Lists all the cities present in the map within a radius of a point x,y in the map. Cities on the boundary of the circle are included, and x,y are integer coordinates. That is, only cities that are in the spatial structure, in this case, the PR quadtree, are relevant to this commmand. <success> will result from the existence of at least one <city> that satisfy the range check condition. If none do, then an <error> tag will be the result. If the radius is 0, no cities will ever exist in the range, even if there is a city at the range point. It should be noted that the radius attribute for a city does not factor into this calculation; all cities are considered points.
If the saveMap attribute is present, the current map will be saved to an image file (see saveMap). The image file should be saved with the correct name. It should match our image file: same dimensions, same cities, etc. How to keep track of your graphic map is discussed in saveMap. Printing it out is discussed there too. The main difference with saveMap is that the image file should have a blue unfilled circle centered at the (x,y) values passed in with the radius passed in. Because CanvasPlus does not behave well when shapes exceed the bounds of the spatial map, the saveMap attribute will only be present when an entire range circle lies inclusively within the bounds of the spatial map.
Parameters (In output order)[edit]
- x
- y
- radius
- saveMap (optional) - image filename
Possible <output>[edit]
The output will contain one <cityList> which will contain the list of cities. This is an example of a city tag:
<city name="city1" x="coordx" y="coordy" color="color1" radius="radius1"/>
The cities should be printed in asciibetical order of the names according to java.lang.String.compareTo().
Possible <error> types[edit]
- noCitiesExistInRange
<success> Example[edit]
<success>
<command name="rangeCities"/>
<parameters>
<x value="1"/>
<y value="1"/>
<radius value="100"/>
</parameters>
<output>
<cityList>
<city name="Annapolis" x="20" y="30" color="red" radius="12"/>
<city name="Derwood" x="20" y="40" color="blue" radius="23"/>
</cityList>
</output>
</success>