@vtx/map 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/lib/VtxMap/AMap/AMap.css +24 -0
- package/lib/VtxMap/AMap/AMap.js +2944 -0
- package/lib/VtxMap/AMap/AMap.less +24 -0
- package/lib/VtxMap/BMap/Map.css +26 -0
- package/lib/VtxMap/BMap/Map.js +3128 -0
- package/lib/VtxMap/BMap/Map.less +28 -0
- package/lib/VtxMap/GMap/Map.css +88 -0
- package/lib/VtxMap/GMap/Map.js +4166 -0
- package/lib/VtxMap/GMap/Map.less +87 -0
- package/lib/VtxMap/Map.css +7 -0
- package/lib/VtxMap/Map.js +84 -0
- package/lib/VtxMap/Map.less +9 -0
- package/lib/VtxMap/MapToolFunction.js +403 -0
- package/lib/VtxMap/OMap/Map.css +76 -0
- package/lib/VtxMap/OMap/Map.js +3932 -0
- package/lib/VtxMap/OMap/Map.less +70 -0
- package/lib/VtxMap/TMap/TMap.css +26 -0
- package/lib/VtxMap/TMap/TMap.js +3151 -0
- package/lib/VtxMap/TMap/TMap.less +31 -0
- package/lib/VtxMap/index.js +34 -0
- package/lib/VtxMap/mapPlayer.js +348 -0
- package/lib/VtxMap/optimizingPointMap.js +238 -0
- package/lib/VtxMap/zoomMap.js +124 -0
- package/lib/VtxModal/VtxModal.css +62 -0
- package/lib/VtxModal/VtxModal.js +249 -0
- package/lib/VtxModal/VtxModal.less +65 -0
- package/lib/VtxModal/draggableModal.js +143 -0
- package/lib/VtxModal/index.js +22 -0
- package/lib/VtxSearchMap/VtxSearchMap.css +170 -0
- package/lib/VtxSearchMap/VtxSearchMap.js +872 -0
- package/lib/VtxSearchMap/VtxSearchMap.less +169 -0
- package/lib/VtxSearchMap/index.js +22 -0
- package/lib/VtxSearchMap/mapping.js +15 -0
- package/lib/default.js +40 -0
- package/lib/index.js +35 -0
- package/package.json +39 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
.map{
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
background-color: #f1f1f1;
|
|
5
|
+
}
|
|
6
|
+
.vtx_gmap_html_points,.vtx_gmap_html_pointCollection{
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0px;
|
|
9
|
+
left: 0px;
|
|
10
|
+
}
|
|
11
|
+
.esriSimpleSlider{
|
|
12
|
+
z-index: 10000000 !important;
|
|
13
|
+
}
|
|
14
|
+
.label-content{
|
|
15
|
+
/*margin-left: 0;
|
|
16
|
+
width: 100px;
|
|
17
|
+
line-height: 25px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
position: relative;
|
|
20
|
+
left: -43px;
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
opacity: 1;
|
|
23
|
+
border-radius: 5px;
|
|
24
|
+
color: #5DD0EE;
|
|
25
|
+
word-break: break-all;
|
|
26
|
+
white-space: normal;
|
|
27
|
+
padding: 2px 8px;*/
|
|
28
|
+
display: inline-block;
|
|
29
|
+
padding: 5px;
|
|
30
|
+
line-height: 22px;
|
|
31
|
+
text-align: center;
|
|
32
|
+
border-radius: 5px;
|
|
33
|
+
background-color: #fff;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
color: #5DD0EE;
|
|
36
|
+
}
|
|
37
|
+
.vtx-g-rangingPoint{
|
|
38
|
+
width: 7px;
|
|
39
|
+
height: 7px;
|
|
40
|
+
background-color: #fff;
|
|
41
|
+
border: 2px solid #ff0000;
|
|
42
|
+
display: inline-block;
|
|
43
|
+
border-radius: 7px;
|
|
44
|
+
}
|
|
45
|
+
.vtx-g-rangingDistance{
|
|
46
|
+
position: relative;
|
|
47
|
+
top: -36px;
|
|
48
|
+
left: 15px;
|
|
49
|
+
height: 30px;
|
|
50
|
+
line-height: 28px;
|
|
51
|
+
background-color: #fff;
|
|
52
|
+
border: 1px solid #ff0000;
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
word-break: keep-all;
|
|
55
|
+
padding: 0px 3px;
|
|
56
|
+
}
|
|
57
|
+
.vtx-g-rang-exit{
|
|
58
|
+
width: 9px;
|
|
59
|
+
height: 9px;
|
|
60
|
+
background-color: #fff;
|
|
61
|
+
border: 2px solid #ff0000;
|
|
62
|
+
color: #ff0000;
|
|
63
|
+
line-height: 7px;
|
|
64
|
+
text-align: center;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
.vtx-g-rang-showRangTool{
|
|
69
|
+
line-height: 18px;
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
border: 1px solid #ff0000;
|
|
72
|
+
word-break: keep-all;
|
|
73
|
+
background-color: #fff;
|
|
74
|
+
padding: 0px 5px;
|
|
75
|
+
}
|
|
76
|
+
.zoom_slider_show_scale{
|
|
77
|
+
padding: 1px 8px;
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
text-align: center;
|
|
80
|
+
}
|
|
81
|
+
.zoom_slider_show_bottom{
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 3px;
|
|
84
|
+
border: 1px solid #000;
|
|
85
|
+
border-bottom: 3px solid #000;
|
|
86
|
+
border-top: 0px;
|
|
87
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
|
|
11
|
+
var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
|
|
13
|
+
var _AMap = require('./AMap/AMap');
|
|
14
|
+
|
|
15
|
+
var _AMap2 = _interopRequireDefault(_AMap);
|
|
16
|
+
|
|
17
|
+
var _Map = require('./BMap/Map');
|
|
18
|
+
|
|
19
|
+
var _Map2 = _interopRequireDefault(_Map);
|
|
20
|
+
|
|
21
|
+
var _TMap = require('./TMap/TMap');
|
|
22
|
+
|
|
23
|
+
var _TMap2 = _interopRequireDefault(_TMap);
|
|
24
|
+
|
|
25
|
+
var _Map3 = require('./GMap/Map');
|
|
26
|
+
|
|
27
|
+
var _Map4 = _interopRequireDefault(_Map3);
|
|
28
|
+
|
|
29
|
+
require('./Map.css');
|
|
30
|
+
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
+
|
|
33
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
34
|
+
|
|
35
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
36
|
+
|
|
37
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
38
|
+
|
|
39
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
40
|
+
|
|
41
|
+
var VtxMap = function (_React$Component) {
|
|
42
|
+
_inherits(VtxMap, _React$Component);
|
|
43
|
+
|
|
44
|
+
function VtxMap(props) {
|
|
45
|
+
_classCallCheck(this, VtxMap);
|
|
46
|
+
|
|
47
|
+
return _possibleConstructorReturn(this, (VtxMap.__proto__ || Object.getPrototypeOf(VtxMap)).call(this, props));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_createClass(VtxMap, [{
|
|
51
|
+
key: 'render',
|
|
52
|
+
value: function render() {
|
|
53
|
+
var t = this;
|
|
54
|
+
|
|
55
|
+
var _t$props = t.props,
|
|
56
|
+
mapType = _t$props.mapType,
|
|
57
|
+
getMapInstance = _t$props.getMapInstance,
|
|
58
|
+
newProps = _objectWithoutProperties(_t$props, ['mapType', 'getMapInstance']);
|
|
59
|
+
|
|
60
|
+
if (typeof getMapInstance == 'function') {
|
|
61
|
+
newProps.ref = function (map) {
|
|
62
|
+
if (map) {
|
|
63
|
+
getMapInstance(map);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
switch (mapType) {
|
|
68
|
+
case 'amap':
|
|
69
|
+
return _react2.default.createElement(_AMap2.default, newProps);
|
|
70
|
+
case 'tmap':
|
|
71
|
+
return _react2.default.createElement(_TMap2.default, newProps);
|
|
72
|
+
case 'gmap':
|
|
73
|
+
return _react2.default.createElement(_Map4.default, newProps);
|
|
74
|
+
default:
|
|
75
|
+
return _react2.default.createElement(_Map2.default, newProps);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
|
|
80
|
+
return VtxMap;
|
|
81
|
+
}(_react2.default.Component);
|
|
82
|
+
|
|
83
|
+
exports.default = VtxMap;
|
|
84
|
+
module.exports = exports['default'];
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.graphicManage = graphicManage;
|
|
7
|
+
exports.RotateIcon = RotateIcon;
|
|
8
|
+
exports.getMaxMin = getMaxMin;
|
|
9
|
+
exports.getPolygonArea = getPolygonArea;
|
|
10
|
+
exports.getPixelDistance = getPixelDistance;
|
|
11
|
+
exports.getDistance = getDistance;
|
|
12
|
+
|
|
13
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
14
|
+
|
|
15
|
+
function graphicManage() {
|
|
16
|
+
this.allGraphics = {}; //所有图元对象
|
|
17
|
+
this.allParam = {}; //所有添加图元的数据
|
|
18
|
+
}
|
|
19
|
+
graphicManage.prototype = {
|
|
20
|
+
//存储图元对象
|
|
21
|
+
setGraphic: function setGraphic(id, graphic) {
|
|
22
|
+
this.allGraphics[id] = graphic;
|
|
23
|
+
//链式调用
|
|
24
|
+
return this;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
//获取图元对象
|
|
28
|
+
getGraphic: function getGraphic(id) {
|
|
29
|
+
return this.allGraphics[id];
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
//批量获取图元对象
|
|
33
|
+
getMoreGraphic: function getMoreGraphic(ids) {
|
|
34
|
+
var _this = this;
|
|
35
|
+
|
|
36
|
+
var rg = [];
|
|
37
|
+
ids.map(function (item, index) {
|
|
38
|
+
rg.push(_this.allGraphics[item]);
|
|
39
|
+
});
|
|
40
|
+
return rg;
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
//删除图元时,同时删除id
|
|
44
|
+
removeGraphic: function removeGraphic(id) {
|
|
45
|
+
delete this.allGraphics[id];
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
//判断id是否重复
|
|
49
|
+
isRepetition: function isRepetition(id) {
|
|
50
|
+
return !!this.allGraphics[id];
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
//设置图元数据
|
|
54
|
+
setGraphicParam: function setGraphicParam(id, obj) {
|
|
55
|
+
this.allParam[id] = obj;
|
|
56
|
+
//链式调用
|
|
57
|
+
return this;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
//获取单个图元数据
|
|
61
|
+
getGraphicParam: function getGraphicParam(id) {
|
|
62
|
+
return this.allParam[id];
|
|
63
|
+
},
|
|
64
|
+
removeGraphicParam: function removeGraphicParam(id) {
|
|
65
|
+
delete this.allParam[id];
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
//批量获取图元数据
|
|
69
|
+
getMoreGraphicParam: function getMoreGraphicParam(ids) {
|
|
70
|
+
var _this2 = this;
|
|
71
|
+
|
|
72
|
+
var ap = [];
|
|
73
|
+
ids.map(function (item, index) {
|
|
74
|
+
ap.push(_this2.allParam[item]);
|
|
75
|
+
});
|
|
76
|
+
return ap;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
//清空所有缓存数据
|
|
80
|
+
clearAll: function clearAll() {
|
|
81
|
+
this.allGraphics = {};
|
|
82
|
+
this.allParam = {};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
//使用canvas 旋转图片,生成base64,达到旋转效果
|
|
87
|
+
function RotateIcon() {
|
|
88
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
89
|
+
|
|
90
|
+
this.options = options;
|
|
91
|
+
this.rImg = new Image();
|
|
92
|
+
this.rImg.src = this.options.url || '';
|
|
93
|
+
var canvas = document.createElement("canvas");
|
|
94
|
+
canvas.width = this.options.width;
|
|
95
|
+
canvas.height = this.options.height;
|
|
96
|
+
this.context = canvas.getContext("2d");
|
|
97
|
+
this.canvas = canvas;
|
|
98
|
+
};
|
|
99
|
+
RotateIcon.prototype.setRotation = function () {
|
|
100
|
+
var deg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
101
|
+
|
|
102
|
+
var t = this;
|
|
103
|
+
var canvas = t.context,
|
|
104
|
+
angle = deg * Math.PI / 180,
|
|
105
|
+
centerX = t.options.width / 2,
|
|
106
|
+
centerY = t.options.height / 2;
|
|
107
|
+
canvas.clearRect(0, 0, t.options.width, t.options.height);
|
|
108
|
+
canvas.save();
|
|
109
|
+
canvas.translate(centerX, centerY);
|
|
110
|
+
canvas.rotate(angle);
|
|
111
|
+
canvas.translate(-centerX, -centerY);
|
|
112
|
+
canvas.drawImage(t.rImg, -1, -1);
|
|
113
|
+
canvas.restore();
|
|
114
|
+
return t;
|
|
115
|
+
};
|
|
116
|
+
RotateIcon.prototype.getUrl = function () {
|
|
117
|
+
return this.canvas.toDataURL('image/png');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
function getMaxMin() {
|
|
121
|
+
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
122
|
+
|
|
123
|
+
//区别点和圆的经纬度数据处理
|
|
124
|
+
var lnglatAry = [],
|
|
125
|
+
_extent = { xmax: 0, xmin: 0, ymax: 0, ymin: 0 };
|
|
126
|
+
var p = path.map(function (item, index) {
|
|
127
|
+
var lng = item.lng,
|
|
128
|
+
lat = item.lat;
|
|
129
|
+
if (lng > _extent.xmax) {
|
|
130
|
+
_extent.xmax = lng;
|
|
131
|
+
}
|
|
132
|
+
if (lng < _extent.xmin || _extent.xmin == 0) {
|
|
133
|
+
_extent.xmin = lng;
|
|
134
|
+
}
|
|
135
|
+
if (lat > _extent.ymax) {
|
|
136
|
+
_extent.ymax = lat;
|
|
137
|
+
}
|
|
138
|
+
if (lat < _extent.ymin || _extent.ymin == 0) {
|
|
139
|
+
_extent.ymin = lat;
|
|
140
|
+
}
|
|
141
|
+
lnglatAry.push({
|
|
142
|
+
lngX: lng,
|
|
143
|
+
latX: lat
|
|
144
|
+
});
|
|
145
|
+
return [lng, lat];
|
|
146
|
+
});
|
|
147
|
+
return { path: p, _extent: _extent };
|
|
148
|
+
}
|
|
149
|
+
//计算面 面积
|
|
150
|
+
function getPolygonArea(polygon) {
|
|
151
|
+
var pts = [].concat(_toConsumableArray(polygon));
|
|
152
|
+
|
|
153
|
+
if (pts.length < 3) {
|
|
154
|
+
//小于3个顶点,不能构建面
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
if (pts[0][0] == pts[pts.length - 1][0] && pts[0][1] == pts[pts.length - 1][1]) {
|
|
158
|
+
pts.pop();
|
|
159
|
+
}
|
|
160
|
+
var totalArea = 0; //初始化总面积
|
|
161
|
+
var LowX = 0.0;
|
|
162
|
+
var LowY = 0.0;
|
|
163
|
+
var MiddleX = 0.0;
|
|
164
|
+
var MiddleY = 0.0;
|
|
165
|
+
var HighX = 0.0;
|
|
166
|
+
var HighY = 0.0;
|
|
167
|
+
var AM = 0.0;
|
|
168
|
+
var BM = 0.0;
|
|
169
|
+
var CM = 0.0;
|
|
170
|
+
var AL = 0.0;
|
|
171
|
+
var BL = 0.0;
|
|
172
|
+
var CL = 0.0;
|
|
173
|
+
var AH = 0.0;
|
|
174
|
+
var BH = 0.0;
|
|
175
|
+
var CH = 0.0;
|
|
176
|
+
var CoefficientL = 0.0;
|
|
177
|
+
var CoefficientH = 0.0;
|
|
178
|
+
var ALtangent = 0.0;
|
|
179
|
+
var BLtangent = 0.0;
|
|
180
|
+
var CLtangent = 0.0;
|
|
181
|
+
var AHtangent = 0.0;
|
|
182
|
+
var BHtangent = 0.0;
|
|
183
|
+
var CHtangent = 0.0;
|
|
184
|
+
var ANormalLine = 0.0;
|
|
185
|
+
var BNormalLine = 0.0;
|
|
186
|
+
var CNormalLine = 0.0;
|
|
187
|
+
var OrientationValue = 0.0;
|
|
188
|
+
var AngleCos = 0.0;
|
|
189
|
+
var Sum1 = 0.0;
|
|
190
|
+
var Sum2 = 0.0;
|
|
191
|
+
var Count2 = 0;
|
|
192
|
+
var Count1 = 0;
|
|
193
|
+
var Sum = 0.0;
|
|
194
|
+
var Radius = 6399593.0; //6378137.0,WGS84椭球半径 6399593,CGCS2000 椭球半径
|
|
195
|
+
var Count = pts.length;
|
|
196
|
+
for (var i = 0; i < Count; i++) {
|
|
197
|
+
if (i == 0) {
|
|
198
|
+
LowX = (pts[Count - 1].lng || pts[Count - 1][0]) * Math.PI / 180;
|
|
199
|
+
LowY = (pts[Count - 1].lat || pts[Count - 1][1]) * Math.PI / 180;
|
|
200
|
+
MiddleX = (pts[0].lng || pts[0][0]) * Math.PI / 180;
|
|
201
|
+
MiddleY = (pts[0].lat || pts[0][1]) * Math.PI / 180;
|
|
202
|
+
HighX = (pts[1].lng || pts[1][0]) * Math.PI / 180;
|
|
203
|
+
HighY = (pts[1].lat || pts[1][1]) * Math.PI / 180;
|
|
204
|
+
} else if (i == Count - 1) {
|
|
205
|
+
LowX = (pts[Count - 2].lng || pts[Count - 2][0]) * Math.PI / 180;
|
|
206
|
+
LowY = (pts[Count - 2].lat || pts[Count - 2][1]) * Math.PI / 180;
|
|
207
|
+
MiddleX = (pts[Count - 1].lng || pts[Count - 1][0]) * Math.PI / 180;
|
|
208
|
+
MiddleY = (pts[Count - 1].lat || pts[Count - 1][1]) * Math.PI / 180;
|
|
209
|
+
HighX = (pts[0].lng || pts[0][0]) * Math.PI / 180;
|
|
210
|
+
HighY = (pts[0].lat || pts[0][1]) * Math.PI / 180;
|
|
211
|
+
} else {
|
|
212
|
+
LowX = (pts[i - 1].lng || pts[i - 1][0]) * Math.PI / 180;
|
|
213
|
+
LowY = (pts[i - 1].lat || pts[i - 1][1]) * Math.PI / 180;
|
|
214
|
+
MiddleX = (pts[i].lng || pts[i][0]) * Math.PI / 180;
|
|
215
|
+
MiddleY = (pts[i].lat || pts[i][1]) * Math.PI / 180;
|
|
216
|
+
HighX = (pts[i + 1].lng || pts[i + 1][0]) * Math.PI / 180;
|
|
217
|
+
HighY = (pts[i + 1].lat || pts[i + 1][1]) * Math.PI / 180;
|
|
218
|
+
}
|
|
219
|
+
AM = Math.cos(MiddleY) * Math.cos(MiddleX);
|
|
220
|
+
BM = Math.cos(MiddleY) * Math.sin(MiddleX);
|
|
221
|
+
CM = Math.sin(MiddleY);
|
|
222
|
+
AL = Math.cos(LowY) * Math.cos(LowX);
|
|
223
|
+
BL = Math.cos(LowY) * Math.sin(LowX);
|
|
224
|
+
CL = Math.sin(LowY);
|
|
225
|
+
AH = Math.cos(HighY) * Math.cos(HighX);
|
|
226
|
+
BH = Math.cos(HighY) * Math.sin(HighX);
|
|
227
|
+
CH = Math.sin(HighY);
|
|
228
|
+
CoefficientL = (AM * AM + BM * BM + CM * CM) / (AM * AL + BM * BL + CM * CL);
|
|
229
|
+
CoefficientH = (AM * AM + BM * BM + CM * CM) / (AM * AH + BM * BH + CM * CH);
|
|
230
|
+
ALtangent = CoefficientL * AL - AM;
|
|
231
|
+
BLtangent = CoefficientL * BL - BM;
|
|
232
|
+
CLtangent = CoefficientL * CL - CM;
|
|
233
|
+
AHtangent = CoefficientH * AH - AM;
|
|
234
|
+
BHtangent = CoefficientH * BH - BM;
|
|
235
|
+
CHtangent = CoefficientH * CH - CM;
|
|
236
|
+
if (!(Math.sqrt(AHtangent * AHtangent + BHtangent * BHtangent + CHtangent * CHtangent) * Math.sqrt(ALtangent * ALtangent + BLtangent * BLtangent + CLtangent * CLtangent))) {
|
|
237
|
+
AngleCos = 0;
|
|
238
|
+
} else {
|
|
239
|
+
AngleCos = (AHtangent * ALtangent + BHtangent * BLtangent + CHtangent * CLtangent) / (Math.sqrt(AHtangent * AHtangent + BHtangent * BHtangent + CHtangent * CHtangent) * Math.sqrt(ALtangent * ALtangent + BLtangent * BLtangent + CLtangent * CLtangent));
|
|
240
|
+
AngleCos = Math.acos(AngleCos);
|
|
241
|
+
}
|
|
242
|
+
ANormalLine = BHtangent * CLtangent - CHtangent * BLtangent;
|
|
243
|
+
BNormalLine = 0 - (AHtangent * CLtangent - CHtangent * ALtangent);
|
|
244
|
+
CNormalLine = AHtangent * BLtangent - BHtangent * ALtangent;
|
|
245
|
+
if (AM != 0) OrientationValue = ANormalLine / AM;else if (BM != 0) OrientationValue = BNormalLine / BM;else OrientationValue = CNormalLine / CM;
|
|
246
|
+
if (OrientationValue > 0) {
|
|
247
|
+
Sum1 += AngleCos;
|
|
248
|
+
Count1++;
|
|
249
|
+
} else {
|
|
250
|
+
Sum2 += AngleCos;
|
|
251
|
+
Count2++;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
var tempSum1, tempSum2;
|
|
255
|
+
tempSum1 = Sum1 + (2 * Math.PI * Count2 - Sum2);
|
|
256
|
+
tempSum2 = 2 * Math.PI * Count1 - Sum1 + Sum2;
|
|
257
|
+
if (Sum1 > Sum2) {
|
|
258
|
+
if (tempSum1 - (Count - 2) * Math.PI < 1) Sum = tempSum1;else Sum = tempSum2;
|
|
259
|
+
} else {
|
|
260
|
+
if (tempSum2 - (Count - 2) * Math.PI < 1) Sum = tempSum2;else Sum = tempSum1;
|
|
261
|
+
}
|
|
262
|
+
totalArea = (Sum - (Count - 2) * Math.PI) * Radius * Radius;
|
|
263
|
+
return totalArea; //返回总面积
|
|
264
|
+
}
|
|
265
|
+
//计算2点间的距离 (单位:px)
|
|
266
|
+
function getPixelDistance(lt1, lt2) {
|
|
267
|
+
var x = Math.abs(lt1.x - lt2.x);
|
|
268
|
+
var y = Math.abs(lt1.y - lt2.y);
|
|
269
|
+
var d = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
|
270
|
+
return d;
|
|
271
|
+
}
|
|
272
|
+
//计算2点间的距离 (单位m)
|
|
273
|
+
function getDistance(point1, point2, map, wkid) {
|
|
274
|
+
var lt1 = map.toScreen(new esri.geometry.Point({
|
|
275
|
+
longitude: point1[0],
|
|
276
|
+
latitude: point1[1],
|
|
277
|
+
spatialReference: { wkid: wkid || 4326 }
|
|
278
|
+
}));
|
|
279
|
+
var lt2 = map.toScreen(new esri.geometry.Point({
|
|
280
|
+
longitude: point2[0],
|
|
281
|
+
latitude: point2[1],
|
|
282
|
+
spatialReference: { wkid: wkid || 4326 }
|
|
283
|
+
}));
|
|
284
|
+
var x = Math.abs(lt1.x - lt2.x);
|
|
285
|
+
var y = Math.abs(lt1.y - lt2.y);
|
|
286
|
+
var d = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) * map.getScale() * 0.025399998 / 96;
|
|
287
|
+
return Math.round(d * 100) / 100;
|
|
288
|
+
}
|
|
289
|
+
//arcgis default server 国家天地图矢量图
|
|
290
|
+
//1个像素是多少米: 1像素=0.0254/96
|
|
291
|
+
//第三方天地图 0.025399998 arcgis本身0.0254000508001016
|
|
292
|
+
//resolution = (0.025399998 *scale)/(96*111000)
|
|
293
|
+
//比例尺 resolution*111000 或 0.025399998/96*scale
|
|
294
|
+
var defaultWmtsMapLayers = exports.defaultWmtsMapLayers = {
|
|
295
|
+
services: [{
|
|
296
|
+
type: 'wmts',
|
|
297
|
+
url: ['http://t1.tianditu.com/vec_c/wmts', 'http://t2.tianditu.com/cva_c/wmts'],
|
|
298
|
+
tilematrixset: 'c',
|
|
299
|
+
format: 'tiles',
|
|
300
|
+
layer: ['vec', 'cva']
|
|
301
|
+
}, {
|
|
302
|
+
type: 'wmts',
|
|
303
|
+
url: ['http://srv2.zjditu.cn/ZJEMAP_2D/wmts', 'http://srv2.zjditu.cn/ZJEMAPANNO_2D/wmts'],
|
|
304
|
+
tilematrixset: 'default028mm',
|
|
305
|
+
format: 'image/jpgpng',
|
|
306
|
+
layer: ['TDT_ZJEMAPANNO', 'TDT_ZJEMAPANNO']
|
|
307
|
+
}],
|
|
308
|
+
origin: { x: -180, y: 90 },
|
|
309
|
+
wkid: 4326,
|
|
310
|
+
fullExtent: { xmin: -180.0, ymin: -90.0, xmax: 180.0, ymax: 90.0 },
|
|
311
|
+
// initialExtent: {xmin : 119.96,ymin : 30.2,xmax : 120.3,ymax : 30.54},
|
|
312
|
+
initialExtent: {
|
|
313
|
+
xmin: 120.741407641, ymin: 30.7612148640001,
|
|
314
|
+
xmax: 121.033872803, ymax: 31.0324190470001
|
|
315
|
+
},
|
|
316
|
+
defaultType: "2D", //暂时没用到,抄上就行
|
|
317
|
+
switchTypeArrays: ["2D", "Satellite"], //暂时没用到,抄上就行
|
|
318
|
+
lods: [{
|
|
319
|
+
"level": 0,
|
|
320
|
+
"resolution": 1.40625,
|
|
321
|
+
"scale": 591658721.28
|
|
322
|
+
}, {
|
|
323
|
+
"level": 1,
|
|
324
|
+
"resolution": 0.703125,
|
|
325
|
+
"scale": 295829360.64
|
|
326
|
+
}, {
|
|
327
|
+
"level": 2,
|
|
328
|
+
"resolution": 0.3515625,
|
|
329
|
+
"scale": 147914680.32
|
|
330
|
+
}, {
|
|
331
|
+
"level": 3,
|
|
332
|
+
"resolution": 0.17578125,
|
|
333
|
+
"scale": 73957340.16
|
|
334
|
+
}, {
|
|
335
|
+
"level": 4,
|
|
336
|
+
"resolution": 0.087890625,
|
|
337
|
+
"scale": 36978670.08
|
|
338
|
+
}, {
|
|
339
|
+
"level": 5,
|
|
340
|
+
"resolution": 0.0439453125,
|
|
341
|
+
"scale": 18489335.04
|
|
342
|
+
}, {
|
|
343
|
+
"level": 6,
|
|
344
|
+
"resolution": 0.02197265625,
|
|
345
|
+
"scale": 9244667.52
|
|
346
|
+
}, {
|
|
347
|
+
"level": 7,
|
|
348
|
+
"resolution": 0.010986328125,
|
|
349
|
+
"scale": 4622333.76
|
|
350
|
+
}, {
|
|
351
|
+
"level": 8,
|
|
352
|
+
"resolution": 0.0054931640625,
|
|
353
|
+
"scale": 2311166.88
|
|
354
|
+
}, {
|
|
355
|
+
"level": 9,
|
|
356
|
+
"resolution": 0.00274658203125,
|
|
357
|
+
"scale": 1155583.44
|
|
358
|
+
}, {
|
|
359
|
+
"level": 10,
|
|
360
|
+
"resolution": 0.001373291015625,
|
|
361
|
+
"scale": 577791.72
|
|
362
|
+
}, {
|
|
363
|
+
"level": 11,
|
|
364
|
+
"resolution": 0.0006866455078125,
|
|
365
|
+
"scale": 288895.86
|
|
366
|
+
}, {
|
|
367
|
+
"level": 12,
|
|
368
|
+
"resolution": 0.00034332275390625,
|
|
369
|
+
"scale": 144447.93
|
|
370
|
+
}, {
|
|
371
|
+
"level": 13,
|
|
372
|
+
"resolution": 0.000171661376953125,
|
|
373
|
+
"scale": 72223.96
|
|
374
|
+
}, {
|
|
375
|
+
"level": 14,
|
|
376
|
+
"resolution": 0.0000858306884765625,
|
|
377
|
+
"scale": 36111.98
|
|
378
|
+
}, {
|
|
379
|
+
"level": 15,
|
|
380
|
+
"resolution": 0.00004291534423828125,
|
|
381
|
+
"scale": 18035.742100270663377549137718
|
|
382
|
+
}, {
|
|
383
|
+
"level": 16,
|
|
384
|
+
"resolution": 0.000021457672119140625,
|
|
385
|
+
"scale": 9017.871050135331688774568859
|
|
386
|
+
}, {
|
|
387
|
+
"level": 17,
|
|
388
|
+
"resolution": 0.0000107288360595703125,
|
|
389
|
+
"scale": 4508.9355250676658443872844296
|
|
390
|
+
}, {
|
|
391
|
+
"level": 18,
|
|
392
|
+
"resolution": 0.000005364418029785156,
|
|
393
|
+
"scale": 2254.46776253383
|
|
394
|
+
}, {
|
|
395
|
+
"level": 19,
|
|
396
|
+
"resolution": 0.000002682209014892578,
|
|
397
|
+
"scale": 1127.23388126692
|
|
398
|
+
}, {
|
|
399
|
+
"level": 20,
|
|
400
|
+
"resolution": 0.000001341104507446289,
|
|
401
|
+
"scale": 563.616940633458
|
|
402
|
+
}]
|
|
403
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.label-content {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding: 5px;
|
|
4
|
+
line-height: 22px;
|
|
5
|
+
text-align: center;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
opacity: 1;
|
|
9
|
+
color: #5DD0EE;
|
|
10
|
+
transform: translate(-50%);
|
|
11
|
+
-ms-transform: translate(-50%);
|
|
12
|
+
}
|
|
13
|
+
.noselect {
|
|
14
|
+
-webkit-touch-callout: none;
|
|
15
|
+
/* iOS Safari */
|
|
16
|
+
-webkit-user-select: none;
|
|
17
|
+
/* Chrome/Safari/Opera */
|
|
18
|
+
-khtml-user-select: none;
|
|
19
|
+
/* Konqueror */
|
|
20
|
+
-moz-user-select: none;
|
|
21
|
+
/* Firefox */
|
|
22
|
+
-ms-user-select: none;
|
|
23
|
+
/* Internet Explorer/Edge */
|
|
24
|
+
user-select: none;
|
|
25
|
+
/* Non-prefixed version, currently
|
|
26
|
+
not supported by any browser */
|
|
27
|
+
}
|
|
28
|
+
.vtx_gmap_html_pointCollection_a {
|
|
29
|
+
position: absolute;
|
|
30
|
+
}
|
|
31
|
+
.vtx_gmap_html_pointCollection_a canvas {
|
|
32
|
+
z-index: 111;
|
|
33
|
+
}
|
|
34
|
+
.vtx-g-rangingPoint {
|
|
35
|
+
width: 8px;
|
|
36
|
+
height: 8px;
|
|
37
|
+
background-color: #fff;
|
|
38
|
+
border: 2px solid #108ee9;
|
|
39
|
+
display: inline-block;
|
|
40
|
+
border-radius: 8px;
|
|
41
|
+
position: relative;
|
|
42
|
+
top: 5px;
|
|
43
|
+
left: 1px;
|
|
44
|
+
}
|
|
45
|
+
.vtx-g-rangingDistance {
|
|
46
|
+
position: relative;
|
|
47
|
+
top: -36px;
|
|
48
|
+
left: 15px;
|
|
49
|
+
height: 30px;
|
|
50
|
+
line-height: 28px;
|
|
51
|
+
background-color: #fff;
|
|
52
|
+
border: 1px solid #108ee9;
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
word-break: keep-all;
|
|
55
|
+
padding: 0px 3px;
|
|
56
|
+
color: #108ee9;
|
|
57
|
+
}
|
|
58
|
+
.vtx-g-rang-exit {
|
|
59
|
+
width: 12px;
|
|
60
|
+
height: 12px;
|
|
61
|
+
background-color: #fff;
|
|
62
|
+
border: 2px solid #108ee9;
|
|
63
|
+
color: #108ee9;
|
|
64
|
+
line-height: 7px;
|
|
65
|
+
text-align: center;
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
.vtx-g-rang-showRangTool {
|
|
70
|
+
line-height: 18px;
|
|
71
|
+
font-size: 12px;
|
|
72
|
+
border: 1px solid #108ee9;
|
|
73
|
+
word-break: keep-all;
|
|
74
|
+
background-color: #fff;
|
|
75
|
+
padding: 0px 5px;
|
|
76
|
+
}
|