Class mServer

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by mServer
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class mServer
extends javax.servlet.http.HttpServlet

mServer

Author:
Rune Romundstad
See Also:
Serialized Form

Constructor Summary
mServer()
           
 
Method Summary
 void debug(java.lang.String text, java.lang.String message)
          debug is used for writing out messages to the console, by taking to String parameters and displays them to the console.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          doPost is the required function in a HttpServlet class.
 java.lang.String[] findMap(double posX, double posY)
          findMap is the function for find the right piece of the large map, and calculate the users position in the found piece.
 double[] findPosInMap(double posX, double posY)
          findPosInMap is the function for finding the users position in the large map
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

mServer

public mServer()
Method Detail

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws javax.servlet.ServletException,
                   java.io.IOException
doPost is the required function in a HttpServlet class. Either doGet or doPost. doPost handles the request from the client by reading the ServletInputStream, and writing a response through ServletOutputStream.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

findPosInMap

public double[] findPosInMap(double posX,
                             double posY)
findPosInMap is the function for finding the users position in the large map

Parameters:
posX - is the users position in latitude and Euref89
posY - is the users position in longitude and Euref89
Returns:
a double array with an X and Y value for the users position in pixels for the large map. The values are the number of pixels from the top left corner of the map, in X and Y direction.

findMap

public java.lang.String[] findMap(double posX,
                                  double posY)
findMap is the function for find the right piece of the large map, and calculate the users position in the found piece.

Parameters:
posX - is the users X position in the large map, value returned from findPosInMap function.
posY - is the users Y position in the large map, value returned from findPosInMap function.
Returns:
a string array with: name of the right map piece together with an X and Y position in pixels in that specific piece.

debug

public void debug(java.lang.String text,
                  java.lang.String message)
debug is used for writing out messages to the console, by taking to String parameters and displays them to the console.

Parameters:
text - is the explaining text which shall be written out.
message - is the value the text variable explains.