jview
Class JEarth

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by jview.JImageComponent
                  extended by jview.JEarth
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Initializable, ResourceAware, ResourceComposed
Direct Known Subclasses:
JEarthNight

public class JEarth
extends JImageComponent
implements ResourceComposed, Initializable

This class displays a mercator projection of the earth. Materials are from Weisstein, Eric W. Mercator Projection From MathWorld--A Wolfram Web Resource.

The formulars governing a mercator projection are

 x = λ-λ_0,
    y = ln(tan(φ)+1/cos(φ)) = 1/2ln((1+sin(φ))/(1-sin(φ))),
 
Thus with inversions
 λ = x + λ_0
    tan(φ) = sinh(y)
 
This class provides methods for converting geographical coordinates in x-y of a mercator projection, but does not display anything except the earth. The image of the earth is loaded on init.

See Also:
Serialized Form

Nested Class Summary
static class JEarth.Show
          Shows the earth in a mercator projection.
 
Nested classes/interfaces inherited from class jview.JImageComponent
JImageComponent.Display
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static double DEFLAMBDA0
          The lambda-zero meridian.
private static String DEFMERCATOR
          The location of the mercator map.
private static String DEFURLRESOURCES
          The url-resources.
private static double DEFXORIGIN
          The default origin in x.
private static double DEFXSCALE
          The default scale factor in x.
private static double DEFYORIGIN
          The default origin in y.
private static double DEFYSCALE
          The default scale factor in x.
private  ResourceSupplying info
          My properties.
static String KEY_LAMBDA0
          The center of projection, only longitude needed.
static String KEY_MERCATOR
          The key to the location of the mercator map as an image.
static String KEY_XORIGIN
          The x-position of the zero point in geographical coordinates.
static String KEY_XSCALE
          The scale factor in x if coordinates are given in degrees.
static String KEY_YORIGIN
          The y-position of the zero point in geographical coordinates.
static String KEY_YSCALE
          The scale factor in y if coordinates are given in degrees.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JEarth(ResourceSupplying info)
          Constructs a new JMosaic with at least one of the row and column numbers specified.
 
Method Summary
 ResourceSupplying getComposedProperties()
          Returns my properties.
 Point2D getGeography(Point pix)
          Inverses the getPixel(double, double) method using the input coordinates on the image.
 Point getPixel(double lambda, double phi)
          Calculates the position on the mercator image of a geographical position on earth.
 void init()
          Loads the image on init.
 void setComposedProperties(ResourceSupplying prop)
          Sets the proberties of the mosaic and defines its layout as grid layout.
 
Methods inherited from class jview.JImageComponent
createBufferedImage, getImage, getPreferredSize, paintComponent, setImage
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_MERCATOR

public static final String KEY_MERCATOR
The key to the location of the mercator map as an image.

See Also:
Constant Field Values

KEY_XORIGIN

public static final String KEY_XORIGIN
The x-position of the zero point in geographical coordinates.

See Also:
Constant Field Values

KEY_YORIGIN

public static final String KEY_YORIGIN
The y-position of the zero point in geographical coordinates.

See Also:
Constant Field Values

KEY_XSCALE

public static final String KEY_XSCALE
The scale factor in x if coordinates are given in degrees.

See Also:
Constant Field Values

KEY_YSCALE

public static final String KEY_YSCALE
The scale factor in y if coordinates are given in degrees.

See Also:
Constant Field Values

KEY_LAMBDA0

public static final String KEY_LAMBDA0
The center of projection, only longitude needed.

See Also:
Constant Field Values

DEFURLRESOURCES

private static final String DEFURLRESOURCES
The url-resources.

See Also:
Constant Field Values

DEFMERCATOR

private static final String DEFMERCATOR
The location of the mercator map.

See Also:
Constant Field Values

DEFLAMBDA0

private static final double DEFLAMBDA0
The lambda-zero meridian.

See Also:
Constant Field Values

DEFXSCALE

private static final double DEFXSCALE
The default scale factor in x.

See Also:
Constant Field Values

DEFYSCALE

private static final double DEFYSCALE
The default scale factor in x.

See Also:
Constant Field Values

DEFXORIGIN

private static final double DEFXORIGIN
The default origin in x.

See Also:
Constant Field Values

DEFYORIGIN

private static final double DEFYORIGIN
The default origin in y.

See Also:
Constant Field Values

info

private ResourceSupplying info
My properties.

Constructor Detail

JEarth

public JEarth(ResourceSupplying info)
Constructs a new JMosaic with at least one of the row and column numbers specified.

Method Detail

getComposedProperties

public ResourceSupplying getComposedProperties()
Returns my properties.

Specified by:
getComposedProperties in interface ResourceComposed

setComposedProperties

public void setComposedProperties(ResourceSupplying prop)
Sets the proberties of the mosaic and defines its layout as grid layout. The list of images is cleared.

Specified by:
setComposedProperties in interface ResourceAware

init

public void init()
Loads the image on init.

Specified by:
init in interface Initializable

getPixel

public Point getPixel(double lambda,
                      double phi)
Calculates the position on the mercator image of a geographical position on earth.

Parameters:
lambda - Geographical longitude in degrees.
phi - Geographical lattitude in degrees.

getGeography

public Point2D getGeography(Point pix)
Inverses the getPixel(double, double) method using the input coordinates on the image.

Returns:
The longitude in degrees in x, latitude in degrees in y.