sdr 0.7

net.cscott.sdr.anim
Class Gauge

java.lang.Object
  extended by com.jme.scene.SceneElement
      extended by com.jme.scene.Spatial
          extended by com.jme.scene.Node
              extended by net.cscott.sdr.anim.Gauge
All Implemented Interfaces:
com.jme.util.export.Savable, Serializable

public class Gauge
extends com.jme.scene.Node

A Gauge is a jme component that implements a thermometer-type indicator. Gauges are 128 pixels wide by 24 pixels tall by default, and display a value between 0 and 1. The origin of the gauge is at its top-left corner. The bar grows left-to-right, and '0' is at the left.

Version:
$Id: Gauge.java,v 1.2 2006-11-09 20:56:41 cananian Exp $
Author:
C. Scott Ananian
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
geometricalControllers, localRotation, localScale, localTranslation, parent, worldRotation, worldScale, worldTranslation
 
Fields inherited from class com.jme.scene.SceneElement
COMPOSITE_MESH, CULL_ALWAYS, CULL_DYNAMIC, CULL_INHERIT, CULL_NEVER, cullMode, frustrumIntersects, GEOMBATCH, GEOMETRY, isCollidable, lightCombineMode, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, NM_GL_NORMALIZE_IF_SCALED, NM_GL_NORMALIZE_PROVIDED, NM_INHERIT, NM_OFF, NM_USE_PROVIDED, NODE, normalsMode, QUADBATCH, queueDistance, renderQueueMode, renderStateList, SHARED_MESH, SHAREDBATCH, SKY_BOX, TERRAIN_BLOCK, TERRAIN_PAGE, textureCombineMode, TRIANGLEBATCH, TRIMESH, worldBound, zOrder
 
Constructor Summary
Gauge(String nodeName, boolean reflected, Color[] colors, float... points)
          Creates a Gauge with a gradient.
Gauge(String nodeName, Color leftColor, Color rightColor)
          Creates a Gauge with a gradient from leftColor on the left to rightColor on the right.
 
Method Summary
static void main(String[] args)
          Simple test harness to exercise the features of this class.
 void update(float value)
          Update the value displayed in this Gauge.
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, batchChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getType, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, read, setModelBound, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, write
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, getController, getControllers, getCullMode, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getNormalsMode, getParent, getRenderQueueMode, getTextureCombineMode, getUserData, getWorldRotation, getWorldScale, getWorldTranslation, localToWorld, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setParent, setUserData, setZOrder, updateGeometricState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class com.jme.scene.SceneElement
clearRenderState, getClassTag, getLastFrustumIntersection, getLocalCullMode, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalTextureCombineMode, getLocks, getName, getRenderState, getWorldBound, getZOrder, isCollidable, lock, lock, lockBranch, lockMeshes, setCullMode, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocks, setLocks, setName, setNormalsMode, setRenderQueueMode, setRenderState, setTextureCombineMode, setZOrder, toString, unlock, unlock, unlockBranch, unlockMeshes, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

Gauge

public Gauge(String nodeName,
             Color leftColor,
             Color rightColor)
Creates a Gauge with a gradient from leftColor on the left to rightColor on the right.


Gauge

public Gauge(String nodeName,
             boolean reflected,
             Color[] colors,
             float... points)
Creates a Gauge with a gradient. If reflected is false, then the gauge color goes from colors[0] on the left to colors[colors.length-1] on the right. If reflected is true, then colors[colors.length-1] is in the middle, and we return to colors[0] on the right-hand side. The points give interpolation distances (greater than 0 and less than 1) for intermediate colors in the gradient. Since the first and last colors are always at 0 and 1, respectively, the points array should always have two fewer elements than there are colors.

Method Detail

update

public void update(float value)
Update the value displayed in this Gauge. The value should be between 0 (no bar displayed) and 1 (full bar displayed).


main

public static void main(String[] args)
                 throws Exception
Simple test harness to exercise the features of this class.

Throws:
Exception

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian