forked from fgpv-vpgf/fgpv-vpgf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request fgpv-vpgf#39 from james-rae/feature/common
refactor(geoApi): create common function module
- Loading branch information
Showing
2 changed files
with
36 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
// Common functions for use across other geoApi modules | ||
module.exports = esriBundle => { | ||
|
||
/** | ||
* Will return a string indicating the type of layer a layer object is. | ||
* @private | ||
* @param {Object} layer an ESRI API layer object | ||
* @return {String} layer type | ||
*/ | ||
function getLayerType(layer) { | ||
if (layer instanceof esriBundle.FeatureLayer) { | ||
return 'FeatureLayer'; | ||
} else if (layer instanceof esriBundle.WmsLayer) { | ||
return 'WmsLayer'; | ||
} else if (layer instanceof esriBundle.ArcGISDynamicMapServiceLayer) { | ||
return 'ArcGISDynamicMapServiceLayer'; | ||
} else if (layer instanceof esriBundle.ArcGISTiledMapServiceLayer) { | ||
return 'ArcGISTiledMapServiceLayer'; | ||
} else { | ||
//Can add more types above as we support them | ||
return 'UNKNOWN'; | ||
} | ||
} | ||
|
||
return { | ||
getLayerType | ||
}; | ||
}; |