Skip to content

Commit 2f0f24a

Browse files
committed
FIX ICL-1030 ThemeFeature对L.polygon L.polylone的处理
FIX ICL-1029 将leaflet toGeoJSON的进度设置为10
1 parent a4a8069 commit 2f0f24a

File tree

7 files changed

+147
-79
lines changed

7 files changed

+147
-79
lines changed

dist/leaflet/iclient9-leaflet-es6.js

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38348,7 +38348,7 @@ class TokenServiceParameter_TokenServiceParameter {
3834838348

3834938349
/**
3835038350
* @member {string} SuperMap.TokenServiceParameter.prototype.ip
38351-
* @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则传递相应的 URL
38351+
* @description clientType=IP 时,必选。
3835238352
*/
3835338353

3835438354
this.ip = null;
@@ -63449,7 +63449,26 @@ let Attributions = {
6344963449
external_L_default.a.supermap = external_L_default.a.supermap || {};
6345063450
external_L_default.a.supermap.control = external_L_default.a.supermap.control || {};
6345163451

63452-
external_L_default.a.Control.Attribution.include({options: {position: 'bottomright',prefix: core_Attributions.Prefix}});
63452+
external_L_default.a.Control.Attribution.include({
63453+
options: {
63454+
position: 'bottomright',
63455+
prefix: core_Attributions.Prefix
63456+
}
63457+
});
63458+
63459+
wrapToGeoJSON([external_L_default.a.Polyline, external_L_default.a.Polygon, external_L_default.a.Marker, external_L_default.a.CircleMarker, external_L_default.a.Circle, external_L_default.a.LayerGroup]);
63460+
63461+
function wrapToGeoJSON(objClassArray) {
63462+
for (const objClass of objClassArray) {
63463+
objClass.defaultFunction = objClass.prototype.toGeoJSON;
63464+
objClass.include({
63465+
toGeoJSON: function (precision) {
63466+
return objClass.defaultFunction.call(this, precision || 10);
63467+
}
63468+
})
63469+
}
63470+
63471+
}
6345363472
// CONCATENATED MODULE: ./src/leaflet/services/ServiceBase.js
6345463473

6345563474

@@ -66318,31 +66337,25 @@ var ThemeFeature = external_L_default.a.Class.extend({
6631866337
* @return {SuperMap.Feature.Vector} 内部矢量要素。
6631966338
*/
6632066339
toFeature: function () {
66321-
var geometry = this.geometry;
66322-
var points = [];
66323-
if (geometry instanceof external_L_default.a.Polygon) {
66324-
points = this.reverseLatLngs(geometry.getLatLngs());
66325-
geometry = new Polygon_Polygon(points);
66326-
} else if (geometry instanceof external_L_default.a.Polyline) {
66327-
points = this.reverseLatLngs(geometry.getLatLngs());
66328-
geometry = new LineString_LineString(points);
66329-
} else if (geometry.length === 3) {
66340+
let geometry = this.geometry;
66341+
const points = [];
66342+
let geojsonObject
66343+
if (geometry.toGeoJSON) {
66344+
geojsonObject = geometry.toGeoJSON();
66345+
geojsonObject.properties = this.attributes;
66346+
return new GeoJSON_GeoJSON().read(geojsonObject)[0];
66347+
}
66348+
if (geometry.length === 3) {
6633066349
geometry = new GeoText_GeoText(geometry[1], geometry[0], geometry[2]);
66331-
} else {
66332-
if (geometry instanceof external_L_default.a.LatLng) {
66333-
points = [geometry.lng, geometry.lat];
66334-
} else if (geometry instanceof external_L_default.a.Point) {
66335-
points = [geometry.x, geometry.y];
66336-
} else if (geometry instanceof external_L_default.a.CircleMarker) {
66337-
var latLng = geometry.getLatLng();
66338-
points = [latLng.lng, latLng.lat];
66339-
} else {
66340-
points = geometry;
66341-
}
66342-
if (points.length === 2) {
66343-
geometry = new Point_Point(points[0], points[1]);
66344-
}
66345-
66350+
} else if (geometry.length === 2) {
66351+
geometry = new Point_Point(points[0], points[1]);
66352+
} else if (geometry instanceof external_L_default.a.LatLng) {
66353+
geometry = new Point_Point(geometry.lng, geometry.lat);
66354+
} else if (geometry instanceof external_L_default.a.Point) {
66355+
geometry = new Point_Point(geometry.x, geometry.y);
66356+
} else if (geometry instanceof external_L_default.a.CircleMarker) {
66357+
var latLng = geometry.getLatLng();
66358+
geometry = new Point_Point(latLng.lng, latLng.lat);
6634666359
}
6634766360
return new Vector_Vector(geometry, this.attributes);
6634866361
},

dist/leaflet/iclient9-leaflet-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/leaflet/iclient9-leaflet.js

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,7 +2428,50 @@ _leaflet2["default"].supermap = _leaflet2["default"].supermap || {}; /**
24282428

24292429
_leaflet2["default"].supermap.control = _leaflet2["default"].supermap.control || {};
24302430

2431-
_leaflet2["default"].Control.Attribution.include({ options: { position: 'bottomright', prefix: _Attributions2["default"].Prefix } });
2431+
_leaflet2["default"].Control.Attribution.include({
2432+
options: {
2433+
position: 'bottomright',
2434+
prefix: _Attributions2["default"].Prefix
2435+
}
2436+
});
2437+
2438+
wrapToGeoJSON([_leaflet2["default"].Polyline, _leaflet2["default"].Polygon, _leaflet2["default"].Marker, _leaflet2["default"].CircleMarker, _leaflet2["default"].Circle, _leaflet2["default"].LayerGroup]);
2439+
2440+
function wrapToGeoJSON(objClassArray) {
2441+
var _iteratorNormalCompletion = true;
2442+
var _didIteratorError = false;
2443+
var _iteratorError = undefined;
2444+
2445+
try {
2446+
var _loop = function _loop() {
2447+
var objClass = _step.value;
2448+
2449+
objClass.defaultFunction = objClass.prototype.toGeoJSON;
2450+
objClass.include({
2451+
toGeoJSON: function toGeoJSON(precision) {
2452+
return objClass.defaultFunction.call(this, precision || 10);
2453+
}
2454+
});
2455+
};
2456+
2457+
for (var _iterator = objClassArray[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2458+
_loop();
2459+
}
2460+
} catch (err) {
2461+
_didIteratorError = true;
2462+
_iteratorError = err;
2463+
} finally {
2464+
try {
2465+
if (!_iteratorNormalCompletion && _iterator["return"]) {
2466+
_iterator["return"]();
2467+
}
2468+
} finally {
2469+
if (_didIteratorError) {
2470+
throw _iteratorError;
2471+
}
2472+
}
2473+
}
2474+
}
24322475

24332476
/***/ }),
24342477
/* 5 */
@@ -21320,28 +21363,23 @@ var ThemeFeature = exports.ThemeFeature = _leaflet2["default"].Class.extend({
2132021363
toFeature: function toFeature() {
2132121364
var geometry = this.geometry;
2132221365
var points = [];
21323-
if (geometry instanceof _leaflet2["default"].Polygon) {
21324-
points = this.reverseLatLngs(geometry.getLatLngs());
21325-
geometry = new _iclientCommon.Polygon(points);
21326-
} else if (geometry instanceof _leaflet2["default"].Polyline) {
21327-
points = this.reverseLatLngs(geometry.getLatLngs());
21328-
geometry = new _iclientCommon.LineString(points);
21329-
} else if (geometry.length === 3) {
21366+
var geojsonObject = void 0;
21367+
if (geometry.toGeoJSON) {
21368+
geojsonObject = geometry.toGeoJSON();
21369+
geojsonObject.properties = this.attributes;
21370+
return new _iclientCommon.GeoJSON().read(geojsonObject)[0];
21371+
}
21372+
if (geometry.length === 3) {
2133021373
geometry = new _iclientCommon.GeoText(geometry[1], geometry[0], geometry[2]);
21331-
} else {
21332-
if (geometry instanceof _leaflet2["default"].LatLng) {
21333-
points = [geometry.lng, geometry.lat];
21334-
} else if (geometry instanceof _leaflet2["default"].Point) {
21335-
points = [geometry.x, geometry.y];
21336-
} else if (geometry instanceof _leaflet2["default"].CircleMarker) {
21337-
var latLng = geometry.getLatLng();
21338-
points = [latLng.lng, latLng.lat];
21339-
} else {
21340-
points = geometry;
21341-
}
21342-
if (points.length === 2) {
21343-
geometry = new _iclientCommon.GeometryPoint(points[0], points[1]);
21344-
}
21374+
} else if (geometry.length === 2) {
21375+
geometry = new _iclientCommon.GeometryPoint(points[0], points[1]);
21376+
} else if (geometry instanceof _leaflet2["default"].LatLng) {
21377+
geometry = new _iclientCommon.GeometryPoint(geometry.lng, geometry.lat);
21378+
} else if (geometry instanceof _leaflet2["default"].Point) {
21379+
geometry = new _iclientCommon.GeometryPoint(geometry.x, geometry.y);
21380+
} else if (geometry instanceof _leaflet2["default"].CircleMarker) {
21381+
var latLng = geometry.getLatLng();
21382+
geometry = new _iclientCommon.GeometryPoint(latLng.lng, latLng.lat);
2134521383
}
2134621384
return new _iclientCommon.GeometryVector(geometry, this.attributes);
2134721385
},
@@ -84583,7 +84621,7 @@ var TokenServiceParameter = exports.TokenServiceParameter = function () {
8458384621

8458484622
/**
8458584623
* @member {string} SuperMap.TokenServiceParameter.prototype.ip
84586-
* @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则传递相应的 URL
84624+
* @description clientType=IP 时,必选。
8458784625
*/
8458884626

8458984627
this.ip = null;

dist/leaflet/iclient9-leaflet.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/js/widgets.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ var widgets = {
4747
$(alertDiv).remove();
4848
}
4949
if (!$('#msg_container')[0]) {
50-
alertDiv = $(`<div class='alert alert-dismissible' id='msg_container' role='alert'
51-
style='z-index:999999;position: absolute;top: 20px;left: 40%; display: none;text-align: center'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button><strong><p id='msg' style='word-wrap: break-word'></p></strong></div>`);
50+
alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' style='z-index:999999;position: absolute;top: 20px;left: 40%; display: none;text-align: center'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true' >&times;</span></button><strong><p id='msg' style='word-wrap: break-word'></p></strong></div>");
5251
$('body').append(alertDiv)
5352
}
5453
$('#msg_container').css('width', width + 'px');

src/leaflet/core/Base.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,23 @@ import Attributions from './Attributions'
1212
L.supermap = L.supermap || {};
1313
L.supermap.control = L.supermap.control || {};
1414

15-
L.Control.Attribution.include({options: {position: 'bottomright',prefix: Attributions.Prefix}});
15+
L.Control.Attribution.include({
16+
options: {
17+
position: 'bottomright',
18+
prefix: Attributions.Prefix
19+
}
20+
});
21+
22+
wrapToGeoJSON([L.Polyline, L.Polygon, L.Marker, L.CircleMarker, L.Circle, L.LayerGroup]);
23+
24+
function wrapToGeoJSON(objClassArray) {
25+
for (const objClass of objClassArray) {
26+
objClass.defaultFunction = objClass.prototype.toGeoJSON;
27+
objClass.include({
28+
toGeoJSON: function (precision) {
29+
return objClass.defaultFunction.call(this, precision || 10);
30+
}
31+
})
32+
}
33+
34+
}

src/leaflet/overlay/theme/ThemeFeature.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import L from "leaflet";
22
import "../../core/Base";
3-
import {LineString, Polygon, GeoText, GeometryPoint, GeometryVector as Vector} from '@supermap/iclient-common';
3+
import {
4+
GeoJSON,
5+
GeoText,
6+
GeometryPoint,
7+
GeometryVector as Vector
8+
} from '@supermap/iclient-common';
49

510
/**
611
* @class L.supermap.themeFeature
@@ -24,31 +29,25 @@ export var ThemeFeature = L.Class.extend({
2429
* @return {SuperMap.Feature.Vector} 内部矢量要素。
2530
*/
2631
toFeature: function () {
27-
var geometry = this.geometry;
28-
var points = [];
29-
if (geometry instanceof L.Polygon) {
30-
points = this.reverseLatLngs(geometry.getLatLngs());
31-
geometry = new Polygon(points);
32-
} else if (geometry instanceof L.Polyline) {
33-
points = this.reverseLatLngs(geometry.getLatLngs());
34-
geometry = new LineString(points);
35-
} else if (geometry.length === 3) {
32+
let geometry = this.geometry;
33+
const points = [];
34+
let geojsonObject
35+
if (geometry.toGeoJSON) {
36+
geojsonObject = geometry.toGeoJSON();
37+
geojsonObject.properties = this.attributes;
38+
return new GeoJSON().read(geojsonObject)[0];
39+
}
40+
if (geometry.length === 3) {
3641
geometry = new GeoText(geometry[1], geometry[0], geometry[2]);
37-
} else {
38-
if (geometry instanceof L.LatLng) {
39-
points = [geometry.lng, geometry.lat];
40-
} else if (geometry instanceof L.Point) {
41-
points = [geometry.x, geometry.y];
42-
} else if (geometry instanceof L.CircleMarker) {
43-
var latLng = geometry.getLatLng();
44-
points = [latLng.lng, latLng.lat];
45-
} else {
46-
points = geometry;
47-
}
48-
if (points.length === 2) {
49-
geometry = new GeometryPoint(points[0], points[1]);
50-
}
51-
42+
} else if (geometry.length === 2) {
43+
geometry = new GeometryPoint(points[0], points[1]);
44+
} else if (geometry instanceof L.LatLng) {
45+
geometry = new GeometryPoint(geometry.lng, geometry.lat);
46+
} else if (geometry instanceof L.Point) {
47+
geometry = new GeometryPoint(geometry.x, geometry.y);
48+
} else if (geometry instanceof L.CircleMarker) {
49+
var latLng = geometry.getLatLng();
50+
geometry = new GeometryPoint(latLng.lng, latLng.lat);
5251
}
5352
return new Vector(geometry, this.attributes);
5453
},

0 commit comments

Comments
 (0)