PageSourceSearch

https://www.shipfinder.com/Content/js/elane/elane.olayers.circle.js?v=22

js shipfinder.com collected 2026-10-03 23:58:00 UTC 5,513 bytes, 159 lines download raw bytes

1/// <reference path="elane.olayers.js" />
2/// <reference path="../jquery-1.8.2.min.js" />
3//绘制圆形实例
4elane.overLayers.Circle = elane.overLayers.Circle || {};
5//圆形调用
6L.extend(elane.overLayers.Circle, {
7    hash: {},
8   
9    //设置绘制圆形属性
10    options: {
11        shape: 'Circle',//指定绘制类型 
12        templineStyle: {
13            color: 'red',
14            dashArray: [5, 5],
15            weight: 1
16        },
17        hintlineStyle: {
18            color: 'red',
19            dashArray: [5, 5],
20            weight: 1
21        },
22        pathOptions: {
23            color: 'red',
24            fillColor: 'red',
25            fillOpacity: .2,
26            dashArray: [5, 5],
27            weight: 1
28        },
29        radius: 0
30    },
31    //圆半径存储
32    circleR: 0,
33    //保存
34    save: function (id) {
35        var o = elane.overLayers, e = this;
36        var circle = e.getPointRule();
37        if (e.check(circle)) {
38            var data = L.extend({}, {
39                GroupID: $("#_area_group_option_upd").val(),
40                AreaType: 0,
41                AreaShape: 2,
42                Points: circle.points.join(),
43                Radius: (circle.radius).toFixed(2),
44                ZoomLevel: JSON.stringify([1, 18]),
45                AreaStyle: JSON.stringify(e.options.pathOptions),
46            })
47            if (o._check(data)) {
48                if (id) {
49                    //修改
50                    return o._update(L.extend(data,
51                                           {
52                                               AreaID: id
53                                           }))
54                } else {
55                    //添加
56                    return o._add(L.extend(data,
57                                           {
58                                               AreaID: o.mathuuID
59                                           }))
60                }
61            }
62        }
63        return $.when();
64    },
65    //数据取点规则
66    // 1、优先取录入文本框
67    // 2、再次取绘制
68    // 3、否则返回空
69    getPointRule: function () {
70        var o = elane.overLayers, e = this;
71        //为了最大可能还原文本框优先取文本框
72        var res = DataEntryControl.getData();
73        var points = [], radius = 0;
74        if (res && res.data) {
75            $.each(res.data.split(','), function (i, item) {
76                points.push(Number(item).toFixed(6))
77            })
78            radius = Number($.trim($(".shape-circle-radio-txt").val()));
79        } else {
80            var ly = o.getLayer();
81            if (ly) {
82                var latLngs = ly.getLatLng()
83                e.hash["circle"] = ly;;
84                //数据统一存储-84坐标
85                var nItem = o._showLatLntToGPS(latLngs)
86                nItem = nItem.wrap();
87                points.push(nItem.lng.toFixed(6), nItem.lat.toFixed(6));
88                radius = ly.getRadius();
89            }
90        }
91        return {
92            points: points,
93            radius: radius
94        };
95    },
96    //图层数据入库校验
97    check: function (circle) {
98        var o = elane.overLayers, e = this, res = true;
99        var ly = o.getLayer(), latLngs = [];
100        for (var i = 0; i < circle.points.length / 2; i++) {
101            latLngs.push(L.latLng(circle.points[2 * i + 1], circle.points[2 * i]));
102        }
103        if (circle.points.length) {
104            //
105            if (latLngs.length == 0) {
106                layer.error($.common.lang.wrongrules);
107                res = false;
108            }
109            //半径
110            if ((circle.radius / (1.852 * 1000)) > 500) {
111                layer.error($.common.lang.areatoobig);
112                res = false;
113            }
114            //半径
115            if ((circle.radius / (1.852 * 1000)) == 0) {
116                layer.error($.common.lang.Please_enter_the_radius);
117                res = false;
118            }
119        } else {
120            var ret = DataEntryControl.getData();
121            ret.msg && layer.error(ret.msg);
122            !ret.msg && layer.error($.common.lang.Please_draw_an_area_on_the_map);
123            res = false;
124        }
125        return res;
126    },
127    //录入区域
128    inputArea: function (id) {
129        var o = elane.overLayers, e = this
130            , ly = o.getLayer(), data = [], radis = '';
131        if (ly) {
132            var latLng = ly.getLatLng();
133            if (latLng instanceof L.LatLng) {
134                //坐标显示处理
135                var ll = elane.overLayers._showLatLntToGPS(latLng);
136                ll = ll.wrap();
137                ll.lng && data.push(ll.lng);
138                ll.lat && data.push(ll.lat);
139                latLng.equals(L.latLng(0, 0)) && ly.setRadius(0);
140                // 走锚提醒专用
141                $("#_mao_lat_d").val(ll.lat);
142                $("#_mao_lon_d").val(ll.lat);
143            }
144            radis = (ly.getRadius() / (1.852 * 1000)).toFixed(2);
145        }
146        if (o.callbackWin) {
147            DataEntryControl.start({
148                id: G(id),
149                type: 1,
150                data: data.length?data:null
151            });
152        }
153        $(".shape-circle-radio-div").show()
154        $(".shape-circle-radio-txt").val(radis)
155        $("#distance").val(radis)
156        console.log(radis)
157        elane.overLayers.Circle.circleR = radis;
158    }
159})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.