	     */
	    double coord_x_to_spatial_x(double cx);
	    
	    /**
	     * Calculate the spatial y position belonging to the map by using the world coordinates
	     * @param cy the y world coordinate (north-x)
	     * @return the spatial y coordinate in meters
	     */
	    double coord_y_to_spatial_y(double cy);
	    
	public:

	    /**
	     * constructor
	     * @param coord_x The world x coordinate (east) of the map (is shown in the middle of the image)
	     * @param coord_y The world y coordinate (north) of the map (is shown in the middle of the image)
	     * @param mapsize_x The pixel x size of the map
	     * @param mapsize_x The pixel y size of the map
	     * @param spatial_extend The minimum spatial extend shall be visible on the map
	     */
	    MapData(double coord_x, double coord_y, int mapsize_x, int mapsize_y, double spatial_extend);

	    /**
	     * destructor
	     */
	    ~MapData(void);
	
	    /**
	     * Get the spatial x coordinate in meters of the map (is shown in the middle of the image)
	     * @return the spatial x coordinate of the middle of the map
	     */
	    double get_spatial_pos_x() { return spatial_pos_x; }
	    
	    /**
	     * Get the spatial y coordinate in meters of the map (is shown in the middle of the image)
	     * @return the spatial y coordinate of the middle of the map
	     */
	    double get_spatial_pos_y() { return spatial_pos_y; }
	    
	    /**
	     * Get the spatial lower left x coordinate in meters of the map
	     * @return the spatial lower left x coordinate of the map
	     */
	    double get_spatial_x1() { return spatial_x1; }
	    
	    /**
	     * Get the spatial lower left y coordinate in meters of the map
	     * @return the spatial lower left y coordinate of the map
	     */
	    double get_spatial_y1() { return spatial_y1; }
	    
	    /**
	     * Get the spatial upper right x coordinate in meters of the map
	     * @return the spatial upper right x coordinate of the map
	     */
	    double get_spatial_x2() { return spatial_x2; }
	    
	    /**
	     * Get the spatial upper right y coordinate in meters of the map
	     * @return the spatial upper right y coordinate of the map
	     */
	    double get_spatial_y2() { return spatial_y2; }
	    
	    /**
	     * Get the pixel x size of the map
	     * @return the pixel x size of the map
	     */
	    int get_mapsize_x() { return mapsize_x; }
	    
	    /**
	     * Get the pixel y size of the map
	     * @return the pixel y size of the map
	     */
	    int get_mapsize_y() { return mapsize_y; }
	    
	    /**
	     * Get the pixel x size of the map
	     * @return the pixel x size of the map
	     */
	    double get_spatial_size_x() { return spatial_size_x; }
	    
	    /**
	     * Get the pixel y size of the map
	     * @return the pixel y size of the map
	     */
	    double get_spatial_size_y() { return spatial_size_y; }
	    
	    /**
	     * Get the minimum spatial extend shall be visible on the map
	     * @return the minimum spatial extend of the map
	     */
	    double get_spatial_extend() { return spatial_extend; }

	    /**
	     * Pan this map with the given value to the north
	     * @param pan The value how much the map ist to be panned,
	     * for example is a pan of 1.0 a move of the map with the whole map height,
	     * a pan of 0.5 is a move of the half map height
	     * a pan of 0.0 doesn*t change the map position,
	     * and a negative pan value will pan the map to the south
	     */
	    void pan_north(double pan);
	    
	    /**
	     * Pan this map with the given value to the east
	     * @param pan The value how much the map ist to be panned,
	     * for example is a pan of 1.0 a move of the map with the whole map width,
	     * a pan of 0.5 is a move of the half map width
	     * a pan of 0.0 doesn*t change the map position,
	     * and a negative pan value will pan the map to the west
	     */
	    void pan_east(double pan);
	    
	    /**
	     * Pan this map with the given value to the south
	     * @param pan The value how much the map ist to be panned,
	     * for example is a pan of 1.0 a move of the map with the whole map height,
	     * a pan of 0.5 is a move of the half map height
	     * a pan of 0.0 doesn*t change the map position,
	     * and a negative pan value will pan the map to the north
	     */
	    void pan_south(double pan);
	    
	    /**
	     * Pan this map with the given value to the west
	     * @param pan The value how much the map ist to be panned,
	     * for example is a pan of 1.0 a move of the map with the whole map width,
	     * a pan of 0.5 is a move of the half map width,
	     * a pan of 0.0 doesn*t change the map position,
	     * and a negative pan value will pan the map to the east
	     */
	    void pan_west(double pan);

	    /**
	     * Pan this map with the given values relatively from actual position
	     * @param pan_x Pan the map pan_x meters to the east, a negative value
	     * means panning to the west, 0.0 means no horizontal pan
	     * @param pan_y Pan the map pan_y meters to the north, a negative value
	     * means panning to the south, 0.0 means no vertical pan
	     */
	    void pan_rel(double pan_x, double pan_y);

	    /**
	     * Pan this map absolutely to the given coordinates
	     * @param pan_x The horizontal spatial position to where the map is to be panned at
	     * @param pan_y The vertical spatial position to where the map is to be panned at
	     */
	    void pan_abs(double pan_x, double pan_y);
	  
	    /**
	     * Zoom this map in with the given zoom value
	     * @param zoom The value how much the map is to be zoomed in,
	     * for example means a zoom of 1.0 to reduce the spatial extend to the half,
	     * a zoom of 0.5 to reduce the spatial extend to three fourth,
	     * a zoom of 0.0 doesn't change anything, and a negative zoom means zoomin out
	     */
	    void zoom_in(double zoom);
	    
	    /**
	     * Zoom this map out with the given zoom value
	     * @param zoom The value how much the map is to be zoomed out,
	     * for example means a zoom of 1.0 to double the spatial extend,
	     * a zoom of 0.0 doesn't change anything, and a negative zoom means zoomin in
	     */
	    void zoom_out(double zoom);
	    
	    /**
	     * Zoom this map relatively to the given zoom factor
	     * @param zoom The zoom factor the map is to be zoomed,
	     * for example 1.0 is no change, a lower value means zooming in,
	     * a higher value means zooming out
	     */
	    void zoom_rel(double zoom);

	    /**
	     * Zoom this map absolutely, so that the given spatial extend is just visible in this map
	     * @param spatial_extend The spatial extend, which shall be visible in this map
	     */
	    void zoom_abs(double spatial_extend);

        /**/
	    
	    
    }; /*}}}*/

    /**
     * @author Daniel Dahme, Marius Müller, Okhan Senkhal
     */
    class Pimp { /*{{{*/

        private:

	    /**
	    * array of for the user interest points
	    */
        PoI * poi[];
        
        /**
	     * id of this instance
	     */
	    int uid;
	    
	    /**
	     * the temporary directory for saving the map tiles
	     */
	    char* tempdir;
	   
	    /**
	     * The mapserver the tiles shall be loaded from
	     * (e.g. http://www.siriusdd.de/cgi-bin/mapserver-4.2.3)
	     */
            char* mapserver;
	   
	    /**
	     * Options for loading map tiles from mapserver
	     * (e.g. mode=map&map=/srv/www/htdocs/mapserver/hb.map&layers=uni1+uni2+uni3+uni4)
	     */
            char* mapserver_options;
	    
	    /**
	     * The minimum spatial extend, the map shall be zoomed at,
	     * has to be known for the map preloading for getting a good image quality
	     */
	    double min_spatial_extend;

	    /**
	     * The maximum spatial extend, the map shall be zoomed at,
	     * has to be known for the map preloading for getting a good image quality
	     */
	    double max_spatial_extend;
	   
	    int pixel_mapsize_x;
	    
	    int pixel_mapsize_y;
	    
	    point_spatial* goal_list;
	    int num_of_goals;
	    /**
	     * Proof if a point is over or under the function.  
	     * @param q1 und q2 You need both uf points to build a function 
	     * @author Marius Müller, Okhan Senkhal
	     */
	    bool over_under_f (point_spatial p, point_spatial q1, point_spatial q2);

	    /**
	     * Create a standard filename by the uid and the coordinates of the map
	     * for the temporary map tiles
	     * @param uid The user identity of this user (application using this module)
	     * @param x The x coordinate of the map tile
	     * @param y The y coordinate of the map tile
	     * @return the created filename
	     * @author Daniel Dahme
	     */
	    char* create_tile_filename(unsigned int uid, double x, double y);
	    
		protected:
	
        public:

	    /**
	     * standard constructor
	     * @author Daniel Dahme
	     */
	    Pimp();
	    
	    /**
	     * destructor
	     * @author Daniel Dahme
	     */
	    ~Pimp(void);

	    /**
	     * Set the directory the temporary tile files shall be saved at
	     * @param dir The directory for temporary files
	     * @author Daniel Dahme
	     */
	    void set_tempdir(char* dir);


        /**
        * deletes files, when the are older than a specific limited age
        * this function helps us to save some memory
        */
	    void delOldfiles();

	    /**
	     * Get the directory the temporary tile files shall be saved at
	     * @return The directory for temporary files
	     * @author Daniel Dahme
	     */
	    char* get_tempdir();
	    
	    /**
	     * Set the mapserver the tiles shall be loaded from
	     * @param ms The mapserver the tiles shall be loaded from
	     * (e.g. http://www.siriusdd.de/cgi-bin/mapserver-4.2.3)
	     * @author Daniel Dahme
	     */
	    void set_mapserver(char* ms);

	    /**
	     * Get the mapserver the tiles shall be loaded from
	     * @return The mapserver the tiles shall be loaded from
	     * (e.g. http://www.siriusdd.de/cgi-bin/mapserver-4.2.3)
	     * @author Daniel Dahme
	     */
	    char* get_mapserver();
	    
	    /**
	     * Set the options for loading map tiles from mapserver
	     * @param mso The mapserver options
	     * (e.g. mode=map&map=/srv/www/htdocs/mapserver/hb.map&layers=uni1+uni2+uni3+uni4)
	     * @author Daniel Dahme
	     */
        void set_mapserver_options(char *mso);
	    
	    /**
	     * Get the options for loading map tiles from mapserver
	     * @return The mapserver options
	     * (e.g. mode=map&map=/srv/www/htdocs/mapserver/hb.map&layers=uni1+uni2+uni3+uni4)
	     * @author Daniel Dahme
	     */
        char* get_mapserver_options();
	    
	    /**
	     * Execute a Unix command
	     * @param cmd The command to be executed
	     * @param params All params of the Unix command
	     * @author Daniel Dahme, Marius Müller, Okhan Senkhal
	     */
	    int exec_cmd(char* cmd, char* params[]);

	    /**
	     * Set the minimum spatial extend of the map the application need
	     * @param min_spatial_extend The mininum spatial extend of the map
	     * @author Daniel Dahme
	     */
	    void set_min_spatial_extend(double min_spatial_extend);

	    /**
	     * Set the maximum spatial extend of the map the application need
	     * @param max_spatial_extend The maxinum spatial extend of the map
	     * @author Daniel Dahme
	     */
	    void set_max_spatial_extend(double max_spatial_extend);
	    
	    /**
	     * Set the pixel width of the map the application requires it
	     * @param pixel_mapsize_x The pixel width of the map
	     * @author Daniel Dahme
	     */
	    void set_mapsize_x(unsigned int pixel_mapsize_x);
	    
	    /**
	     * Set the pixel height of the map the application requires it
	     * @param pixel_mapsize_y The pixel height of the map
	     * @author Daniel Dahme
	     */
	    void set_mapsize_y(unsigned int pixel_mapsize_y);
	    
	    /**
	     * Proof if a point is in a in quadrangle, using the
	     * over_under_f function
	     * @param p The starting point
	     * @param q1 The first point of the rectangle
	     * @param q2 The second point of the rectangle
	     * @param q3 The third point of the rectangle
	     * @param q4 The fourth point of the rectangle
	     * @return true, if the point is in the quad, false otherwise
	     * @author Marius Müller, Okhan Senkhal
	     */
	    bool point_in_quad (point_spatial p, point_spatial q1, point_spatial q2, point_spatial q3, point_spatial q4);
	    
	    /**
	     * Proof if a rectangle is in a quadrangle, using the point_in_quad function
	     * @param p1 The first point of the rectangle
	     * @param p2 The second point of the rectangle
	     * @param q1 The first point of the quadrangle
	     * @param q2 The second point of the quadrangle
	     * @param q3 The third point of the quadrangle
	     * @param q4 The fourth point of the quadrangle
	     * @return true, if one of the rectangle points is in the quad, false otherwise
	     * @author Daniel Dahme
	     */
	    bool rect_in_quad (point_spatial p1, point_spatial p2, point_spatial q1, point_spatial q2, point_spatial q3, point_spatial q4);

	    /**
	     * Load a tile from a mapserver and save it to the temporary directory 
	     * @param spatial_x The spatial x coordinate of the center of map tile
	     * @param spatial_y The spatial y coordinate of the center of map tile
	     * @author Daniel Dahme
	     */
	    void get_tile(double spatial_x, double spatial_y);
	    
	    /**
	     * Deliver start and target points to this module for precaching maps
	     * @param array of points for precaching
	     * @author Daniel Dahme
	     */
	    void set_goal_coords_list(point_coords* goal_list, int num_of_goals);
	    
	    /**
	     * Deliver start and target points to this module for precaching maps
	     * @param array of points for precaching
	     * @author Daniel Dahme
	     */
	    void set_goal_list(point_spatial* goal_list, int num_of_goals);
	    
	    /**
	     * Get a map of the given data and save it at the given filename.
	     * @param md The data of the map, which has to be loaded
	     * @param filename The filename the map image is to be saved at
	     * @author Daniel Dahme
	     */
	    void get_map(MapData md, char* filename);
        
        /**
		*Contains a number of Points of Interests. These points are gonna be used
		*to calculate different distances between the current position of the user and 
		*divers bulidings in the vicinity.
		*/
		PoI * get_poi(int i);
		
    };

	class Compass
	{	
		public:
        
        /**
		*This function delivers the necessary degree, of what the user is looking to,
		*to provide that we could get information from the surrounding.
		*/
		double get_news();
		
		/**
		*Returns with a char, to explain the Users angle with one letter.
		*N is for example north, E is the east, S the south and W the west.
		*/
		string transform_angle();

		/**
		*This is the current x-axis position of the GPS-User.
		*/
		double current_pos_x();

		/**
		*This is the current y-axis position of the GPS-User.
		*/
		double current_pos_y();

	};
	
	class View
	{
		private:
			Compass compass;
			
			Pimp pimp;
			
		public:

        double degree;

		/**
		*Loads the data, delivered by Compass, to get the current angle.
		*/    
		void refresh_degree();

		/**
		*Calculates the distance between the current user-position and points of interests.
		*/		
		bool dist(int i);
		
		/**
        * Calculates the distance between the users actual point to any other
        *  specific point in the world via GPS. those makes it possible 
        * to get informations to any objekt in a specific distance.
        */
		double get_distance(double dist);
	};/*}}}*/

} // namespace map
} // namespace iwear
#endif // __PIMP_H

