Merge pull request #1844 from pagameba/doc-ol-format-feature

Documentation for ol.format.Feature subclasses
This commit is contained in:
Paul Spencer
2014-03-12 10:23:25 -04:00
10 changed files with 195 additions and 4 deletions

View File

@@ -373,7 +373,7 @@ virtual('lint', 'build/lint-timestamp', 'build/lint-generated-timestamp',
def build_lint_src_timestamp(t):
t.run('%(GJSLINT)s',
'--jslint_error=all',
'--custom_jsdoc_tags=todo',
'--custom_jsdoc_tags=todo,function',
'--strict',
t.newer(t.dependencies))
t.touch()

View File

@@ -5,6 +5,10 @@ goog.require('goog.functions');
/**
* ol.format.Feature subclasses provide the ability to decode and encode
* {@link ol.Feature} objects from a variety of commonly used geospatial
* file formats. See the documentation for each format for more details.
*
* @constructor
*/
ol.format.Feature = function() {
@@ -24,6 +28,8 @@ ol.format.Feature.prototype.getType = goog.abstractMethod;
/**
* Read a single feature from a source.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
@@ -31,6 +37,8 @@ ol.format.Feature.prototype.readFeature = goog.abstractMethod;
/**
* Read all features from a source.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
@@ -38,6 +46,8 @@ ol.format.Feature.prototype.readFeatures = goog.abstractMethod;
/**
* Read a single geometry from a source.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.geom.Geometry} Geometry.
*/
@@ -45,6 +55,8 @@ ol.format.Feature.prototype.readGeometry = goog.abstractMethod;
/**
* Read the projection from a source.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
@@ -52,6 +64,8 @@ ol.format.Feature.prototype.readProjection = goog.abstractMethod;
/**
* Encode a feature in this format.
*
* @param {ol.Feature} feature Feature.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
@@ -59,6 +73,8 @@ ol.format.Feature.prototype.writeFeature = goog.abstractMethod;
/**
* Encode an array of features in this format.
*
* @param {Array.<ol.Feature>} features Features.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
@@ -66,6 +82,8 @@ ol.format.Feature.prototype.writeFeatures = goog.abstractMethod;
/**
* Write a single geometry in this format.
*
* @param {ol.geom.Geometry} geometry Geometry.
* @return {ArrayBuffer|Node|Object|string} Node.
*/

View File

@@ -21,6 +21,8 @@ goog.require('ol.proj');
/**
* Provide access to features stored in the GeoJSON format.
*
* @constructor
* @extends {ol.format.JSONFeature}
* @param {olx.format.GeoJSONOptions=} opt_options Options.
@@ -313,6 +315,28 @@ ol.format.GeoJSON.prototype.getExtensions = function() {
};
/**
* Read a feature from a GeoJSON Feature source. This method will throw
* an error if used with a FeatureCollection source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.GeoJSON.prototype.readFeature;
/**
* Read all features from a GeoJSON source. Works with both Feature and
* FeatureCollection sources.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.GeoJSON.prototype.readFeatures;
/**
* @inheritDoc
*/
@@ -356,6 +380,16 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(object) {
};
/**
* Read a geometry from a GeoJSON source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.GeoJSON.prototype.readGeometry;
/**
* @inheritDoc
*/
@@ -366,7 +400,10 @@ ol.format.GeoJSON.prototype.readGeometryFromObject = function(object) {
/**
* @inheritDoc
* Read the projection from the GeoJSON source file.
*
* @param {ArrayBuffer|Document|Node|Object|string} object Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.GeoJSON.prototype.readProjection = function(object) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
@@ -390,6 +427,16 @@ ol.format.GeoJSON.prototype.readProjection = function(object) {
};
/**
* Encode a feature as a GeoJSON Feature object.
*
* @function
* @param {ol.Feature} feature Feature.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.GeoJSON.prototype.writeFeature;
/**
* @inheritDoc
*/
@@ -415,6 +462,16 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature) {
};
/**
* Encode an array of features as GeoJSON.
*
* @function
* @param {Array.<ol.Feature>} features Features.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.GeoJSON.prototype.writeFeatures;
/**
* @inheritDoc
*/

View File

@@ -1,3 +1,5 @@
@exportSymbol ol.format.GPX
@exportProperty ol.format.GPX.prototype.readFeature
@exportProperty ol.format.GPX.prototype.readFeatures
@exportProperty ol.format.GPX.prototype.readProjection
@exportProperty ol.format.GPX.prototype.writeFeatures

View File

@@ -363,6 +363,16 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeParsersNS(
});
/**
* Read the first feature from a GPX source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.GPX.prototype.readFeature;
/**
* @inheritDoc
*/
@@ -384,6 +394,16 @@ ol.format.GPX.prototype.readFeatureFromNode = function(node) {
};
/**
* Read all features from a GPX source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.GPX.prototype.readFeatures;
/**
* @inheritDoc
*/
@@ -407,6 +427,15 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node) {
};
/**
* Read the projection from a GPX source.
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.GPX.prototype.readProjection;
/**
* @inheritDoc
*/
@@ -770,6 +799,16 @@ ol.format.GPX.V1_1 = function() {
goog.inherits(ol.format.GPX.V1_1, ol.format.GPX);
/**
* Encode an array of features in the GPX format.
*
* @function
* @param {Array.<ol.Feature>} features Features.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.GPX.prototype.writeFeatures;
/**
* @inheritDoc
*/

View File

@@ -1,3 +1,4 @@
@exportSymbol ol.format.IGC
@exportProperty ol.format.IGC.prototype.readFeature
@exportProperty ol.format.IGC.prototype.readFeatures
@exportProperty ol.format.IGC.prototype.readProjection

View File

@@ -85,6 +85,16 @@ ol.format.IGC.prototype.getExtensions = function() {
};
/**
* Read the feature from the IGC source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.IGC.prototype.readFeature;
/**
* @inheritDoc
*/
@@ -156,6 +166,17 @@ ol.format.IGC.prototype.readFeatureFromText = function(text) {
};
/**
* Read the feature from the source. As IGC sources contain a single
* feature, this will return the feature in an array.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.IGC.prototype.readFeatures;
/**
* @inheritDoc
*/
@@ -169,6 +190,16 @@ ol.format.IGC.prototype.readFeaturesFromText = function(text) {
};
/**
* Read the projection from the IGC source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.IGC.prototype.readProjection;
/**
* @inheritDoc
*/

View File

@@ -1,6 +1,5 @@
@exportSymbol ol.format.KML
@exportProperty ol.format.KML.prototype.readFeature
@exportProperty ol.format.KML.prototype.readFeatures
@exportProperty ol.format.KML.prototype.readGeometry
@exportProperty ol.format.KML.prototype.readName
@exportProperty ol.format.KML.prototype.readProjection

View File

@@ -1443,6 +1443,16 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
};
/**
* Read the first feature from a KML source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.KML.prototype.readFeature;
/**
* @inheritDoc
*/
@@ -1462,6 +1472,16 @@ ol.format.KML.prototype.readFeatureFromNode = function(node) {
};
/**
* Read all features from a KML source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.KML.prototype.readFeatures;
/**
* @inheritDoc
*/
@@ -1573,6 +1593,16 @@ ol.format.KML.prototype.readNameFromNode = function(node) {
};
/**
* Read the projection from a KML source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.KML.prototype.readProjection;
/**
* @inheritDoc
*/

View File

@@ -264,6 +264,16 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
};
/**
* Read all features from a TopoJSON source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.TopoJSON.prototype.readFeatures;
/**
* @inheritDoc
*/
@@ -364,7 +374,11 @@ ol.format.TopoJSON.transformVertex_ = function(vertex, scale, translate) {
/**
* @inheritDoc
* Read the projection from a TopoJSON source.
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} object Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.TopoJSON.prototype.readProjection = function(object) {
return this.defaultProjection_;