Skip to content

Commit 7eb68e0

Browse files
committed
fix ol3标签专题图若干问题
1 parent 6af10b5 commit 7eb68e0

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

dist/iclient9-openlayers.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20796,7 +20796,6 @@ var Label = function (_GeoFeature) {
2079620796

2079720797
//标签最终的中心点像素位置 (偏移后)
2079820798
var loc = this.getLabelPxLocation(fi);
20799-
loc = { x: loc.getCoordinates()[0], y: loc.getCoordinates()[1] };
2080020799

2080120800
//过滤掉地图范围外的标签 (偏移后)
2080220801
if (loc.x >= 0 && loc.x <= mapSize.x && loc.y >= 0 && loc.y <= mapSize.y) {
@@ -21057,7 +21056,7 @@ var Label = function (_GeoFeature) {
2105721056
* @function ol.source.Label.prototype.getLabelPxLocation
2105821057
* @description 获取标签要素的像素坐标
2105921058
* @param feature -{SuperMap.Feature.Vector} 标签要素。
21060-
* @return {ol.geom.Point} 标签位置
21059+
* @return {Object} 标签位置,例如:{"x":1,"y":1}
2106121060
*/
2106221061

2106321062
}, {
@@ -21076,18 +21075,16 @@ var Label = function (_GeoFeature) {
2107621075
var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
2107721076
var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
2107821077
loc.translate(xOffset, -yOffset);
21079-
return new _olDebug2.default.geom.Point(loc.getCoordinates());
21080-
} else {
21081-
return new _olDebug2.default.geom.Point(loc.getCoordinates());
2108221078
}
21079+
return { x: loc.getCoordinates()[0], y: loc.getCoordinates()[1] };
2108321080
}
2108421081

2108521082
/**
2108621083
* @function ol.source.Label.prototype.calculateLabelBounds
2108721084
* @description 获得标签要素的最终范围
2108821085
*
2108921086
* @param feature - {SuperMap.Feature.Vector} 需要计算bounds的标签要素数。
21090-
* @param loc - {ol.geom.Point} 标签位置
21087+
* @param loc - {Object} 标签位置,例如:{"x":1,"y":1}
2109121088
*
2109221089
* @return {Array<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
2109321090
*/

dist/iclient9-openlayers.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.

src/openlayers/overlay/Label.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ export default class Label extends GeoFeature {
153153

154154
//标签最终的中心点像素位置 (偏移后)
155155
var loc = this.getLabelPxLocation(fi);
156-
loc = {x: loc.getCoordinates()[0], y: loc.getCoordinates()[1]};
157156

158157
//过滤掉地图范围外的标签 (偏移后)
159158
if ((loc.x >= 0 && loc.x <= mapSize.x ) && (loc.y >= 0 && loc.y <= mapSize.y)) {
@@ -404,7 +403,7 @@ export default class Label extends GeoFeature {
404403
* @function ol.source.Label.prototype.getLabelPxLocation
405404
* @description 获取标签要素的像素坐标
406405
* @param feature -{SuperMap.Feature.Vector} 标签要素。
407-
* @return {ol.geom.Point} 标签位置
406+
* @return {Object} 标签位置,例如:{"x":1,"y":1}
408407
*/
409408
getLabelPxLocation(feature) {
410409
var geoText = feature.geometry;
@@ -420,10 +419,8 @@ export default class Label extends GeoFeature {
420419
var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
421420
var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
422421
loc.translate(xOffset, -yOffset);
423-
return new ol.geom.Point(loc.getCoordinates());
424-
} else {
425-
return new ol.geom.Point(loc.getCoordinates());
426422
}
423+
return {x: loc.getCoordinates()[0], y: loc.getCoordinates()[1]};
427424
}
428425

429426

@@ -432,7 +429,7 @@ export default class Label extends GeoFeature {
432429
* @description 获得标签要素的最终范围
433430
*
434431
* @param feature - {SuperMap.Feature.Vector} 需要计算bounds的标签要素数。
435-
* @param loc - {ol.geom.Point} 标签位置
432+
* @param loc - {Object} 标签位置,例如:{"x":1,"y":1}
436433
*
437434
* @return {Array<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
438435
*/

0 commit comments

Comments
 (0)