Skip to content

Commit 98f63e4

Browse files
committed
[fix]ICL-1294 ol岛洞问题 review by songym
1 parent bfcffab commit 98f63e4

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/common/iServer/ServerGeometry.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ export class ServerGeometry {
291291
CCWIdent.push(1);
292292
areaArray.push(polygon.getArea());
293293
}
294-
//根据面积排序
295-
ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
296294
//iServer 9D新增字段
297295
if (geoTopo.length === 0) {
296+
//根据面积排序
297+
ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
298298
//岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
299299
// 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
300300
// 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
@@ -324,27 +324,23 @@ export class ServerGeometry {
324324
}
325325
}
326326
} else {
327-
//根据面积排序
328-
//ServerGeometry.bubbleSort(areaArray, polygonArrayTemp,geoTopo);
329327
polygonArray = new Array();
330328
for (let i = 0; i < polygonArrayTemp.length; i++) {
331329
if (geoTopo[i] && geoTopo[i] == -1) {
332330
CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
333331
} else {
334332
if (CCWArray.length > 0 && polygonArray.length > 0) {
335-
polygonArray[polygonArray.length - 1].components = polygonArray[
336-
polygonArray.length - 1
337-
].components.concat(CCWArray);
333+
polygonArray[polygonArray.length - 1].components =
334+
polygonArray[polygonArray.length - 1].components.concat(CCWArray);
338335
CCWArray = [];
339336
}
340337
polygonArray.push(polygonArrayTemp[i]);
341338
}
342339
if (i == len - 1) {
343340
var polyLength = polygonArray.length;
344341
if (polyLength) {
345-
polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
346-
CCWArray
347-
);
342+
polygonArray[polyLength - 1].components =
343+
polygonArray[polyLength - 1].components.concat(CCWArray);
348344
} else {
349345
for (let k = 0, length = CCWArray.length; k < length; k++) {
350346
polygonArray.push(new Polygon(CCWArray));
@@ -406,10 +402,10 @@ export class ServerGeometry {
406402
CCWIdent.push(1);
407403
areaArray.push(polygon.getArea());
408404
}
409-
//根据面积排序
410-
ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
411405
//iServer 9D新增字段
412406
if (geoTopo.length === 0) {
407+
//根据面积排序
408+
ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
413409
//岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
414410
// 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
415411
// 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
@@ -439,26 +435,23 @@ export class ServerGeometry {
439435
}
440436
}
441437
} else {
442-
//根据面积排序
443438
polygonArray = new Array();
444439
for (let i = 0; i < polygonArrayTemp.length; i++) {
445440
if (geoTopo[i] && geoTopo[i] == -1) {
446441
CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
447442
} else {
448443
if (CCWArray.length > 0 && polygonArray.length > 0) {
449-
polygonArray[polygonArray.length - 1].components = polygonArray[
450-
polygonArray.length - 1
451-
].components.concat(CCWArray);
444+
polygonArray[polygonArray.length - 1].components =
445+
polygonArray[polygonArray.length - 1].components.concat(CCWArray);
452446
CCWArray = [];
453447
}
454448
polygonArray.push(polygonArrayTemp[i]);
455449
}
456450
if (i == len - 1) {
457451
var polyLength = polygonArray.length;
458452
if (polyLength) {
459-
polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
460-
CCWArray
461-
);
453+
polygonArray[polyLength - 1].components =
454+
polygonArray[polyLength - 1].components.concat(CCWArray);
462455
} else {
463456
for (let k = 0, length = CCWArray.length; k < length; k++) {
464457
polygonArray.push(new Polygon(CCWArray));

0 commit comments

Comments
 (0)