Skip to content

Commit

Permalink
Get rid of olx.js and typedef.js typedefs for ol
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Mar 8, 2018
1 parent 8f0ffe2 commit 95d6251
Show file tree
Hide file tree
Showing 198 changed files with 2,262 additions and 2,698 deletions.
713 changes: 2 additions & 711 deletions externs/olx.js

Large diffs are not rendered by default.

52 changes: 29 additions & 23 deletions src/ol/CanvasMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,53 @@ registerMultiple(PluginType.LAYER_RENDERER, [
* The map is the core component of OpenLayers. For a map to render, a view,
* one or more layers, and a target container are needed:
*
* var map = new ol.CanvasMap({
* view: new ol.View({
* import CanvasMap from 'ol/CanvasMap';
* import TileLayer from 'ol/layer/Tile';
* import OSM from 'ol/source/OSM';
* import View from 'ol/View';
*
* var map = new CanvasMap({
* view: new View({
* center: [0, 0],
* zoom: 1
* }),
* layers: [
* new ol.layer.Tile({
* source: new ol.source.OSM()
* new TileLayer({
* source: new OSM()
* })
* ],
* target: 'map'
* });
*
* The above snippet creates a map using a {@link ol.layer.Tile} to display
* {@link ol.source.OSM} OSM data and render it to a DOM element with the
* id `map`.
* The above snippet creates a map using a {@link module:ol/layer/Tile~Tile} to
* display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM
* element with the id `map`.
*
* The constructor places a viewport container (with CSS class name
* `ol-viewport`) in the target element (see `getViewport()`), and then two
* further elements within the viewport: one with CSS class name
* `ol-overlaycontainer-stopevent` for controls and some overlays, and one with
* CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`
* option of {@link ol.Overlay} for the difference). The map itself is placed in
* a further element within the viewport.
* option of {@link module:ol/Overlay~Overlay} for the difference). The map
* itself is placed in a further element within the viewport.
*
* Layers are stored as a `ol.Collection` in layerGroups. A top-level group is
* provided by the library. This is what is accessed by `getLayerGroup` and
* `setLayerGroup`. Layers entered in the options are added to this group, and
* `addLayer` and `removeLayer` change the layer collection in the group.
* `getLayers` is a convenience function for `getLayerGroup().getLayers()`.
* Note that `ol.layer.Group` is a subclass of `ol.layer.Base`, so layers
* entered in the options or added with `addLayer` can be groups, which can
* contain further groups, and so on.
* Layers are stored as a {@link module:ol/Collection~Collection} in
* layerGroups. A top-level group is provided by the library. This is what is
* accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the
* options are added to this group, and `addLayer` and `removeLayer` change the
* layer collection in the group. `getLayers` is a convenience function for
* `getLayerGroup().getLayers()`.
* Note that {@link module:ol/layer/Group~Group} is a subclass of
* {@link module:ol/layer/Base~Base}, so layers entered in the options or added
* with `addLayer` can be groups, which can contain further groups, and so on.
*
* @constructor
* @extends {ol.PluggableMap}
* @param {olx.MapOptions} options Map options.
* @fires ol.MapBrowserEvent
* @fires ol.MapEvent
* @fires ol.render.Event#postcompose
* @fires ol.render.Event#precompose
* @extends {module:ol/PluggableMap~PluggableMap}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~Event#postcompose
* @fires module:ol/render/Event~Event#precompose
* @api
*/
const CanvasMap = function(options) {
Expand Down
2 changes: 1 addition & 1 deletion src/ol/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Property = {
* @constructor
* @extends {module:ol/events/Event~Event}
* @implements {oli.CollectionEvent}
* @param {module:ol/CollectionEventType} type Type.
* @param {module:ol/CollectionEventType~CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
export const CollectionEvent = function(type, opt_element) {
Expand Down
4 changes: 2 additions & 2 deletions src/ol/CollectionEventType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
export default {
/**
* Triggered when an item is added to the collection.
* @event ol.CollectionEvent#add
* @event module:ol/CollectionEvent~CollectionEvent#add
* @api
*/
ADD: 'add',
/**
* Triggered when an item is removed from the collection.
* @event ol.CollectionEvent#remove
* @event module:ol/CollectionEvent~CollectionEvent#remove
* @api
*/
REMOVE: 'remove'
Expand Down
71 changes: 38 additions & 33 deletions src/ol/Feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Style from './style/Style.js';
* Features can be styled individually with `setStyle`; otherwise they use the
* style of their vector layer.
*
* Note that attribute properties are set as {@link ol.Object} properties on
* Note that attribute properties are set as {@link module:ol/Object~Object} properties on
* the feature object, so they are observable, and have get/set accessors.
*
* Typically, a feature has a single geometry property. You can set the
Expand All @@ -30,9 +30,14 @@ import Style from './style/Style.js';
* property associated with the geometry for the feature. For example:
*
* ```js
* var feature = new ol.Feature({
* geometry: new ol.geom.Polygon(polyCoords),
* labelPoint: new ol.geom.Point(labelCoords),
*
* import Feature from 'ol/Feature';
* import Polygon from 'ol/geom/Polygon';
* import Point from 'ol/geom/Point';
*
* var feature = new Feature({
* geometry: new Polygon(polyCoords),
* labelPoint: new Point(labelCoords),
* name: 'My Polygon'
* });
*
Expand All @@ -47,11 +52,11 @@ import Style from './style/Style.js';
* ```
*
* @constructor
* @extends {ol.Object}
* @param {ol.geom.Geometry|Object.<string, *>=} opt_geometryOrProperties
* You may pass a Geometry object directly, or an object literal
* containing properties. If you pass an object literal, you may
* include a Geometry associated with a `geometry` key.
* @extends {module:ol/Object~Object}
* @param {module:ol/geom/Geometry~Geometry|Object.<string, *>=} opt_geometryOrProperties
* You may pass a Geometry object directly, or an object literal containing
* properties. If you pass an object literal, you may include a Geometry
* associated with a `geometry` key.
* @api
*/
const Feature = function(opt_geometryOrProperties) {
Expand All @@ -73,19 +78,19 @@ const Feature = function(opt_geometryOrProperties) {
/**
* User provided style.
* @private
* @type {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction}
* @type {module:ol/style/Style~Geometry|Array.<module:ol/style/Style~Geometry>|module:ol/style~StyleFunction}
*/
this.style_ = null;

/**
* @private
* @type {ol.StyleFunction|undefined}
* @type {module:ol/style~StyleFunction|undefined}
*/
this.styleFunction_ = undefined;

/**
* @private
* @type {?ol.EventsKey}
* @type {?module:ol/events~EventsKey}
*/
this.geometryChangeKey_ = null;

Expand All @@ -112,7 +117,7 @@ inherits(Feature, BaseObject);
/**
* Clone this feature. If the original feature has a geometry it
* is also cloned. The feature id is not set in the clone.
* @return {ol.Feature} The clone.
* @return {module:ol/Feature~Feature} The clone.
* @api
*/
Feature.prototype.clone = function() {
Expand All @@ -133,21 +138,21 @@ Feature.prototype.clone = function() {
/**
* Get the feature's default geometry. A feature may have any number of named
* geometries. The "default" geometry (the one that is rendered by default) is
* set when calling {@link ol.Feature#setGeometry}.
* @return {ol.geom.Geometry|undefined} The default geometry for the feature.
* set when calling {@link module:ol/Feature~Feature#setGeometry}.
* @return {module:ol/geom/Geometry~Geometry|undefined} The default geometry for the feature.
* @api
* @observable
*/
Feature.prototype.getGeometry = function() {
return /** @type {ol.geom.Geometry|undefined} */ (
return /** @type {module:ol/geom/Geometry~Geometry|undefined} */ (
this.get(this.geometryName_));
};


/**
* Get the feature identifier. This is a stable identifier for the feature and
* is either set when reading data from a remote source or set explicitly by
* calling {@link ol.Feature#setId}.
* calling {@link module:ol/Feature~Feature#setId}.
* @return {number|string|undefined} Id.
* @api
*/
Expand All @@ -170,8 +175,8 @@ Feature.prototype.getGeometryName = function() {

/**
* Get the feature's style. Will return what was provided to the
* {@link ol.Feature#setStyle} method.
* @return {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction} The feature style.
* {@link module:ol/Feature~Feature#setStyle} method.
* @return {module:ol/style/Style~Geometry|Array.<module:ol/style/Style~Geometry>|module:ol/style~StyleFunction} The feature style.
* @api
*/
Feature.prototype.getStyle = function() {
Expand All @@ -181,7 +186,7 @@ Feature.prototype.getStyle = function() {

/**
* Get the feature's style function.
* @return {ol.StyleFunction|undefined} Return a function
* @return {module:ol/style~StyleFunction|undefined} Return a function
* representing the current style of this feature.
* @api
*/
Expand Down Expand Up @@ -217,8 +222,8 @@ Feature.prototype.handleGeometryChanged_ = function() {

/**
* Set the default geometry for the feature. This will update the property
* with the name returned by {@link ol.Feature#getGeometryName}.
* @param {ol.geom.Geometry|undefined} geometry The new geometry.
* with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
* @param {module:ol/geom/Geometry~Geometry|undefined} geometry The new geometry.
* @api
* @observable
*/
Expand All @@ -231,9 +236,9 @@ Feature.prototype.setGeometry = function(geometry) {
* Set the style for the feature. This can be a single style object, an array
* of styles, or a function that takes a resolution and returns an array of
* styles. If it is `null` the feature has no style (a `null` style).
* @param {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction} style Style for this feature.
* @param {module:ol/style/Style~Geometry|Array.<module:ol/style/Style~Geometry>|module:ol/style~StyleFunction} style Style for this feature.
* @api
* @fires ol.events.Event#event:change
* @fires module:ol/events/Event~Event#event:change
*/
Feature.prototype.setStyle = function(style) {
this.style_ = style;
Expand All @@ -245,11 +250,11 @@ Feature.prototype.setStyle = function(style) {
/**
* Set the feature id. The feature id is considered stable and may be used when
* requesting features or comparing identifiers returned from a remote source.
* The feature id can be used with the {@link ol.source.Vector#getFeatureById}
* method.
* The feature id can be used with the
* {@link module:ol/source/Vector~Vector#getFeatureById} method.
* @param {number|string|undefined} id The feature id.
* @api
* @fires ol.events.Event#event:change
* @fires module:ol/events/Event~Event#event:change
*/
Feature.prototype.setId = function(id) {
this.id_ = id;
Expand All @@ -259,7 +264,7 @@ Feature.prototype.setId = function(id) {

/**
* Set the property name to be used when getting the feature's default geometry.
* When calling {@link ol.Feature#getGeometry}, the value of the property with
* When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
* this name will be returned.
* @param {string} name The property name of the default geometry.
* @api
Expand All @@ -278,25 +283,25 @@ Feature.prototype.setGeometryName = function(name) {

/**
* Convert the provided object into a feature style function. Functions passed
* through unchanged. Arrays of ol.style.Style or single style objects wrapped
* through unchanged. Arrays of module:ol/style/Style~Geometry or single style objects wrapped
* in a new feature style function.
* @param {ol.StyleFunction|!Array.<ol.style.Style>|!ol.style.Style} obj
* @param {module:ol/style~StyleFunction|!Array.<module:ol/style/Style~Geometry>|!module:ol/style/Style~Geometry} obj
* A feature style function, a single style, or an array of styles.
* @return {ol.StyleFunction} A style function.
* @return {module:ol/style~StyleFunction} A style function.
*/
export function createStyleFunction(obj) {
if (typeof obj === 'function') {
return obj;
} else {
/**
* @type {Array.<ol.style.Style>}
* @type {Array.<module:ol/style/Style~Geometry>}
*/
let styles;
if (Array.isArray(obj)) {
styles = obj;
} else {
assert(obj instanceof Style,
41); // Expected an `ol.style.Style` or an array of `ol.style.Style`
41); // Expected an `module:ol/style/Style~Geometry` or an array of `module:ol/style/Style~Geometry`
styles = [obj];
}
return function() {
Expand Down
12 changes: 6 additions & 6 deletions src/ol/Geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {get as getProjection, getTransformFromProjections, identityTransform} fr
* instantiation.
* @property {GeolocationPositionOptions} [trackingOptions] Tracking options.
* See {@link http://www.w3.org/TR/geolocation-API/#position_options_interface}.
* @property {module:ol/types~ProjectionLike} [projection] The projection the position
* @property {module:ol/proj~ProjectionLike} [projection] The projection the position
* is reported in.
*/

Expand Down Expand Up @@ -58,13 +58,13 @@ const Geolocation = function(opt_options) {
/**
* The unprojected (EPSG:4326) device position.
* @private
* @type {module:ol/types~Coordinate}
* @type {module:ol/coordinate~Coordinate}
*/
this.position_ = null;

/**
* @private
* @type {module:ol/types~TransformFunction}
* @type {module:ol/proj~TransformFunction}
*/
this.transform_ = identityTransform;

Expand Down Expand Up @@ -247,13 +247,13 @@ Geolocation.prototype.getHeading = function() {

/**
* Get the position of the device.
* @return {module:ol/types~Coordinate|undefined} The current position of the device reported
* @return {module:ol/coordinate~Coordinate|undefined} The current position of the device reported
* in the current projection.
* @observable
* @api
*/
Geolocation.prototype.getPosition = function() {
return /** @type {module:ol/types~Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION));
return /** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION));
};


Expand Down Expand Up @@ -308,7 +308,7 @@ Geolocation.prototype.getTrackingOptions = function() {

/**
* Set the projection to use for transforming the coordinates.
* @param {module:ol/types~ProjectionLike} projection The projection the position is
* @param {module:ol/proj~ProjectionLike} projection The projection the position is
* reported in.
* @observable
* @api
Expand Down
Loading

0 comments on commit 95d6251

Please sign in to comment.