Merge pull request #5335 from probins/typedefs
Move typedefs to separate file
This commit is contained in:
@@ -79,16 +79,6 @@ ol.DragBoxEvent = function(type, coordinate, mapBrowserEvent) {
|
||||
goog.inherits(ol.DragBoxEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
* A function that takes a {@link ol.MapBrowserEvent} and two
|
||||
* {@link ol.Pixel}s and returns a `{boolean}`. If the condition is met,
|
||||
* true should be returned.
|
||||
* @typedef {function(ol.MapBrowserEvent, ol.Pixel, ol.Pixel):boolean}
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.DragBoxEndConditionType;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map,
|
||||
|
||||
@@ -2,7 +2,7 @@ goog.provide('ol.interaction.DragPan');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Kinetic');
|
||||
goog.require('ol.Pixel');
|
||||
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.functions');
|
||||
|
||||
@@ -850,19 +850,6 @@ ol.interaction.Draw.getMode_ = function(type) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function that takes coordinates and an optional existing geometry as
|
||||
* arguments, and returns a geometry. The optional existing geometry is the
|
||||
* geometry that is returned when the function is called without a second
|
||||
* argument.
|
||||
* @typedef {function(!(ol.Coordinate|Array.<ol.Coordinate>|
|
||||
* Array.<Array.<ol.Coordinate>>), ol.geom.SimpleGeometry=):
|
||||
* ol.geom.SimpleGeometry}
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.DrawGeometryFunctionType;
|
||||
|
||||
|
||||
/**
|
||||
* Draw mode. This collapses multi-part geometry types with their single-part
|
||||
* cousins.
|
||||
|
||||
@@ -11,7 +11,6 @@ goog.require('ol.CollectionEventType');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.MapBrowserEvent.EventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.Pixel');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.coordinate');
|
||||
@@ -83,16 +82,6 @@ ol.interaction.ModifyEvent = function(type, features, mapBrowserPointerEvent) {
|
||||
goog.inherits(ol.interaction.ModifyEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{depth: (Array.<number>|undefined),
|
||||
* feature: ol.Feature,
|
||||
* geometry: ol.geom.SimpleGeometry,
|
||||
* index: (number|undefined),
|
||||
* segment: Array.<ol.Extent>}}
|
||||
*/
|
||||
ol.interaction.SegmentDataType;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for modifying feature geometries.
|
||||
|
||||
@@ -3,7 +3,6 @@ goog.provide('ol.interaction.Pointer');
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapBrowserEvent.EventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.Pixel');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
@@ -30,17 +30,6 @@ ol.interaction.SelectEventType = {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A function that takes an {@link ol.Feature} or {@link ol.render.Feature} and
|
||||
* an {@link ol.layer.Layer} and returns `true` if the feature may be selected
|
||||
* or `false` otherwise.
|
||||
* @typedef {function((ol.Feature|ol.render.Feature), ol.layer.Layer):
|
||||
* boolean}
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.SelectFilterFunction;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link ol.interaction.Select} instances are instances of
|
||||
|
||||
@@ -9,7 +9,6 @@ goog.require('ol.CollectionEventType');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.Observable');
|
||||
goog.require('ol.Pixel');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
@@ -130,7 +129,7 @@ ol.interaction.Snap = function(opt_options) {
|
||||
options.pixelTolerance : 10;
|
||||
|
||||
/**
|
||||
* @type {function(ol.interaction.Snap.SegmentDataType, ol.interaction.Snap.SegmentDataType): number}
|
||||
* @type {function(ol.interaction.SnapSegmentDataType, ol.interaction.SnapSegmentDataType): number}
|
||||
* @private
|
||||
*/
|
||||
this.sortByDistance_ = ol.interaction.Snap.sortByDistance.bind(this);
|
||||
@@ -138,7 +137,7 @@ ol.interaction.Snap = function(opt_options) {
|
||||
|
||||
/**
|
||||
* Segment RTree for each layer
|
||||
* @type {ol.structs.RBush.<ol.interaction.Snap.SegmentDataType>}
|
||||
* @type {ol.structs.RBush.<ol.interaction.SnapSegmentDataType>}
|
||||
* @private
|
||||
*/
|
||||
this.rBush_ = new ol.structs.RBush();
|
||||
@@ -379,7 +378,7 @@ ol.interaction.Snap.prototype.shouldStopEvent = ol.functions.FALSE;
|
||||
* @param {ol.Pixel} pixel Pixel
|
||||
* @param {ol.Coordinate} pixelCoordinate Coordinate
|
||||
* @param {ol.Map} map Map.
|
||||
* @return {ol.interaction.Snap.ResultType} Snap result
|
||||
* @return {ol.interaction.SnapResultType} Snap result
|
||||
*/
|
||||
ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
|
||||
|
||||
@@ -438,7 +437,7 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
|
||||
vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])];
|
||||
}
|
||||
}
|
||||
return /** @type {ol.interaction.Snap.ResultType} */ ({
|
||||
return /** @type {ol.interaction.SnapResultType} */ ({
|
||||
snapped: snapped,
|
||||
vertex: vertex,
|
||||
vertexPixel: vertexPixel
|
||||
@@ -480,7 +479,7 @@ ol.interaction.Snap.prototype.writeLineStringGeometry_ = function(feature, geome
|
||||
var i, ii, segment, segmentData;
|
||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segment = coordinates.slice(i, i + 2);
|
||||
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: segment
|
||||
});
|
||||
@@ -501,7 +500,7 @@ ol.interaction.Snap.prototype.writeMultiLineStringGeometry_ = function(feature,
|
||||
coordinates = lines[j];
|
||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segment = coordinates.slice(i, i + 2);
|
||||
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: segment
|
||||
});
|
||||
@@ -521,7 +520,7 @@ ol.interaction.Snap.prototype.writeMultiPointGeometry_ = function(feature, geome
|
||||
var coordinates, i, ii, segmentData;
|
||||
for (i = 0, ii = points.length; i < ii; ++i) {
|
||||
coordinates = points[i];
|
||||
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: [coordinates, coordinates]
|
||||
});
|
||||
@@ -544,7 +543,7 @@ ol.interaction.Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geo
|
||||
coordinates = rings[j];
|
||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segment = coordinates.slice(i, i + 2);
|
||||
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: segment
|
||||
});
|
||||
@@ -562,7 +561,7 @@ ol.interaction.Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geo
|
||||
*/
|
||||
ol.interaction.Snap.prototype.writePointGeometry_ = function(feature, geometry) {
|
||||
var coordinates = geometry.getCoordinates();
|
||||
var segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
var segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: [coordinates, coordinates]
|
||||
});
|
||||
@@ -582,7 +581,7 @@ ol.interaction.Snap.prototype.writePolygonGeometry_ = function(feature, geometry
|
||||
coordinates = rings[j];
|
||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segment = coordinates.slice(i, i + 2);
|
||||
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
|
||||
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
|
||||
feature: feature,
|
||||
segment: segment
|
||||
});
|
||||
@@ -592,25 +591,6 @@ ol.interaction.Snap.prototype.writePolygonGeometry_ = function(feature, geometry
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* snapped: {boolean},
|
||||
* vertex: (ol.Coordinate|null),
|
||||
* vertexPixel: (ol.Pixel|null)
|
||||
* }}
|
||||
*/
|
||||
ol.interaction.Snap.ResultType;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* feature: ol.Feature,
|
||||
* segment: Array.<ol.Coordinate>
|
||||
* }}
|
||||
*/
|
||||
ol.interaction.Snap.SegmentDataType;
|
||||
|
||||
|
||||
/**
|
||||
* Handle all pointer events events.
|
||||
* @param {ol.MapBrowserEvent} evt A move event.
|
||||
@@ -646,8 +626,8 @@ ol.interaction.Snap.handleUpEvent_ = function(evt) {
|
||||
|
||||
/**
|
||||
* Sort segments by distance, helper function
|
||||
* @param {ol.interaction.Snap.SegmentDataType} a The first segment data.
|
||||
* @param {ol.interaction.Snap.SegmentDataType} b The second segment data.
|
||||
* @param {ol.interaction.SnapSegmentDataType} a The first segment data.
|
||||
* @param {ol.interaction.SnapSegmentDataType} b The second segment data.
|
||||
* @return {number} The difference in distance.
|
||||
* @this {ol.interaction.Snap}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user