com.hdcookbook.grin.features
Class SETranslatorModel

java.lang.Object
  extended by com.hdcookbook.grin.Feature
      extended by com.hdcookbook.grin.features.InterpolatedModel
          extended by com.hdcookbook.grin.features.SEInterpolatedModel
              extended by com.hdcookbook.grin.features.SETranslatorModel
All Implemented Interfaces:
Node, SENode, SEScalableNode

public class SETranslatorModel
extends SEInterpolatedModel
implements SEScalableNode


Field Summary
 
Fields inherited from class com.hdcookbook.grin.features.InterpolatedModel
currValues, endCommands, frames, loopCount, repeatFrame, SCALE_X_FACTOR_FIELD, SCALE_X_FIELD, SCALE_Y_FACTOR_FIELD, SCALE_Y_FIELD, values
 
Fields inherited from class com.hdcookbook.grin.Feature
name, show
 
Constructor Summary
SETranslatorModel()
           
 
Method Summary
 void accept(SEShowVisitor visitor)
          Calls the visit method corresponding to this node type.
 void changeFeatureReference(Feature from, Feature to)
          Change a feature reference from one feature to a new one.
 boolean getIsRelative()
           
 int[] getXs()
           
 int[] getYs()
           
 void postProcess(ShowBuilder builder)
          Do any needed post-processing in this show.
 void scaleBy(int xScale, int yScale, int xOffset, int yOffset)
          Scale this node by the given scale factor, and apply the given offset.
 void setIsRelative(boolean isRelative)
           
 java.lang.String toString()
          
 
Methods inherited from class com.hdcookbook.grin.features.SEInterpolatedModel
getCurrValues, getFrames, getLoopCount, getRepeatFrame, getRuntimeClassName, getValues, setCurrValues, setEndCommands, setFrames, setRepeatFrame, setup, setValues, writeInstanceData
 
Methods inherited from class com.hdcookbook.grin.features.InterpolatedModel
addDisplayAreas, createClone, destroy, getEndCommands, getField, getX, getY, initialize, initializeClone, markDisplayAreasChanged, needsMoreSetup, nextFrame, paintFrame, readInstanceData, scaleBounds, setActivateMode, setField, setSetupMode
 
Methods inherited from class com.hdcookbook.grin.Feature
activate, addSubgraph, cloneCommands, clonedReference, cloneSubgraph, deactivate, destroyClonedSubgraph, getName, isSetup, makeNewClone, resetFeature, sendFeatureSetup, setName, setup, unsetup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SETranslatorModel

public SETranslatorModel()
Method Detail

setIsRelative

public void setIsRelative(boolean isRelative)

getIsRelative

public boolean getIsRelative()

getXs

public int[] getXs()

getYs

public int[] getYs()

accept

public void accept(SEShowVisitor visitor)
Description copied from interface: SENode
Calls the visit method corresponding to this node type.

If you are defining a user-defined feature, there are some restrictions that you'll want to follow. If your extension is a feature that has children, then you should make it a subclass of one of the built-in feature types, Assembly, Modifer or Group. That's because the GRIN compiler defines visitors that need to visit every node in the tree, but these built-in visitors don't know about your extension types. By making your extension type a subclass of one of the standard ones, and by making your accept() method call either visitAssembly(), visitGroup() or visitUserDefinedModifier(), as appropriate, you'll ensure that all the children get visited.

Specified by:
accept in interface SENode
Overrides:
accept in class SEInterpolatedModel
Parameters:
visitor - SEShowVisitor object.
See Also:
SEShowVisitor

postProcess

public void postProcess(ShowBuilder builder)
                 throws java.io.IOException
Do any needed post-processing in this show. The grin compiler works as follows:

During the post-process phase, a node can add new features to the show, by calling ShowBuilder.addSyntheticFeature(), and it can insert a new feature as the parent of a given feature, by calling ShowBuilder.injectParent(). It can also add segments and handlers by calling the appropriate builder methods.

When a parent is injected, the ShowBuilder calls postProcess() on all nodes automatically, including nodes that are created during the execution of postProcess() in another node.

Specified by:
postProcess in interface SENode
Overrides:
postProcess in class SEInterpolatedModel
Parameters:
builder - The builder that holds state for the show
Throws:
java.io.IOException - if an error is encountered
See Also:
ShowBuilder.addSyntheticFeature(Feature), ShowBuilder.injectParent(Feature, Feature)

changeFeatureReference

public void changeFeatureReference(Feature from,
                                   Feature to)
Change a feature reference from one feature to a new one. If your node has a reference to the feature from, it should be changed to refer to to. This is called for every node in an SEShow when SENode.injectParent is used.

The ShowBuilder calls changeFeatureReference() on all nodes automatically, including nodes that are created during the execution of postProcess().

Specified by:
changeFeatureReference in interface SENode
Overrides:
changeFeatureReference in class SEInterpolatedModel
See Also:
SENode.changeFeatureReference(Feature, Feature)

scaleBy

public void scaleBy(int xScale,
                    int yScale,
                    int xOffset,
                    int yOffset)
Scale this node by the given scale factor, and apply the given offset. This will change the size of the features and RC handlers within the show at compile time, so no special scaling action is required at runtime.

Specified by:
scaleBy in interface SEScalableNode
Parameters:
xScale - x scale factor in mills
yScale - y scale factor in mills
xOffset - x offset in pixels
yOffset - y offset in pixels

toString

public java.lang.String toString()

Overrides:
toString in class SEInterpolatedModel
Returns:
a developer-friendly description of this feature, for debugging