Better type definition
Fixes the `Invalid type(s) for operator IN.` warnings from the closure compiler.
This commit is contained in:
@@ -379,7 +379,7 @@ const GPX_SERIALIZERS = makeStructureNS(
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {ol.LayoutOptions} layoutOptions Layout options.
|
||||
* @param {Node} node Node.
|
||||
* @param {Object} values Values.
|
||||
* @param {!Object} values Values.
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
function appendCoordinate(flatCoordinates, layoutOptions, node, values) {
|
||||
@@ -477,14 +477,11 @@ function parseExtensions(node, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function parseRtePt(node, objectStack) {
|
||||
const values = pushParseAndPop(
|
||||
{}, RTEPT_PARSERS, node, objectStack);
|
||||
const values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack);
|
||||
if (values) {
|
||||
const rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const flatCoordinates = /** @type {Array.<number>} */
|
||||
(rteValues['flatCoordinates']);
|
||||
const layoutOptions = /** @type {ol.LayoutOptions} */
|
||||
(rteValues['layoutOptions']);
|
||||
const rteValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
|
||||
const flatCoordinates = /** @type {Array.<number>} */ (rteValues['flatCoordinates']);
|
||||
const layoutOptions = /** @type {ol.LayoutOptions} */ (rteValues['layoutOptions']);
|
||||
appendCoordinate(flatCoordinates, layoutOptions, node, values);
|
||||
}
|
||||
}
|
||||
@@ -497,11 +494,9 @@ function parseRtePt(node, objectStack) {
|
||||
function parseTrkPt(node, objectStack) {
|
||||
const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);
|
||||
if (values) {
|
||||
const trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const flatCoordinates = /** @type {Array.<number>} */
|
||||
(trkValues['flatCoordinates']);
|
||||
const layoutOptions = /** @type {ol.LayoutOptions} */
|
||||
(trkValues['layoutOptions']);
|
||||
const trkValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
|
||||
const flatCoordinates = /** @type {Array.<number>} */ (trkValues['flatCoordinates']);
|
||||
const layoutOptions = /** @type {ol.LayoutOptions} */ (trkValues['layoutOptions']);
|
||||
appendCoordinate(flatCoordinates, layoutOptions, node, values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ const KML = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<string, (Array.<ol.style.Style>|string)>}
|
||||
* @type {!Object.<string, (Array.<ol.style.Style>|string)>}
|
||||
*/
|
||||
this.sharedStyles_ = {};
|
||||
|
||||
@@ -384,14 +384,11 @@ function createNameStyleFunction(foundStyle, name) {
|
||||
* @param {Array.<ol.style.Style>|undefined} style Style.
|
||||
* @param {string} styleUrl Style URL.
|
||||
* @param {Array.<ol.style.Style>} defaultStyle Default style.
|
||||
* @param {Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles Shared
|
||||
* styles.
|
||||
* @param {boolean|undefined} showPointNames true to show names for point
|
||||
* placemarks.
|
||||
* @param {!Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles Shared styles.
|
||||
* @param {boolean|undefined} showPointNames true to show names for point placemarks.
|
||||
* @return {ol.StyleFunction} Feature style function.
|
||||
*/
|
||||
function createFeatureStyleFunction(style, styleUrl,
|
||||
defaultStyle, sharedStyles, showPointNames) {
|
||||
function createFeatureStyleFunction(style, styleUrl, defaultStyle, sharedStyles, showPointNames) {
|
||||
|
||||
return (
|
||||
/**
|
||||
@@ -418,25 +415,21 @@ function createFeatureStyleFunction(style, styleUrl,
|
||||
|
||||
if (style) {
|
||||
if (drawName) {
|
||||
nameStyle = createNameStyleFunction(style[0],
|
||||
name);
|
||||
nameStyle = createNameStyleFunction(style[0], name);
|
||||
return style.concat(nameStyle);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
if (styleUrl) {
|
||||
const foundStyle = findStyle(styleUrl, defaultStyle,
|
||||
sharedStyles);
|
||||
const foundStyle = findStyle(styleUrl, defaultStyle, sharedStyles);
|
||||
if (drawName) {
|
||||
nameStyle = createNameStyleFunction(foundStyle[0],
|
||||
name);
|
||||
nameStyle = createNameStyleFunction(foundStyle[0], name);
|
||||
return foundStyle.concat(nameStyle);
|
||||
}
|
||||
return foundStyle;
|
||||
}
|
||||
if (drawName) {
|
||||
nameStyle = createNameStyleFunction(defaultStyle[0],
|
||||
name);
|
||||
nameStyle = createNameStyleFunction(defaultStyle[0], name);
|
||||
return defaultStyle.concat(nameStyle);
|
||||
}
|
||||
return defaultStyle;
|
||||
@@ -448,7 +441,7 @@ function createFeatureStyleFunction(style, styleUrl,
|
||||
/**
|
||||
* @param {Array.<ol.style.Style>|string|undefined} styleValue Style value.
|
||||
* @param {Array.<ol.style.Style>} defaultStyle Default style.
|
||||
* @param {Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles
|
||||
* @param {!Object.<string, (Array.<ol.style.Style>|string)>} sharedStyles
|
||||
* Shared styles.
|
||||
* @return {Array.<ol.style.Style>} Style.
|
||||
*/
|
||||
@@ -462,8 +455,7 @@ function findStyle(styleValue, defaultStyle, sharedStyles) {
|
||||
if (!(styleValue in sharedStyles) && ('#' + styleValue in sharedStyles)) {
|
||||
styleValue = '#' + styleValue;
|
||||
}
|
||||
return findStyle(
|
||||
sharedStyles[styleValue], defaultStyle, sharedStyles);
|
||||
return findStyle(sharedStyles[styleValue], defaultStyle, sharedStyles);
|
||||
} else {
|
||||
return defaultStyle;
|
||||
}
|
||||
|
||||
@@ -446,8 +446,7 @@ function readCapabilityLayer(node, objectStack) {
|
||||
* @return {Object|undefined} Layer object.
|
||||
*/
|
||||
function readLayer(node, objectStack) {
|
||||
const parentLayerObject = /** @type {Object.<string,*>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
const parentLayerObject = /** @type {!Object.<string,*>} */ (objectStack[objectStack.length - 1]);
|
||||
|
||||
const layerObject = pushParseAndPop({}, LAYER_PARSERS, node, objectStack);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user