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

Function getMeterPerMapUnit

src/common/util/MapCalculateUtil.js:25–45  ·  view source on GitHub ↗
(mapUnit)

Source from the content-addressed store, hash-verified

23 * ```
24 */
25export var getMeterPerMapUnit = function(mapUnit) {
26 var meterPerMapUnit;
27 if(!mapUnit){
28 return meterPerMapUnit;
29 }
30 var earchRadiusInMeters = 6378137;
31
32 if (['m','meter','meters'].indexOf(mapUnit.toLocaleLowerCase())>-1) {
33 meterPerMapUnit = 1;
34 } else if (['degrees','deg','degree','dd'].indexOf(mapUnit.toLocaleLowerCase())>-1) {
35 // 每度表示多少米。
36 meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
37 } else if (mapUnit === Unit.KILOMETER) {
38 meterPerMapUnit = 1000;
39 } else if (mapUnit === Unit.INCH) {
40 meterPerMapUnit = 2.5399999918e-2;
41 } else if (mapUnit === Unit.FOOT) {
42 meterPerMapUnit = 0.3048;
43 }
44 return meterPerMapUnit;
45};
46
47/**
48 * @private

Callers 13

_getResolutionMethod · 0.90
_canvasUpdateMethod · 0.90
resolutionToScaleFunction · 0.90
_canvasUpdateMethod · 0.90
_getResolutionMethod · 0.90
distanceToLineSegmentMethod · 0.90
computeParallelMethod · 0.90
resolutionToScaleFunction · 0.90
scaleToResolutionFunction · 0.90
scaleToResolutionFunction · 0.85

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected