Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,15 +3,29 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* Read and write WKT.
|
||||
* @requires OpenLayers/Format.js
|
||||
*
|
||||
* Class: OpenLayers.Format.WKT
|
||||
* Class for reading and writing Well-Known Text. Create a new instance
|
||||
* with the <OpenLayers.Format.WKT> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Format>
|
||||
*/
|
||||
OpenLayers.Format.WKT = OpenLayers.Class.create();
|
||||
OpenLayers.Format.WKT.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Format, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Format.WKT
|
||||
* Create a new parser for WKT
|
||||
*
|
||||
* Parameters:
|
||||
* options - {Object} An optional object whose properties will be set on
|
||||
* this instance
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Format.WKT>} A new WKT parser.
|
||||
*/
|
||||
initialize: function(options) {
|
||||
this.regExes = {
|
||||
@@ -25,14 +39,18 @@ OpenLayers.Format.WKT.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: read
|
||||
* Deserialize a WKT string and return an OpenLayers.Feature.Vector or an
|
||||
* array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT,
|
||||
* LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
|
||||
* GEOMETRYCOLLECTION.
|
||||
* @param {String} wkt A WKT string
|
||||
* @returns {OpenLayers.Feature.Vector|Array} A feature or array of
|
||||
* features for
|
||||
* GEOMETRYCOLLECTION WKT.
|
||||
*
|
||||
* Parameters:
|
||||
* wkt - {String} A WKT string
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Feature.Vector>|Array} A feature or array of features for
|
||||
* GEOMETRYCOLLECTION WKT.
|
||||
*/
|
||||
read: function(wkt) {
|
||||
var features, type, str;
|
||||
@@ -48,10 +66,15 @@ OpenLayers.Format.WKT.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: write
|
||||
* Serialize a feature or array of features into a WKT string.
|
||||
* @param {OpenLayers.Feature.Vector|Array} features A feature or array of
|
||||
* features
|
||||
* @returns {String} The WKT string representation of the input geometries
|
||||
*
|
||||
* Parameters:
|
||||
* features - {<OpenLayers.Feature.Vector>|Array} A feature or array of
|
||||
* features
|
||||
*
|
||||
* Return:
|
||||
* {String} The WKT string representation of the input geometries
|
||||
*/
|
||||
write: function(features) {
|
||||
var collection, geometry, type, data, isCollection;
|
||||
@@ -91,7 +114,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
extract: {
|
||||
/**
|
||||
* Return a space delimited string of point coordinates.
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* @param {<OpenLayers.Geometry.Point>} point
|
||||
* @returns {String} A string of coordinates representing the point
|
||||
*/
|
||||
'point': function(point) {
|
||||
@@ -100,7 +123,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
|
||||
/**
|
||||
* Return a comma delimited string of point coordinates from a multipoint.
|
||||
* @param {OpenLayers.Geometry.MultiPoint} multipoint
|
||||
* @param {<OpenLayers.Geometry.MultiPoint>} multipoint
|
||||
* @returns {String} A string of point coordinate strings representing
|
||||
* the multipoint
|
||||
*/
|
||||
@@ -114,7 +137,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
|
||||
/**
|
||||
* Return a comma delimited string of point coordinates from a line.
|
||||
* @param {OpenLayers.Geometry.LineString} linestring
|
||||
* @param {<OpenLayers.Geometry.LineString>} linestring
|
||||
* @returns {String} A string of point coordinate strings representing
|
||||
* the linestring
|
||||
*/
|
||||
@@ -128,7 +151,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
|
||||
/**
|
||||
* Return a comma delimited string of linestring strings from a multilinestring.
|
||||
* @param {OpenLayers.Geometry.MultiLineString} multilinestring
|
||||
* @param {<OpenLayers.Geometry.MultiLineString>} multilinestring
|
||||
* @returns {String} A string of of linestring strings representing
|
||||
* the multilinestring
|
||||
*/
|
||||
@@ -144,7 +167,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
|
||||
/**
|
||||
* Return a comma delimited string of linear ring arrays from a polygon.
|
||||
* @param {OpenLayers.Geometry.Polygon} polygon
|
||||
* @param {<OpenLayers.Geometry.Polygon>} polygon
|
||||
* @returns {String} An array of linear ring arrays representing the polygon
|
||||
*/
|
||||
'polygon': function(polygon) {
|
||||
@@ -159,7 +182,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
|
||||
/**
|
||||
* Return an array of polygon arrays from a multipolygon.
|
||||
* @param {OpenLayers.Geometry.MultiPolygon} multipolygon
|
||||
* @param {<OpenLayers.Geometry.MultiPolygon>} multipolygon
|
||||
* @returns {Array} An array of polygon arrays representing
|
||||
* the multipolygon
|
||||
*/
|
||||
@@ -183,7 +206,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return point feature given a point WKT fragment.
|
||||
* @param {String} str A WKT fragment representing the point
|
||||
* @returns {OpenLayers.Feature.Vector} A point feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A point feature
|
||||
* @private
|
||||
*/
|
||||
'point': function(str) {
|
||||
@@ -196,7 +219,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return a multipoint feature given a multipoint WKT fragment.
|
||||
* @param {String} A WKT fragment representing the multipoint
|
||||
* @returns {OpenLayers.Feature.Vector} A multipoint feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A multipoint feature
|
||||
* @private
|
||||
*/
|
||||
'multipoint': function(str) {
|
||||
@@ -213,7 +236,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return a linestring feature given a linestring WKT fragment.
|
||||
* @param {String} A WKT fragment representing the linestring
|
||||
* @returns {OpenLayers.Feature.Vector} A linestring feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A linestring feature
|
||||
* @private
|
||||
*/
|
||||
'linestring': function(str) {
|
||||
@@ -230,7 +253,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return a multilinestring feature given a multilinestring WKT fragment.
|
||||
* @param {String} A WKT fragment representing the multilinestring
|
||||
* @returns {OpenLayers.Feature.Vector} A multilinestring feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A multilinestring feature
|
||||
* @private
|
||||
*/
|
||||
'multilinestring': function(str) {
|
||||
@@ -249,7 +272,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return a polygon feature given a polygon WKT fragment.
|
||||
* @param {String} A WKT fragment representing the polygon
|
||||
* @returns {OpenLayers.Feature.Vector} A polygon feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A polygon feature
|
||||
* @private
|
||||
*/
|
||||
'polygon': function(str) {
|
||||
@@ -270,7 +293,7 @@ OpenLayers.Format.WKT.prototype =
|
||||
/**
|
||||
* Return a multipolygon feature given a multipolygon WKT fragment.
|
||||
* @param {String} A WKT fragment representing the multipolygon
|
||||
* @returns {OpenLayers.Feature.Vector} A multipolygon feature
|
||||
* @returns {<OpenLayers.Feature.Vector>} A multipolygon feature
|
||||
* @private
|
||||
*/
|
||||
'multipolygon': function(str) {
|
||||
|
||||
Reference in New Issue
Block a user