Skip to content

Commit

Permalink
Fix types in interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jan 28, 2019
1 parent eea63d8 commit d64b0ae
Show file tree
Hide file tree
Showing 36 changed files with 342 additions and 345 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/src/editing/editFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ Controller.prototype.$onInit = function() {
this.dirty = this.dirty === true;
this.editableNode_ = /** @type {import(gmf/themes.js).GmfLayer} */ (
this.editableTreeCtrl.node);
this.features = this.vectorLayer.getSource().getFeaturesCollection();
this.features = /** @type {olSourceVector} */(this.vectorLayer.getSource()).getFeaturesCollection();
this.tolerance = this.tolerance !== undefined ? this.tolerance : 10;

// (1.1) Set editable WMS layer
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/import/importdatasourceComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ class Controller {
this.pending = false;

/**
* @type {!unitPrefix}
* @type {!import('ngeo/misc/filters.js').unitPrefix}
* @private
*/
this.unitPrefixFormat_ = /** @type {unitPrefix} */ (
this.unitPrefixFormat_ = /** @type {import('ngeo/misc/filters.js').unitPrefix} */ (
$filter('ngeoUnitPrefix'));

/**
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/src/lidarprofile/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class LidarprofileManager {
*/
clearBuffer() {
if (this.lidarBuffer) {
this.lidarBuffer.getSource().clear();
/** @type {olSourceVector} */(this.lidarBuffer.getSource()).clear();
}
}

Expand Down Expand Up @@ -461,8 +461,8 @@ export class LidarprofileManager {
const clip = this.utils.clipLineByMeasure(this.config, map_resolution,
this.line_, domainX[0], domainX[1]);

this.lidarBuffer.getSource().clear();
this.lidarBuffer.getSource().addFeature(clip.bufferGeom);
/** @type {olSourceVector} */(this.lidarBuffer.getSource()).clear();
/** @type {olSourceVector} */(this.lidarBuffer.getSource()).addFeature(clip.bufferGeom);
this.lidarBuffer.setStyle(clip.bufferStyle);

const span = domainX[1] - domainX[0];
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/src/lidarprofile/Plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export default class {

this.manager_.cartoHighlight.setElement(el);
this.manager_.cartoHighlight.setPosition([p.coords[0], p.coords[1]]);
this.manager_.lidarPointHighlight.getSource().clear();
/** @type {olSourceVector} */(this.manager_.lidarPointHighlight.getSource()).clear();
const lidarPointGeom = new olGeomPoint([p.coords[0], p.coords[1]]);
const lidarPointFeature = new olFeature(lidarPointGeom);
if (typeof (pointClassification.color) !== undefined) {
Expand All @@ -358,9 +358,9 @@ export default class {
}));
}

this.manager_.lidarPointHighlight.getSource().addFeature(lidarPointFeature);
/** @type {olSourceVector} */(this.manager_.lidarPointHighlight.getSource()).addFeature(lidarPointFeature);
} else {
this.manager_.lidarPointHighlight.getSource().clear();
/** @type {olSourceVector} */(this.manager_.lidarPointHighlight.getSource()).clear();
svg.select('#highlightCircle').remove();
lidarInfo.html('');
this.manager_.cartoHighlight.setPosition(undefined);
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/mobile/measure/areaComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.run(/* @ngInject */ ($templateCache) => {
* or deactivate the component.
* @htmlAttribute {number=} gmf-mobile-measurearea-precision the number of significant digits to display.
* @htmlAttribute {import("ol/Map.js").default} gmf-mobile-measurearea-map The map.
* @htmlAttribute {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction=}
* @htmlAttribute {import("ol/style/Style.js").StyleLike=}
* gmf-mobile-measurearea-sketchstyle A style for the measure area.
* @param {string|function(!JQuery=, !angular.IAttributes=)}
* gmfMobileMeasureAreaTemplateUrl Template URL for the directive.
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/mobile/measure/baseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function MeasueMobileBaseController($scope, $filter, gettextCatalog) {
this.precision;

/**
* @type {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction}
* @type {import("ol/style/Style.js").StyleLike}
* @export
*/
this.sketchStyle = new olStyleStyle({
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/mobile/measure/lengthComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.run(/* @ngInject */ ($templateCache) => {
* or deactivate the component.
* @htmlAttribute {number=} gmf-mobile-measurelength-precision the number of significant digits to display.
* @htmlAttribute {import("ol/Map.js").default} gmf-mobile-measurelength-map The map.
* @htmlAttribute {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction=}
* @htmlAttribute {import("ol/style/Style.js").StyleLike=}
* gmf-mobile-measurelength-sketchstyle A style for the measure length.
* @param {string|function(!JQuery=, !angular.IAttributes=)}
* gmfMobileMeasureLengthTemplateUrl Template URL for the directive.
Expand Down
6 changes: 3 additions & 3 deletions contribs/gmf/src/mobile/measure/pointComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.run(/* @ngInject */ ($templateCache) => {
* gmf-mobile-measurepoint-layersconfig Raster elevation layers to get
* information under the point and its configuaration.
* @htmlAttribute {import("ol/Map.js").default} gmf-mobile-measurepoint-map The map.
* @htmlAttribute {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction=}
* @htmlAttribute {import("ol/style/Style.js").StyleLike=}
* gmf-mobile-measurepoint-sketchstyle A style for the measure point.
* @param {string|function(!JQuery=, !angular.IAttributes=)}
* gmfMobileMeasurePointTemplateUrl Template URL for the directive.
Expand Down Expand Up @@ -170,7 +170,7 @@ function Controller(gettextCatalog, $scope, $filter, gmfRaster, ngeoDebounce) {
this.layersConfig;

/**
* @type {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction}
* @type {import("ol/style/Style.js").StyleLike}
* @export
*/
this.sketchStyle;
Expand Down Expand Up @@ -229,7 +229,7 @@ function Controller(gettextCatalog, $scope, $filter, gmfRaster, ngeoDebounce) {
*/
Controller.prototype.init = function() {
this.measure = new ngeoInteractionMeasurePointMobile(
/** @type {numberCoordinates} */ (this.$filter_('ngeoNumberCoordinates')),
/** @type {import('ngeo/misc/filters.js').numberCoordinates} */ (this.$filter_('ngeoNumberCoordinates')),
this.format || '{x}, {y}',
{
decimals: this.coordinateDecimals,
Expand Down
2 changes: 1 addition & 1 deletion examples/elevationProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function MainController($http, $scope) {
});

this.snappedPoint_ = new olFeature();
vectorLayer.getSource().addFeature(this.snappedPoint_);
/** @type {olSourceVector} */(vectorLayer.getSource()).addFeature(this.snappedPoint_);

// Use vectorLayer.setMap(map) rather than map.addLayer(vectorLayer). This
// makes the vector layer "unmanaged", meaning that it is always on top.
Expand Down
2 changes: 1 addition & 1 deletion examples/modifycircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function MainController() {
* @export
*/
this.interaction = new ngeoInteractionModifyCircle(
/** @type {olx.interaction.ModifyOptions} */({
/** @type {import('ol/interaction/Modify.js').Options} */({
features: this.features
}));

Expand Down
2 changes: 1 addition & 1 deletion examples/modifyrectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function MainController() {
* @export
*/
this.interaction = new ngeoInteractionModifyRectangle(
/** @type {olx.interaction.ModifyOptions} */({
/** @type {import('ol/interaction/Modify.js').Options} */({
features: this.features,
style: style
}));
Expand Down
4 changes: 2 additions & 2 deletions examples/permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function DrawComponentController($scope, ngeoLocation) {
}

DrawComponentController.prototype.$onInit = function() {
const vectorSource = this.layer.getSource();
const vectorSource = /** @type {olSourceVector} */(this.layer.getSource());

this.interaction = new olInteractionDraw({
type: /** @type {import("ol/geom/GeometryType.js").default} */ ('LineString'),
Expand Down Expand Up @@ -226,7 +226,7 @@ DrawComponentController.prototype.$onInit = function() {
* @export
*/
DrawComponentController.prototype.clearLayer = function() {
this.layer.getSource().clear(true);
/** @type {olSourceVector} */(this.layer.getSource()).clear(true);
this.featureSeq_ = 0;
this.ngeoLocation_.deleteParam('features');
};
Expand Down
2 changes: 1 addition & 1 deletion examples/rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function MainController() {
* @export
*/
this.interaction = new ngeoInteractionRotate(
/** @type {olx.interaction.ModifyOptions} */({
/** @type {import('ol/interaction/Modify.js').Options} */({
features: this.features,
layers: [vectorLayer],
style: style
Expand Down
2 changes: 1 addition & 1 deletion src/draw/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ DrawController.prototype.handleActiveChange = function(event) {
* Called when a feature is finished being drawn. Set the default properties
* for its style, then set its style and add it to the features collection.
* @param {string} type Type of geometry being drawn.
* @param {import("ol/interaction/Draw/Event.js").default|MeasureEvent} event Event.
* @param {import('ol/events/Event.js').default|MeasureEvent} event Event.
* @export
*/
DrawController.prototype.handleDrawEnd = function(type, event) {
Expand Down
2 changes: 1 addition & 1 deletion src/editing/createfeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Controller.prototype.$onInit = function() {
/**
* Called when a feature is finished being drawn. Add the feature to the
* collection.
* @param {import("ol/interaction/Draw/Event.js").default|MeasureEvent} event Event.
* @param {import('ol/events/Event.js').default|MeasureEvent} event Event.
* @export
*/
Controller.prototype.handleDrawEnd_ = function(event) {
Expand Down
2 changes: 1 addition & 1 deletion src/editing/createregularpolygonfromclickComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Controller.prototype.$onInit = function() {
/**
* Called when a feature is finished being drawn. Add the feature to the
* collection.
* @param {import("ol/interaction/Draw/Event.js").default} evt Event.
* @param {import('ol/events/Event.js').default} evt Event.
* @private
*/
Controller.prototype.handleDrawEnd_ = function(evt) {
Expand Down
4 changes: 2 additions & 2 deletions src/geolocation/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import olGeomPoint from 'ol/geom/Point.js';
* Options for the mobile geolocations directive.
*
* @typedef {Object} DesktopGeolocationDirectiveOptions
* @property {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction} [accuracyFeatureStyle] The style to
* @property {import("ol/style/Style.js").StyleLike} [accuracyFeatureStyle] The style to
* use to sketch the accuracy feature, which is a regular polygon.
* @property {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction} [positionFeatureStyle] The style to
* @property {import("ol/style/Style.js").StyleLike} [positionFeatureStyle] The style to
* use to sketch the position feature, which is a point.
* @property {number} [zoom] If set, in addition to recentering the map view at the location, determines
* the zoom level to set when obtaining a new position.
Expand Down
4 changes: 2 additions & 2 deletions src/geolocation/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import olGeomPoint from 'ol/geom/Point.js';
* Options for the mobile geolocations directive.
*
* @typedef {Object} MobileGeolocationDirectiveOptions
* @property {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction} [accuracyFeatureStyle] The style to
* @property {import("ol/style/Style.js").StyleLike} [accuracyFeatureStyle] The style to
* use to sketch the accuracy feature, which is a regular polygon.
* @property {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|import('ol/style/Style.js').StyleFunction} [positionFeatureStyle] The style to
* @property {import("ol/style/Style.js").StyleLike} [positionFeatureStyle] The style to
* use to sketch the position feature, which is a point.
* @property {number} [zoom] If set, in addition to recentering the map view at the location, determines
* the zoom level to set when obtaining a new position
Expand Down
3 changes: 1 addition & 2 deletions src/googlestreetview/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class Controller {

/**
* Style for the feature.
* @type {import("ol/style/Style.js").default|Array.<import("ol/style/Style.js").default>|
* ol.FeatureStyleFunction|ol.StyleFunction|undefined}
* @type {import("ol/style/Style.js").StyleLike|undefined}
* @export
*/
this.featureStyle;
Expand Down
Loading

0 comments on commit d64b0ae

Please sign in to comment.