MapRoad

From CMSC 420
Revision as of 15:54, 30 September 2013 by Rforsythe (talk | contribs) (Created page with "Inserts a road between the two cities (vertices) named by the '''start''' and '''end''' attributes in PM quadtree. The obvious error conditions follow: the '''start''' or '''e...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Inserts a road between the two cities (vertices) named by the start and end attributes in PM quadtree. The obvious error conditions follow: the start or end city does not exist or are the same; the start or end vertex is an isolated city (see below); the road from start to end already exists; the road is outside of the spatial area defined by (0,0) and spatialWidth/spatialHeight. Note that it is possible for (part of) a road to be within the spatial area, but not its endpoints. However, there are two other potential error conditions you must handle when adding a road to the spatial map, but not until part 3.

Note: THIS IS FOR Part 3: First, the new road should not intersect any road already mapped at a point other than a vertex of the road (this is a requirement of the PM quadtree family). Also, you must check that inserting this road into the PM quadtree will not cause the tree to be partitioned beyond the smallest size. We would prefer to have you implement this correctly the first time; but, experience has shown that not everyone will be comfortable doing this the first time through. Thus, the correct functionality is included in the spec, but will not be fully tested until Part 3.

Parameters[edit]

  • start
  • end

Possible <output>[edit]

The road mapped will cause a roadCreated tag in the <output> and will appear as such:

   <roadCreated start = ”citya” end = ”cityb”/>

Possible <error> types (In priority order)[edit]

  • startPointDoesNotExist
  • endPointDoesNotExist
  • startEqualsEnd
  • startOrEndIsIsolated
  • roadAlreadyMapped
  • roadOutOfBounds

<success> Example[edit]

   <success>
       <command name="mapRoad" id="4"/>
       <parameters>
           <start value="Baltimore"/>
           <end value="Annapolis"/>
       </parameters>
       <output>
           <roadCreated start="Baltimore" end="Annapolis"/>
       </output>
   </success>