Packagecom.kapit.diagram.ui
Classpublic class Utils



Public Methods
 MethodDefined by
  
clipPoint(r:Rectangle, p:Point):Point
[static] Clips a point inside a rectangle.
Utils
  
clipSegment(t:Sprite, x0:Number, y0:Number, x1:Number, y1:Number):Point
[static] Clips a segment given two points.
Utils
  
clonePath(arr:Array):Array
[static]
Utils
  
[static]
Utils
  
getArrowCoordinates(x0:Number, y0:Number, x1:Number, y1:Number, width:Number, height:Number):Array
[static] Returns polyline points array that describes an arrow shape given to extreme corners, the arrow width and the arrow height.
Utils
  
getIntersectionRectBetweenPointsAndRect(p0:Point, p1:Point, rect:Rectangle):Rectangle
[static] Gets intersection rectangle between segment(p0,p1) and given rectangle
Utils
  
getSegmentRotation(x0:Number, y0:Number, x1:Number, y1:Number):Number
[static] Returns the rotation angle of a segment that is used to reshape links given a start point and a final point (horizontal and vertical segments combination).
Utils
  
getTextFormat(fontname:String):TextFormat
[static] Returns a text format (font, bold, italic) according to a font name.
Utils
  
globalToLocalRectangle(target:DisplayObject, rect:Rectangle):Rectangle
[static] Converts a rectangle description to a local rectangle description according to a target display object (a container).
Utils
  
intersectCurvedLineToRectangle(curveLine:Array, rect:Rectangle):Boolean
[static] Checks if a bezier curve intersects with a rectangle.
Utils
  
isEmbeddedFont(fontname:String):Boolean
[static] Checks if a font string refrence (font name) is supported by the current application.
Utils
  
isHorizontal(idx:int, pts:Array):Boolean
[static] Checks if a segment linking two points (contained in a points array and defined by an index) is horizontal.
Utils
  
localToGlobalRectangle(target:DisplayObject, rect:Rectangle):Rectangle
[static] Converts a local rectangle description according to a target display object (a container) to a global rectangle description .
Utils
  
overSamplePath(path:Array, nb:uint):Array
[static]
Utils
  
pointIsNearSegment(p:Point, lp1:Point, lp2:Point, tolerance:Number):Boolean
[static]
Utils
  
pointToLineDistance(p0:Point, lp1:Point, lp2:Point):Number
[static]
Utils
  
segmentIntersectsWithRectangle(p0:Point, p1:Point, rect:Rectangle):Boolean
[static] Checks if segment(p0,p1) intersects given rectangle
Utils
Public Constants
 ConstantDefined by
  PIO2 : Number = 1.5707963267948966
[static] 90°
Utils
  TWOPI : Number = 6.283185307179586
[static] 360°
Utils
Method detail
clipPoint()method
public static function clipPoint(r:Rectangle, p:Point):Point

Clips a point inside a rectangle.

Parameters
r:Rectangle — Bounding rectangle
 
p:Point — Point to clip.

Returns
Point — Clipped point.
clipSegment()method 
public static function clipSegment(t:Sprite, x0:Number, y0:Number, x1:Number, y1:Number):Point

Clips a segment given two points.

Parameters
t:Sprite — Sprite
 
x0:Number — Start point X coordinate.
 
y0:Number — Start point Y coordinate.
 
x1:Number — Final point X coordinate.
 
y1:Number — Final point Y coordinate.

Returns
Point — Clipping point.
clonePath()method 
public static function clonePath(arr:Array):ArrayParameters
arr:Array

Returns
Array
firstSignificantSegmentIndex()method 
public static function firstSignificantSegmentIndex(pts:Array):intParameters
pts:Array

Returns
int
getArrowCoordinates()method 
public static function getArrowCoordinates(x0:Number, y0:Number, x1:Number, y1:Number, width:Number, height:Number):Array

Returns polyline points array that describes an arrow shape given to extreme corners, the arrow width and the arrow height.

Parameters
x0:Number — First arrow corner X coordinate.
 
y0:Number — First arrow corner Y coordinate.
 
x1:Number — Second arrow corner X coordinate.
 
y1:Number — Second arrow corner Y coordinate.
 
width:Number — Arrow width.
 
height:Number — Arrow height.

Returns
Array — Arrow polyline points.
getIntersectionRectBetweenPointsAndRect()method 
public static function getIntersectionRectBetweenPointsAndRect(p0:Point, p1:Point, rect:Rectangle):Rectangle

Gets intersection rectangle between segment(p0,p1) and given rectangle

Parameters
p0:Point — Point0 of segment
 
p1:Point — Point1 of segment
 
rect:Rectangle

Returns
Rectangle — intersection rectangle
getSegmentRotation()method 
public static function getSegmentRotation(x0:Number, y0:Number, x1:Number, y1:Number):Number

Returns the rotation angle of a segment that is used to reshape links given a start point and a final point (horizontal and vertical segments combination).

Parameters
x0:Number — Start point X coordinate.
 
y0:Number — Start point Y coordinate.
 
x1:Number — Final point X coordinate.
 
y1:Number — Final point Y coordinate.

Returns
Number — Segment rotation angle.
getTextFormat()method 
public static function getTextFormat(fontname:String):TextFormat

Returns a text format (font, bold, italic) according to a font name.

Parameters
fontname:String — Font name.

Returns
TextFormat — Text Format containing the input font properties.
globalToLocalRectangle()method 
public static function globalToLocalRectangle(target:DisplayObject, rect:Rectangle):Rectangle

Converts a rectangle description to a local rectangle description according to a target display object (a container).

Parameters
target:DisplayObject — Target Display Object that defines the local reference.
 
rect:Rectangle — Global Rectangle description.

Returns
Rectangle — Loacal Rectangle description in the Target Display Object.
intersectCurvedLineToRectangle()method 
public static function intersectCurvedLineToRectangle(curveLine:Array, rect:Rectangle):Boolean

Checks if a bezier curve intersects with a rectangle.

Parameters
curveLine:Array — Bezier curve path.
 
rect:Rectangle — Input rectangle.

Returns
Boolean — True if rectangle intersetcs the bezier curve.
isEmbeddedFont()method 
public static function isEmbeddedFont(fontname:String):Boolean

Checks if a font string refrence (font name) is supported by the current application.

Parameters
fontname:String — Font name.

Returns
Boolean — True if the font is supported.
isHorizontal()method 
public static function isHorizontal(idx:int, pts:Array):Boolean

Checks if a segment linking two points (contained in a points array and defined by an index) is horizontal.

Parameters
idx:int — Point index.
 
pts:Array — Array points from which the two points will be extracted.

Returns
Boolean — True if the described segment is horizontal.
localToGlobalRectangle()method 
public static function localToGlobalRectangle(target:DisplayObject, rect:Rectangle):Rectangle

Converts a local rectangle description according to a target display object (a container) to a global rectangle description .

Parameters
target:DisplayObject — Target Display Object that defines the local reference of the input rectangle description.
 
rect:Rectangle — Local Rectangle description in the Target Display Object.

Returns
Rectangle — Global Rectangle description .
overSamplePath()method 
public static function overSamplePath(path:Array, nb:uint):ArrayParameters
path:Array
 
nb:uint

Returns
Array
pointIsNearSegment()method 
public static function pointIsNearSegment(p:Point, lp1:Point, lp2:Point, tolerance:Number):BooleanParameters
p:Point
 
lp1:Point
 
lp2:Point
 
tolerance:Number

Returns
Boolean
pointToLineDistance()method 
public static function pointToLineDistance(p0:Point, lp1:Point, lp2:Point):NumberParameters
p0:Point
 
lp1:Point
 
lp2:Point

Returns
Number
segmentIntersectsWithRectangle()method 
public static function segmentIntersectsWithRectangle(p0:Point, p1:Point, rect:Rectangle):Boolean

Checks if segment(p0,p1) intersects given rectangle

Parameters
p0:Point — Point0 of segment
 
p1:Point — Point1 of segment
 
rect:Rectangle

Returns
Booleantrue if segment intersects with rectangle false otherwise.
Constant detail
PIO2constant
public static const PIO2:Number = 1.5707963267948966

90°

TWOPIconstant 
public static const TWOPI:Number = 6.283185307179586

360°