PrintPMQuadtree

From CMSC 420

Prints the PM quadtree. Since PM quadtrees are deterministic once the order of quadrants has been fixed, your XML should match exactly the primary input/output.

Parameters[edit]

  • (none)

Possible <output>[edit]

A <quadtree> tag will be contained within output. This tag will have one attribute order which will be the PM order of the tree you are printing (this is given in the commands tag). and will contain several <gray> <white> and <black> nodes. The first node in the quadtree will be the root node, this node can be gray or black, then the rest of the PM Quadtree follows. Remember, the exact structure of the quadtree will be represented by the XML output.

<gray>

  • Nodes will contain 4 children nodes with ordering decided by the order of the nodes within the actual gray node in your PM Quad Tree.<gray> nodes will have the attributes x and y, these are integers that identify the location of the gray node. They will appear as such:

   <gray x="72" y="40">
       ...
   </gray>

<black>

  • Nodes in a PMQuadtree can contain at most one <city> and possibly several <road> tags, depending on the type of tree (PM1,PM3). The format of <city> and <road> tags will be as such:

   <black cardinality="card">
       ...
   </black>

<white>

  • Nodes represent an empty node in your PM Quadtree and will appear as such:

   <white/>

Possible <error> types[edit]

  • mapIsEmpty

<success> Example[edit]

   <success>
       <command name="printPMQuadtree" id="1"/>
       <parameters/>
       <output>
           <quadtree order="3">
               <gray x="128" y="128">
                   <black cardinality="2">
                       <city color="red" name="Berlin" radius="50" x="128" y="128" />
                       <road end="Geneva" start="Berlin" />
                   </black>
                   <black cardinality="2">
                       <city color="red" name="Berlin" radius="50" x="128" y="128" />
                       <road end="Geneva" start="Berlin" />
                   </black>
                   <gray x="64" y="64">
                       <white />
                       <gray x="96" y="96">
                           <white />
                           <black cardinality="2">
                               <city color="red" name="Berlin" radius="50" x="128" y="128" />
                               <road end="Geneva" start="Berlin" />
                           </black>
                           <black cardinality="3">
                               <city color="orange" name="Geneva" radius="80" x="90" y="70" />
                               <road end="Geneva" start="Berlin" />
                               <road end="Madrid" start="Geneva" />
                           </black>
                           <black cardinality="2">
                               <isolatedCity color="black" name="Paris" radius="10" x="50" y="30"/>
                               <road end="Geneva" start="Berlin" />
                           </black>
                       </gray>
                       <black cardinality="2">
                           <city color="yellow" name="Madrid" radius="60" x="45" y="50" />
                           <road end="Madrid" start="Geneva" />
                       </black>
                       <black cardinality="1">
                           <road end="Madrid" start="Geneva" />
                       </black>
                   </gray>
                   <black cardinality="2">
                       <city color="red" name="Berlin" radius="50" x="128" y="128" />
                       <road end="Geneva" start="Berlin" />
                   </black>
               </gray>
           </quadtree>
       </output>
   </success>