MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / viewOptionsFromMapJSON

Function viewOptionsFromMapJSON

src/openlayers/mapping/InitMap.js:103–118  ·  view source on GitHub ↗
(mapJSONObj, level = 22)

Source from the content-addressed store, hash-verified

101 */
102
103export function viewOptionsFromMapJSON(mapJSONObj, level = 22) {
104 let { bounds, dpi, center, visibleScales, scale, coordUnit, prjCoordSys, scaleDenominators, resolutions } = mapJSONObj;
105 const mapCenter =
106 center.x && center.y ? [center.x, center.y] : [(bounds.left + bounds.right) / 2, (bounds.bottom + bounds.top) / 2];
107 const extent = [bounds.left, bounds.bottom, bounds.right, bounds.top];
108 let projection = Util.getProjection(prjCoordSys, extent);
109 resolutions = resolutions || Util.scalesToResolutions(visibleScales, bounds, dpi, coordUnit, level);
110 const resolution = scaleDenominators ? (1.0 / scale) : Util.scaleToResolution(scale, dpi, coordUnit);
111 const zoom = Util.getZoomByResolution(resolution, resolutions);
112 return {
113 center: mapCenter,
114 projection,
115 zoom,
116 resolutions
117 };
118}
119
120function createMap(result, mapOptions, viewOptions) {
121 let view = viewOptionsFromMapJSON(result);

Callers 2

InitMapSpec.jsFile · 0.90
createMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected