Package | twaver |
Class | public class ShapeNode |
Inheritance | ShapeNode ![]() ![]() ![]() ![]() ![]() |
Subclasses | Bus, ShapeSubNetwork |
ShapeNodeUI
how to draw line between
points. It can be "line to", "move to", or "quad to".
Shape node and shape link are both displays complex
shape or path on network canvas. The diffence of
shape node and shape link is, shape link is still a
link, it extens from link element, normally has from
and to nodes. As a link object, it does not has the
abilities of a TWaver node or follower, such as location,
following another node or be followed by other nodes.
Another difference is, shape link displays a continuing
line, shape node can display uncontinuing line with
Consts.SEGMENT_MOVETO
segment.
For example, if you displays a map of the United States, it is a good idea to use shape node to display each state with a set of location points. Then you can resize the shape node to scale the shape vectorially. You can edit the control points of this shape by mouse drag-and-drop on network canvas.
Check the demo "States Map Demo" in TWaver Flex online demo to know more how to use shape node.
var node:ShapeNode=new ShapeNode(); node.setStyle(Styles.SHAPENODE_CLOSED, false); node.setStyle(Styles.LABEL_POSITION, Consts.POSITION_CENTER); node.setStyle(Styles.LABEL_FILL, true); node.setStyle(Styles.LABEL_FILL_COLOR, 0xC0C0C0); node.setStyle(Styles.LABEL_OUTLINE_WIDTH, 0); node.setStyle(Styles.LABEL_OUTLINE_COLOR, 0x606060); node.setStyle(Styles.LABEL_CORNER_RADIUS, 3); node.setStyle(Styles.VECTOR_FILL, true); node.setStyle(Styles.VECTOR_FILL_ALPHA, 0.7); node.setStyle(Styles.VECTOR_GRADIENT, Consts.GRADIENT_NONE); node.setStyle(Styles.SELECT_STYLE, Consts.SELECT_STYLE_SHADOW); node.setStyle(Styles.SELECT_STRENGTH, 2); node.setStyle(Styles.SELECT_BLURX, 20); node.setStyle(Styles.SELECT_BLURY, 20); node.setStyle(Styles.SELECT_COLOR, this.selectColor.selectedColor); node.setStyle(Styles.SELECT_INNER, this.selectInner.selected); //... var segments:ICollection = new Collection(); var points:ICollection = new Collection(); for each(var point:XML in features.s.p){ segments.addItem(Consts.SEGMENT_LINETO); points.addItem(new Point(x, y)); } node.segments = segments; node.points = points; //... box.add(node);
Property | Defined By | ||
---|---|---|---|
![]() | agentLinks : ICollection [read-only]
Get all agential links of this node. | Node | |
![]() | alarmState : AlarmState [read-only]
Get alarm state object of this element. | Element | |
![]() | centerLocation : Point
Get the location of this node's center point. | Node | |
![]() | children : ICollection [read-only]
Get all children data objects of this data object. | Data | |
![]() | childrenCount : int [read-only]
Get all children total count for this data. | Data | |
![]() | clientProperties : ICollection [read-only]
Get a ICollection that contians all client proerty name. | Data | |
elementUIClass : Class [override] [read-only]
Get element ui class name. | ShapeNode | ||
![]() | followers : ICollection [read-only]
Get all followers of this node with a collection. | Node | |
![]() | fromAgentLinks : ICollection [read-only]
Get all agential from/start links of this node with a collection. | Node | |
![]() | fromLinks : ICollection [read-only]
Get all links start from this node. | Node | |
![]() | hasChildren : Boolean [read-only]
Check whether this data has children objects. | Data | |
height : Number [override]
Set node height. | ShapeNode | ||
![]() | host : Node
Get the host node of this follower. | Follower | |
![]() | icon : String
Get icon value for this data. | Data | |
![]() | id : Object [read-only]
Get the ID value of this data. | Data | |
![]() | image : String
Get image url of this node. | Node | |
![]() | layerID : Object
Get layer ID of this element. | Element | |
lineLength : Number [read-only]
Get the number how many lines are contains in this shape. | ShapeNode | ||
![]() | links : ICollection [read-only]
Get all connected links of this node with a collection. | Node | |
location : Point [override]
Set the location for this node. | ShapeNode | ||
![]() | loopedLinks : ICollection [read-only]
Get all looped links on this node with a collection. | Node | |
![]() | name : String
Get name of this data. | Data | |
![]() | parent : IData
Get parent data object. | Data | |
points : ICollection
Get all trace points of the shape. | ShapeNode | ||
![]() | rect : Rectangle [read-only]
Get node bounds. | Node | |
segments : ICollection
Get all segments of this shape node. | ShapeNode | ||
![]() | size : Size [read-only]
Get node size. | Node | |
![]() | styleProperties : ICollection [read-only]
Get a ICollection that contians all style proerty name. | Element | |
![]() | toAgentLinks : ICollection [read-only]
Get all agential to/end links of this node with a collection. | Node | |
![]() | toLinks : ICollection [read-only]
Get all to/end links end to this node. | Node | |
![]() | toolTip : String
Get the tooltip text of this data. | Data | |
width : Number [override]
Set node width. | ShapeNode | ||
![]() | x : Number [read-only]
Get x location of this node. | Node | |
![]() | y : Number [read-only]
Get y location of this node. | Node |
Method | Defined By | ||
---|---|---|---|
ShapeNode(id:Object = null)
Constructor. | ShapeNode | ||
![]() |
Add a child data object for this data. | Data | |
addPoint(point:Point):void
Add a point into this shape node. | ShapeNode | ||
addPointAt(point:Point, index:int):void
Add a new point into this shape in the specified
location. | ShapeNode | ||
![]() | addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a property change listener to this data to monitoring property
change event. | Data | |
![]() | clearChildren():Boolean
Clear all children from this data. | Data | |
![]() | deserializeXML(serializer:XMLSerializer, xml:XML):void [override]
inheritDoc
| Element | |
dispatchPointsChangeEvent():void
Dispatch change event to all installed listeners
when any point is changed. | ShapeNode | ||
![]() | dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed listeners. | Data | |
![]() | getChildAt(index:int):IData
Get child as specified index location. | Data | |
![]() | getClient(clientProp:String):*
Get specified client property value. | Data | |
![]() | getPropertyValue(property:String):Object [override]
Get an user defined property on this data. | Element | |
![]() | getStyle(styleProp:String, returnDefaultIfNull:Boolean = true):*
Get the specified style property value. | Element | |
![]() | hasAgentLinks():Boolean
Check whether this node has agential links. | Node | |
![]() | hasOwnProperty(name:String):Boolean
Whether this data has specified property. | Data | |
![]() | isAdjustedToBottom():Boolean
Check whether this element has been adjusted to bottom. | Element | |
![]() | isDescendantOf(data:IData):Boolean
Check whether this data is a descendant of the specified data object. | Data | |
![]() |
Check whether the specified node is my host or on
my host chain. | Follower | |
![]() | isLoopedHostOn(follower:Follower):Boolean
Check whether specified follower is on a looped host chain. | Follower | |
![]() | isParentOf(data:IData):Boolean
Check whether this data is the parent of specified data. | Data | |
![]() | isRelatedTo(data:IData):Boolean
Check whether this data has descendant relationship with the specified data. | Data | |
![]() | removeChild(child:IData):Boolean
Remove the specified child object. | Data | |
removePoint(point:Point):void
Remove a point from this shape path. | ShapeNode | ||
removePointAt(index:int):void
Remove the point at specified location. | ShapeNode | ||
![]() | removePropertyChangeListener(listener:Function):void
Remove the specified property change listener. | Data | |
[override]
inheritDoc
| ShapeNode | ||
![]() | setCenterLocation(x:Number, y:Number):void
Set a new location for this node's center point. | Node | |
![]() |
Set client property for this data. | Data | |
![]() | setLocation(x:Number, y:Number):void
Set a new location for this node. | Node | |
setPointAt(point:Point, index:int):void
Update the point at specified index location. | ShapeNode | ||
![]() | setPropertyValue(property:String, value:Object):void [override]
Set an user defined property on this data. | Element | |
![]() | setSize(width:Number, height:Number):void
Set node size. | Node | |
![]() |
Set a style for this element. | Element | |
![]() | toChildren(matchFunction:Function = null):ICollection
Iterate children collection by given callback function. | Data | |
![]() | toString():String [override]
| Data | |
![]() | translate(dx:Number, dy:Number):void
Translate node location to specified offset. | Node |
elementUIClass | property |
elementUIClass:Class
[read-only] [override] Get element ui class name. UI class is used to paint/draw element on network canvas. TWaver Flex will create UI object for the element instance by this returned class name.
public function get elementUIClass():Class
height | property |
height:Number
[override] Set node height.
public function get height():Number
public function set height(value:Number):void
lineLength | property |
lineLength:Number
[read-only] Get the number how many lines are contains in this shape.
public function get lineLength():Number
location | property |
location:Point
[override]
Set the location for this node. Node on network canvas
will be moved to the new location once this has been changed.
Please note that node location is the left-top point of this node.
Use setCenterLocation
if you want use the node center as
the location.
public function get location():Point
public function set location(value:Point):void
points | property |
points:ICollection
Get all trace points of the shape.
public function get points():ICollection
public function set points(value:ICollection):void
segments | property |
segments:ICollection
Get all segments of this shape node. Each segment
used to control the corresponding point.
Object inside this collection can be:
Consts.SETMENT_MOVETO
,
Consts.SETMENT_LINETO
,
Consts.SETMENT_QUADTO
.
public function get segments():ICollection
public function set segments(value:ICollection):void
width | property |
width:Number
[override] Set node width.
public function get width():Number
public function set width(value:Number):void
ShapeNode | () | Constructor |
public function ShapeNode(id:Object = null)
Constructor. Create a shape node by specified id.
Parametersid:Object (default = null ) — the shape node id.
|
addPoint | () | method |
public function addPoint(point:Point):void
Add a point into this shape node.
Parameters
point:Point — a new point to be added.
|
addPointAt | () | method |
public function addPointAt(point:Point, index:int):void
Add a new point into this shape in the specified location. You can use this method to insert a point in the shape at an index location.
Parameters
point:Point — the point to be added.
| |
index:int — the index location of this point to be added.
|
dispatchPointsChangeEvent | () | method |
public function dispatchPointsChangeEvent():void
Dispatch change event to all installed listeners when any point is changed. All installed listeners will be notified when any points of this shape is changed.
removePoint | () | method |
public function removePoint(point:Point):void
Remove a point from this shape path.
Parameters
point:Point — the point to be removed.
|
removePointAt | () | method |
public function removePointAt(index:int):void
Remove the point at specified location.
Parameters
index:int — the point location to be removed.
|
serializeXML | () | method |
override public function serializeXML(serializer:XMLSerializer, newInstance:IData):void
inheritDoc
Parameters
serializer:XMLSerializer | |
newInstance:IData |
setPointAt | () | method |
public function setPointAt(point:Point, index:int):void
Update the point at specified index location.
Parameters
point:Point — the new point value to be used to update.
| |
index:int — the point location to be updated.
|