Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
don't use API for subsetting if coverage data is fully loaded already
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik committed Apr 3, 2016
1 parent 154ca2a commit d339b85
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ function wrappedSubsetByIndex (coverage, wrappedCoverage, api, wrapOptions) {
return wrappedCoverage
}

// if the coverage is fully loaded, then there is no need to use a server API
if (coverage.loaded) {
return coverage.subsetByIndex(constraints, options)
}

let caps = api.capabilities.subset
let axisMap = getAxisConcepts(domain)

Expand Down Expand Up @@ -285,6 +290,11 @@ function wrappedSubsetByValue (coverage, wrappedCoverage, api, wrapOptions) {
return wrappedCoverage
}

// if the coverage is fully loaded, then there is no need to use a server API
if (coverage.loaded) {
return coverage.subsetByValue(constraints, options)
}

let caps = api.capabilities.subset
let axisMap = getAxisConcepts(domain)

Expand Down Expand Up @@ -509,13 +519,6 @@ function prepareForAxisArraySearch (domain, axis, ...searchVal) {
} else if (isLongitudeAxis(domain, axis)) {
let lonWrapper = getLongitudeWrapper(domain, axis)
searchVal = searchVal.map(lonWrapper)
if (axisBounds) {
let originalBounds = axisBounds
axisBounds = {
get: i => [lonWrapper(originalBounds.get(i)[0]),
lonWrapper(originalBounds.get(i)[1])]
}
}
}
return [axisVals, axisBounds, ...searchVal]
}
Expand Down

0 comments on commit d339b85

Please sign in to comment.