Replace type annotations

This commit is contained in:
Tim Schaub
2018-05-07 20:49:08 -06:00
parent 8e7c88d9a5
commit 34c1a6b9ba
19 changed files with 78 additions and 78 deletions

View File

@@ -103,7 +103,7 @@ inherits(MVT, FeatureFormat);
* Reader callback for parsing layers. * Reader callback for parsing layers.
* @param {number} tag The tag. * @param {number} tag The tag.
* @param {Object} layers The layers object. * @param {Object} layers The layers object.
* @param {ol.ext.PBF} pbf The PBF. * @param {Object} pbf The PBF.
*/ */
function layersPBFReader(tag, layers, pbf) { function layersPBFReader(tag, layers, pbf) {
if (tag === 3) { if (tag === 3) {
@@ -125,7 +125,7 @@ function layersPBFReader(tag, layers, pbf) {
* Reader callback for parsing layer. * Reader callback for parsing layer.
* @param {number} tag The tag. * @param {number} tag The tag.
* @param {Object} layer The layer object. * @param {Object} layer The layer object.
* @param {ol.ext.PBF} pbf The PBF. * @param {Object} pbf The PBF.
*/ */
function layerPBFReader(tag, layer, pbf) { function layerPBFReader(tag, layer, pbf) {
if (tag === 15) { if (tag === 15) {
@@ -159,7 +159,7 @@ function layerPBFReader(tag, layer, pbf) {
* Reader callback for parsing feature. * Reader callback for parsing feature.
* @param {number} tag The tag. * @param {number} tag The tag.
* @param {Object} feature The feature object. * @param {Object} feature The feature object.
* @param {ol.ext.PBF} pbf The PBF. * @param {Object} pbf The PBF.
*/ */
function featurePBFReader(tag, feature, pbf) { function featurePBFReader(tag, feature, pbf) {
if (tag == 1) { if (tag == 1) {
@@ -182,7 +182,7 @@ function featurePBFReader(tag, feature, pbf) {
/** /**
* Read a raw feature from the pbf offset stored at index `i` in the raw layer. * Read a raw feature from the pbf offset stored at index `i` in the raw layer.
* @suppress {missingProperties} * @suppress {missingProperties}
* @param {ol.ext.PBF} pbf PBF. * @param {Object} pbf PBF.
* @param {Object} layer Raw layer. * @param {Object} layer Raw layer.
* @param {number} i Index of the feature in the raw layer's `features` array. * @param {number} i Index of the feature in the raw layer's `features` array.
* @return {Object} Raw feature. * @return {Object} Raw feature.
@@ -205,7 +205,7 @@ function readRawFeature(pbf, layer, i) {
* Read the raw geometry from the pbf offset stored in a raw feature's geometry * Read the raw geometry from the pbf offset stored in a raw feature's geometry
* property. * property.
* @suppress {missingProperties} * @suppress {missingProperties}
* @param {ol.ext.PBF} pbf PBF. * @param {Object} pbf PBF.
* @param {Object} feature Raw feature. * @param {Object} feature Raw feature.
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in. * @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in. * @param {Array.<number>} ends Array to store ends in.
@@ -294,7 +294,7 @@ function getGeometryType(type, numEnds) {
/** /**
* @private * @private
* @param {ol.ext.PBF} pbf PBF * @param {Object} pbf PBF
* @param {Object} rawFeature Raw Mapbox feature. * @param {Object} rawFeature Raw Mapbox feature.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {module:ol/Feature|module:ol/render/Feature} Feature. * @return {module:ol/Feature|module:ol/render/Feature} Feature.

View File

@@ -1,13 +1,13 @@
# Implementing formats with ol.format.Feature # Implementing formats with ol/format/Feature
`ol.format.Feature` defines a number of abstract methods including: `ol/format/Feature` defines a number of abstract methods including:
* `readFeatures` returning an `Array.<ol.Feature>` * `readFeatures` returning an `Array.<ol/Feature>`
* `readFeature` returning an `ol.Feature` * `readFeature` returning an `ol/Feature`
* `readGeometry` returning an `module:ol/geom/Geometry~Geometry` * `readGeometry` returning an `module:ol/geom/Geometry~Geometry`
Having different functions for multiple return types allows both the user to specify what type of data they want and for the compiler to properly type check the code. Depending on the format, it is entirely reasonable to leave one or more of these methods unimplemented, or provide sensible default implementations. Having different functions for multiple return types allows both the user to specify what type of data they want and for the compiler to properly type check the code. Depending on the format, it is entirely reasonable to leave one or more of these methods unimplemented, or provide sensible default implementations.
For example, `ol.format.GPX` only supports reading multiple features. Therefore `readFeature` and `readGeometry` are unimplemented and will raise an exception if called. For example, `ol/format/GPX` only supports reading multiple features. Therefore `readFeature` and `readGeometry` are unimplemented and will raise an exception if called.
The IGC format contains only one feature per file, so `readFeature` returns that feature, `readFeatures` returns an array containing a single feature which is the feature in the file, and `readGeometry` is unimplemented. The IGC format contains only one feature per file, so `readFeature` returns that feature, `readFeatures` returns an array containing a single feature which is the feature in the file, and `readGeometry` is unimplemented.
@@ -18,10 +18,10 @@ If a file cannot be parsed, then the return value should be `null` for all three
# Implementing XML formats # Implementing XML formats
This is an introduction for people looking to contribute an XML format reader to OpenLayers. After having read this document, you should read the code of and make sure that you understand the simpler XML format readers like `ol.format.GPX` before embarking on writing your own format reader. This is an introduction for people looking to contribute an XML format reader to OpenLayers. After having read this document, you should read the code of and make sure that you understand the simpler XML format readers like `ol/format/GPX` before embarking on writing your own format reader.
The document ends with guidelines for implementing a new format. The document ends with guidelines for implementing a new format.
The `ol.xml` namespace contains a number of useful functions for parsing XML documents. All code in OpenLayers that reads data from XML documents should use it. It has several features: The `ol/xml` namespace contains a number of useful functions for parsing XML documents. All code in OpenLayers that reads data from XML documents should use it. It has several features:
* Browser support back to IE9 * Browser support back to IE9
* Correct treatment of XML namespaces * Correct treatment of XML namespaces
@@ -30,34 +30,34 @@ The `ol.xml` namespace contains a number of useful functions for parsing XML doc
* Decoupling of the XML document structure from the output data structure * Decoupling of the XML document structure from the output data structure
* Good compatibility with the Closure Compiler, including good type checking * Good compatibility with the Closure Compiler, including good type checking
The `ol.format.XML` class includes a number of methods for reading arrays of features, single features, geometries, and projections from XML documents. `ol.format.XML` should only be used for formats containing features and geometries. If your format does not contain features or geometries (e.g. WMS GetCapabilities) then you should not use `ol.format.XML`. The `ol/format/XML` class includes a number of methods for reading arrays of features, single features, geometries, and projections from XML documents. `ol/format/XML` should only be used for formats containing features and geometries. If your format does not contain features or geometries (e.g. WMS GetCapabilities) then you should not use `ol/format/XML`.
## `ol.format.XML` ## `ol/format/XML`
`ol.format.XML` is for formats that contain features and geometries. If your XML file contains something else then you should not inherit from `ol.format.XML` and can skip ahead to the `ol.xml` section. `ol/format/XML` is for formats that contain features and geometries. If your XML file contains something else then you should not inherit from `ol/format/XML` and can skip ahead to the `ol/xml` section.
`ol.format.XML` is perhaps easiest to explain first, since it is higher level than `ol.xml`. `ol/format/XML` is perhaps easiest to explain first, since it is higher level than `ol/xml`.
`ol.format.XML` defines a number of abstract type-checked methods with names including: `ol/format/XML` defines a number of abstract type-checked methods with names including:
read{Features,Feature,Geometry}From{Document,Node} read{Features,Feature,Geometry}From{Document,Node}
`Document`s are top-level XML document objects, `Node`s are children of the top-level XML document object. In modern browsers `Document` is a subclass of `Node`, and inherits all of `Node`'s methods. In IE, this is not the case: `Document` is not a subclass of `Node`, and `Document` only has some of `Node`'s functionality. The distinction between the two is therefore necessary. `Document`s are top-level XML document objects, `Node`s are children of the top-level XML document object. In modern browsers `Document` is a subclass of `Node`, and inherits all of `Node`'s methods. In IE, this is not the case: `Document` is not a subclass of `Node`, and `Document` only has some of `Node`'s functionality. The distinction between the two is therefore necessary.
## `ol.xml` ## `ol/xml`
There are two key concepts to master to understand how `ol.xml` works: There are two key concepts to master to understand how `ol/xml` works:
* How `ol.xml.parse` traverses the XML document (or node) and calls back to your code * How `ol/xml~parse` traverses the XML document (or node) and calls back to your code
* How `ol.xml` decouples the structure of the XML document (which is always a tree) from the structure of the output data (which could be a single object, an array of objects, or anything else) using an object stack. * How `ol/xml` decouples the structure of the XML document (which is always a tree) from the structure of the output data (which could be a single object, an array of objects, or anything else) using an object stack.
It's handy to have the [`src/ol/xml.js` source code](https://github.com/openlayers/openlayers/blob/master/src/ol/xml.js) to hand while you read the following. It's handy to have the [`src/ol/xml.js` source code](https://github.com/openlayers/openlayers/blob/master/src/ol/xml.js) to hand while you read the following.
## How `ol.xml.parse` traverses the XML document ## How `ol/xml~parse` traverses the XML document
`ol.xml.parse` is the core of the XML parser. Given a `Node`, it loops over all that `Node`'s child `Elements` (ignoring text, CDATA sections, comments, etc.). For each child element, it looks up to see if there is a function to call that matches the child element's namespace and local (unqualified) name. If there is a function to call, then that function is called with the child element. `ol/xml~parse` is the core of the XML parser. Given a `Node`, it loops over all that `Node`'s child `Elements` (ignoring text, CDATA sections, comments, etc.). For each child element, it looks up to see if there is a function to call that matches the child element's namespace and local (unqualified) name. If there is a function to call, then that function is called with the child element.
The `parserNS` argument to `ol.xml.parse` is an `Object` whose keys are XML namespaces and whose values are `Objects` whose keys are local element names and whose values are functions. A simple example might look like this: The `parserNS` argument to `parse` is an `Object` whose keys are XML namespaces and whose values are `Objects` whose keys are local element names and whose values are functions. A simple example might look like this:
```js ```js
var parserNS = { var parserNS = {
@@ -74,11 +74,11 @@ var parserNS = {
}; };
``` ```
Many XML formats use different namespaces for different versions, but the code for handling the elements in different versions is the same. `ol.xml.makeParserNS` is an helper function that creates the above structure given a single array of namespaces and a single object mapping element names onto functions. Many XML formats use different namespaces for different versions, but the code for handling the elements in different versions is the same. `ol/xml~makeParserNS` is an helper function that creates the above structure given a single array of namespaces and a single object mapping element names onto functions.
## How the object stack works ## How the object stack works
`ol.xml.parse` also takes an argument called `objectStack` which is an `Array` of arbitrary values. This stack is key to the decoupling of the XML tree structure from the structure of the parsed output. `ol/xml~parse` also takes an argument called `objectStack` which is an `Array` of arbitrary values. This stack is key to the decoupling of the XML tree structure from the structure of the parsed output.
Generally speaking, each callback function will modify the object at the top of the object stack. This is perhaps best demonstrated with a couple of examples. Generally speaking, each callback function will modify the object at the top of the object stack. This is perhaps best demonstrated with a couple of examples.
@@ -93,9 +93,9 @@ First consider the case of constructing a feature. Consider the following (imag
</doc> </doc>
``` ```
When we parse find the `<Feature>` tag, we construct a new `ol.Feature` and push it on to the object stack. We will then call a `ol.xml.parse` to parse the child elements of the `Feature` tag. When we find the `<id>` element, we'll set the id of the object that is on top of the object stack (the `ol.Feature`). When find the `<Point>` element we set the geometry of the object on the top of the object stack (still the `ol.Feature`). Finally, at the end of the `</Feature>` tag, our fully-configured `ol.Feature` is on the top of the stack, so we pop it off the top of the stack and return it. When we parse find the `<Feature>` tag, we construct a new `ol/Feature` and push it on to the object stack. We will then call a `ol/xml~parse` to parse the child elements of the `Feature` tag. When we find the `<id>` element, we'll set the id of the object that is on top of the object stack (the `ol/Feature`). When find the `<Point>` element we set the geometry of the object on the top of the object stack (still the `ol/Feature`). Finally, at the end of the `</Feature>` tag, our fully-configured `ol/Feature` is on the top of the stack, so we pop it off the top of the stack and return it.
This pattern is so common that there is a function, `ol.xml.pushParseAndPop` that implements it. This pattern is so common that there is a function, `ol/xml~pushParseAndPop` that implements it.
Now consider the case of parsing multiple features: Now consider the case of parsing multiple features:
@@ -112,23 +112,23 @@ Now consider the case of parsing multiple features:
</doc> </doc>
``` ```
In this case, we want to extract an `Array` of `ol.Feature`s. Here's how it works. When we encounter the `<doc>` tag we push an empty `Array` on to the stack. On each `<Feature>` tag, we invoke our feature parser above, which will return a populated `ol.Feature`. We append this `ol.Feature` to the object on the top of the object stack (our `Array` of `ol.Feature`s). At the final closing `</doc>` tag we pop the object off the top of the stack - now an `Array` containing two features - and return it. In this case, we want to extract an `Array` of `ol/Feature`s. Here's how it works. When we encounter the `<doc>` tag we push an empty `Array` on to the stack. On each `<Feature>` tag, we invoke our feature parser above, which will return a populated `ol/Feature`. We append this `ol/Feature` to the object on the top of the object stack (our `Array` of `ol/Feature`s). At the final closing `</doc>` tag we pop the object off the top of the stack - now an `Array` containing two features - and return it.
### Common operations ### Common operations
In the above there are many common operations, like setting the property of the object on the top of the stack, or reading an object and appending that to an array on the top of the stack. There are many helper functions here, for example: In the above there are many common operations, like setting the property of the object on the top of the stack, or reading an object and appending that to an array on the top of the stack. There are many helper functions here, for example:
* `ol.xml.makeObjectPropertySetter` reads a value from the child element and sets a property on the object on the top of the stack. * `ol/xml~makeObjectPropertySetter` reads a value from the child element and sets a property on the object on the top of the stack.
* `ol.xml.makeArrayPusher` reads a value from the child element and appends it to the array on the top of the stack. * `ol/xml~makeArrayPusher` reads a value from the child element and appends it to the array on the top of the stack.
* `ol.xml.makeReplacer` reads a value from the child element and *replaces* whatever is on top of the stack with it. * `ol/xml~makeReplacer` reads a value from the child element and *replaces* whatever is on top of the stack with it.
### Putting it all together ### Putting it all together
With the above, you should be able to read through the [source code to `ol.format.GPX`](https://github.com/openlayers/openlayers/blob/master/src/ol/format/gpxformat.js) and get a feel for how it works. Start from the bottom of the file and work upwards. It's also useful to have [an example GPX file](http://www.topografix.com/fells_loop.gpx) and [the GPX specification](http://www.topografix.com/GPX/1/1/) to hand. With the above, you should be able to read through the [source code to `ol/format/GPX`](https://github.com/openlayers/openlayers/blob/master/src/ol/format/gpxformat.js) and get a feel for how it works. Start from the bottom of the file and work upwards. It's also useful to have [an example GPX file](http://www.topografix.com/fells_loop.gpx) and [the GPX specification](http://www.topografix.com/GPX/1/1/) to hand.
### Handling errors ### Handling errors
If, when reading a value from a child element, you find an invalid value, you should return `undefined`. The helper functions above (like `ol.xml.makeObjectPropertySetter`) will then skip this value. If the structure is incomplete or incorrect (e.g. a child element is missing a mandatory tag) then you should also return `undefined` from your reader, which will in turn cause the value to be skipped. If, when reading a value from a child element, you find an invalid value, you should return `undefined`. The helper functions above (like `ol/xml~makeObjectPropertySetter`) will then skip this value. If the structure is incomplete or incorrect (e.g. a child element is missing a mandatory tag) then you should also return `undefined` from your reader, which will in turn cause the value to be skipped.
An `ol.format.Format` should read as many features as it can, skipping features with any errors. An `ol/format/Format` should read as many features as it can, skipping features with any errors.

View File

@@ -27,7 +27,7 @@ const WebGLCircleReplay = function(tolerance, maxExtent) {
/** /**
* @private * @private
* @type {ol.render.webgl.circlereplay.defaultshader.Locations} * @type {module:ol/render/webgl/circlereplay/defaultshader/Locations}
*/ */
this.defaultLocations_ = null; this.defaultLocations_ = null;

View File

@@ -7,7 +7,7 @@ import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
* @extends {ol.render.webgl.TextureReplay} * @extends {module:ol/render/webgl/TextureReplay}
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {module:ol/extent~Extent} maxExtent Max extent. * @param {module:ol/extent~Extent} maxExtent Max extent.
* @struct * @struct

View File

@@ -94,7 +94,7 @@ inherits(WebGLImmediateRenderer, VectorContext);
*/ */
WebGLImmediateRenderer.prototype.drawText_ = function(replayGroup, geometry) { WebGLImmediateRenderer.prototype.drawText_ = function(replayGroup, geometry) {
const context = this.context_; const context = this.context_;
const replay = /** @type {ol.render.webgl.TextReplay} */ ( const replay = /** @type {module:ol/render/webgl/TextReplay} */ (
replayGroup.getReplay(0, ReplayType.TEXT)); replayGroup.getReplay(0, ReplayType.TEXT));
replay.setTextStyle(this.textStyle_); replay.setTextStyle(this.textStyle_);
replay.drawText(geometry, null); replay.drawText(geometry, null);
@@ -128,7 +128,7 @@ WebGLImmediateRenderer.prototype.setStyle = function(style) {
/** /**
* Render a geometry into the canvas. Call * Render a geometry into the canvas. Call
* {@link ol.render.webgl.Immediate#setStyle} first to set the rendering style. * {@link ol/render/webgl/Immediate#setStyle} first to set the rendering style.
* *
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry The geometry to render. * @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry The geometry to render.
* @override * @override
@@ -199,7 +199,7 @@ WebGLImmediateRenderer.prototype.drawGeometryCollection = function(geometry, dat
WebGLImmediateRenderer.prototype.drawPoint = function(geometry, data) { WebGLImmediateRenderer.prototype.drawPoint = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.ImageReplay} */ ( const replay = /** @type {module:ol/render/webgl/ImageReplay} */ (
replayGroup.getReplay(0, ReplayType.IMAGE)); replayGroup.getReplay(0, ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
replay.drawPoint(geometry, data); replay.drawPoint(geometry, data);
@@ -226,7 +226,7 @@ WebGLImmediateRenderer.prototype.drawPoint = function(geometry, data) {
WebGLImmediateRenderer.prototype.drawMultiPoint = function(geometry, data) { WebGLImmediateRenderer.prototype.drawMultiPoint = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.ImageReplay} */ ( const replay = /** @type {module:ol/render/webgl/ImageReplay} */ (
replayGroup.getReplay(0, ReplayType.IMAGE)); replayGroup.getReplay(0, ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
replay.drawMultiPoint(geometry, data); replay.drawMultiPoint(geometry, data);
@@ -252,7 +252,7 @@ WebGLImmediateRenderer.prototype.drawMultiPoint = function(geometry, data) {
WebGLImmediateRenderer.prototype.drawLineString = function(geometry, data) { WebGLImmediateRenderer.prototype.drawLineString = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.LineStringReplay} */ ( const replay = /** @type {module:ol/render/webgl/LineStringReplay} */ (
replayGroup.getReplay(0, ReplayType.LINE_STRING)); replayGroup.getReplay(0, ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
replay.drawLineString(geometry, data); replay.drawLineString(geometry, data);
@@ -278,7 +278,7 @@ WebGLImmediateRenderer.prototype.drawLineString = function(geometry, data) {
WebGLImmediateRenderer.prototype.drawMultiLineString = function(geometry, data) { WebGLImmediateRenderer.prototype.drawMultiLineString = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.LineStringReplay} */ ( const replay = /** @type {module:ol/render/webgl/LineStringReplay} */ (
replayGroup.getReplay(0, ReplayType.LINE_STRING)); replayGroup.getReplay(0, ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
replay.drawMultiLineString(geometry, data); replay.drawMultiLineString(geometry, data);
@@ -304,7 +304,7 @@ WebGLImmediateRenderer.prototype.drawMultiLineString = function(geometry, data)
WebGLImmediateRenderer.prototype.drawPolygon = function(geometry, data) { WebGLImmediateRenderer.prototype.drawPolygon = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.PolygonReplay} */ ( const replay = /** @type {module:ol/render/webgl/PolygonReplay} */ (
replayGroup.getReplay(0, ReplayType.POLYGON)); replayGroup.getReplay(0, ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawPolygon(geometry, data); replay.drawPolygon(geometry, data);
@@ -330,7 +330,7 @@ WebGLImmediateRenderer.prototype.drawPolygon = function(geometry, data) {
WebGLImmediateRenderer.prototype.drawMultiPolygon = function(geometry, data) { WebGLImmediateRenderer.prototype.drawMultiPolygon = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.PolygonReplay} */ ( const replay = /** @type {module:ol/render/webgl/PolygonReplay} */ (
replayGroup.getReplay(0, ReplayType.POLYGON)); replayGroup.getReplay(0, ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawMultiPolygon(geometry, data); replay.drawMultiPolygon(geometry, data);
@@ -356,7 +356,7 @@ WebGLImmediateRenderer.prototype.drawMultiPolygon = function(geometry, data) {
WebGLImmediateRenderer.prototype.drawCircle = function(geometry, data) { WebGLImmediateRenderer.prototype.drawCircle = function(geometry, data) {
const context = this.context_; const context = this.context_;
const replayGroup = new WebGLReplayGroup(1, this.extent_); const replayGroup = new WebGLReplayGroup(1, this.extent_);
const replay = /** @type {ol.render.webgl.CircleReplay} */ ( const replay = /** @type {module:ol/render/webgl/CircleReplay} */ (
replayGroup.getReplay(0, ReplayType.CIRCLE)); replayGroup.getReplay(0, ReplayType.CIRCLE));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawCircle(geometry, data); replay.drawCircle(geometry, data);

View File

@@ -47,7 +47,7 @@ const WebGLLineStringReplay = function(tolerance, maxExtent) {
/** /**
* @private * @private
* @type {ol.render.webgl.linestringreplay.defaultshader.Locations} * @type {module:ol/render/webgl/linestringreplay/defaultshader/Locations}
*/ */
this.defaultLocations_ = null; this.defaultLocations_ = null;

View File

@@ -51,7 +51,7 @@ const WebGLPolygonReplay = function(tolerance, maxExtent) {
/** /**
* @private * @private
* @type {ol.render.webgl.polygonreplay.defaultshader.Locations} * @type {module:ol/render/webgl/polygonreplay/defaultshader/Locations}
*/ */
this.defaultLocations_ = null; this.defaultLocations_ = null;

View File

@@ -114,7 +114,7 @@ const WebGLReplay = function(tolerance, maxExtent) {
/** /**
* Optional parameter for PolygonReplay instances. * Optional parameter for PolygonReplay instances.
* @protected * @protected
* @type {ol.render.webgl.LineStringReplay|undefined} * @type {module:ol/render/webgl/LineStringReplay|undefined}
*/ */
this.lineStringReplay = undefined; this.lineStringReplay = undefined;
@@ -145,10 +145,10 @@ WebGLReplay.prototype.finish = function(context) {};
* @param {module:ol/webgl/Context} context Context. * @param {module:ol/webgl/Context} context Context.
* @param {module:ol/size~Size} size Size. * @param {module:ol/size~Size} size Size.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @return {ol.render.webgl.circlereplay.defaultshader.Locations| * @return {module:ol/render/webgl/circlereplay/defaultshader/Locations|
ol.render.webgl.linestringreplay.defaultshader.Locations| ol/render/webgl/linestringreplay/defaultshader/Locations|
ol.render.webgl.polygonreplay.defaultshader.Locations| ol/render/webgl/polygonreplay/defaultshader/Locations|
ol.render.webgl.texturereplay.defaultshader.Locations} Locations. ol/render/webgl/texturereplay/defaultshader/Locations} Locations.
*/ */
WebGLReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {}; WebGLReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {};
@@ -157,10 +157,10 @@ WebGLReplay.prototype.setUpProgram = function(gl, context, size, pixelRatio) {};
* @abstract * @abstract
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.render.webgl.circlereplay.defaultshader.Locations| * @param {module:ol/render/webgl/circlereplay/defaultshader/Locations|
ol.render.webgl.linestringreplay.defaultshader.Locations| ol/render/webgl/linestringreplay/defaultshader/Locations|
ol.render.webgl.polygonreplay.defaultshader.Locations| ol/render/webgl/polygonreplay/defaultshader/Locations|
ol.render.webgl.texturereplay.defaultshader.Locations} locations Locations. ol/render/webgl/texturereplay/defaultshader/Locations} locations Locations.
*/ */
WebGLReplay.prototype.shutDownProgram = function(gl, locations) {}; WebGLReplay.prototype.shutDownProgram = function(gl, locations) {};

View File

@@ -24,7 +24,7 @@ import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
* @extends {ol.render.webgl.TextureReplay} * @extends {module:ol/render/webgl/TextureReplay}
* @param {number} tolerance Tolerance. * @param {number} tolerance Tolerance.
* @param {module:ol/extent~Extent} maxExtent Max extent. * @param {module:ol/extent~Extent} maxExtent Max extent.
* @struct * @struct

View File

@@ -65,7 +65,7 @@ const WebGLTextureReplay = function(tolerance, maxExtent) {
/** /**
* @protected * @protected
* @type {ol.render.webgl.texturereplay.defaultshader.Locations} * @type {module:ol/render/webgl/texturereplay/defaultshader/Locations}
*/ */
this.defaultLocations = null; this.defaultLocations = null;

View File

@@ -183,7 +183,7 @@ inherits(WebGLMapRenderer, MapRenderer);
/** /**
* @param {ol.Tile} tile Tile. * @param {module:ol/Tile} tile Tile.
* @param {module:ol/size~Size} tileSize Tile size. * @param {module:ol/size~Size} tileSize Tile size.
* @param {number} tileGutter Tile gutter. * @param {number} tileGutter Tile gutter.
* @param {number} magFilter Mag filter. * @param {number} magFilter Mag filter.

View File

@@ -19,21 +19,21 @@ const ImageSourceEventType = {
/** /**
* Triggered when an image starts loading. * Triggered when an image starts loading.
* @event ol.source.Image.Event#imageloadstart * @event ol/source/Image~ImageSourceEvent#imageloadstart
* @api * @api
*/ */
IMAGELOADSTART: 'imageloadstart', IMAGELOADSTART: 'imageloadstart',
/** /**
* Triggered when an image finishes loading. * Triggered when an image finishes loading.
* @event ol.source.Image.Event#imageloadend * @event ol/source/Image~ImageSourceEvent#imageloadend
* @api * @api
*/ */
IMAGELOADEND: 'imageloadend', IMAGELOADEND: 'imageloadend',
/** /**
* Triggered if image loading results in an error. * Triggered if image loading results in an error.
* @event ol.source.Image.Event#imageloaderror * @event ol/source/Image~ImageSourceEvent#imageloaderror
* @api * @api
*/ */
IMAGELOADERROR: 'imageloaderror' IMAGELOADERROR: 'imageloaderror'
@@ -107,7 +107,7 @@ const ImageSource = function(options) {
/** /**
* @private * @private
* @type {ol.reproj.Image} * @type {module:ol/reproj/Image}
*/ */
this.reprojectedImage_ = null; this.reprojectedImage_ = null;

View File

@@ -19,7 +19,7 @@ import {appendParams} from '../uri.js';
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to * you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See * access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail. * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {boolean} [hidpi=true] Use the `ol.Map#pixelRatio` value when requesting the image from * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting the image from
* the remote server. * the remote server.
* @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given * @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given
* a URL. * a URL.
@@ -49,7 +49,7 @@ import {appendParams} from '../uri.js';
* {@link module:ol/source/TileArcGISRest} data source. * {@link module:ol/source/TileArcGISRest} data source.
* *
* @constructor * @constructor
* @fires ol.source.Image.Event * @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image} * @extends {module:ol/source/Image}
* @param {module:ol/source/ImageArcGISRest~Options=} opt_options Image ArcGIS Rest Options. * @param {module:ol/source/ImageArcGISRest~Options=} opt_options Image ArcGIS Rest Options.
* @api * @api

View File

@@ -33,7 +33,7 @@ import {appendParams} from '../uri.js';
* Source for images from Mapguide servers * Source for images from Mapguide servers
* *
* @constructor * @constructor
* @fires ol.source.Image.Event * @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image} * @extends {module:ol/source/Image}
* @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options. * @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options.
* @api * @api

View File

@@ -48,7 +48,7 @@ import {appendParams} from '../uri.js';
* Source for WMS servers providing single, untiled images. * Source for WMS servers providing single, untiled images.
* *
* @constructor * @constructor
* @fires ol.source.Image.Event * @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image} * @extends {module:ol/source/Image}
* @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options. * @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options.
* @api * @api

View File

@@ -46,14 +46,14 @@ import {create as createTransform} from '../transform.js';
const RasterEventType = { const RasterEventType = {
/** /**
* Triggered before operations are run. * Triggered before operations are run.
* @event ol.source.Raster.Event#beforeoperations * @event ol/source/Raster~RasterSourceEvent#beforeoperations
* @api * @api
*/ */
BEFOREOPERATIONS: 'beforeoperations', BEFOREOPERATIONS: 'beforeoperations',
/** /**
* Triggered after operations are run. * Triggered after operations are run.
* @event ol.source.Raster.Event#afteroperations * @event ol/source/Raster~RasterSourceEvent#afteroperations
* @api * @api
*/ */
AFTEROPERATIONS: 'afteroperations' AFTEROPERATIONS: 'afteroperations'
@@ -138,7 +138,7 @@ inherits(RasterSourceEvent, Event);
* *
* @constructor * @constructor
* @extends {module:ol/source/Image} * @extends {module:ol/source/Image}
* @fires ol.source.Raster.Event * @fires ol/source/Raster~RasterSourceEvent
* @param {module:ol/source/Raster~Options=} options Options. * @param {module:ol/source/Raster~Options=} options Options.
* @api * @api
*/ */

View File

@@ -151,7 +151,7 @@ inherits(VectorSourceEvent, Event);
* *
* @constructor * @constructor
* @extends {module:ol/source/Source} * @extends {module:ol/source/Source}
* @fires ol.source.Vector.Event * @fires ol/source/Vector~VectorSourceEvent
* @param {module:ol/source/Vector~Options=} opt_options Vector source options. * @param {module:ol/source/Vector~Options=} opt_options Vector source options.
* @api * @api
*/ */

View File

@@ -8,21 +8,21 @@
export default { export default {
/** /**
* Triggered when a feature is added to the source. * Triggered when a feature is added to the source.
* @event ol.source.Vector.Event#addfeature * @event ol/source/Vector~VectorSourceEvent#addfeature
* @api * @api
*/ */
ADDFEATURE: 'addfeature', ADDFEATURE: 'addfeature',
/** /**
* Triggered when a feature is updated. * Triggered when a feature is updated.
* @event ol.source.Vector.Event#changefeature * @event ol/source/Vector~VectorSourceEvent#changefeature
* @api * @api
*/ */
CHANGEFEATURE: 'changefeature', CHANGEFEATURE: 'changefeature',
/** /**
* Triggered when the clear method is called on the source. * Triggered when the clear method is called on the source.
* @event ol.source.Vector.Event#clear * @event ol/source/Vector~VectorSourceEvent#clear
* @api * @api
*/ */
CLEAR: 'clear', CLEAR: 'clear',
@@ -30,7 +30,7 @@ export default {
/** /**
* Triggered when a feature is removed from the source. * Triggered when a feature is removed from the source.
* See {@link ol.source.Vector#clear source.clear()} for exceptions. * See {@link ol.source.Vector#clear source.clear()} for exceptions.
* @event ol.source.Vector.Event#removefeature * @event ol/source/Vector~VectorSourceEvent#removefeature
* @api * @api
*/ */
REMOVEFEATURE: 'removefeature' REMOVEFEATURE: 'removefeature'

View File

@@ -75,7 +75,7 @@ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
* @property {module:ol/extent~Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the * @property {module:ol/extent~Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the
* top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the * top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the
* provided extent. If not provided, the extent of the EPSG:3857 projection is used. * provided extent. If not provided, the extent of the EPSG:3857 projection is used.
* @property {number} [maxZoom] Maximum zoom. The default is `ol.DEFAULT_MAX_ZOOM`. This determines the number of levels * @property {number} [maxZoom] Maximum zoom. The default is `ol~DEFAULT_MAX_ZOOM`. This determines the number of levels
* in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set. * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.
* @property {number} [minZoom=0] Minimum zoom. * @property {number} [minZoom=0] Minimum zoom.
* @property {number|module:ol/size~Size} [tileSize=[256, 256]] Tile size in pixels. * @property {number|module:ol/size~Size} [tileSize=[256, 256]] Tile size in pixels.