1
8 import com.sekati.geom.Point;
9 import com.sekati.except.IllegalArgumentException;
10
11
14 class com.sekati.convert.PointConversion {
15
16
26 public static function toPointArray(coords:String):Array {
27 var pointArray:Array = new Array( );
28 var strArray:Array = coords.split( "|" );
29 if (strArray.length < 1) {
30 throw new IllegalArgumentException( PointConversion, "@@@ com.sekati.convert.PointConversion.toPointArray() Error: method requires a properly formatted coords string argument ('x,y|x,y|x,y') with at least 1 stringified points.", arguments );
31 }
32 var len:Number = strArray.length;
33 for (var i:Number = 0; i < len ; i++) {
34 var p:Array = strArray[i].split( "," );
35 pointArray.push( new Point( Number( p[0] ), Number( p[1] ) ) );
36 }
37 return pointArray;
38 }
39 }
40