JHeightMap
Class JPanelMap

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by JHeightMap.JPanelMap
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class JPanelMap
extends javax.swing.JPanel

Class JPanelMap represents a third level in the draft JHeightMap library. This level is designed to display a height map and create 3D scene.

Author:
Martin Kinkor
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
JPanelMap(JHeightMap.AbstractHeightMap map)
          The constructor creates graph scene with default setting.
JPanelMap(JHeightMap.AbstractHeightMap map, java.awt.Color backgroundColor)
          The constructor creates graph scene with default setting with the given background color.
JPanelMap(JHeightMap.AbstractHeightMap map, int width, int height, boolean defaultBehavior, java.awt.Color backgroundColor, javax.vecmath.Point3d cameraPosition)
          The constructor creates graph scene with default setting.
JPanelMap(JHeightMap.AbstractHeightMap map, int width, int height, java.awt.Color backgroundColor)
          The constructor creates graph scene with default setting.
 
Method Summary
 void addLight(JLight lightMap)
          The method adds light in scene for array light.
 void compileScene()
          Method compiles graph scene optimization rendering.
 javax.vecmath.Color3f getColorAmbientLight()
          The method returns color default ambient light.
 javax.vecmath.Color3f getColorBackground()
          The method returns color background in scene.
 javax.vecmath.Color3f getColorDirectLight()
          The method returns color default direct light
 javax.vecmath.Vector3f getDirectionDirectLight()
          The method returns direct default direct light.
 int getLightListSize()
          The method returns size array lights.
 javax.vecmath.Point3d getPositionCamera()
          The method returns position camera in scene.
 javax.media.j3d.TransformGroup getRotation()
          The method returns node graph for rotation height map.
 javax.media.j3d.TransformGroup getScaling()
          The method returns node graph for scaling height map.
 double getScalingNumber()
          The method returns number scaling map.
 javax.media.j3d.BoundingSphere getSceneBounds()
          The method returns value bounds.
 java.awt.Image getScreenImage()
          The method draws scene
 javax.media.j3d.TransformGroup getTranslation()
          The method returns node graph for translation height map.
 void removeLight()
          The method removes last added light.
 void removeLight(int index)
          The method removes light in scene from array Light.
 boolean saveImage(java.lang.String file, java.lang.String imageType)
          Saves image of a given name and type into the file
 void setBackClippingDistance(double d)
          Sets distance of back clipping plane
 void setBehavior(javax.media.j3d.Behavior behavior)
          The method sets new behavior and remove last behavior.
 void setColorAmbientLight(javax.vecmath.Color3f color)
          The method sets color default ambient light
 void setColorBackground(javax.vecmath.Color3f color)
          The method sets color background in scene.
 void setColorBackground(float r, float g, float b)
          The method sets color background in scene.
 void setColorDirectLight(javax.vecmath.Color3f color)
          The method sets color direct light.
 void setDirectionDirectLight(float x, float y, float z)
          The method sets direct default direct light.
 void setDirectionDirectLight(javax.vecmath.Vector3f direct)
          The method sets direct default direct light.
 void setDirectLight(javax.vecmath.Color3f color, javax.vecmath.Vector3f direct)
          The method sets direct and color default direct light.
 void setMap(JHeightMap.AbstractHeightMap map)
          The method sets new map and inserted map into the center of the scene.
 void setPositionCamera(javax.vecmath.Point3d position)
          The method sets position camera in scene.
 void setPositionCamera(javax.vecmath.Vector3f nposition)
          The method sets position camera in scene.
 void setRotation(javax.media.j3d.TransformGroup tg)
          The method sets rotation height map
 void setRotationX(double angle)
          The method sets rotation height map about x-axis.
 void setRotationY(double angle)
          The method sets rotation height map about y-axis.
 void setRotationZ(double angle)
          The method sets rotation height map about z-axis.
 void setScaling(double scaling)
          The method sets scale height map.
 void setScaling(javax.media.j3d.TransformGroup tg)
          The method sets scaling height map.
 void setScaling(javax.vecmath.Vector3d scaling)
          The method sets scale height map.
 void setTexts(java.lang.String texts)
          The method sets text which draw on screen.
 void setTexts(java.lang.String[] texts)
          The method sets text which draw on screen.
 void setTranslation(javax.media.j3d.TransformGroup tg)
          The method sets translation height map.
 void setTranslation(javax.vecmath.Vector3f position)
          The method sets translation height map.
 void setVisiableText(boolean status)
          The method sets whether to display text.
 void update(java.awt.Graphics g)
          The method draws scene.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, 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
 
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, 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, checkImage, checkImage, 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
 

Constructor Detail

JPanelMap

public JPanelMap(JHeightMap.AbstractHeightMap map)
The constructor creates graph scene with default setting.

Parameters:
map - Height map.

JPanelMap

public JPanelMap(JHeightMap.AbstractHeightMap map,
                 java.awt.Color backgroundColor)
The constructor creates graph scene with default setting with the given background color.

Parameters:
map - Height map.
backgroundColor - color of the background (if NULL -> blue)

JPanelMap

public JPanelMap(JHeightMap.AbstractHeightMap map,
                 int width,
                 int height,
                 java.awt.Color backgroundColor)
The constructor creates graph scene with default setting.

Parameters:
map - Height map.
width - Width panel.
height - Height panel.
backgroundColor - color of the background (if NULL -> blue)

JPanelMap

public JPanelMap(JHeightMap.AbstractHeightMap map,
                 int width,
                 int height,
                 boolean defaultBehavior,
                 java.awt.Color backgroundColor,
                 javax.vecmath.Point3d cameraPosition)
The constructor creates graph scene with default setting.

Parameters:
map - Height map.
width - Width panel
height - Height panel
defaultBehavior - Value is determined whether class is using the mouse control
backgroundColor - color of the background (if NULL -> blue)
cameraPosition - position of the camera after creating the panel
Method Detail

update

public void update(java.awt.Graphics g)
The method draws scene.

Overrides:
update in class javax.swing.JComponent

getScreenImage

public java.awt.Image getScreenImage()
The method draws scene

Returns:
Image scene.

setTexts

public void setTexts(java.lang.String[] texts)
The method sets text which draw on screen.

Parameters:
texts - Drawing text

setTexts

public void setTexts(java.lang.String texts)
The method sets text which draw on screen.

Parameters:
texts - Drawing text

setVisiableText

public void setVisiableText(boolean status)
The method sets whether to display text.

Parameters:
status - Value to determine text is displayed or not.

getSceneBounds

public javax.media.j3d.BoundingSphere getSceneBounds()
The method returns value bounds.

Returns:
Value bounds.

setBehavior

public void setBehavior(javax.media.j3d.Behavior behavior)
The method sets new behavior and remove last behavior.

Parameters:
behavior - Next behavior.

setMap

public void setMap(JHeightMap.AbstractHeightMap map)
The method sets new map and inserted map into the center of the scene.

Parameters:
map - Height map.

compileScene

public void compileScene()
Method compiles graph scene optimization rendering. Without calling this method does not render the scene.


setRotation

public void setRotation(javax.media.j3d.TransformGroup tg)
The method sets rotation height map

Parameters:
tg - Rotation height map

setTranslation

public void setTranslation(javax.vecmath.Vector3f position)
The method sets translation height map.

Parameters:
position - Translation height map.

setTranslation

public void setTranslation(javax.media.j3d.TransformGroup tg)
The method sets translation height map.

Parameters:
tg - Translation height map.

setScaling

public void setScaling(javax.media.j3d.TransformGroup tg)
The method sets scaling height map.

Parameters:
tg - Scale height map.

getRotation

public javax.media.j3d.TransformGroup getRotation()
The method returns node graph for rotation height map.

Returns:
Transformation node for rotation.

getTranslation

public javax.media.j3d.TransformGroup getTranslation()
The method returns node graph for translation height map.

Returns:
Transformation node for translation.

getScaling

public javax.media.j3d.TransformGroup getScaling()
The method returns node graph for scaling height map.

Returns:
Scaling node for scaling.

setRotationX

public void setRotationX(double angle)
The method sets rotation height map about x-axis.

Parameters:
angle - Angle rotation about x-axis.

setRotationY

public void setRotationY(double angle)
The method sets rotation height map about y-axis.

Parameters:
angle - Angle rotation about y-axis.

setRotationZ

public void setRotationZ(double angle)
The method sets rotation height map about z-axis.

Parameters:
angle - Angle rotation about z-axis.

setScaling

public void setScaling(double scaling)
The method sets scale height map.

Parameters:
scaling - Scale height map.

getScalingNumber

public double getScalingNumber()
The method returns number scaling map.

Returns:
Value of scale map.

setScaling

public void setScaling(javax.vecmath.Vector3d scaling)
The method sets scale height map.

Parameters:
scaling - Vector for scale height map.

setPositionCamera

public void setPositionCamera(javax.vecmath.Vector3f nposition)
The method sets position camera in scene.

Parameters:
nposition - Position camera in scene.

setPositionCamera

public void setPositionCamera(javax.vecmath.Point3d position)
The method sets position camera in scene.

Parameters:
position - Position camera in scene.

getPositionCamera

public javax.vecmath.Point3d getPositionCamera()
The method returns position camera in scene.

Returns:
Position camera in scene.

setColorBackground

public void setColorBackground(javax.vecmath.Color3f color)
The method sets color background in scene.


setColorBackground

public void setColorBackground(float r,
                               float g,
                               float b)
The method sets color background in scene.

Parameters:
r - red component of set the background color in scene
g - green component of set the background color in scene
b - blue component of set the background color in scené

getColorBackground

public javax.vecmath.Color3f getColorBackground()
The method returns color background in scene.


setColorAmbientLight

public void setColorAmbientLight(javax.vecmath.Color3f color)
The method sets color default ambient light


getColorAmbientLight

public javax.vecmath.Color3f getColorAmbientLight()
The method returns color default ambient light.


setColorDirectLight

public void setColorDirectLight(javax.vecmath.Color3f color)
The method sets color direct light.

Parameters:
color - Color direct light

setDirectionDirectLight

public void setDirectionDirectLight(javax.vecmath.Vector3f direct)
The method sets direct default direct light.

Parameters:
direct - Direct direct light.

setDirectionDirectLight

public void setDirectionDirectLight(float x,
                                    float y,
                                    float z)
The method sets direct default direct light.

Parameters:
x - x-coordinates direct
y - y-coordinates direct
z - z-coordinates direct

setDirectLight

public void setDirectLight(javax.vecmath.Color3f color,
                           javax.vecmath.Vector3f direct)
The method sets direct and color default direct light.

Parameters:
color - Color direct light.
direct - Direct direct light.

addLight

public void addLight(JLight lightMap)
The method adds light in scene for array light.

Parameters:
lightMap - Add new light.

removeLight

public void removeLight(int index)
The method removes light in scene from array Light.

Parameters:
index - Index removes light.

removeLight

public void removeLight()
The method removes last added light.


getLightListSize

public int getLightListSize()
The method returns size array lights.

Returns:
Size array light.

getColorDirectLight

public javax.vecmath.Color3f getColorDirectLight()
The method returns color default direct light

Returns:
Color default directed light

getDirectionDirectLight

public javax.vecmath.Vector3f getDirectionDirectLight()
The method returns direct default direct light.

Returns:
Direct default directed light.

saveImage

public boolean saveImage(java.lang.String file,
                         java.lang.String imageType)
Saves image of a given name and type into the file

Parameters:
file - file name
imageType - file type (JPG, BMP, PNG)
Returns:
true -> saving OK

setBackClippingDistance

public void setBackClippingDistance(double d)
Sets distance of back clipping plane

Parameters:
d - distance of clipping plane