Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd07d754

Browse files
committed
【 fix 】增加 L 端 Util 中的方法的文档;review by luox
1 parent26da305 commitd07d754

File tree

2 files changed

+128
-12
lines changed

2 files changed

+128
-12
lines changed

‎src/common/util/FetchRequest.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ var RequestTimeout;
181181
*@usage
182182
* ```
183183
* // 浏览器
184-
* <script type="text/javascript" src="{cnd}"></script>
184+
* <script type="text/javascript" src="{cdn}"></script>
185185
* <script>
186186
* {namespace}.setCORS(cors);
187187
*
@@ -206,7 +206,7 @@ export var setCORS = function (cors) {
206206
*@usage
207207
* ```
208208
* // 浏览器
209-
* <script type="text/javascript" src="{cnd}"></script>
209+
* <script type="text/javascript" src="{cdn}"></script>
210210
* <script>
211211
* {namespace}.isCORS();
212212
*
@@ -235,7 +235,7 @@ export var isCORS = function () {
235235
*@usage
236236
* ```
237237
* // 浏览器
238-
<script type="text/javascript" src="{cnd}"></script>
238+
<script type="text/javascript" src="{cdn}"></script>
239239
<script>
240240
{namespace}.setRequestTimeout(timeout);
241241
@@ -261,7 +261,7 @@ export var setRequestTimeout = function (timeout) {
261261
*@usage
262262
* ```
263263
* // 浏览器
264-
<script type="text/javascript" src="{cnd}"></script>
264+
<script type="text/javascript" src="{cdn}"></script>
265265
<script>
266266
{namespace}.getRequestTimeout();
267267
@@ -288,7 +288,7 @@ export var getRequestTimeout = function () {
288288
*@usage
289289
* ```
290290
* // 浏览器
291-
<script type="text/javascript" src="{cnd}"></script>
291+
<script type="text/javascript" src="{cdn}"></script>
292292
<script>
293293
const fetchRequest = {namespace}.FetchRequest;
294294

‎src/leaflet/core/Util.js‎

Lines changed: 123 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,53 @@
55
import{GeoJSONasGeoJSONFormat}from'@supermap/iclient-common/format/GeoJSON';
66
import{getMeterPerMapUnitasMeterPerMapUnit}from'@supermap/iclient-common/util/MapCalculateUtil';
77

8-
/**
9-
*@name Util
10-
*@namespace
8+
/**
9+
*@function toGeoJSON
1110
*@category BaseTypes Util
12-
*@description 工具类。
11+
*@description 将传入对象转为 GeoJSON 格式。
12+
*@param {Object} feature - 待转参数。
1313
*@usage
1414
* ```
1515
* // 浏览器
1616
* <script type="text/javascript" src="{cdn}"></script>
1717
* <script>
18-
*const util ={namespace}.Util;
18+
* {namespace}.Util.toGeoJSON(feature);
1919
*
2020
* </script>
21+
*
2122
* // ES6 Import
22-
* import {Util } from '{npm}';
23+
* import {toGeoJSON } from '{npm}';
2324
*
25+
* toGeoJSON(feature);
2426
* ```
2527
*/
26-
exportvartoGeoJSON=function(feature){
28+
exportvartoGeoJSON=function(feature){
2729
if(!feature){
2830
returnfeature;
2931
}
3032
returnnewGeoJSONFormat().toGeoJSON(feature);
3133
};
34+
35+
/**
36+
*@function toSuperMapGeometry
37+
*@category BaseTypes Util
38+
*@description 将 GeoJSON 对象转为 SuperMap 几何图形。
39+
*@param {GeoJSONObject} geometry - GeoJSON 对象。
40+
*@usage
41+
* ```
42+
* // 浏览器
43+
* <script type="text/javascript" src="{cdn}"></script>
44+
* <script>
45+
* {namespace}.Util.toSuperMapGeometry(geometry);
46+
*
47+
* </script>
48+
*
49+
* // ES6 Import
50+
* import { toSuperMapGeometry } from '{npm}';
51+
*
52+
* toSuperMapGeometry(geometry);
53+
* ```
54+
*/
3255
exportvartoSuperMapGeometry=function(geometry){
3356
if(!geometry){
3457
returngeometry;
@@ -59,6 +82,30 @@ export var toSuperMapGeometry = function(geometry) {
5982
};
6083
exportvargetMeterPerMapUnit=MeterPerMapUnit;
6184

85+
86+
/**
87+
*@function resolutionToScale
88+
*@category BaseTypes Util
89+
*@description 通过分辨率计算比例尺。
90+
*@param {number} resolution - 分辨率。
91+
*@param {number} dpi - 屏幕分辨率。
92+
*@param {string} mapUnit - 地图单位。
93+
*@returns {number} 比例尺。
94+
*@usage
95+
* ```
96+
* // 浏览器
97+
* <script type="text/javascript" src="{cdn}"></script>
98+
* <script>
99+
* {namespace}.Util.resolutionToScale(resolution, dpi, mapUnit);
100+
*
101+
* </script>
102+
*
103+
* // ES6 Import
104+
* import { resolutionToScale } from '{npm}';
105+
*
106+
* resolutionToScale(resolution, dpi, mapUnit);
107+
* ```
108+
*/
62109
exportvarresolutionToScale=function(resolution,dpi,mapUnit){
63110
varinchPerMeter=1/0.0254;
64111
// 地球半径。
@@ -67,6 +114,30 @@ export var resolutionToScale = function(resolution, dpi, mapUnit) {
67114
scale=1/scale;
68115
returnscale;
69116
};
117+
118+
/**
119+
*@function scaleToResolution
120+
*@category BaseTypes Util
121+
*@description 通过比例尺计算分辨率。
122+
*@param {number} scale - 比例尺。
123+
*@param {number} dpi - 屏幕分辨率。
124+
*@param {string} mapUnit - 地图单位。
125+
*@returns {number} 分辨率。
126+
*@usage
127+
* ```
128+
* // 浏览器
129+
* <script type="text/javascript" src="{cdn}"></script>
130+
* <script>
131+
* {namespace}.Util.scaleToResolution(scale, dpi, mapUnit);
132+
*
133+
* </script>
134+
*
135+
* // ES6 Import
136+
* import { scaleToResolution } from '{npm}';
137+
*
138+
* scaleToResolution(scale, dpi, mapUnit);
139+
* ```
140+
*/
70141
exportvarscaleToResolution=function(scale,dpi,mapUnit){
71142
varinchPerMeter=1/0.0254;
72143
varmeterPerMapUnitValue=getMeterPerMapUnit(mapUnit);
@@ -75,10 +146,55 @@ export var scaleToResolution = function(scale, dpi, mapUnit) {
75146
returnresolution;
76147
};
77148

149+
/**
150+
*@function NormalizeScale
151+
*@category BaseTypes Util
152+
*@description 转换比例尺。
153+
*@param {number} scale - 比例尺。
154+
*@returns {number} 正常的 scale 值。
155+
*@usage
156+
* ```
157+
* // 浏览器
158+
* <script type="text/javascript" src="{cdn}"></script>
159+
* <script>
160+
* {namespace}.Util.NormalizeScale(scale);
161+
*
162+
* </script>
163+
*
164+
* // ES6 Import
165+
* import { NormalizeScale } from '{npm}';
166+
*
167+
* NormalizeScale(scale);
168+
* ```
169+
*/
78170
exportvarNormalizeScale=function(scale){
79171
returnscale>1.0 ?1.0/scale :scale;
80172
};
81173

174+
/**
175+
*@function GetResolutionFromScaleDpi
176+
*@category BaseTypes Util
177+
*@description 根据比例尺和 dpi 计算屏幕分辨率。
178+
*@param {number} scale - 比例尺。
179+
*@param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
180+
*@param {string} [coordUnit] - 投影坐标系统的地图单位。
181+
*@param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
182+
*@returns {number} 当前比例尺下的屏幕分辨率。
183+
*@usage
184+
* ```
185+
* // 浏览器
186+
* <script type="text/javascript" src="{cdn}"></script>
187+
* <script>
188+
* {namespace}.Util.GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
189+
*
190+
* </script>
191+
*
192+
* // ES6 Import
193+
* import { GetResolutionFromScaleDpi } from '{npm}';
194+
*
195+
* GetResolutionFromScaleDpi(scale, dpi, coordUnit, datumAxis);
196+
* ```
197+
*/
82198
exportvarGetResolutionFromScaleDpi=function(scale,dpi,coordUnit,datumAxis){
83199
varresolution=null,
84200
ratio=10000;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp