00001 /************************************************************** 00002 * Name: Aldo Alejandro Avila (aavila) 00003 * File: MapVisuals.H 00004 * Asgn: visuals 00005 * Date: Thu Mar 24 16:14:11 EST 2005 00006 **************************************************************/ 00007 /************************************************************** 00008 * This class is the core of the mapVisuals for our program. The 00009 * first method defined will only be used once, and it will be offline. 00010 * Once all the mapTile gifs have been created, the webGUI will be able 00011 * to call the other two methods to access both a visual and textual 00012 * description of the user's requested route 00013 * 00014 * - Testing Strategy - 00015 * All three methods will require the same type of testing strategy. Using 00016 * dummy data passed in from a dummy db or webGUI, I will check to see if 00017 * my maps look how they are supposed to, my path follows the instructions and 00018 * lies correctly on top of the map, and my text description is correct. 00019 * -Due to limited amounts of time the dummy data testing will not be finished 00020 * until the end of spring break 00021 * -Dummy data testing should be complete by the end of spring break 00022 * and ready for integration with the actuall database. 00023 * -Middle of spring break, dummy data testing will start for draw route 00024 * -End of spring break (weekend), dummy data testing will start for text 00025 * description 00026 * -Integration with webGUI should commence the week after spring break is 00027 * is over. 00028 *************************************************************************/ 00029 00030 #ifndef MapVisuals_Header 00031 #define MapVisuals_Header 00032 00033 #include <iostream> 00034 #include <string> 00035 #include "BQStructs.H" 00036 #include "qimage.h" 00037 00038 #include "MapGenerator.H" 00039 00040 00041 using namespace std; 00042 00043 const int NOTHING = 0; 00044 const int LEFT = 1; 00045 const int RIGHT = 2; 00046 const int UP = 3; 00047 const int DOWN = 4; 00048 00050 class MapVisuals { 00051 00052 public: 00053 00054 MapVisuals(DBInterface* db,bool tiles=false); 00055 virtual ~MapVisuals(); 00056 00057 /********************************************************************** 00058 * Since the TilesGeneration method isn't really called by another component 00059 * it doesn't really need to be shown on the interface. Instead we will 00060 * have a method that returns true if the tiles have been generated. If 00061 * its false then we know that the tiles haven't been made. 00062 *************************************************************************/ 00064 bool areTilesGenerated(); 00065 00066 /************************************************************************** 00067 * PathDesc is a struct that is defined elsewhere in our program. I will 00068 * use this struct to obtain graphical information from the database so 00069 * that I can draw out a path. The zoom parameter will determine how big 00070 * this path must be drawn, in order to accommodate the map that is being 00071 * shown by the webGUI. I then draw this route on the tiles and return the 00072 * whole image to the webGUI. For right now, I am returning a QImage, but 00073 * most likely that will change. 00074 *************************************************************************/ 00076 string drawRoute(path_t* route, int dZoom=-1,int sX=0, int sY=0,int Pan=0,string routeID=""); 00077 00078 /************************************************************************* 00079 * PathDesc is a struct that is defined elsewhere in our program. Using 00080 * the struct, I am able to obtain intersection information that I can 00081 * then use to call getPath on the database. Once I have obtained the 00082 * all the information, this method will create a string that will 00083 * give the user instructions on how to get to their destination. 00084 *************************************************************************/ 00086 string routeInstructions(path_t route); 00087 00088 /************************************************************************** 00089 * Once a user clicks on a portion of the map, I am returned an x and y 00090 * coordinate. Using the coordinates I check if the user clicked on a 00091 * road and then return the streetSeg that the user clicked on 00092 *************************************************************************/ 00094 seg_t streetHit(double x, double y); 00095 00096 protected: 00097 00098 private: 00100 MapGenerator* m_mGenerator; 00102 int m_argc; 00104 char* m_argv; 00106 DBInterface* m_db; 00107 }; 00108 00109 #endif