Packagecom.degrafa.geometry.splines
Classpublic class BasicSpline
InheritanceBasicSpline Inheritance Geometry Inheritance DegrafaObject
ImplementsIGeometry, ISpline
SubclassesCardinalSpline, CatmullRomSpline, NaturalCubicSpline, QuadraticHermiteSpline

The Basic Spline is a pseudo-abstract base class from which a wide variety of splines may be constructed and easily integrated into the Degrafa geometry pipeline. This class is currently designed for purely interpolative splines.

Default MXML Propertypoints



Public Properties
 PropertyDefined by
 Inheritedalpha : Number
The alpha setting that applies to this object.
Geometry
 InheritedautoClearGraphicsTarget : Boolean
When using a graphicsTarget and if this property is set to true the draw phase will clear the graphics context before drawing.
Geometry
 Inheritedbottom : Number
When set, the bottom of the layout will be located offset from the bottom of it's parent.
Geometry
 Inheritedbounds : Rectangle
The tight bounds of this element as represented by a Rectangle.
Geometry
 InheritedclippingRectangle : Rectangle
A clipping rectangle to use when rendering this geometry.
Geometry
 InheritedcommandStack : CommandStack
Provides access to the command stack.
Geometry
 InheritedcurrentState : String
The current view state.
Geometry
 Inheriteddata : Object
Allows a short hand property setting that is specific to and parsed by each geometry object.
Geometry
 InheriteddecoratorCollection : DecoratorCollection
Access to the Decorator collection object for this Geometry object.
Geometry
 Inheriteddecorators : Array
A array of IDecorator objects to be applied on this Geometry.
Geometry
 Inheriteddocument : Object
The MXML document that created this object.
DegrafaObject
 InheritedenableEvents : Boolean
Enable events for this object.
DegrafaObject
 Inheritedfill : IGraphicsFill
Defines the fill object that will be used for rendering this geometry object.
Geometry
 Inheritedfilters : Array
An array of BitmapFilter objects applied to this Geometry.
Geometry
 InheritedgeometricLength : Number
Returns geometric length of this object.
Geometry
 Inheritedgeometry : Array
A array of IGeometryComposition objects.
Geometry
 InheritedgeometryCollection : GeometryCollection
Access to the Degrafa geometry collection object for this geometry object.
Geometry
 InheritedgraphicsTarget : Array
One or more display object's that this Geometry is to be drawn to.
Geometry
 InheritedgraphicsTargetCollection : DisplayObjectCollection
Access to the Degrafa target collection object for this geometry object.
Geometry
 InheritedhasDecorators : Boolean
Returns true if this Geometry has decorators.
Geometry
 InheritedhasEventManager : Boolean
Tests to see if a EventDispatcher instance has been created for this object.
DegrafaObject
 InheritedhasFilters : Boolean
Returns true if this Geometry has filters.
Geometry
 InheritedhasLayout : Boolean
Returns true if this Geometry has layout.
Geometry
 InheritedhasStates : Boolean
Returns true if this Geometry has states.
Geometry
 InheritedhasTriggers : Boolean
Returns true if this Geometry has triggers.
Geometry
 Inheritedheight : Number
Defines the height of the layout boundary.
Geometry
 InheritedhorizontalCenter : Number
When set, if left or right is not set, the layout will be centered horizontally offset by the numeric value of this property.
Geometry
 Inheritedid : String
The identifier used by document to refer to this object.
DegrafaObject
 InheritedIGraphicParent : IGraphic
Geometry
 InheritedinheritFill : Boolean
If set to true and no fill is defined and there is a parent object then this object will walk up through the parents to retrive a fill object.
Geometry
 InheritedinheritStroke : Boolean
If set to true and no stroke is defined and there is a parent object then this object will walk up through the parents to retrive a stroke object.
Geometry
 Inheritedinvalidated : Boolean
Specifies whether this object is to be re calculated on the next cycle.
Geometry
 InheritedisInitialized : Boolean
DegrafaObject
 InheritedisInvalidated : Boolean
Returns true if this Geometry object is invalidated
Geometry
 InheritedisRootGeometry : Boolean
Returns true if this Geometry object is a root Geometry Object.
Geometry
  knotCount : int
[read-only] Access the knot count
BasicSpline
  knots : Object
[write-only] Assign the knot collection using a shorthand data value, similar to the Geometry data setter.
BasicSpline
 InheritedlayoutConstraint : LayoutConstraint
The layout constraint that is used for positioning/sizing this geometry object.
Geometry
 Inherited_layoutMatrix : Matrix
Access to the layout matrix if this Geometry has layout.
Geometry
 InheritedlayoutRectangle : Rectangle
Returns the constraint based layout rectangle for this object or bounds if no layout constraint is specified.
Geometry
 Inheritedleft : Number
When set, the left of the layout will be located offset by the value of this property multiplied by the containing width.
Geometry
 InheritedmaintainAspectRatio : Boolean
When true, the size of the layout will always maintain an aspect ratio relative to the ratio of the current width and height properties, even if those properties are not in control of the height and width of the layout.
Geometry
 Inheritedmask : IGeometryComposition
A separate geometry object to use as a mask when rendering this geometry.
Geometry
 InheritedmaskMode : String
The mode used when this object is being masked by the geometry assigned to the mask property.
Geometry
 InheritedmaskSpace : String
The coordinate space within which the referenced mask geometry is rendered before being applied as a mask (respecting maskMode) to this object.
Geometry
 InheritedmaxHeight : Number
The maximum height that can be applied to the layout.
Geometry
 InheritedmaxWidth : Number
The maximum width that can be applied to the layout.
Geometry
 InheritedmaxX : Number
The maximum x location that can be applied to the layout.
Geometry
 InheritedmaxY : Number
The maximum y location that can be applied to the layout.
Geometry
 InheritedminHeight : Number
The minimum height that can be applied to the layout.
Geometry
 InheritedminWidth : Number
The minimum width that can be applied to the layout.
Geometry
 InheritedminX : Number
The minimum x location that can be applied to the layout.
Geometry
 InheritedminY : Number
The minimum y location that can be applied to the layout.
Geometry
 Inheritedname : String
The name that refers to this object.
DegrafaObject
 InheritedobjectBindings : Array
DegrafaObject
 Inheritedparent : IDegrafaObject
The current degrafa object parent.
DegrafaObject
 InheritedpercentHeight : Number
When set, the height of the layout will be set as the value of this property multiplied by the containing height.
Geometry
 InheritedpercentWidth : Number
When set, the width of the layout will be set as the value of this property multiplied by the containing width.
Geometry
  pointCollection : GraphicPointCollection
[read-only] Access to the Degrafa point collection object for this spline.
BasicSpline
  points : Array
Access the array of points that describe the knot set.
BasicSpline
  quadApproximation : Array
[read-only] Access the direct sequence of quadratic Bezier data that approximates the spline, including index into starting quad at each knot.
BasicSpline
 Inheritedright : Number
When set, the right of the layout will be located offset by the value of this property multiplied by the containing width.
Geometry
 InheritedscaleOnLayout : Boolean
When using layout this flag will determine if you want Scale to be applied to fit layout rules
Geometry
  spline : IPlottableSpline
[write-only] [set] spline Assign the reference to the IPlottableSpline providing the computational basis for this Degrafa spline.
BasicSpline
 Inheritedstate : String
The state at which to draw this object.
Geometry
 InheritedstateEvent : String
The state event at which to draw this object.
Geometry
 Inheritedstates : Array
An array of states defined for this Geometry.
Geometry
 Inheritedstroke : IGraphicsStroke
Defines the stroke object that will be used for rendering this geometry object.
Geometry
 InheritedstyleName : Object
The css style name associated with this Geometry.
Geometry
 InheritedsuppressEventProcessing : Boolean
Temporarily suppress event processing for this object.
DegrafaObject
 InheritedtargetCoordinateSpace : DisplayObject
The display object that defines the coordinate system to use.
Geometry
 Inheritedtop : Number
When set, the top of the layout will be located offset from the top of it's parent.
Geometry
 Inheritedtransform : ITransform
Defines the transform object that will be used for rendering this geometry object.
Geometry
 InheritedtransformBounds : Rectangle
Returns a transformed version of this objects bounds as represented by a Rectangle.
Geometry
 InheritedtransformContext : Matrix
A reference to the transformation matrix context within which local transforms will be applied.
Geometry
 Inheritedtriggers : Array
An array of ITrigger objects that this Geometry object will use.
Geometry
 InheritedverticalCenter : Number
When set, if top or bottom is not set, the layout will be centered vertically offset by the numeric value of this property.
Geometry
 Inheritedvisible : Boolean
Controls the visibility of this geometry object.
Geometry
 Inheritedwidth : Number
Defines the width of the layout.
Geometry
 Inheritedx : Number
Defines the x location (top left) of the layout.
Geometry
 Inheritedy : Number
Defines the y location (top left) of the layout.
Geometry
Protected Properties
 PropertyDefined by
  _count : uint = 0
BasicSpline
 InheritedeventDispatcher : EventDispatcher
EventDispatcher instance for this object.
DegrafaObject
 Inherited_fill : IGraphicsFill
Geometry
  _quads : Array
BasicSpline
  _spline : IPlottableSpline
BasicSpline
 Inherited_stroke : IGraphicsStroke
Geometry
  _toBezier : SplineToBezier
BasicSpline
Public Methods
 MethodDefined by
  
BasicSpline(_myPoints:Array = null)
BasicSpline
  
addControlPoint(x:Number, y:Number):void
Adds a new knot to the spline.
BasicSpline
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
DegrafaObject
  
addItem(_x:Number, _y:Number):void
BasicSpline
 Inherited
angleAt(t:Number):Number
Returns the angle of a point t(0-1) on the path.
Geometry
  
approximateInterval(val1:Number, val2:Number):Array
return an array of quad Bezier approximations to the spline over the specified interval (cartesian or parameteric) - returns null if the values are outside the knot range for a cartesian spline or outside [0,1] for a parametric spline.
BasicSpline
  
calculateLayout(childBounds:Rectangle = null):void
Performs the specific layout work required by this Geometry.
BasicSpline
 Inherited
Clears all graphics targets specified in the graphicsTarget array.
Geometry
  
derivative(_x:Number):Number
BasicSpline
 Inherited
dispatchEvent(evt:Event):Boolean
Dispatches an event into the event flow.
DegrafaObject
 Inherited
dispatchPropertyChange(bubbles:Boolean = false, property:Object = null, oldValue:Object = null, newValue:Object = null, source:Object = null):Boolean
Dispatches an property change event into the event flow.
DegrafaObject
  
draw(graphics:Graphics, rc:Rectangle):void
Begins the draw phase for geometry objects.
BasicSpline
 Inherited
Requests a draw for each graphics target specified in the graphicsTarget array.
Geometry
 Inherited
endDraw(graphics:Graphics):void
Ends the draw phase for geometry objects.
Geometry
  
eval(_x:Number):Number
BasicSpline
  
getX(_t:Number):Number
BasicSpline
  
getXPrime(_t:Number):Number
BasicSpline
  
getY(_t:Number):Number
BasicSpline
  
getYPrime(_t:Number):Number
BasicSpline
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
DegrafaObject
 Inherited
initChange(property:String, oldValue:Object, newValue:Object, source:Object):void
Helper function for dispatching property changes
DegrafaObject
 Inherited
initFill(graphics:Graphics, rc:Rectangle):void
Initialise the fill for this geometry object.
Geometry
 Inherited
initialized(document:Object, id:String):void
Called after the implementing object has been created and all component properties specified on the MXML tag have been initialized.
DegrafaObject
 Inherited
initStroke(graphics:Graphics, rc:Rectangle):void
Initialise the stroke for this geometry object.
Geometry
 Inherited
pointAt(t:Number):Point
Returns the point at t(0-1) on this object.
Geometry
  
preDraw():void
Performs any pre calculation that is required to successfully render this element.
BasicSpline
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
DegrafaObject
 Inherited
styleChanged(styleProp:String):void
Called when the value of a style property is changed.
Geometry
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
DegrafaObject
Protected Methods
 MethodDefined by
  
approximateCartesianInterval(val1:Number, val2:Number):Array
BasicSpline
  
initPoints():void
BasicSpline
  
Initialize the point collection by creating it and adding the event listener.
BasicSpline
  
propertyChangeHandler(event:PropertyChangeEvent):void
Principle event handler for any property changes to a geometry object or it's child objects.
BasicSpline
Events
 EventSummaryDefined by
 Inherited  DegrafaObject
 Inherited  DegrafaObject
Property detail
_countproperty
protected var _count:uint = 0
knotCountproperty 
knotCount:int  [read-only]

Access the knot count

This property can be used as the source for data binding.

Implementation
    public function get knotCount():int
knotsproperty 
knots:Object  [write-only]

Assign the knot collection using a shorthand data value, similar to the Geometry data setter.

The spline data property expects a list of space seperated points. For example "10,20 30,35".

This property can be used as the source for data binding.

Implementation
    public function set knots(value:Object):void

See also

Geometry.data
pointCollectionproperty 
pointCollection:GraphicPointCollection  [read-only]

Access to the Degrafa point collection object for this spline.

This property can be used as the source for data binding.

Implementation
    public function get pointCollection():GraphicPointCollection
pointsproperty 
points:Array  [read-write]

Access the array of points that describe the knot set.

This property can be used as the source for data binding.

Implementation
    public function get points():Array
    public function set points(value:Array):void
quadApproximationproperty 
quadApproximation:Array  [read-only]

Access the direct sequence of quadratic Bezier data that approximates the spline, including index into starting quad at each knot. First array is sequence of QuadData instances. Second array is index of QuadData instance of each knot.

This property can be used as the source for data binding.

Implementation
    public function get quadApproximation():Array
_quadsproperty 
protected var _quads:Array
_splineproperty 
protected var _spline:IPlottableSpline
splineproperty 
spline:IPlottableSpline  [write-only]

[set] spline Assign the reference to the IPlottableSpline providing the computational basis for this Degrafa spline.

This property can be used as the source for data binding.

Implementation
    public function set spline(value:IPlottableSpline):void
_toBezierproperty 
protected var _toBezier:SplineToBezier
Constructor detail
BasicSpline()constructor
public function BasicSpline(_myPoints:Array = null)

Parameters
_myPoints:Array (default = null)
Method detail
addControlPoint()method
public function addControlPoint(x:Number, y:Number):void

Adds a new knot to the spline.

Parameters
x:Number
 
y:Number
addItem()method 
public function addItem(_x:Number, _y:Number):voidParameters
_x:Number
 
_y:Number
approximateCartesianInterval()method 
protected function approximateCartesianInterval(val1:Number, val2:Number):ArrayParameters
val1:Number
 
val2:Number

Returns
Array
approximateInterval()method 
public function approximateInterval(val1:Number, val2:Number):Array

return an array of quad Bezier approximations to the spline over the specified interval (cartesian or parameteric) - returns null if the values are outside the knot range for a cartesian spline or outside [0,1] for a parametric spline. Also returns null if the quad. Bezier approximation is not yet available, which is the case until Degrafa indicates the spline is completely rendered.

Parameters
val1:Number
 
val2:Number

Returns
Array
calculateLayout()method 
public override function calculateLayout(childBounds:Rectangle = null):void

Performs the specific layout work required by this Geometry.

Parameters
childBounds:Rectangle (default = null) — the bounds to be layed out. If not specified a rectangle of (0,0,1,1) is used.
derivative()method 
public function derivative(_x:Number):NumberParameters
_x:Number

Returns
Number
draw()method 
public override function draw(graphics:Graphics, rc:Rectangle):void

Begins the draw phase for geometry objects. All geometry objects override this to do their specific rendering.

Parameters
graphics:Graphics — The current context to draw to.
 
rc:Rectangle — A Rectangle object used for fill bounds.
eval()method 
public function eval(_x:Number):NumberParameters
_x:Number

Returns
Number
getX()method 
public function getX(_t:Number):NumberParameters
_t:Number

Returns
Number
getXPrime()method 
public function getXPrime(_t:Number):NumberParameters
_t:Number

Returns
Number
getY()method 
public function getY(_t:Number):NumberParameters
_t:Number

Returns
Number
getYPrime()method 
public function getYPrime(_t:Number):NumberParameters
_t:Number

Returns
Number
initPoints()method 
protected function initPoints():void
initPointsCollection()method 
protected function initPointsCollection():void

Initialize the point collection by creating it and adding the event listener.

preDraw()method 
public override function preDraw():void

Performs any pre calculation that is required to successfully render this element. Including bounds calculations and lower level drawing command storage. Each geometry object overrides this and is responsible for it's own pre calculation cycle.

propertyChangeHandler()method 
protected override function propertyChangeHandler(event:PropertyChangeEvent):void

Principle event handler for any property changes to a geometry object or it's child objects.

Parameters
event:PropertyChangeEvent