Skip to content

Commit

Permalink
5
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed May 10, 2019
1 parent 9fec7eb commit 2f4b735
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import olOverlayPositioning from 'ol/OverlayPositioning.js';
* The options for the contextual menu overlay.
*
* @typedef {Object} MenuOptions
* @property {Array.<MenuActionOptions>} actions A list of menu actions.
* @property {Array<MenuActionOptions>} actions A list of menu actions.
* @property {boolean} [autoClose=true] Whether to automatically close the contextual menu when an action is
* clicked or not.
* @property {string} [title] A title to display as header of the contextual menu.
Expand Down
8 changes: 5 additions & 3 deletions src/Popover.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import olOverlay from 'ol/Overlay.js';

/**
* @classdesc
* An openlayers overlay that uses bootstrap popover to produce a popup for maps.
*
* @param {import('ol/Overlay.js').Options=} opt_options Overlay options.
* @hidden
*/
export default class extends olOverlay {
/**
* @param {import('ol/Overlay.js').Options=} options Overlay options.
*/
constructor(options = {}) {
super(options);

Expand Down Expand Up @@ -40,7 +41,8 @@ export default class extends olOverlay {
}

/**
* @override
* @param {import("ol/PluggableMap.js").default|undefined} map The map that the
* overlay is part of.
*/
setMap(map) {
const element = this.getElement();
Expand Down
30 changes: 18 additions & 12 deletions src/WFSDescribeFeatureType.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,24 @@ WFSDescribeFeatureType.prototype.read;


/**
* @inheritDoc
* @param {Document} doc Document.
* @return {Object} Object
*/
WFSDescribeFeatureType.prototype.readFromDocument = function(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n);
/** @type {?Node|ChildNode} */
let node;
for (node = doc.firstChild; node; node = node.nextSibling) {
if (node && node.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(/** @type {Element} */(node));
}
}
return null;
};


/**
* @inheritDoc
* @param {Element} node Node.
* @return {Object} Object
*/
WFSDescribeFeatureType.prototype.readFromNode = function(node) {
let result = {};
Expand Down Expand Up @@ -180,18 +184,20 @@ function readElement_(node, objectStack) {
* @hidden
* @param {Element} node Node.
* @param {Array<*>} objectStack Object stack.
* @return {Object<string, string>} Object.
* @return {Object<string, ?string>} Object.
*/
function readComplexType_(node, objectStack) {
const name = node.getAttribute('name');
/** @type {Object<string, ?string>} */
const object = olXml.pushParseAndPop(
{'name': name},
{name: name},
COMPLEX_TYPE_PARSERS_,
node, objectStack
);
// flatten
object['complexContent'] = object['complexContent'].extension.sequence.element;
return /** @type {Object<string, string>} */(object);
// @ts-ignore
object.complexContent = object.complexContent.extension.sequence.element;
return object;
}


Expand All @@ -200,7 +206,7 @@ function readComplexType_(node, objectStack) {
* @hidden
* @param {Element} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {!Object.<string, string>} Object.
* @return {Object<string, string>} Object.
*/
function readComplexContent_(
node, objectStack
Expand All @@ -218,8 +224,8 @@ function readComplexContent_(
* @private
* @hidden
* @param {Element} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {!Object.<string, string>} Object.
* @param {Array<*>} objectStack Object stack.
* @return {Object<string, string>} Object.
*/
function readExtension_(node, objectStack) {
return olXml.pushParseAndPop(
Expand Down
6 changes: 3 additions & 3 deletions src/draw/rectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ function drawRectangleComponent() {
}

const drawRectangle = new olInteractionDraw({
type: /** @type {import("ol/geom/GeometryType.js").default} */ ('LineString'),
type: 'LineString',
geometryFunction: (coordinates, geometry) => {
if (!geometry) {
geometry = new olGeomPolygon([]);
}
const start = coordinates[0];
const end = coordinates[1];
const start = /** @type {number[]|number[][]} */(coordinates[0]);
const end = /** @type {number[]|number[][]} */(coordinates[1]);
geometry.setCoordinates([
[start, [start[0], end[1]], end, [end[0], start[1]], start]
]);
Expand Down
2 changes: 1 addition & 1 deletion src/layertree/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function LayertreeController($scope, $rootScope, $attrs) {
let node;
if (isRoot) {
$scope.$watch(nodeExpr, (newVal, oldVal) => {
node = newVal;
this.node = newVal;
});
} else {
node = $scope.$eval(nodeExpr);
Expand Down

0 comments on commit 2f4b735

Please sign in to comment.