Difference between revisions of "MeeshQuest"

From CMSC 420
(Initial edit)
 
(Fleshed out and broken up into sections)
Line 1: Line 1:
 
The idea of the MeeshQuest project is to emulate some of the functionality of map sites like [http://www.mapquest.com/ MapQuest] or [http://maps.google.com/ Google Maps].  We will need a database of cities, which are just named points in the plane.  From this, we want to be able to draw pictures of a given region showing the cities contained in that region.  We will get cities from the database and insert them into a spatial datastructure that can be used to draw a picture.  The basic spatial datastructure we will use is a [[quadtree]] -- a sort of 2-dimensional binary search tree.  
 
The idea of the MeeshQuest project is to emulate some of the functionality of map sites like [http://www.mapquest.com/ MapQuest] or [http://maps.google.com/ Google Maps].  We will need a database of cities, which are just named points in the plane.  From this, we want to be able to draw pictures of a given region showing the cities contained in that region.  We will get cities from the database and insert them into a spatial datastructure that can be used to draw a picture.  The basic spatial datastructure we will use is a [[quadtree]] -- a sort of 2-dimensional binary search tree.  
  
 +
 +
== Basic Operations ==
 
The operations you will need to support can be gleaned from the [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node26.html input specification]:
 
The operations you will need to support can be gleaned from the [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node26.html input specification]:
  
* [[createCity]] and [[deleteCity]]: You will need to be able to register cities with and remove them from the database.  No two cities can have the same coordinates or name.
+
* [[createCity]] and [[deleteCity]]: You will need to be able to register cities with and remove them from the database.  (The spec refers to this database as a "dictionary.") No two cities can have the same coordinates or name.
 
* [[mapCity]] and [[unmapCity]]: These take a city that's already registered in the database and add it to or remove it from the spatial datastructure.
 
* [[mapCity]] and [[unmapCity]]: These take a city that's already registered in the database and add it to or remove it from the spatial datastructure.
 
* [[listCities]]: Output a sorted (XML) list of cities in the (database? spatial datastructure? graph?).
 
* [[listCities]]: Output a sorted (XML) list of cities in the (database? spatial datastructure? graph?).
Line 12: Line 14:
 
* [[clearAll]]: Clears all of the datastructures, removing all elements.
 
* [[clearAll]]: Clears all of the datastructures, removing all elements.
  
Since this is a visual project, it will help to be able to visualize your datastructures.  A nice graphics library called [[CanvasPlus]] [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node24.html (spec)] makes this visualization easy.
+
== Input ==
 +
 
 +
The input comes in the form of XML [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node19.html]; a handy [[XmlUtility]] for parsing the input is provided [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node20.html].
 +
 
 +
== Output ==
 +
 
 +
When required to print XML for output, you can use the same handy [[XmlUtility]] [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node21.html] (although for sorted lists, you may be better off just printing to standard out, since order isn't significant in XML [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node22.html]).
 +
 
 +
== City Objects ==
 +
 
 +
You will probably want to create a <code>City</code> object to store basic information about cities; the spec recommends extending <code>java.awt.geom.Point2D.Float</code> [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node23.html].
 +
 
 +
== Visualization ==
 +
 
 +
Since this is a visual project, it will help to be able to visualize your datastructures.  A nice graphics library called [[CanvasPlus]] [http://www.cs.umd.edu/users/meesh/420/spr07/part1/p11/node24.html] makes this visualization easy.
 +
 
 +
== Part 1 (Due Wed March 21) ==
 +
 
 +
From the spec:
 +
 
 +
<blockquote>
 +
For the first part of your project, you will implement a data dictionary that supports both city names and city coordinates as keys. You will also need to write an interpreter that will be able to handle basic XML commands. Your data dictionary can be written by merely playing games with comparators, thereby convincing a good old TreeMap or TreeSet to act like it's something else altogether. Commands will require you to insert verified cities into the spatial map, and to delete them from the spatial map. The role of the spatial map is to support range searches where, given a location in 2-d space and a radius, you will find all the cities within that circle, including on the border. These types of operations are not efficient using the treemap of coordinates.
 +
</blockquote>

Revision as of 20:26, 6 March 2007

The idea of the MeeshQuest project is to emulate some of the functionality of map sites like MapQuest or Google Maps. We will need a database of cities, which are just named points in the plane. From this, we want to be able to draw pictures of a given region showing the cities contained in that region. We will get cities from the database and insert them into a spatial datastructure that can be used to draw a picture. The basic spatial datastructure we will use is a quadtree -- a sort of 2-dimensional binary search tree.


Basic Operations[edit]

The operations you will need to support can be gleaned from the input specification:

  • createCity and deleteCity: You will need to be able to register cities with and remove them from the database. (The spec refers to this database as a "dictionary.") No two cities can have the same coordinates or name.
  • mapCity and unmapCity: These take a city that's already registered in the database and add it to or remove it from the spatial datastructure.
  • listCities: Output a sorted (XML) list of cities in the (database? spatial datastructure? graph?).
  • rangeCity: This searches the spatial datastructure for all cities within a given radius of a given point.
  • nearestCity: This finds the nearest city to a given point (in the database ?).
  • printPRQuadtree: This outputs an XML (textual) representation of the spatial datastructure.
  • saveMap: This outputs a visual representation (an image) of the spatial datastructure. See CanvasPlus.
  • clearAll: Clears all of the datastructures, removing all elements.

Input[edit]

The input comes in the form of XML [1]; a handy XmlUtility for parsing the input is provided [2].

Output[edit]

When required to print XML for output, you can use the same handy XmlUtility [3] (although for sorted lists, you may be better off just printing to standard out, since order isn't significant in XML [4]).

City Objects[edit]

You will probably want to create a City object to store basic information about cities; the spec recommends extending java.awt.geom.Point2D.Float [5].

Visualization[edit]

Since this is a visual project, it will help to be able to visualize your datastructures. A nice graphics library called CanvasPlus [6] makes this visualization easy.

Part 1 (Due Wed March 21)[edit]

From the spec:

For the first part of your project, you will implement a data dictionary that supports both city names and city coordinates as keys. You will also need to write an interpreter that will be able to handle basic XML commands. Your data dictionary can be written by merely playing games with comparators, thereby convincing a good old TreeMap or TreeSet to act like it's something else altogether. Commands will require you to insert verified cities into the spatial map, and to delete them from the spatial map. The role of the spatial map is to support range searches where, given a location in 2-d space and a radius, you will find all the cities within that circle, including on the border. These types of operations are not efficient using the treemap of coordinates.