core
Class Mapper

java.lang.Object
  extended by core.Mapper

public class Mapper
extends java.lang.Object

Classe de gestion d'une carte numerique par les outils de zoom, orientation et positionement. On passe par un appel a la methode getImage pour afficher une carte. Elle renvoie le plan sous forme d'une image de taille size*size aux bonnes coordonnees de zoom, translation et rotation. Il n'y a qu'a l'afficher dans l'interface utilisateur.

Version:
0.1
Author:
Mathieu petit

Field Summary
static double ROTATE_DEFAULT
          Default rotation value = ROTATE_MIN = 0.0
static double ROTATE_MAX
          maximal rotation value = 1.0
static double ROTATE_MIN
          minimal rotation value = 0.0
static double TRANSLATEX_DEFAULT
          Default translation on X value = (TRANSLATEX_MAX + TRANSLATEX_MIN)/2 = 0.5
static double TRANSLATEX_MAX
          maximal translation on X value = 1.0
static double TRANSLATEX_MIN
          minimal translation on X value = 0.0
static double TRANSLATEY_DEFAULT
          Default translation on Y value = (TRANSLATEY_MAX + TRANSLATEY_MIN)/2 = 0.5
static double TRANSLATEY_MAX
          maximal translation on Y value = 1.0
static double TRANSLATEY_MIN
          minimal translation on Y value = 0.0
static double ZOOM_DEFAULT
          Default zoom level value = ZOOM_MIN = 0.0
static double ZOOM_MAX
          maximal zoom level value = 1.0
static double ZOOM_MIN
          minimal zoom level value = 0.0
 
Constructor Summary
Mapper(int size)
          Creates a squared size*size map
 
Method Summary
 double getDefaultRotate()
          Return the default rotation value.
 double getDefaultTranslateX()
          Return the default translation along X.
 double getDefaultTranslateY()
          Return the default translation along Y.
 double getDefaultZoom()
          Return the default zoom level.
 java.awt.Dimension getDimension()
          Return the map display dimensions.
 java.awt.image.BufferedImage getImage()
          Return the map image.
 double getRotate()
          Return the current rotation angle.
 double getTranslateX()
          Return the current translation on X.
 double getTranslateY()
          Return the current translation on Y.
 double getZoom()
          Return the current zoom level.
 void resetMap()
          Reset the map display to the default values of zoom (ZOOM_DEFAULT) , rotation (ROTATE_DEFAULT) and position (TRANSLATEX_DEFAULT, TRANSLATEY_DEFAULT)
 void resetRotate()
          Reset the map display to the initial value of rotation (ROTATE_DEFAULT).
 void resetTranslateX()
          Reset the translation along X to the default value (TRANSLATEX_DEFAULT).
 void resetTranslateY()
          Reset the the translation along Y to the default value (TRANSLATEY_DEFAULT).
 void resetZoom()
          Reset the map display to the default value of zoom (ZOOM_DEFAULT).
 void setRotate(double rotate)
          Rotate the map.
 void setTranslateX(double translateX)
          Translate the map on X axis.
 void setTranslateY(double translateY)
          Translate the map on Y axis.
 void setZoom(double zoom)
          Zoom into the map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZOOM_MAX

public static final double ZOOM_MAX
maximal zoom level value = 1.0

See Also:
Constant Field Values

ZOOM_MIN

public static final double ZOOM_MIN
minimal zoom level value = 0.0

See Also:
Constant Field Values

TRANSLATEX_MAX

public static final double TRANSLATEX_MAX
maximal translation on X value = 1.0

See Also:
Constant Field Values

TRANSLATEX_MIN

public static final double TRANSLATEX_MIN
minimal translation on X value = 0.0

See Also:
Constant Field Values

TRANSLATEY_MAX

public static final double TRANSLATEY_MAX
maximal translation on Y value = 1.0

See Also:
Constant Field Values

TRANSLATEY_MIN

public static final double TRANSLATEY_MIN
minimal translation on Y value = 0.0

See Also:
Constant Field Values

ROTATE_MAX

public static final double ROTATE_MAX
maximal rotation value = 1.0

See Also:
Constant Field Values

ROTATE_MIN

public static final double ROTATE_MIN
minimal rotation value = 0.0

See Also:
Constant Field Values

ZOOM_DEFAULT

public static final double ZOOM_DEFAULT
Default zoom level value = ZOOM_MIN = 0.0

See Also:
Constant Field Values

ROTATE_DEFAULT

public static final double ROTATE_DEFAULT
Default rotation value = ROTATE_MIN = 0.0

See Also:
Constant Field Values

TRANSLATEX_DEFAULT

public static final double TRANSLATEX_DEFAULT
Default translation on X value = (TRANSLATEX_MAX + TRANSLATEX_MIN)/2 = 0.5

See Also:
Constant Field Values

TRANSLATEY_DEFAULT

public static final double TRANSLATEY_DEFAULT
Default translation on Y value = (TRANSLATEY_MAX + TRANSLATEY_MIN)/2 = 0.5

See Also:
Constant Field Values
Constructor Detail

Mapper

public Mapper(int size)
Creates a squared size*size map

Parameters:
size - The display size of the map
Method Detail

setRotate

public void setRotate(double rotate)
Rotate the map. Rotation value ranges from ROTATE_MIN to ROTATE_MAX. ROTATE_MIN relates to a 0 degree rotation, and ROTATE_MAX relates to a 360 degree rotation

Parameters:
rotate - A value between ROTATE_MIN and ROTATE_MAX

setTranslateX

public void setTranslateX(double translateX)
Translate the map on X axis. X translation ranges from TRANSLATEX_MIN to TRANSLATEX_MAX

Parameters:
translateX - A value between TRANSLATEX_MIN and TRANSLATEX_MAX

setTranslateY

public void setTranslateY(double translateY)
Translate the map on Y axis. Y translation value ranges from TRANSLATEY_MIN to TRANSLATEY_MAX.

Parameters:
translateY - A value between TRANSLATEY_MIN and TRANSLATEY_MAX

setZoom

public void setZoom(double zoom)
Zoom into the map. The zoom setting value ranges from ZOOM_MIN to ZOOM_MAX. ZOOM_MIN means no zoom, and ZOOM_MAX means a maximum zoom level. This maximum level depends on the resolution of the image map.

Parameters:
zoom - A value between ZOOM_MIN and ZOOM_MAX

getRotate

public double getRotate()
Return the current rotation angle.

Returns:
The rotation angle value between ROTATE_MIN and ROTATE_MAX

getTranslateX

public double getTranslateX()
Return the current translation on X.

Returns:
The X translation value between TRANSLATEX_MIN and TRANSLATEX_MAX

getTranslateY

public double getTranslateY()
Return the current translation on Y.

Returns:
The Y translation value between TRANSLATEY_MIN and TRANSLATEY_MAX

getZoom

public double getZoom()
Return the current zoom level.

Returns:
The zoom level value between ZOOM_MIN and ZOOM_MAX

getDefaultZoom

public double getDefaultZoom()
Return the default zoom level.

Returns:
The default zoom level ZOOM_DEFAULT

getDefaultTranslateY

public double getDefaultTranslateY()
Return the default translation along Y.

Returns:
The default Y translation value between TRANSLATEY_DEFAULT

getDefaultTranslateX

public double getDefaultTranslateX()
Return the default translation along X.

Returns:
The default X translation value TRANSLATEX_DEFAULT

getDefaultRotate

public double getDefaultRotate()
Return the default rotation value.

Returns:
The default Rotation value ROTATE_DEFAULT

getDimension

public java.awt.Dimension getDimension()
Return the map display dimensions.

Returns:
The dimensions of the map

resetMap

public void resetMap()
Reset the map display to the default values of zoom (ZOOM_DEFAULT) , rotation (ROTATE_DEFAULT) and position (TRANSLATEX_DEFAULT, TRANSLATEY_DEFAULT)


resetTranslateX

public void resetTranslateX()
Reset the translation along X to the default value (TRANSLATEX_DEFAULT).


resetTranslateY

public void resetTranslateY()
Reset the the translation along Y to the default value (TRANSLATEY_DEFAULT).


resetZoom

public void resetZoom()
Reset the map display to the default value of zoom (ZOOM_DEFAULT).


resetRotate

public void resetRotate()
Reset the map display to the initial value of rotation (ROTATE_DEFAULT).


getImage

public java.awt.image.BufferedImage getImage()
Return the map image.

Returns:
the image to be displayed at the UI level
See Also:
BufferedImage