org.apache.batik.anim.values
Class AnimatableLengthValue

java.lang.Object
  extended by org.apache.batik.anim.values.AnimatableValue
      extended by org.apache.batik.anim.values.AnimatableLengthValue
Direct Known Subclasses:
AnimatableLengthOrIdentValue

public class AnimatableLengthValue
extends AnimatableValue

An SVG length value in the animation system.


Field Summary
protected  short lengthType
          The length type.
protected  float lengthValue
          The length value.
protected  short percentageInterpretation
          How to interpret percentage values.
protected static String[] UNITS
          Length units.
 
Fields inherited from class org.apache.batik.anim.values.AnimatableValue
decimalFormat, hasChanged, target
 
Constructor Summary
protected AnimatableLengthValue(AnimationTarget target)
          Creates a new AnimatableLengthValue with no length.
  AnimatableLengthValue(AnimationTarget target, short type, float v, short pcInterp)
          Creates a new AnimatableLengthValue.
 
Method Summary
 boolean canPace()
          Returns whether two values of this type can have their distance computed, as needed by paced animation.
static boolean compatibleTypes(short t1, short pi1, short t2, short pi2)
          Determines if two SVG length types are compatible.
 float distanceTo(AnimatableValue other)
          Returns the absolute distance between this value and the specified other value.
 String getCssText()
          Returns the CSS text representation of the value.
 int getLengthType()
          Returns the unit type of this length value.
 float getLengthValue()
          Returns the magnitude of this length value.
 AnimatableValue getZeroValue()
          Returns a zero value of this AnimatableValue's type.
 AnimatableValue interpolate(AnimatableValue result, AnimatableValue to, float interpolation, AnimatableValue accumulation, int multiplier)
          Performs interpolation to the given value.
 
Methods inherited from class org.apache.batik.anim.values.AnimatableValue
formatNumber, hasChanged, toString, toStringRep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNITS

protected static final String[] UNITS
Length units.


lengthType

protected short lengthType
The length type.


lengthValue

protected float lengthValue
The length value. This should be one of the constants defined in SVGLength.


percentageInterpretation

protected short percentageInterpretation
How to interpret percentage values. One of the AnimationTarget.PERCENTAGE_* constants.

Constructor Detail

AnimatableLengthValue

protected AnimatableLengthValue(AnimationTarget target)
Creates a new AnimatableLengthValue with no length.


AnimatableLengthValue

public AnimatableLengthValue(AnimationTarget target,
                             short type,
                             float v,
                             short pcInterp)
Creates a new AnimatableLengthValue.

Method Detail

interpolate

public AnimatableValue interpolate(AnimatableValue result,
                                   AnimatableValue to,
                                   float interpolation,
                                   AnimatableValue accumulation,
                                   int multiplier)
Performs interpolation to the given value.

Specified by:
interpolate in class AnimatableValue
Parameters:
result - the object in which to store the result of the interpolation, or null if a new object should be created
to - the value this value should be interpolated towards, or null if no actual interpolation should be performed
interpolation - the interpolation distance, 0 <= interpolation <= 1
accumulation - an accumulation to add to the interpolated value
multiplier - an amount the accumulation values should be multiplied by before being added to the interpolated value

compatibleTypes

public static boolean compatibleTypes(short t1,
                                      short pi1,
                                      short t2,
                                      short pi2)
Determines if two SVG length types are compatible.

Parameters:
t1 - the first SVG length type
pi1 - the first percentage interpretation type
t2 - the second SVG length type
pi2 - the second percentage interpretation type

getLengthType

public int getLengthType()
Returns the unit type of this length value.


getLengthValue

public float getLengthValue()
Returns the magnitude of this length value.


canPace

public boolean canPace()
Returns whether two values of this type can have their distance computed, as needed by paced animation.

Specified by:
canPace in class AnimatableValue

distanceTo

public float distanceTo(AnimatableValue other)
Returns the absolute distance between this value and the specified other value.

Specified by:
distanceTo in class AnimatableValue

getZeroValue

public AnimatableValue getZeroValue()
Returns a zero value of this AnimatableValue's type.

Specified by:
getZeroValue in class AnimatableValue

getCssText

public String getCssText()
Returns the CSS text representation of the value. This could use org.apache.batik.css.engine.value.FloatValue.getCssText, but we don't want a dependency on the CSS package.

Overrides:
getCssText in class AnimatableValue


Copyright © 2008 Apache Software Foundation. All Rights Reserved.