station-positions-function.js
8.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/**
* 函数
*/
var PositionsPublicFunctions = function () {
var PubFun = {
initStationInfo : function(id) {
PositionsPublicFunctions.getStationRouteInfo(id,function(r) {
var Station = r[0];
PositionsStationObj.setAddStation(Station);
var len = r.length;
if(len>0) {
var stationShapesType = r[0].stationShapesType;
// 获取中心坐标点字符串分割
var BJwpoints = r[0].stationJwpoints.split(' ');
// 中心坐标点
var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
'<span style="color:#DDD;font-size: 15px;">站点名称:' + r[0].stationName + '</span>' +
'<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + r[0].stationCode + '</span>' +
'<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + r[0].stationRouteCode + '</span>' +
'<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + r[0].stationJwpoints + '</span>' +
'<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + r[0].stationRadius + '</span>' +
'<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + r[0].stationRouteVersions + '</span>' +
'<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' ;
// 信息窗口参数属性
var opts = {
// 信息窗口宽度
width : 200,
// 信息窗口高度
height : 450,
// 信息窗位置偏移值。
offset: new BMap.Size(500,80),
//标题
title : '<h4 style="color:#FFFFFF">'+r[0].stationName+'站详情</h4>',
//设置不允许信窗发送短息
enableMessage : false,
//是否开启点击地图关闭信息窗口
enableCloseOnClick : false,
// 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
enableAutoPan:true
};
if(stationShapesType == 'r') {
// 画圆
StationPositionsWorldsBMap.pointsCircle(r,point,htm,opts);
}else if(stationShapesType == 'd'){
// 画多边形
StationPositionsWorldsBMap.pointsPolygon(r,point,htm,opts);
}
}
});
},
editSeteditStationParmasValue : function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
// 百度地图经纬度坐标中心点
stationObj[0].stationJwpoints = points;
// WGS经度
stationObj[0].stationGlonx = gLonx;
// WGS经度
stationObj[0].stationGlaty = gLaty;
// 百度坐标点图形集合
stationObj[0].stationGPloyonGrid = gPolygonGridVlaue;
// WGS坐标点图形集合
stationObj[0].stationBPolyonGrid = bPolygonGridValue;
// 图形类型
stationObj[0].stationShapesType = shapesTypeValue;
// 圆形半径
stationObj[0].stationRadius = radiusValue;
},
// 原百度坐标转WGS坐标
getFormPointEToWGS: function(points,callback) {
// 获取长度
var len = points.length;
(function(){
if (!arguments.callee.count) {
arguments.callee.count = 0;
}
arguments.callee.count++;
var index = parseInt(arguments.callee.count) - 1;
if (index >= len) {
callback && callback(points);
return;
}
var f = arguments.callee;
$.ajax({
url: 'http://api.zdoz.net/bd2wgs.aspx',
data: {lat: points[index].potion.lat , lng: points[index].potion.lng},
dataType: 'jsonp',
success: function(r){
if(r) {
points[index].WGSpotion = r;
}
f();
}
});
})();
},
setFormValue : function(stationObj) {
// 站点ID
$('#stationIdInput').val(stationObj.stationId);
// 站点路由ID
$('#stationRouteIdInput').val(stationObj.stationRouteId);
// 站点路由线路Id
$('#stationRouteLineInput').val(stationObj.stationRouteLine);
// 线路编码
$('#lineCodeInput').val(stationObj.stationRouteLIneCode);
// WGS坐标点图形集合
$('#bPolygonGridInput').val(stationObj.stationBPolyonGrid);
// 获取站点名称元素设值
$('#stationNameInput').val(stationObj.stationName);
// 获取站点编码元素设值
$('#stationCodInput').val(stationObj.stationCode);
// 获取站点类型元素设值
$('#stationMarkSelect').val(stationObj.stationRouteStationMark);
// 获取站点方向元素设值
$('#stationdirSelect').val(stationObj.stationRoutedirections);
// 获取站点道路编码元素设值
$('#roadCodingCodInput').val(stationObj.stationRoadCoding);
// 百度地图经纬度坐标中心点
$('#bJwpointsInput').val(stationObj.stationJwpoints);
// 获取图形类型元素,并添加值
$('#shapesTypeSelect').val(stationObj.stationShapesType);
// 获取半径元素,并添加值
$('#radiusInput').val(stationObj.stationRadius);
// 是否撤销
$('#destroySelect').val(stationObj.stationRouteDestroy);
// 到站时间
$('#toTimeInput').val(stationObj.stationRouteToTime);
// 到站距离
$('#distancesInput').val(stationObj.stationRouteDistances);
// 描述/说明
$('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
},
// 树数据获取
getStation : function(id_,dir_,callback) {
var treeDateJson = [];
$get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) {
treeDateJson = createTreeData(resultdata);
callback && callback(treeDateJson);
});
},
findUpStationRouteCode : function(lineId,diraction,stationRouteCode,callback) {
$get('/stationroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,stationRouteCode:stationRouteCode},function(result) {
callback && callback(result);
});
},
getStationRouteInfo : function(stationId,callback){
$get('/stationroute/findStationRouteInfo',{id:stationId},function(r) {
callback && callback(r);
});
},
// 站点更新
stationUpdate : function(station,callback) {
$post('/station/stationUpdate',station,function(data) {
callback && callback(data);
});
},
clearRefresh : function() {
// 清楚地图覆盖物
mapB.clearOverlays();
$('#eidt').attr("disabled",false);
$('#eidt').removeClass('btn disabled');
$('#eidt').addClass('btn');
stationObj='';
PublicFunctions.initStationInfo(stationId,mapB);
},
getstationObjData : function(){
return stationObj;
},
getStationIdValue : function() {
return stationId;
},
setStationNameValue : function(editStationName) {
stationObj[0].stationName = editStationName;
return stationObj;
},
getPolygonObj : function() {
return polygon;
},
getMarkerObj : function() {
return marker;
},
getCircleObj : function() {
return circle;
}
}
return PubFun ;
}();