- Timestamp:
- Jan 14, 2011, 2:30:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-api/js/ZOO-api.js
r26 r74 23 23 */ 24 24 25 /** 26 * Class: ZOO 27 */ 25 28 ZOO = { 29 /** 30 * Constant: SERVICE_ACCEPTED 31 * {Integer} used for 32 */ 26 33 SERVICE_ACCEPTED: 0, 34 /** 35 * Constant: SERVICE_STARTED 36 * {Integer} used for 37 */ 27 38 SERVICE_STARTED: 1, 39 /** 40 * Constant: SERVICE_PAUSED 41 * {Integer} used for 42 */ 28 43 SERVICE_PAUSED: 2, 44 /** 45 * Constant: SERVICE_SUCCEEDED 46 * {Integer} used for 47 */ 29 48 SERVICE_SUCCEEDED: 3, 49 /** 50 * Constant: SERVICE_FAILED 51 * {Integer} used for 52 */ 30 53 SERVICE_FAILED: 4, 54 /** 55 * Function: removeItem 56 * Remove an object from an array. Iterates through the array 57 * to find the item, then removes it. 58 * 59 * Parameters: 60 * array - {Array} 61 * item - {Object} 62 * 63 * Return 64 * {Array} A reference to the array 65 */ 31 66 removeItem: function(array, item) { 32 67 for(var i = array.length - 1; i >= 0; i--) { … … 37 72 return array; 38 73 }, 74 /** 75 * Function: indexOf 76 * 77 * Parameters: 78 * array - {Array} 79 * obj - {Object} 80 * 81 * Returns: 82 * {Integer} The index at, which the first object was found in the array. 83 * If not found, returns -1. 84 */ 39 85 indexOf: function(array, obj) { 40 86 for(var i=0, len=array.length; i<len; i++) { … … 44 90 return -1; 45 91 }, 92 /** 93 * Function: extend 94 * Copy all properties of a source object to a destination object. Modifies 95 * the passed in destination object. Any properties on the source object 96 * that are set to undefined will not be (re)set on the destination object. 97 * 98 * Parameters: 99 * destination - {Object} The object that will be modified 100 * source - {Object} The object with properties to be set on the destination 101 * 102 * Returns: 103 * {Object} The destination object. 104 */ 46 105 extend: function(destination, source) { 47 106 destination = destination || {}; … … 55 114 return destination; 56 115 }, 116 /** 117 * Function: Class 118 * Method used to create ZOO classes. Includes support for 119 * multiple inheritance. 120 */ 57 121 Class: function() { 58 122 var Class = function() { … … 64 128 if(typeof arguments[i] == "function") { 65 129 // get the prototype of the superclass 66 130 parent = arguments[i].prototype; 67 131 } else { 68 132 // in this case we're extending with the prototype … … 75 139 return Class; 76 140 }, 141 /** 142 * Function: UpdateStatus 143 * Method used to update the status of the process 144 * 145 * Parameters: 146 * env - {Object} The environment object 147 * value - {Float} the status value between 0 to 100 148 */ 77 149 UpdateStatus: function(env,value) { 78 150 return ZOOUpdateStatus(env,value); … … 80 152 }; 81 153 82 }; 83 154 /** 155 * Class: ZOO.String 156 * Contains convenience methods for string manipulation 157 */ 84 158 ZOO.String = { 159 /** 160 * Function: startsWith 161 * Test whether a string starts with another string. 162 * 163 * Parameters: 164 * str - {String} The string to test. 165 * sub - {Sring} The substring to look for. 166 * 167 * Returns: 168 * {Boolean} The first string starts with the second. 169 */ 85 170 startsWith: function(str, sub) { 86 171 return (str.indexOf(sub) == 0); 87 172 }, 173 /** 174 * Function: contains 175 * Test whether a string contains another string. 176 * 177 * Parameters: 178 * str - {String} The string to test. 179 * sub - {String} The substring to look for. 180 * 181 * Returns: 182 * {Boolean} The first string contains the second. 183 */ 88 184 contains: function(str, sub) { 89 185 return (str.indexOf(sub) != -1); 90 186 }, 187 /** 188 * Function: trim 189 * Removes leading and trailing whitespace characters from a string. 190 * 191 * Parameters: 192 * str - {String} The (potentially) space padded string. This string is not 193 * modified. 194 * 195 * Returns: 196 * {String} A trimmed version of the string with all leading and 197 * trailing spaces removed. 198 */ 91 199 trim: function(str) { 92 200 return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 93 201 }, 202 /** 203 * Function: camelize 204 * Camel-case a hyphenated string. 205 * Ex. "chicken-head" becomes "chickenHead", and 206 * "-chicken-head" becomes "ChickenHead". 207 * 208 * Parameters: 209 * str - {String} The string to be camelized. The original is not modified. 210 * 211 * Returns: 212 * {String} The string, camelized 213 * 214 */ 94 215 camelize: function(str) { 95 216 var oStringList = str.split('-'); … … 101 222 return camelizedString; 102 223 }, 224 /** 225 * Property: tokenRegEx 226 * Used to find tokens in a string. 227 * Examples: ${a}, ${a.b.c}, ${a-b}, ${5} 228 */ 103 229 tokenRegEx: /\$\{([\w.]+?)\}/g, 230 /** 231 * Property: numberRegEx 232 * Used to test strings as numbers. 233 */ 104 234 numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/, 235 /** 236 * Function: isNumeric 237 * Determine whether a string contains only a numeric value. 238 * 239 * Examples: 240 * (code) 241 * ZOO.String.isNumeric("6.02e23") // true 242 * ZOO.String.isNumeric("12 dozen") // false 243 * ZOO.String.isNumeric("4") // true 244 * ZOO.String.isNumeric(" 4 ") // false 245 * (end) 246 * 247 * Returns: 248 * {Boolean} String contains only a number. 249 */ 105 250 isNumeric: function(value) { 106 251 return ZOO.String.numberRegEx.test(value); 107 252 }, 253 /** 254 * Function: numericIf 255 * Converts a string that appears to be a numeric value into a number. 256 * 257 * Returns 258 * {Number|String} a Number if the passed value is a number, a String 259 * otherwise. 260 */ 108 261 numericIf: function(value) { 109 262 return ZOO.String.isNumeric(value) ? parseFloat(value) : value; … … 111 264 }; 112 265 266 /** 267 * Class: ZOO.Request 268 * Contains convenience methods for working with ZOORequest which 269 * replace XMLHttpRequest. Because of we are not in a browser 270 * JavaScript environment, ZOO Project provides a method to 271 * query servers which is based on curl : ZOORequest. 272 */ 113 273 ZOO.Request = { 274 /** 275 * Function: GET 276 * Send an HTTP GET request. 277 * 278 * Parameters: 279 * url - {String} The URL to request. 280 * params - {Object} Params to add to the url 281 * 282 * Returns: 283 * {String} Request result. 284 */ 114 285 Get: function(url,params) { 115 286 var paramsArray = []; … … 140 311 return ZOORequest('GET',url); 141 312 }, 313 /** 314 * Function: POST 315 * Send an HTTP POST request. 316 * 317 * Parameters: 318 * url - {String} The URL to request. 319 * body - {String} The request's body to send. 320 * headers - {Object} A key-value object of headers to push to 321 * the request's head 322 * 323 * Returns: 324 * {String} Request result. 325 */ 142 326 Post: function(url,body,headers) { 143 327 if(!(headers instanceof Array)) { 144 328 var headersArray = []; 145 for (var hname in headers) {329 for (var name in headers) { 146 330 headersArray.push(name+': '+headers[name]); 147 331 } … … 152 336 }; 153 337 338 /** 339 * Class: ZOO.Bounds 340 * Instances of this class represent bounding boxes. Data stored as left, 341 * bottom, right, top floats. All values are initialized to null, 342 * however, you should make sure you set them before using the bounds 343 * for anything. 344 */ 154 345 ZOO.Bounds = ZOO.Class({ 346 /** 347 * Property: left 348 * {Number} Minimum horizontal coordinate. 349 */ 155 350 left: null, 351 /** 352 * Property: bottom 353 * {Number} Minimum vertical coordinate. 354 */ 156 355 bottom: null, 356 /** 357 * Property: right 358 * {Number} Maximum horizontal coordinate. 359 */ 157 360 right: null, 361 /** 362 * Property: top 363 * {Number} Maximum vertical coordinate. 364 */ 158 365 top: null, 366 /** 367 * Constructor: ZOO.Bounds 368 * Construct a new bounds object. 369 * 370 * Parameters: 371 * left - {Number} The left bounds of the box. Note that for width 372 * calculations, this is assumed to be less than the right value. 373 * bottom - {Number} The bottom bounds of the box. Note that for height 374 * calculations, this is assumed to be more than the top value. 375 * right - {Number} The right bounds. 376 * top - {Number} The top bounds. 377 */ 159 378 initialize: function(left, bottom, right, top) { 160 379 if (left != null) … … 167 386 this.top = parseFloat(top); 168 387 }, 388 /** 389 * Method: clone 390 * Create a cloned instance of this bounds. 391 * 392 * Returns: 393 * {<ZOO.Bounds>} A fresh copy of the bounds 394 */ 169 395 clone:function() { 170 396 return new ZOO.Bounds(this.left, this.bottom, 171 397 this.right, this.top); 172 398 }, 399 /** 400 * Method: equals 401 * Test a two bounds for equivalence. 402 * 403 * Parameters: 404 * bounds - {<ZOO.Bounds>} 405 * 406 * Returns: 407 * {Boolean} The passed-in bounds object has the same left, 408 * right, top, bottom components as this. Note that if bounds 409 * passed in is null, returns false. 410 */ 173 411 equals:function(bounds) { 174 412 var equals = false; … … 180 418 return equals; 181 419 }, 420 /** 421 * Method: toString 422 * 423 * Returns: 424 * {String} String representation of bounds object. 425 * (ex.<i>"left-bottom=(5,42) right-top=(10,45)"</i>) 426 */ 182 427 toString:function() { 183 428 return ( "left-bottom=(" + this.left + "," + this.bottom + ")" 184 429 + " right-top=(" + this.right + "," + this.top + ")" ); 185 430 }, 431 /** 432 * APIMethod: toArray 433 * 434 * Returns: 435 * {Array} array of left, bottom, right, top 436 */ 186 437 toArray: function() { 187 438 return [this.left, this.bottom, this.right, this.top]; 188 439 }, 440 /** 441 * Method: toBBOX 442 * 443 * Parameters: 444 * decimal - {Integer} How many significant digits in the bbox coords? 445 * Default is 6 446 * 447 * Returns: 448 * {String} Simple String representation of bounds object. 449 * (ex. <i>"5,42,10,45"</i>) 450 */ 189 451 toBBOX:function(decimal) { 190 452 if (decimal== null) … … 197 459 return bbox; 198 460 }, 461 /** 462 * Method: toGeometry 463 * Create a new polygon geometry based on this bounds. 464 * 465 * Returns: 466 * {<ZOO.Geometry.Polygon>} A new polygon with the coordinates 467 * of this bounds. 468 */ 199 469 toGeometry: function() { 200 470 return new ZOO.Geometry.Polygon([ … … 207 477 ]); 208 478 }, 479 /** 480 * Method: getWidth 481 * 482 * Returns: 483 * {Float} The width of the bounds 484 */ 209 485 getWidth:function() { 210 486 return (this.right - this.left); 211 487 }, 488 /** 489 * Method: getHeight 490 * 491 * Returns: 492 * {Float} The height of the bounds (top minus bottom). 493 */ 212 494 getHeight:function() { 213 495 return (this.top - this.bottom); 214 496 }, 497 /** 498 * Method: add 499 * 500 * Parameters: 501 * x - {Float} 502 * y - {Float} 503 * 504 * Returns: 505 * {<ZOO.Bounds>} A new bounds whose coordinates are the same as 506 * this, but shifted by the passed-in x and y values. 507 */ 215 508 add:function(x, y) { 216 509 if ( (x == null) || (y == null) ) … … 219 512 this.right + x, this.top + y); 220 513 }, 514 /** 515 * Method: extend 516 * Extend the bounds to include the point, lonlat, or bounds specified. 517 * Note, this function assumes that left < right and bottom < top. 518 * 519 * Parameters: 520 * object - {Object} Can be Point, or Bounds 521 */ 221 522 extend:function(object) { 222 523 var bounds = null; … … 244 545 } 245 546 }, 547 /** 548 * APIMethod: contains 549 * 550 * Parameters: 551 * x - {Float} 552 * y - {Float} 553 * inclusive - {Boolean} Whether or not to include the border. 554 * Default is true. 555 * 556 * Returns: 557 * {Boolean} Whether or not the passed-in coordinates are within this 558 * bounds. 559 */ 246 560 contains:function(x, y, inclusive) { 247 561 //set default … … 262 576 return contains; 263 577 }, 578 /** 579 * Method: intersectsBounds 580 * Determine whether the target bounds intersects this bounds. Bounds are 581 * considered intersecting if any of their edges intersect or if one 582 * bounds contains the other. 583 * 584 * Parameters: 585 * bounds - {<ZOO.Bounds>} The target bounds. 586 * inclusive - {Boolean} Treat coincident borders as intersecting. Default 587 * is true. If false, bounds that do not overlap but only touch at the 588 * border will not be considered as intersecting. 589 * 590 * Returns: 591 * {Boolean} The passed-in bounds object intersects this bounds. 592 */ 264 593 intersectsBounds:function(bounds, inclusive) { 265 594 if (inclusive == null) … … 293 622 return intersects; 294 623 }, 624 /** 625 * Method: containsBounds 626 * Determine whether the target bounds is contained within this bounds. 627 * 628 * bounds - {<ZOO.Bounds>} The target bounds. 629 * partial - {Boolean} If any of the target corners is within this bounds 630 * consider the bounds contained. Default is false. If true, the 631 * entire target bounds must be contained within this bounds. 632 * inclusive - {Boolean} Treat shared edges as contained. Default is 633 * true. 634 * 635 * Returns: 636 * {Boolean} The passed-in bounds object is contained within this bounds. 637 */ 295 638 containsBounds:function(bounds, partial, inclusive) { 296 639 if (partial == null) … … 308 651 }); 309 652 653 /** 654 * Class: ZOO.Projection 655 * Class for coordinate transforms between coordinate systems. 656 * Depends on the zoo-proj4js library. zoo-proj4js library 657 * is loaded by the ZOO Kernel with zoo-api. 658 */ 310 659 ZOO.Projection = ZOO.Class({ 660 /** 661 * Property: proj 662 * {Object} Proj4js.Proj instance. 663 */ 311 664 proj: null, 665 /** 666 * Property: projCode 667 * {String} 668 */ 312 669 projCode: null, 670 /** 671 * Constructor: OpenLayers.Projection 672 * This class offers several methods for interacting with a wrapped 673 * zoo-pro4js projection object. 674 * 675 * Parameters: 676 * projCode - {String} A string identifying the Well Known Identifier for 677 * the projection. 678 * options - {Object} An optional object to set additional properties. 679 * 680 * Returns: 681 * {<ZOO.Projection>} A projection object. 682 */ 313 683 initialize: function(projCode, options) { 314 684 ZOO.extend(this, options); … … 318 688 } 319 689 }, 690 /** 691 * Method: getCode 692 * Get the string SRS code. 693 * 694 * Returns: 695 * {String} The SRS code. 696 */ 320 697 getCode: function() { 321 698 return this.proj ? this.proj.srsCode : this.projCode; 322 699 }, 700 /** 701 * Method: getUnits 702 * Get the units string for the projection -- returns null if 703 * zoo-proj4js is not available. 704 * 705 * Returns: 706 * {String} The units abbreviation. 707 */ 323 708 getUnits: function() { 324 709 return this.proj ? this.proj.units : null; 325 710 }, 711 /** 712 * Method: toString 713 * Convert projection to string (getCode wrapper). 714 * 715 * Returns: 716 * {String} The projection code. 717 */ 326 718 toString: function() { 327 719 return this.getCode(); 328 720 }, 721 /** 722 * Method: equals 723 * Test equality of two projection instances. Determines equality based 724 * soley on the projection code. 725 * 726 * Returns: 727 * {Boolean} The two projections are equivalent. 728 */ 329 729 equals: function(projection) { 330 730 if (projection && projection.getCode) … … 333 733 return false; 334 734 }, 735 /* Method: destroy 736 * Destroy projection object. 737 */ 335 738 destroy: function() { 336 739 this.proj = null; … … 339 742 CLASS_NAME: 'ZOO.Projection' 340 743 }); 744 /** 745 * Method: transform 746 * Transform a point coordinate from one projection to another. Note that 747 * the input point is transformed in place. 748 * 749 * Parameters: 750 * point - {{ZOO.Geometry.Point> | Object} An object with x and y 751 * properties representing coordinates in those dimensions. 752 * sourceProj - {OpenLayers.Projection} Source map coordinate system 753 * destProj - {OpenLayers.Projection} Destination map coordinate system 754 * 755 * Returns: 756 * point - {object} A transformed coordinate. The original point is modified. 757 */ 341 758 ZOO.Projection.transform = function(point, source, dest) { 342 759 if (source.proj && dest.proj) … … 345 762 }; 346 763 764 /** 765 * Class: ZOO.Format 766 * Base class for format reading/writing a variety of formats. Subclasses 767 * of ZOO.Format are expected to have read and write methods. 768 */ 347 769 ZOO.Format = ZOO.Class({ 770 /** 771 * Property: options 772 * {Object} A reference to options passed to the constructor. 773 */ 348 774 options:null, 775 /** 776 * Property: externalProjection 777 * {<ZOO.Projection>} When passed a externalProjection and 778 * internalProjection, the format will reproject the geometries it 779 * reads or writes. The externalProjection is the projection used by 780 * the content which is passed into read or which comes out of write. 781 * In order to reproject, a projection transformation function for the 782 * specified projections must be available. This support is provided 783 * via zoo-proj4js. 784 */ 349 785 externalProjection: null, 786 /** 787 * Property: internalProjection 788 * {<ZOO.Projection>} When passed a externalProjection and 789 * internalProjection, the format will reproject the geometries it 790 * reads or writes. The internalProjection is the projection used by 791 * the geometries which are returned by read or which are passed into 792 * write. In order to reproject, a projection transformation function 793 * for the specified projections must be available. This support is 794 * provided via zoo-proj4js. 795 */ 350 796 internalProjection: null, 797 /** 798 * Property: data 799 * {Object} When <keepData> is true, this is the parsed string sent to 800 * <read>. 801 */ 351 802 data: null, 803 /** 804 * Property: keepData 805 * {Object} Maintain a reference (<data>) to the most recently read data. 806 * Default is false. 807 */ 352 808 keepData: false, 809 /** 810 * Constructor: ZOO.Format 811 * Instances of this class are not useful. See one of the subclasses. 812 * 813 * Parameters: 814 * options - {Object} An optional object with properties to set on the 815 * format 816 * 817 * Valid options: 818 * keepData - {Boolean} If true, upon <read>, the data property will be 819 * set to the parsed object (e.g. the json or xml object). 820 * 821 * Returns: 822 * An instance of ZOO.Format 823 */ 353 824 initialize: function(options) { 354 825 ZOO.extend(this, options); 355 826 this.options = options; 356 827 }, 828 /** 829 * Method: destroy 830 * Clean up. 831 */ 357 832 destroy: function() { 358 833 }, 834 /** 835 * Method: read 836 * Read data from a string, and return an object whose type depends on the 837 * subclass. 838 * 839 * Parameters: 840 * data - {string} Data to read/parse. 841 * 842 * Returns: 843 * Depends on the subclass 844 */ 359 845 read: function(data) { 360 846 }, 847 /** 848 * Method: write 849 * Accept an object, and return a string. 850 * 851 * Parameters: 852 * object - {Object} Object to be serialized 853 * 854 * Returns: 855 * {String} A string representation of the object. 856 */ 361 857 write: function(data) { 362 858 }, 363 859 CLASS_NAME: 'ZOO.Format' 364 860 }); 861 /** 862 * Class: ZOO.Format.WKT 863 * Class for reading and writing Well-Known Text. Create a new instance 864 * with the <ZOO.Format.WKT> constructor. 865 * 866 * Inherits from: 867 * - <ZOO.Format> 868 */ 365 869 ZOO.Format.WKT = ZOO.Class(ZOO.Format, { 870 /** 871 * Constructor: ZOO.Format.WKT 872 * Create a new parser for WKT 873 * 874 * Parameters: 875 * options - {Object} An optional object whose properties will be set on 876 * this instance 877 * 878 * Returns: 879 * {<ZOO.Format.WKT>} A new WKT parser. 880 */ 366 881 initialize: function(options) { 367 882 this.regExes = { … … 374 889 ZOO.Format.prototype.initialize.apply(this, [options]); 375 890 }, 891 /** 892 * Method: read 893 * Deserialize a WKT string and return a vector feature or an 894 * array of vector features. Supports WKT for POINT, 895 * MULTIPOINT, LINESTRING, MULTILINESTRING, POLYGON, 896 * MULTIPOLYGON, and GEOMETRYCOLLECTION. 897 * 898 * Parameters: 899 * wkt - {String} A WKT string 900 * 901 * Returns: 902 * {<ZOO.Feature.Vector>|Array} A feature or array of features for 903 * GEOMETRYCOLLECTION WKT. 904 */ 376 905 read: function(wkt) { 377 906 var features, type, str; … … 401 930 return features; 402 931 }, 932 /** 933 * Method: write 934 * Serialize a feature or array of features into a WKT string. 935 * 936 * Parameters: 937 * features - {<ZOO.Feature.Vector>|Array} A feature or array of 938 * features 939 * 940 * Returns: 941 * {String} The WKT string representation of the input geometries 942 */ 403 943 write: function(features) { 404 944 var collection, geometry, type, data, isCollection; … … 432 972 return pieces.join(''); 433 973 }, 974 /** 975 * Object with properties corresponding to the geometry types. 976 * Property values are functions that do the actual data extraction. 977 */ 434 978 extract: { 979 /** 980 * Return a space delimited string of point coordinates. 981 * @param {<ZOO.Geometry.Point>} point 982 * @returns {String} A string of coordinates representing the point 983 */ 435 984 'point': function(point) { 436 985 return point.x + ' ' + point.y; 437 986 }, 987 /** 988 * Return a comma delimited string of point coordinates from a multipoint. 989 * @param {<ZOO.Geometry.MultiPoint>} multipoint 990 * @returns {String} A string of point coordinate strings representing 991 * the multipoint 992 */ 438 993 'multipoint': function(multipoint) { 439 994 var array = []; … … 443 998 return array.join(','); 444 999 }, 1000 /** 1001 * Return a comma delimited string of point coordinates from a line. 1002 * @param {<ZOO.Geometry.LineString>} linestring 1003 * @returns {String} A string of point coordinate strings representing 1004 * the linestring 1005 */ 445 1006 'linestring': function(linestring) { 446 1007 var array = []; … … 450 1011 return array.join(','); 451 1012 }, 1013 /** 1014 * Return a comma delimited string of linestring strings from a multilinestring. 1015 * @param {<ZOO.Geometry.MultiLineString>} multilinestring 1016 * @returns {String} A string of of linestring strings representing 1017 * the multilinestring 1018 */ 452 1019 'multilinestring': function(multilinestring) { 453 1020 var array = []; … … 459 1026 return array.join(','); 460 1027 }, 1028 /** 1029 * Return a comma delimited string of linear ring arrays from a polygon. 1030 * @param {<ZOO.Geometry.Polygon>} polygon 1031 * @returns {String} An array of linear ring arrays representing the polygon 1032 */ 461 1033 'polygon': function(polygon) { 462 1034 var array = []; … … 468 1040 return array.join(','); 469 1041 }, 1042 /** 1043 * Return an array of polygon arrays from a multipolygon. 1044 * @param {<ZOO.Geometry.MultiPolygon>} multipolygon 1045 * @returns {Array} An array of polygon arrays representing 1046 * the multipolygon 1047 */ 470 1048 'multipolygon': function(multipolygon) { 471 1049 var array = []; … … 478 1056 } 479 1057 }, 1058 /** 1059 * Object with properties corresponding to the geometry types. 1060 * Property values are functions that do the actual parsing. 1061 */ 480 1062 parse: { 1063 /** 1064 * Return point feature given a point WKT fragment. 1065 * @param {String} str A WKT fragment representing the point 1066 * @returns {<ZOO.Feature>} A point feature 1067 */ 481 1068 'point': function(str) { 482 1069 var coords = ZOO.String.trim(str).split(this.regExes.spaces); … … 485 1072 ); 486 1073 }, 1074 /** 1075 * Return a multipoint feature given a multipoint WKT fragment. 1076 * @param {String} A WKT fragment representing the multipoint 1077 * @returns {<ZOO.Feature>} A multipoint feature 1078 */ 487 1079 'multipoint': function(str) { 488 1080 var points = ZOO.String.trim(str).split(','); … … 495 1087 ); 496 1088 }, 1089 /** 1090 * Return a linestring feature given a linestring WKT fragment. 1091 * @param {String} A WKT fragment representing the linestring 1092 * @returns {<ZOO.Feature>} A linestring feature 1093 */ 497 1094 'linestring': function(str) { 498 1095 var points = ZOO.String.trim(str).split(','); … … 505 1102 ); 506 1103 }, 1104 /** 1105 * Return a multilinestring feature given a multilinestring WKT fragment. 1106 * @param {String} A WKT fragment representing the multilinestring 1107 * @returns {<ZOO.Feature>} A multilinestring feature 1108 */ 507 1109 'multilinestring': function(str) { 508 1110 var line; … … 517 1119 ); 518 1120 }, 1121 /** 1122 * Return a polygon feature given a polygon WKT fragment. 1123 * @param {String} A WKT fragment representing the polygon 1124 * @returns {<ZOO.Feature>} A polygon feature 1125 */ 519 1126 'polygon': function(str) { 520 1127 var ring, linestring, linearring; … … 531 1138 ); 532 1139 }, 1140 /** 1141 * Return a multipolygon feature given a multipolygon WKT fragment. 1142 * @param {String} A WKT fragment representing the multipolygon 1143 * @returns {<ZOO.Feature>} A multipolygon feature 1144 * @private 1145 */ 533 1146 'multipolygon': function(str) { 534 1147 var polygon; … … 543 1156 ); 544 1157 }, 1158 /** 1159 * Return an array of features given a geometrycollection WKT fragment. 1160 * @param {String} A WKT fragment representing the geometrycollection 1161 * @returns {Array} An array of ZOO.Feature 1162 */ 545 1163 'geometrycollection': function(str) { 546 1164 // separate components of the collection with | … … 556 1174 CLASS_NAME: 'ZOO.Format.WKT' 557 1175 }); 1176 /** 1177 * Class: ZOO.Format.JSON 1178 * A parser to read/write JSON safely. Create a new instance with the 1179 * <ZOO.Format.JSON> constructor. 1180 * 1181 * Inherits from: 1182 * - <OpenLayers.Format> 1183 */ 558 1184 ZOO.Format.JSON = ZOO.Class(ZOO.Format, { 559 1185 indent: " ",
Note: See TracChangeset
for help on using the changeset viewer.