From b447e1f7668e5a71b7373f5980815ac722f106c0 Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Wed, 1 Oct 2014 17:49:05 +0200 Subject: [PATCH] Fix ol externs definitions * Namespaces must be defined; * Interfaces must be initialized. --- externs/oli.js | 79 +++++++++++++++++++++++++++++++++++------------ externs/olx.js | 63 +++++++++++++++++++++++++++++++++++++ externs/readme.md | 8 +++-- 3 files changed, 128 insertions(+), 22 deletions(-) diff --git a/externs/oli.js b/externs/oli.js index 7f1d49940b..4be5f74d8d 100644 --- a/externs/oli.js +++ b/externs/oli.js @@ -10,8 +10,10 @@ var oli; -/** @interface */ -oli.CollectionEvent; +/** + * @interface + */ +oli.CollectionEvent = function() {}; /** @@ -21,8 +23,10 @@ oli.CollectionEvent.prototype.element; -/** @interface */ -oli.DragBoxEvent; +/** + * @interface + */ +oli.DragBoxEvent = function() {}; /** @@ -32,8 +36,10 @@ oli.DragBoxEvent.prototype.coordinate; -/** @interface */ -oli.DrawEvent; +/** + * @interface + */ +oli.DrawEvent = function() {}; /** @@ -43,8 +49,10 @@ oli.DrawEvent.prototype.feature; -/** @interface */ -oli.ObjectEvent; +/** + * @interface + */ +oli.ObjectEvent = function() {}; /** @type {string} */ @@ -52,8 +60,10 @@ oli.ObjectEvent.prototype.key; -/** @interface */ -oli.MapBrowserEvent; +/** + * @interface + */ +oli.MapBrowserEvent = function() {}; /** @@ -75,8 +85,10 @@ oli.MapBrowserEvent.prototype.pixel; -/** @interface */ -oli.MapEvent; +/** + * @interface + */ +oli.MapEvent = function() {}; /** @@ -91,11 +103,16 @@ oli.MapEvent.prototype.map; oli.MapEvent.prototype.frameState; +/** + * @type {Object} + */ +oli.control; + /** * @interface */ -oli.control.Control; +oli.control.Control = function() {}; /** @@ -105,9 +122,17 @@ oli.control.Control; oli.control.Control.prototype.setMap = function(map) {}; +/** + * @type {Object} + */ +oli.interaction; -/** @interface */ -oli.interaction.DragAndDropEvent; + + +/** + * @interface + */ +oli.interaction.DragAndDropEvent = function() {}; /** @@ -128,9 +153,17 @@ oli.interaction.DragAndDropEvent.prototype.projection; oli.interaction.DragAndDropEvent.prototype.file; +/** + * @type {Object} + */ +oli.render; -/** @interface */ -oli.render.Event; + + +/** + * @interface + */ +oli.render.Event = function() {}; /** @@ -157,9 +190,17 @@ oli.render.Event.prototype.glContext; oli.render.Event.prototype.vectorContext; +/** + * @type {Object} + */ +oli.source; -/** @interface */ -oli.source.VectorEvent; + + +/** + * @interface + */ +oli.source.VectorEvent = function() {}; /** diff --git a/externs/olx.js b/externs/olx.js index a46aa56d57..ed11d4dc82 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -594,6 +594,13 @@ olx.ViewOptions.prototype.zoom; olx.ViewOptions.prototype.zoomFactor; +/** + * Namespace. + * @type {Object} + */ +olx.animation; + + /** * @typedef {{resolution: number, * start: (number|undefined), @@ -779,6 +786,13 @@ olx.animation.ZoomOptions.prototype.duration; olx.animation.ZoomOptions.prototype.easing; +/** + * Namespace. + * @type {Object} + */ +olx.control; + + /** * @typedef {{className: (string|undefined), * target: (Element|undefined)}} @@ -1279,6 +1293,13 @@ olx.control.ZoomToExtentOptions.prototype.tipLabel; olx.control.ZoomToExtentOptions.prototype.extent; +/** + * Namespace. + * @type {Object} + */ +olx.format; + + /** * @typedef {{dataProjection: (ol.proj.ProjectionLike|undefined), * featureProjection: (ol.proj.ProjectionLike|undefined)}} @@ -1742,6 +1763,13 @@ olx.format.WKTOptions; olx.format.WKTOptions.prototype.splitCollection; +/** + * Namespace. + * @type {Object} + */ +olx.interaction; + + /** * Interactions for the map. Default is `true` for all options. * @typedef {{altShiftDragRotate: (boolean|undefined), @@ -2307,6 +2335,13 @@ olx.interaction.SelectOptions.prototype.removeCondition; olx.interaction.SelectOptions.prototype.toggleCondition; +/** + * Namespace. + * @type {Object} + */ +olx.layer; + + /** * @typedef {{brightness: (number|undefined), * contrast: (number|undefined), @@ -3097,6 +3132,13 @@ olx.FeatureOverlayOptions.prototype.map; olx.FeatureOverlayOptions.prototype.style; +/** + * Namespace. + * @type {Object} + */ +olx.source; + + /** * @typedef {{culture: (string|undefined), * key: string, @@ -5241,6 +5283,13 @@ olx.source.ZoomifyOptions.prototype.tierSizeCalculation; olx.source.ZoomifyOptions.prototype.size; +/** + * Namespace. + * @type {Object} + */ +olx.style; + + /** * @typedef {{fill: (ol.style.Fill|undefined), * radius: number, @@ -5662,6 +5711,13 @@ olx.style.StyleOptions.prototype.text; olx.style.StyleOptions.prototype.zIndex; +/** + * Namespace. + * @type {Object} + */ +olx.tilegrid; + + /** * @typedef {{minZoom: (number|undefined), * origin: (ol.Coordinate|undefined), @@ -5847,6 +5903,13 @@ olx.tilegrid.ZoomifyOptions; olx.tilegrid.ZoomifyOptions.prototype.resolutions; +/** + * Namespace. + * @type {Object} + */ +olx.View; + + /** * @typedef {{padding: !Array., * constrainResolution: (boolean|undefined), diff --git a/externs/readme.md b/externs/readme.md index cbecf2b70c..992c354fe3 100644 --- a/externs/readme.md +++ b/externs/readme.md @@ -11,8 +11,10 @@ These two files are special externs that belong to ol3, and this document explai For events, we make properties available to the application. Methods can be made available by just marking them with the `@api` annotation directly where they are defined; properties should also be added to `oli.js`: ```js -/** @interface */ -oli.MapBrowserEvent; +/** + * @interface + */ +oli.MapBrowserEvent = function() {}; /** * @type {ol.Coordinate} @@ -48,7 +50,7 @@ For custom subclasses in applications, which can be created using `ol.inherits`, /** * @interface */ -oli.control.Control; +oli.control.Control = function() {}; /** * @param {ol.Map} map Map.