Skip to content

Commit

Permalink
Merge pull request openlayers#2795 from gingerik/externs
Browse files Browse the repository at this point in the history
Externs
  • Loading branch information
Éric Lemoine committed Oct 3, 2014
2 parents a1c3d57 + b321501 commit fa30ba2
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 29 deletions.
79 changes: 60 additions & 19 deletions externs/oli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ var oli;



/** @interface */
oli.CollectionEvent;
/**
* @interface
*/
oli.CollectionEvent = function() {};


/**
Expand All @@ -21,8 +23,10 @@ oli.CollectionEvent.prototype.element;



/** @interface */
oli.DragBoxEvent;
/**
* @interface
*/
oli.DragBoxEvent = function() {};


/**
Expand All @@ -32,8 +36,10 @@ oli.DragBoxEvent.prototype.coordinate;



/** @interface */
oli.DrawEvent;
/**
* @interface
*/
oli.DrawEvent = function() {};


/**
Expand All @@ -43,17 +49,21 @@ oli.DrawEvent.prototype.feature;



/** @interface */
oli.ObjectEvent;
/**
* @interface
*/
oli.ObjectEvent = function() {};


/** @type {string} */
oli.ObjectEvent.prototype.key;



/** @interface */
oli.MapBrowserEvent;
/**
* @interface
*/
oli.MapBrowserEvent = function() {};


/**
Expand All @@ -75,8 +85,10 @@ oli.MapBrowserEvent.prototype.pixel;



/** @interface */
oli.MapEvent;
/**
* @interface
*/
oli.MapEvent = function() {};


/**
Expand All @@ -91,11 +103,16 @@ oli.MapEvent.prototype.map;
oli.MapEvent.prototype.frameState;


/**
* @type {Object}
*/
oli.control;


/**
* @interface
*/
oli.control.Control;
oli.control.Control = function() {};


/**
Expand All @@ -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() {};


/**
Expand All @@ -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() {};


/**
Expand All @@ -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() {};


/**
Expand Down
75 changes: 69 additions & 6 deletions externs/olx.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@ olx.ViewOptions.prototype.zoom;
olx.ViewOptions.prototype.zoomFactor;


/**
* Namespace.
* @type {Object}
*/
olx.animation;


/**
* @typedef {{resolution: number,
* start: (number|undefined),
Expand Down Expand Up @@ -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)}}
Expand Down Expand Up @@ -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)}}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -3097,6 +3132,13 @@ olx.FeatureOverlayOptions.prototype.map;
olx.FeatureOverlayOptions.prototype.style;


/**
* Namespace.
* @type {Object}
*/
olx.source;


/**
* @typedef {{culture: (string|undefined),
* key: string,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -5847,14 +5903,21 @@ olx.tilegrid.ZoomifyOptions;
olx.tilegrid.ZoomifyOptions.prototype.resolutions;


/**
* Namespace.
* @type {Object}
*/
olx.view;


/**
* @typedef {{padding: !Array.<number>,
* constrainResolution: (boolean|undefined),
* nearest: (boolean|undefined),
* minResolution: (number|undefined)}}
* @api
*/
olx.View.fitGeometryOptions;
olx.view.FitGeometryOptions;


/**
Expand All @@ -5863,31 +5926,31 @@ olx.View.fitGeometryOptions;
* @type {!Array.<number>}
* @api
*/
olx.View.fitGeometryOptions.prototype.padding;
olx.view.FitGeometryOptions.prototype.padding;


/**
* Constrain the resolution. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.View.fitGeometryOptions.prototype.constrainResolution;
olx.view.FitGeometryOptions.prototype.constrainResolution;


/**
* Get the nearest extent. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.View.fitGeometryOptions.prototype.nearest;
olx.view.FitGeometryOptions.prototype.nearest;


/**
* Minimum resolution that we zoom to. Default is `0`.
* @type {number|undefined}
* @api
*/
olx.View.fitGeometryOptions.prototype.minResolution;
olx.view.FitGeometryOptions.prototype.minResolution;


/**
Expand All @@ -5896,7 +5959,7 @@ olx.View.fitGeometryOptions.prototype.minResolution;
* @type {number|undefined}
* @api
*/
olx.View.fitGeometryOptions.prototype.maxZoom;
olx.view.FitGeometryOptions.prototype.maxZoom;


/* typedefs for object literals exposed by the library */
Expand Down
8 changes: 5 additions & 3 deletions externs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/ol/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ ol.View.prototype.fitExtent = function(extent, size) {
* Take care on the map angle.
* @param {ol.geom.SimpleGeometry} geometry Geometry.
* @param {ol.Size} size Box pixel size.
* @param {olx.View.fitGeometryOptions=} opt_options Options.
* @param {olx.view.FitGeometryOptions=} opt_options Options.
* @api
*/
ol.View.prototype.fitGeometry = function(geometry, size, opt_options) {
Expand Down

0 comments on commit fa30ba2

Please sign in to comment.