|
@@ -1,15 +1,15 @@
|
|
|
-// import { mathUtil } from "./MathUtil.js";
|
|
|
+import { mathUtil } from "./Util/MathUtil";
|
|
|
import { dataService } from "./Service/DataService.js";
|
|
|
import { stateService } from "./Service/StateService.js";
|
|
|
-// import { wallService } from "./Service/WallService.js";
|
|
|
+import { roadService } from "./Service/RoadService.js";
|
|
|
import Constant from "./Constant.js";
|
|
|
import VectorType from "./enum/VectorType.js";
|
|
|
import SelectState from "./enum/SelectState.js";
|
|
|
|
|
|
export default class ListenLayer {
|
|
|
constructor() {
|
|
|
- this.wallInfo = {
|
|
|
- wallId: null,
|
|
|
+ this.roadInfo = {
|
|
|
+ roadId: null,
|
|
|
state: null, // 未选中null
|
|
|
};
|
|
|
|
|
@@ -18,56 +18,28 @@ export default class ListenLayer {
|
|
|
state: null,
|
|
|
};
|
|
|
|
|
|
- this.symbolInfo = {
|
|
|
- symbolId: null,
|
|
|
- state: null, // start,end,all表示哪个部位。与前面的wallInfo和pointInfo不同,上面两个变量一直都有值,因为他们的意义是找到最近的,而symbolInfo是判断是否选中
|
|
|
- };
|
|
|
-
|
|
|
- this.componentInfo = {
|
|
|
- componentId: null,
|
|
|
- state: null,
|
|
|
- };
|
|
|
-
|
|
|
this.tagInfo = {
|
|
|
tagId: null,
|
|
|
state: null,
|
|
|
};
|
|
|
|
|
|
- this.furnitureInfo = {
|
|
|
- furnitureId: null,
|
|
|
- state: null,
|
|
|
- };
|
|
|
-
|
|
|
this.modifyPoint = null;
|
|
|
}
|
|
|
|
|
|
- //开始监听,exceptPointId表示不考虑的点,exceptWallIds表示不考虑的墙
|
|
|
- start(position, exceptPointId, exceptWallIds) {
|
|
|
+ //开始监听,exceptPointId表示不考虑的点,exceptRoadIds表示不考虑的墙
|
|
|
+ start(position, exceptPointId, exceptRoadIds) {
|
|
|
let nearest = this.getNearForVectors(
|
|
|
position,
|
|
|
exceptPointId,
|
|
|
- exceptWallIds
|
|
|
+ exceptRoadIds
|
|
|
);
|
|
|
- /*
|
|
|
- // getNearForWalls在一定的条件下必须执行两次!
|
|
|
- // 如果吸附在墙面上,或者吸附在其余墙的顶点(x/y坐标),这时候因为抖动,可能会变成完全吸附在墙角,这时候是要再执行一次getNearForWalls
|
|
|
- if (
|
|
|
- nearest.modifyPoint &&
|
|
|
- (nearest.modifyPoint.hasOwnProperty("linkedPointIdX") ||
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedPointIdY") ||
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedWallId"))
|
|
|
- ) {
|
|
|
- mathUtil.clonePoint(position, nearest.modifyPoint);
|
|
|
- nearest = this.getNearForVectors(position, exceptPointId, exceptWallIds);
|
|
|
- }
|
|
|
- */
|
|
|
|
|
|
if (
|
|
|
nearest.modifyPoint &&
|
|
|
(nearest.modifyPoint.hasOwnProperty("linkedPointId") ||
|
|
|
nearest.modifyPoint.hasOwnProperty("linkedPointIdX") ||
|
|
|
nearest.modifyPoint.hasOwnProperty("linkedPointIdY") ||
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedWallId"))
|
|
|
+ nearest.modifyPoint.hasOwnProperty("linkedRoadId"))
|
|
|
) {
|
|
|
this.modifyPoint = {
|
|
|
x: nearest.modifyPoint.x,
|
|
@@ -79,10 +51,10 @@ export default class ListenLayer {
|
|
|
) {
|
|
|
this.modifyPoint.linkedPointId = nearest.modifyPoint.linkedPointId;
|
|
|
} else if (
|
|
|
- nearest.modifyPoint.hasOwnProperty("linkedWallId") &&
|
|
|
- nearest.modifyPoint.linkedWallId != null
|
|
|
+ nearest.modifyPoint.hasOwnProperty("linkedRoadId") &&
|
|
|
+ nearest.modifyPoint.linkedRoadId != null
|
|
|
) {
|
|
|
- this.modifyPoint.linkedWallId = nearest.modifyPoint.linkedWallId;
|
|
|
+ this.modifyPoint.linkedRoadId = nearest.modifyPoint.linkedRoadId;
|
|
|
} else {
|
|
|
if (
|
|
|
nearest.modifyPoint.hasOwnProperty("linkedPointIdX") &&
|
|
@@ -109,7 +81,7 @@ export default class ListenLayer {
|
|
|
// 获得最近的墙面和墙角
|
|
|
// 同时获得吸附的相关信息
|
|
|
// 找到选中的symbol(只有选中了,才算是最近的)
|
|
|
- getNearForVectors(position, exceptPointId, exceptWallIds) {
|
|
|
+ getNearForVectors(position, exceptPointId, exceptRoadIds) {
|
|
|
let min1 = null; // 与墙角的距离
|
|
|
let min2 = null; // 与墙面的距离
|
|
|
// 纠正
|
|
@@ -122,44 +94,45 @@ export default class ListenLayer {
|
|
|
hasPointIds.push(exceptPointId);
|
|
|
}
|
|
|
|
|
|
- const walls = dataService.getWalls();
|
|
|
- for (const wallId in walls) {
|
|
|
- if (exceptWallIds && exceptWallIds.hasOwnProperty(wallId)) {
|
|
|
+ const roads = dataService.getRoads();
|
|
|
+ for (const roadId in roads) {
|
|
|
+ if (exceptRoadIds && exceptRoadIds.hasOwnProperty(roadId)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- const wall = dataService.getWall(wallId);
|
|
|
+ const road = dataService.getRoad(roadId);
|
|
|
|
|
|
- const startPoint = dataService.getPoint(wall.start);
|
|
|
- const endPoint = dataService.getPoint(wall.end);
|
|
|
+ const startPoint = dataService.getPoint(road.startId);
|
|
|
+ const endPoint = dataService.getPoint(road.endId);
|
|
|
let distance = null;
|
|
|
- const line = wallService.getLine(wall);
|
|
|
+ const line = roadService.getMidLine(road);
|
|
|
if (!line) {
|
|
|
//debugger
|
|
|
//删除墙
|
|
|
- dataService.deleteWall(wallId);
|
|
|
+ dataService.deleteRoad(roadId);
|
|
|
continue;
|
|
|
console.error("getNearForVectors************************************");
|
|
|
}
|
|
|
const join = mathUtil.getJoinLinePoint(position, line);
|
|
|
|
|
|
- if (hasPointIds.indexOf(wall.start) == -1) {
|
|
|
- hasPointIds.push(wall.start);
|
|
|
+ //先找端点
|
|
|
+ if (hasPointIds.indexOf(road.startId) == -1) {
|
|
|
+ hasPointIds.push(road.startId);
|
|
|
distance = mathUtil.getDistance(position, startPoint);
|
|
|
|
|
|
if (min1 == null || min1.distance > distance) {
|
|
|
min1 = {
|
|
|
distance: distance,
|
|
|
- pointId: wall.start,
|
|
|
+ pointId: road.startId,
|
|
|
};
|
|
|
|
|
|
//start部分找到了墙的端点
|
|
|
if (
|
|
|
- (mathUtil.getDistance(join, position) < Constant.minAdsorbPix &&
|
|
|
- mathUtil.getDistance(join, startPoint) < Constant.minAdsorbPix) ||
|
|
|
- min1.distance < Constant.minAdsorbPix
|
|
|
+ (mathUtil.getDistance(join, position) < road.width / 2 &&
|
|
|
+ mathUtil.getDistance(join, startPoint) < road.width / 2) ||
|
|
|
+ min1.distance < road.width / 2
|
|
|
) {
|
|
|
- modifyPoint.linkedPointId = wall.start;
|
|
|
+ modifyPoint.linkedPointId = road.startId;
|
|
|
modifyPoint.x = startPoint.x;
|
|
|
modifyPoint.y = startPoint.y;
|
|
|
|
|
@@ -168,60 +141,60 @@ export default class ListenLayer {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- //start部分找到了与x接近的其他点
|
|
|
- if (Math.abs(position.x - startPoint.x) < Constant.minAdsorbPix) {
|
|
|
- if (!modifyPoint.linkedPointIdX) {
|
|
|
- modifyPoint.x = startPoint.x;
|
|
|
- modifyPoint.linkedPointIdX = wall.start;
|
|
|
- } else {
|
|
|
- const linkedPointX = dataService.getPoint(
|
|
|
- modifyPoint.linkedPointIdX
|
|
|
- );
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, linkedPointX) >
|
|
|
- mathUtil.getDistance(position, startPoint)
|
|
|
- ) {
|
|
|
- modifyPoint.x = startPoint.x;
|
|
|
- modifyPoint.linkedPointIdX = wall.start;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //start部分找到了与y接近的其他点
|
|
|
- if (Math.abs(position.y - startPoint.y) < Constant.minAdsorbPix) {
|
|
|
- if (!modifyPoint.linkedPointIdY) {
|
|
|
- modifyPoint.y = startPoint.y;
|
|
|
- modifyPoint.linkedPointIdY = wall.start;
|
|
|
- } else {
|
|
|
- const linkedPointY = dataService.getPoint(
|
|
|
- modifyPoint.linkedPointIdY
|
|
|
- );
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, linkedPointY) >
|
|
|
- mathUtil.getDistance(position, startPoint)
|
|
|
- ) {
|
|
|
- modifyPoint.y = startPoint.y;
|
|
|
- modifyPoint.linkedPointIdY = wall.start;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // //start部分找到了与x接近的其他点
|
|
|
+ // if (Math.abs(position.x - startPoint.x) < Constant.minAdsorbPix) {
|
|
|
+ // if (!modifyPoint.linkedPointIdX) {
|
|
|
+ // modifyPoint.x = startPoint.x;
|
|
|
+ // modifyPoint.linkedPointIdX = road.startId;
|
|
|
+ // } else {
|
|
|
+ // const linkedPointX = dataService.getPoint(
|
|
|
+ // modifyPoint.linkedPointIdX
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(position, linkedPointX) >
|
|
|
+ // mathUtil.getDistance(position, startPoint)
|
|
|
+ // ) {
|
|
|
+ // modifyPoint.x = startPoint.x;
|
|
|
+ // modifyPoint.linkedPointIdX = road.startId;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //start部分找到了与y接近的其他点
|
|
|
+ // if (Math.abs(position.y - startPoint.y) < Constant.minAdsorbPix) {
|
|
|
+ // if (!modifyPoint.linkedPointIdY) {
|
|
|
+ // modifyPoint.y = startPoint.y;
|
|
|
+ // modifyPoint.linkedPointIdY = road.startId;
|
|
|
+ // } else {
|
|
|
+ // const linkedPointY = dataService.getPoint(
|
|
|
+ // modifyPoint.linkedPointIdY
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(position, linkedPointY) >
|
|
|
+ // mathUtil.getDistance(position, startPoint)
|
|
|
+ // ) {
|
|
|
+ // modifyPoint.y = startPoint.y;
|
|
|
+ // modifyPoint.linkedPointIdY = road.startId;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
- if (hasPointIds.indexOf(wall.end) == -1) {
|
|
|
- hasPointIds.push(wall.end);
|
|
|
+ if (hasPointIds.indexOf(road.endId) == -1) {
|
|
|
+ hasPointIds.push(road.endId);
|
|
|
distance = mathUtil.getDistance(position, endPoint);
|
|
|
|
|
|
if (min1 == null || min1.distance > distance) {
|
|
|
min1 = {
|
|
|
distance: distance,
|
|
|
- pointId: wall.end,
|
|
|
+ pointId: road.endId,
|
|
|
};
|
|
|
//end部分找到了墙的端点
|
|
|
if (
|
|
|
- (mathUtil.getDistance(join, position) < Constant.minAdsorbPix &&
|
|
|
- mathUtil.getDistance(join, endPoint) < Constant.minAdsorbPix) ||
|
|
|
- min1.distance < Constant.minAdsorbPix
|
|
|
+ (mathUtil.getDistance(join, position) < road.width / 2 &&
|
|
|
+ mathUtil.getDistance(join, endPoint) < road.width / 2) ||
|
|
|
+ min1.distance < road.width / 2
|
|
|
) {
|
|
|
- modifyPoint.linkedPointId = wall.end;
|
|
|
+ modifyPoint.linkedPointId = road.endId;
|
|
|
modifyPoint.x = endPoint.x;
|
|
|
modifyPoint.y = endPoint.y;
|
|
|
delete modifyPoint.linkedPointIdX;
|
|
@@ -229,70 +202,64 @@ export default class ListenLayer {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- //end部分找到了与x接近的其他点
|
|
|
- if (Math.abs(position.x - endPoint.x) < Constant.minAdsorbPix) {
|
|
|
- if (!modifyPoint.linkedPointIdX) {
|
|
|
- modifyPoint.x = endPoint.x;
|
|
|
- modifyPoint.linkedPointIdX = wall.end;
|
|
|
- } else {
|
|
|
- const linkedPointX = dataService.getPoint(
|
|
|
- modifyPoint.linkedPointIdX
|
|
|
- );
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, linkedPointX) >
|
|
|
- mathUtil.getDistance(position, endPoint)
|
|
|
- ) {
|
|
|
- modifyPoint.x = endPoint.x;
|
|
|
- modifyPoint.linkedPointIdX = wall.end;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //end部分找到了与y接近的其他点
|
|
|
- if (Math.abs(position.y - endPoint.y) < Constant.minAdsorbPix) {
|
|
|
- if (!modifyPoint.linkedPointIdY) {
|
|
|
- modifyPoint.y = endPoint.y;
|
|
|
- modifyPoint.linkedPointIdY = wall.end;
|
|
|
- } else {
|
|
|
- const linkedPointY = dataService.getPoint(
|
|
|
- modifyPoint.linkedPointIdY
|
|
|
- );
|
|
|
- if (
|
|
|
- mathUtil.getDistance(position, linkedPointY) >
|
|
|
- mathUtil.getDistance(position, endPoint)
|
|
|
- ) {
|
|
|
- modifyPoint.y = endPoint.y;
|
|
|
- modifyPoint.linkedPointIdY = wall.end;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // //end部分找到了与x接近的其他点
|
|
|
+ // if (Math.abs(position.x - endPoint.x) < Constant.minAdsorbPix) {
|
|
|
+ // if (!modifyPoint.linkedPointIdX) {
|
|
|
+ // modifyPoint.x = endPoint.x;
|
|
|
+ // modifyPoint.linkedPointIdX = road.endId;
|
|
|
+ // } else {
|
|
|
+ // const linkedPointX = dataService.getPoint(
|
|
|
+ // modifyPoint.linkedPointIdX
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(position, linkedPointX) >
|
|
|
+ // mathUtil.getDistance(position, endPoint)
|
|
|
+ // ) {
|
|
|
+ // modifyPoint.x = endPoint.x;
|
|
|
+ // modifyPoint.linkedPointIdX = road.endId;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //end部分找到了与y接近的其他点
|
|
|
+ // if (Math.abs(position.y - endPoint.y) < Constant.minAdsorbPix) {
|
|
|
+ // if (!modifyPoint.linkedPointIdY) {
|
|
|
+ // modifyPoint.y = endPoint.y;
|
|
|
+ // modifyPoint.linkedPointIdY = road.endId;
|
|
|
+ // } else {
|
|
|
+ // const linkedPointY = dataService.getPoint(
|
|
|
+ // modifyPoint.linkedPointIdY
|
|
|
+ // );
|
|
|
+ // if (
|
|
|
+ // mathUtil.getDistance(position, linkedPointY) >
|
|
|
+ // mathUtil.getDistance(position, endPoint)
|
|
|
+ // ) {
|
|
|
+ // modifyPoint.y = endPoint.y;
|
|
|
+ // modifyPoint.linkedPointIdY = road.endId;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
distance = mathUtil.getDistance(position, join);
|
|
|
//是否在墙上,可能在墙外
|
|
|
- const _flag = wallService.isContain(wall, join);
|
|
|
+ const _flag = roadService.isContain(road, join);
|
|
|
|
|
|
if (_flag && (min2 == null || min2.distance > distance)) {
|
|
|
min2 = {
|
|
|
distance: distance,
|
|
|
- wallId: wallId,
|
|
|
+ roadId: roadId,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- if (
|
|
|
- _flag &&
|
|
|
- mathUtil.getDistance(position, join) < Constant.minAdsorbPix
|
|
|
- ) {
|
|
|
+ if (_flag && mathUtil.getDistance(position, join) < road.width / 2) {
|
|
|
_modifyPoint = join;
|
|
|
- _modifyPoint.linkedWallId = wallId;
|
|
|
+ _modifyPoint.linkedRoadId = roadId;
|
|
|
}
|
|
|
}
|
|
|
const result = {
|
|
|
minPoint: min1,
|
|
|
- minWall: min2,
|
|
|
- symbolInfo: {},
|
|
|
- componentInfo: {},
|
|
|
+ minRoad: min2,
|
|
|
tagInfo: {},
|
|
|
- furnitureInfo: {},
|
|
|
};
|
|
|
|
|
|
if (_modifyPoint != null) {
|
|
@@ -312,59 +279,18 @@ export default class ListenLayer {
|
|
|
result.modifyPoint.y = modifyPoint.y;
|
|
|
}
|
|
|
|
|
|
- //是否在门/窗 上
|
|
|
- const symbols = dataService.getSymbols();
|
|
|
- for (const symbolId in symbols) {
|
|
|
- const symbol = dataService.getSymbol(symbolId);
|
|
|
- const location = symbol.isContain(position);
|
|
|
- if (location != null) {
|
|
|
- result.symbolInfo = {
|
|
|
- symbolId: symbolId,
|
|
|
- state: location,
|
|
|
- };
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const components = dataService.getComponents();
|
|
|
- for (const componentId in components) {
|
|
|
- const component = dataService.getComponent(componentId);
|
|
|
- const location = component.isContain(position);
|
|
|
- if (location) {
|
|
|
- result.componentInfo = {
|
|
|
- componentId: componentId,
|
|
|
- state: "all",
|
|
|
- };
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const tags = dataService.getTags();
|
|
|
- for (const tagId in tags) {
|
|
|
- const tag = dataService.getTag(tagId);
|
|
|
- const location = tag.isContain(position);
|
|
|
- if (location) {
|
|
|
- result.tagInfo = {
|
|
|
- tagId: tagId,
|
|
|
- state: "all",
|
|
|
- };
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const furnitures = dataService.getFurnitures();
|
|
|
- for (const furnitureId in furnitures) {
|
|
|
- const furniture = dataService.getFurniture(furnitureId);
|
|
|
- const location = furniture.isContain(position);
|
|
|
- if (location) {
|
|
|
- result.furnitureInfo = {
|
|
|
- furnitureId: furnitureId,
|
|
|
- state: "all",
|
|
|
- };
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ // const tags = dataService.getTags();
|
|
|
+ // for (const tagId in tags) {
|
|
|
+ // const tag = dataService.getTag(tagId);
|
|
|
+ // const location = tag.isContain(position);
|
|
|
+ // if (location) {
|
|
|
+ // result.tagInfo = {
|
|
|
+ // tagId: tagId,
|
|
|
+ // state: "all",
|
|
|
+ // };
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -395,47 +321,27 @@ export default class ListenLayer {
|
|
|
}
|
|
|
// 墙面状态是否改变
|
|
|
let flag2 = false;
|
|
|
- if (nearest.minWall != null) {
|
|
|
- if (nearest.minWall.distance < minDistance) {
|
|
|
- flag2 = this.isChanged(nearest.minWall.wallId, SelectState.Select, 2);
|
|
|
- this.wallInfo = {
|
|
|
- wallId: nearest.minWall.wallId,
|
|
|
+ if (nearest.minRoad != null) {
|
|
|
+ if (nearest.minRoad.distance < minDistance) {
|
|
|
+ flag2 = this.isChanged(nearest.minRoad.roadId, SelectState.Select, 2);
|
|
|
+ this.roadInfo = {
|
|
|
+ roadId: nearest.minRoad.roadId,
|
|
|
state: SelectState.Select,
|
|
|
};
|
|
|
} else {
|
|
|
- flag2 = this.isChanged(nearest.minWall.wallId, null, 2);
|
|
|
- this.wallInfo = {
|
|
|
- wallId: nearest.minWall.wallId,
|
|
|
+ flag2 = this.isChanged(nearest.minRoad.roadId, null, 2);
|
|
|
+ this.roadInfo = {
|
|
|
+ roadId: nearest.minRoad.roadId,
|
|
|
state: null,
|
|
|
};
|
|
|
}
|
|
|
} else {
|
|
|
flag2 = this.isChanged(null, null, 2);
|
|
|
- this.wallInfo = {
|
|
|
- wallId: null,
|
|
|
+ this.roadInfo = {
|
|
|
+ roadId: null,
|
|
|
state: null,
|
|
|
};
|
|
|
}
|
|
|
- // symbols状态是否改变
|
|
|
- const flag3 = this.isChanged(
|
|
|
- nearest.symbolInfo.symbolId,
|
|
|
- nearest.symbolInfo.state,
|
|
|
- 3
|
|
|
- );
|
|
|
- this.symbolInfo = {
|
|
|
- symbolId: nearest.symbolInfo.symbolId,
|
|
|
- state: nearest.symbolInfo.state,
|
|
|
- };
|
|
|
-
|
|
|
- const flag4 = this.isChanged(
|
|
|
- nearest.componentInfo.componentId,
|
|
|
- nearest.componentInfo.state,
|
|
|
- 4
|
|
|
- );
|
|
|
- this.componentInfo = {
|
|
|
- componentId: nearest.componentInfo.componentId,
|
|
|
- state: nearest.componentInfo.state,
|
|
|
- };
|
|
|
|
|
|
const flag5 = this.isChanged(
|
|
|
nearest.tagInfo.tagId,
|
|
@@ -447,17 +353,7 @@ export default class ListenLayer {
|
|
|
state: nearest.tagInfo.state,
|
|
|
};
|
|
|
|
|
|
- const flag6 = this.isChanged(
|
|
|
- nearest.furnitureInfo.furnitureId,
|
|
|
- nearest.furnitureInfo.state,
|
|
|
- 6
|
|
|
- );
|
|
|
- this.furnitureInfo = {
|
|
|
- furnitureId: nearest.furnitureInfo.furnitureId,
|
|
|
- state: nearest.furnitureInfo.state,
|
|
|
- };
|
|
|
-
|
|
|
- return flag1 || flag2 || flag3 || flag4 || flag5 || flag6;
|
|
|
+ return flag1 || flag2 || flag5;
|
|
|
}
|
|
|
|
|
|
// type是1表示点,2表示墙,3表示symbol,4表示component, 5表示tag,6表示furniture
|
|
@@ -475,33 +371,11 @@ export default class ListenLayer {
|
|
|
flag = true;
|
|
|
}
|
|
|
} else if (type == 2) {
|
|
|
- if (state == null && state == this.wallInfo.state) {
|
|
|
- flag = false;
|
|
|
- } else if (
|
|
|
- this.wallInfo.wallId == vectorId &&
|
|
|
- state == this.wallInfo.state
|
|
|
- ) {
|
|
|
- flag = false;
|
|
|
- } else {
|
|
|
- flag = true;
|
|
|
- }
|
|
|
- } else if (type == 3) {
|
|
|
- if (state == null && state == this.symbolInfo.state) {
|
|
|
- flag = false;
|
|
|
- } else if (
|
|
|
- this.symbolInfo.symbolId == vectorId &&
|
|
|
- state == this.symbolInfo.state
|
|
|
- ) {
|
|
|
- flag = false;
|
|
|
- } else {
|
|
|
- flag = true;
|
|
|
- }
|
|
|
- } else if (type == 4) {
|
|
|
- if (state == null && state == this.componentInfo.state) {
|
|
|
+ if (state == null && state == this.roadInfo.state) {
|
|
|
flag = false;
|
|
|
} else if (
|
|
|
- this.componentInfo.componentId == vectorId &&
|
|
|
- state == this.componentInfo.state
|
|
|
+ this.roadInfo.roadId == vectorId &&
|
|
|
+ state == this.roadInfo.state
|
|
|
) {
|
|
|
flag = false;
|
|
|
} else {
|
|
@@ -518,19 +392,7 @@ export default class ListenLayer {
|
|
|
} else {
|
|
|
flag = true;
|
|
|
}
|
|
|
- } else if (type == 6) {
|
|
|
- if (state == null && state == this.furnitureInfo.state) {
|
|
|
- flag = false;
|
|
|
- } else if (
|
|
|
- this.furnitureInfo.furnitureId == vectorId &&
|
|
|
- state == this.furnitureInfo.state
|
|
|
- ) {
|
|
|
- flag = false;
|
|
|
- } else {
|
|
|
- flag = true;
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
@@ -542,50 +404,16 @@ export default class ListenLayer {
|
|
|
tag.geoType,
|
|
|
this.tagInfo.state
|
|
|
);
|
|
|
- } else if (
|
|
|
- this.componentInfo.componentId != null &&
|
|
|
- this.componentInfo.state != null
|
|
|
- ) {
|
|
|
- const component = dataService.getComponent(
|
|
|
- this.componentInfo.componentId
|
|
|
- );
|
|
|
- stateService.setSelectItem(
|
|
|
- this.componentInfo.componentId,
|
|
|
- component.geoType,
|
|
|
- this.componentInfo.state
|
|
|
- );
|
|
|
- } else if (
|
|
|
- this.furnitureInfo.furnitureId != null &&
|
|
|
- this.furnitureInfo.state != null
|
|
|
- ) {
|
|
|
- const furniture = dataService.getFurniture(
|
|
|
- this.furnitureInfo.furnitureId
|
|
|
- );
|
|
|
- stateService.setSelectItem(
|
|
|
- this.furnitureInfo.furnitureId,
|
|
|
- furniture.geoType,
|
|
|
- this.furnitureInfo.state
|
|
|
- );
|
|
|
- } else if (
|
|
|
- this.symbolInfo.symbolId != null &&
|
|
|
- this.symbolInfo.state != null
|
|
|
- ) {
|
|
|
- const symbol = dataService.getSymbol(this.symbolInfo.symbolId);
|
|
|
- stateService.setSelectItem(
|
|
|
- this.symbolInfo.symbolId,
|
|
|
- symbol.geoType,
|
|
|
- this.symbolInfo.state
|
|
|
- );
|
|
|
} else if (this.pointInfo.pointId != null && this.pointInfo.state != null) {
|
|
|
stateService.setSelectItem(
|
|
|
this.pointInfo.pointId,
|
|
|
- VectorType.WallCorner,
|
|
|
+ VectorType.RoadCorner,
|
|
|
SelectState.Select
|
|
|
);
|
|
|
- } else if (this.wallInfo.wallId != null && this.wallInfo.state != null) {
|
|
|
+ } else if (this.roadInfo.roadId != null && this.roadInfo.state != null) {
|
|
|
stateService.setSelectItem(
|
|
|
- this.wallInfo.wallId,
|
|
|
- VectorType.Wall,
|
|
|
+ this.roadInfo.roadId,
|
|
|
+ VectorType.Road,
|
|
|
SelectState.Select
|
|
|
);
|
|
|
} else {
|
|
@@ -594,8 +422,8 @@ export default class ListenLayer {
|
|
|
}
|
|
|
|
|
|
clear() {
|
|
|
- this.wallInfo = {
|
|
|
- wallId: null,
|
|
|
+ this.roadInfo = {
|
|
|
+ roadId: null,
|
|
|
state: null,
|
|
|
};
|
|
|
|
|
@@ -604,21 +432,6 @@ export default class ListenLayer {
|
|
|
state: null,
|
|
|
};
|
|
|
|
|
|
- this.symbolInfo = {
|
|
|
- symbolId: null,
|
|
|
- state: null,
|
|
|
- };
|
|
|
-
|
|
|
- this.componentInfo = {
|
|
|
- componentId: null,
|
|
|
- state: null,
|
|
|
- };
|
|
|
-
|
|
|
- this.furnitureInfo = {
|
|
|
- furnitureId: null,
|
|
|
- state: null,
|
|
|
- };
|
|
|
-
|
|
|
this.modifyPoint = null;
|
|
|
}
|
|
|
}
|