com.flagstone.transform
Class FSShape

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSShape
All Implemented Interfaces:
java.lang.Cloneable

public class FSShape
extends FSTransformObject

FSShape is a container for the shape objects (FSLine, FSCurve and FSShapeStyle objects) that describe how a particular shape is drawn.

Attributes
objects An array of shape (FSLine, FSCurve and FSShapeStyle) objects which are used to draw the outline of the shape.

FSShapes are used in shape and font definitions. The FSShape class is used to simplify the design of these classes and provides no added functionality other than acting as a container class.

History

The FSShape class represents the Shape record from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1.


Constructor Summary
FSShape()
          Constructs an FSShape object with no shape objects.
FSShape(java.util.ArrayList anArray)
          Constructs an FSShape object, specifying the Objects that describe how the shape is drawn.
FSShape(FSCoder coder)
          Construct an FSShape object, initalizing it with values decoded from an encoded object.
FSShape(FSShape obj)
          Constructs an FSShape object by copying values from an existing object.
 
Method Summary
 void add(FSTransformObject anObject)
          Adds the object to the array of shape records.
 void appendDescription(java.lang.StringBuffer buffer, int depth)
          AppendDescription is used to present a string description of the object including all nested objects up to a specified depth.
 java.lang.Object clone()
          Creates a deep copy of the entire object.
 void decode(FSCoder coder)
           
 void encode(FSCoder coder)
           
 boolean equals(java.lang.Object anObject)
          Returns true if anObject is equal to this one.
 java.util.ArrayList getObjects()
          Gets the array of shape records that define the shape.
 int length(FSCoder coder)
           
 void setObjects(java.util.ArrayList anArray)
          Sets the array of shape records.
 
Methods inherited from class com.flagstone.transform.FSTransformObject
name, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSShape

public FSShape(FSCoder coder)
Construct an FSShape object, initalizing it with values decoded from an encoded object.

Parameters:
coder - an FSCoder containing the binary data.

FSShape

public FSShape()
Constructs an FSShape object with no shape objects.


FSShape

public FSShape(java.util.ArrayList anArray)
Constructs an FSShape object, specifying the Objects that describe how the shape is drawn.

Parameters:
anArray - the array of shape records.

FSShape

public FSShape(FSShape obj)
Constructs an FSShape object by copying values from an existing object.

Parameters:
obj - an FSShape object.
Method Detail

add

public void add(FSTransformObject anObject)
Adds the object to the array of shape records.

Parameters:
anObject - an instance of FSShapeStyle, FSLine or FSCurve.

getObjects

public java.util.ArrayList getObjects()
Gets the array of shape records that define the shape.

Returns:
the array of shape records.

setObjects

public void setObjects(java.util.ArrayList anArray)
Sets the array of shape records.

Parameters:
anArray - the array of shape records.

clone

public java.lang.Object clone()
Description copied from class: FSTransformObject
Creates a deep copy of the entire object.

Overrides:
clone in class FSTransformObject
Returns:
a copy of the object.

equals

public boolean equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

Overrides:
equals in class FSTransformObject
Returns:
true if this object would be identical to anObject when encoded.

appendDescription

public void appendDescription(java.lang.StringBuffer buffer,
                              int depth)
Description copied from class: FSTransformObject
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

Specified by:
appendDescription in class FSTransformObject
Parameters:
buffer - a StringBuffer to which the description of each object is appended.
depth - the maximum level of nesting up to which objects will be displayed.

length

public int length(FSCoder coder)
Specified by:
length in class FSTransformObject

encode

public void encode(FSCoder coder)
Specified by:
encode in class FSTransformObject

decode

public void decode(FSCoder coder)
Specified by:
decode in class FSTransformObject