org.stellarium.ui.components
Class MapPicture

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by org.stellarium.ui.components.StellariumComponent
          extended by org.stellarium.ui.components.CallbackComponent
              extended by org.stellarium.ui.components.StelPicture
                  extended by org.stellarium.ui.components.MapPicture
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class MapPicture
extends StelPicture


Nested Class Summary
(package private) static class MapPicture.CityType
           
 
Nested classes/interfaces inherited from class org.stellarium.ui.components.StellariumComponent
StellariumComponent.S_GUI_VALUE
 
Field Summary
private  CityMgr cities
           
private static SColor CITY_SELECT
           
private static int CITY_SIZE
           
private  SFontIfc cityNameFont
           
private  StelPicture cityPointer
           
private  Vector2i cursorPos
           
private  boolean dragging
           
private  boolean exact
           
private  int exactAltitude
           
private  double exactLatitude
           
private  double exactLongitude
           
private  float fontSize
           
private  int nearestIndex
           
private  Vector2i oldPos
           
private  StelCallback onNearestCityCallback
           
private  Vector2i originalPos
           
private  Vector2i originalSize
           
private  boolean panning
           
private  StelPicture pointer
           
private static int POINTER_SIZE
           
private  int pointerIndex
           
private  Vector2i pointerPos
           
private  boolean sized
           
private  float zoom
           
private static float ZOOM_LIMIT
           
 
Fields inherited from class org.stellarium.ui.components.CallbackComponent
isMouseOver, onMouseInOutCallback, onPressCallback
 
Fields inherited from class org.stellarium.ui.components.StellariumComponent
active, defaultPainter, desktop, focus, focusing, guiBaseColor, guiColorSchemeMember, guiTextColor, moveToFront, needNewTopEdit, painter, pos, scissor, size, type, visible
 
Constructor Summary
MapPicture(STexture imageTex, STexture pointerTex, STexture cityTex)
           
MapPicture(STexture imageTex, STexture pointerTex, STexture cityTex, int xpos, int ypos, int xsize, int ysize)
           
 
Method Summary
 void addCity(java.lang.String name, java.lang.String state, java.lang.String country, double longitude, double latitude, float zone, int showatzoom, int altitude)
           
private  void calcPointerPos(int x, int y, int modifiers)
           
 void close()
           
 void draw()
           
private  void drawCities()
           
private  void drawCity(Vector2i cityPos, MapPicture.CityType ctype)
           
private  void drawCityName(Vector2i cityPos, java.lang.String cityName)
           
private  void drawNearestCity()
           
 void findPosition(double longitude, double latitude)
           
private  java.lang.String getCity(int index)
           
private  java.lang.String getCountry(int index)
           
 java.lang.String getCursorString()
           
private  double getLatitudeFromy(int y)
           
private  java.lang.String getLocationString(int index)
           
private  double getLongitudeFromx(int x)
           
 int getPointerAltitude()
           
 double getPointerLatitude()
           
 double getPointerLongitude()
           
 java.lang.String getPositionString()
           
private  java.lang.String getState(int index)
           
private  int getxFromLongitude(double longitude)
           
private  int getyFromLatitude(double latitude)
           
 boolean isIn(int x, int y)
           
 void keyPressed(java.awt.event.KeyEvent e)
          bool onKey(Uint16 k, S_GUI_VALUE s);
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
          virtual bool onMove(int, int);
 void mousePressed(java.awt.event.MouseEvent e)
          virtual bool onClic(int, int, S_GUI_VALUE, S_GUI_VALUE);
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
           
 void setFont(float fontSize, java.lang.String fontName)
           
 void setOnNearestCityCallback(StelCallback c)
           
 void setPointerLatitude(double latitude)
           
 void setPointerLongitude(double longitude)
           
(package private)  void zoomInOut(float step)
           
 
Methods inherited from class org.stellarium.ui.components.StelPicture
setImgColor, setShowEdge
 
Methods inherited from class org.stellarium.ui.components.CallbackComponent
callbackOnClic, callbackOnMove, getActive, getFocus, getIsMouseOver, getPos, getPosx, getPosy, getSize, getSizeX, getSizeY, getVisible, mouseClicked, setActive, setFocus, setFont, setOnMouseInOutCallback, setOnPressCallback, setPos, setPos, setPosx, setPosy, setSize, setSize, setSizeX, setSizey, setTexture, setVisible
 
Methods inherited from class org.stellarium.ui.components.StellariumComponent
deleteScissor, disableScissor, enableScissor, getFont, getNeedNewEdit, getType, inFront, initScissor, mouseEntered, mouseExited, reshape, reshape, setBaseColor, setColorScheme, setDefaultPainter, setGUIColorSchemeMember, setInFront, setNeedNewEdit, setOpaque, setPainter, setTextColor
 
Methods inherited from class java.awt.event.KeyAdapter
keyReleased, keyTyped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POINTER_SIZE

private static final int POINTER_SIZE
See Also:
Constant Field Values

CITY_SIZE

private static final int CITY_SIZE
See Also:
Constant Field Values

CITY_SELECT

private static final SColor CITY_SELECT

ZOOM_LIMIT

private static final float ZOOM_LIMIT
See Also:
Constant Field Values

onNearestCityCallback

private StelCallback onNearestCityCallback

pointer

private StelPicture pointer

cityPointer

private StelPicture cityPointer

cityNameFont

private SFontIfc cityNameFont

pointerPos

private Vector2i pointerPos

oldPos

private Vector2i oldPos

originalSize

private Vector2i originalSize

originalPos

private Vector2i originalPos

cursorPos

private Vector2i cursorPos

panning

private boolean panning

dragging

private boolean dragging

zoom

private float zoom

sized

private boolean sized

cities

private CityMgr cities

nearestIndex

private int nearestIndex

pointerIndex

private int pointerIndex

exact

private boolean exact

exactLatitude

private double exactLatitude

exactLongitude

private double exactLongitude

exactAltitude

private int exactAltitude

fontSize

private float fontSize
Constructor Detail

MapPicture

public MapPicture(STexture imageTex,
                  STexture pointerTex,
                  STexture cityTex)

MapPicture

public MapPicture(STexture imageTex,
                  STexture pointerTex,
                  STexture cityTex,
                  int xpos,
                  int ypos,
                  int xsize,
                  int ysize)
Method Detail

close

public void close()
Overrides:
close in class StelPicture

draw

public void draw()
Overrides:
draw in class StelPicture

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
virtual bool onClic(int, int, S_GUI_VALUE, S_GUI_VALUE);

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class StellariumComponent
Parameters:
e -

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener
Overrides:
mouseWheelMoved in class StellariumComponent

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class StellariumComponent

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class StellariumComponent

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
virtual bool onMove(int, int);

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class CallbackComponent
Parameters:
e -

isIn

public boolean isIn(int x,
                    int y)
Overrides:
isIn in class StellariumComponent

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
bool onKey(Uint16 k, S_GUI_VALUE s);

Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class StellariumComponent
Parameters:
e -

getPointerLongitude

public double getPointerLongitude()

getPointerLatitude

public double getPointerLatitude()

getPointerAltitude

public int getPointerAltitude()

setPointerLongitude

public void setPointerLongitude(double longitude)

setPointerLatitude

public void setPointerLatitude(double latitude)

setOnNearestCityCallback

public void setOnNearestCityCallback(StelCallback c)

setFont

public void setFont(float fontSize,
                    java.lang.String fontName)

zoomInOut

void zoomInOut(float step)

addCity

public void addCity(java.lang.String name,
                    java.lang.String state,
                    java.lang.String country,
                    double longitude,
                    double latitude,
                    float zone,
                    int showatzoom,
                    int altitude)

getPositionString

public java.lang.String getPositionString()

getCursorString

public java.lang.String getCursorString()

findPosition

public void findPosition(double longitude,
                         double latitude)

getCity

private java.lang.String getCity(int index)

getState

private java.lang.String getState(int index)

getCountry

private java.lang.String getCountry(int index)

getLocationString

private java.lang.String getLocationString(int index)

getxFromLongitude

private int getxFromLongitude(double longitude)

getyFromLatitude

private int getyFromLatitude(double latitude)

getLongitudeFromx

private double getLongitudeFromx(int x)

getLatitudeFromy

private double getLatitudeFromy(int y)

drawCities

private void drawCities()

drawCityName

private void drawCityName(Vector2i cityPos,
                          java.lang.String cityName)

drawCity

private void drawCity(Vector2i cityPos,
                      MapPicture.CityType ctype)

drawNearestCity

private void drawNearestCity()

calcPointerPos

private void calcPointerPos(int x,
                            int y,
                            int modifiers)