|
@@ -50,24 +50,20 @@ Move.prototype.moveSpiralcorner = function (stairId, point, index) {
|
|
|
if (point.y > center.y) {
|
|
if (point.y > center.y) {
|
|
|
newpoint.y = center.y + r;
|
|
newpoint.y = center.y + r;
|
|
|
angle = 1.5 * Math.PI;
|
|
angle = 1.5 * Math.PI;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
newpoint.y = center.y - r;
|
|
newpoint.y = center.y - r;
|
|
|
angle = Math.PI / 2;
|
|
angle = Math.PI / 2;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if (line.hasOwnProperty('y')) {
|
|
|
|
|
|
|
+ } else if (line.hasOwnProperty('y')) {
|
|
|
newpoint.y = center.y;
|
|
newpoint.y = center.y;
|
|
|
if (point.x > center.x) {
|
|
if (point.x > center.x) {
|
|
|
newpoint.x = center.x + r;
|
|
newpoint.x = center.x + r;
|
|
|
angle = 0;
|
|
angle = 0;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
newpoint.x = center.x - r;
|
|
newpoint.x = center.x - r;
|
|
|
angle = Math.PI;
|
|
angle = Math.PI;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
var verticalLine1 = {};
|
|
var verticalLine1 = {};
|
|
|
var verticalLine2 = {};
|
|
var verticalLine2 = {};
|
|
|
verticalLine1.a = -1 / line.a;
|
|
verticalLine1.a = -1 / line.a;
|
|
@@ -82,8 +78,7 @@ Move.prototype.moveSpiralcorner = function (stairId, point, index) {
|
|
|
var join2 = this.calculateLine.getIntersectionPoint(verticalLine2, line);
|
|
var join2 = this.calculateLine.getIntersectionPoint(verticalLine2, line);
|
|
|
if (this.calculateLine.containPoint(center, join1, point) || this.calculateLine.containPoint(center, point, join1)) {
|
|
if (this.calculateLine.containPoint(center, join1, point) || this.calculateLine.containPoint(center, point, join1)) {
|
|
|
newpoint = join1;
|
|
newpoint = join1;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
newpoint = join2;
|
|
newpoint = join2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -93,16 +88,13 @@ Move.prototype.moveSpiralcorner = function (stairId, point, index) {
|
|
|
if (dx > 0 && dy > 0 || dx < 0 && dy > 0) {
|
|
if (dx > 0 && dy > 0 || dx < 0 && dy > 0) {
|
|
|
if (line.a > 0) {
|
|
if (line.a > 0) {
|
|
|
angle = 2 * Math.PI - Math.atan(line.a);
|
|
angle = 2 * Math.PI - Math.atan(line.a);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
angle = Math.PI + Math.abs(Math.atan(line.a));
|
|
angle = Math.PI + Math.abs(Math.atan(line.a));
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
if (line.a > 0) {
|
|
if (line.a > 0) {
|
|
|
angle = Math.PI - Math.atan(line.a);
|
|
angle = Math.PI - Math.atan(line.a);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
angle = Math.abs(Math.atan(line.a));
|
|
angle = Math.abs(Math.atan(line.a));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -111,8 +103,7 @@ Move.prototype.moveSpiralcorner = function (stairId, point, index) {
|
|
|
if (index == 1) {
|
|
if (index == 1) {
|
|
|
this.layer.vectors[stairId].geometry.sAngle = angle;
|
|
this.layer.vectors[stairId].geometry.sAngle = angle;
|
|
|
this.layer.vectors[stairId].geometry.point1 = newpoint;
|
|
this.layer.vectors[stairId].geometry.point1 = newpoint;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
this.layer.vectors[stairId].geometry.eAngle = angle;
|
|
this.layer.vectors[stairId].geometry.eAngle = angle;
|
|
|
this.layer.vectors[stairId].geometry.point2 = newpoint;
|
|
this.layer.vectors[stairId].geometry.point2 = newpoint;
|
|
|
}
|
|
}
|
|
@@ -122,7 +113,8 @@ Move.prototype.moveSpiralcorner = function (stairId, point, index) {
|
|
|
this.layer.vectors[this.currentState.currentPointId].geometry.y = newpoint.y;
|
|
this.layer.vectors[this.currentState.currentPointId].geometry.y = newpoint.y;
|
|
|
this.layer.vectors[this.currentState.currentCircleId].geometry.y = newpoint.y;
|
|
this.layer.vectors[this.currentState.currentCircleId].geometry.y = newpoint.y;
|
|
|
|
|
|
|
|
- this.layer.control.refreshCanvas = true; this.layer.control.refreshSelectCanvas = true;
|
|
|
|
|
|
|
+ this.layer.control.refreshCanvas = true;
|
|
|
|
|
+ this.layer.control.refreshSelectCanvas = true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
Move.prototype.moveSpiralPlane = function (stairId, dx, dy) {
|
|
Move.prototype.moveSpiralPlane = function (stairId, dx, dy) {
|
|
@@ -166,12 +158,27 @@ Move.prototype.moveWallcorner = function (wallid, index, newdragPoint) {
|
|
|
var index1 = this.calculateElement.getPreIndex(this.layer.vectors[wallid].geometry.points, index);
|
|
var index1 = this.calculateElement.getPreIndex(this.layer.vectors[wallid].geometry.points, index);
|
|
|
var index2 = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, index);
|
|
var index2 = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, index);
|
|
|
if (index1 == i) {
|
|
if (index1 == i) {
|
|
|
- this.layer.data2d.deleteNode({ wallId: wallid, startIndex: index, endIndex: -1 }, index1);
|
|
|
|
|
- this.layer.data2d.moveNodeForWall({ wallId: wallid, startIndex: index, endIndex: -1 });
|
|
|
|
|
- }
|
|
|
|
|
- else if (index2 == i) {
|
|
|
|
|
- this.layer.data2d.deleteNode({ wallId: wallid, startIndex: index, endIndex: -1 }, index2);
|
|
|
|
|
- this.layer.data2d.moveNodeForWall({ wallId: wallid, startIndex: index, endIndex: -1 });
|
|
|
|
|
|
|
+ this.layer.data2d.deleteNode({
|
|
|
|
|
+ wallId: wallid,
|
|
|
|
|
+ startIndex: index,
|
|
|
|
|
+ endIndex: -1
|
|
|
|
|
+ }, index1);
|
|
|
|
|
+ this.layer.data2d.moveNodeForWall({
|
|
|
|
|
+ wallId: wallid,
|
|
|
|
|
+ startIndex: index,
|
|
|
|
|
+ endIndex: -1
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (index2 == i) {
|
|
|
|
|
+ this.layer.data2d.deleteNode({
|
|
|
|
|
+ wallId: wallid,
|
|
|
|
|
+ startIndex: index,
|
|
|
|
|
+ endIndex: -1
|
|
|
|
|
+ }, index2);
|
|
|
|
|
+ this.layer.data2d.moveNodeForWall({
|
|
|
|
|
+ wallId: wallid,
|
|
|
|
|
+ startIndex: index,
|
|
|
|
|
+ endIndex: -1
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.calculateElement.updateSymbolsWallCornerIndexDelete(wallid, i, index)
|
|
this.calculateElement.updateSymbolsWallCornerIndexDelete(wallid, i, index)
|
|
@@ -194,14 +201,12 @@ Move.prototype.moveWallcorner = function (wallid, index, newdragPoint) {
|
|
|
this.layer.control.refreshCanvas = true;
|
|
this.layer.control.refreshCanvas = true;
|
|
|
this.layer.pan.f_draggingWallCorner = false;
|
|
this.layer.pan.f_draggingWallCorner = false;
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
- else if (this.layer.vectors[wallid].geometry.points.length < 3) {
|
|
|
|
|
|
|
+ } else if (this.layer.vectors[wallid].geometry.points.length < 3) {
|
|
|
this.layer.vectors[wallid].geometry.state = 1;
|
|
this.layer.vectors[wallid].geometry.state = 1;
|
|
|
}
|
|
}
|
|
|
if (index > i) {
|
|
if (index > i) {
|
|
|
index = i;
|
|
index = i;
|
|
|
- }
|
|
|
|
|
- else if (index == 0 && (i == len - 1)) {
|
|
|
|
|
|
|
+ } else if (index == 0 && (i == len - 1)) {
|
|
|
//删除了一个点
|
|
//删除了一个点
|
|
|
index = len - 2;
|
|
index = len - 2;
|
|
|
}
|
|
}
|
|
@@ -249,8 +254,7 @@ Move.prototype.changeCorner = function () {
|
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.startAngle = sector.start;
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.startAngle = sector.start;
|
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.endAngle = sector.end;
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.endAngle = sector.end;
|
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.contextIndex = this.layer.select.contextIndex;
|
|
this.layer.vectors[this.currentState.currentSecotrId].geometry.contextIndex = this.layer.select.contextIndex;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
//添加扇形
|
|
//添加扇形
|
|
|
var addsector = new Sector(sector.x, sector.y, Sector_r, sector.start, sector.end);
|
|
var addsector = new Sector(sector.x, sector.y, Sector_r, sector.start, sector.end);
|
|
|
var vector = new Vector(addsector, sectorStyle);
|
|
var vector = new Vector(addsector, sectorStyle);
|
|
@@ -258,8 +262,7 @@ Move.prototype.changeCorner = function () {
|
|
|
vector.geometry.contextIndex = this.layer.select.contextIndex;
|
|
vector.geometry.contextIndex = this.layer.select.contextIndex;
|
|
|
this.layer.drawSingleVector(vector);
|
|
this.layer.drawSingleVector(vector);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
this.layer.deleteVector(this.currentState.currentSecotrId);
|
|
this.layer.deleteVector(this.currentState.currentSecotrId);
|
|
|
this.currentState.currentSecotrId = null;
|
|
this.currentState.currentSecotrId = null;
|
|
|
}
|
|
}
|
|
@@ -427,8 +430,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
var r;
|
|
var r;
|
|
|
if (this.layer.vectors[id].geometry.wallType == 1) {
|
|
if (this.layer.vectors[id].geometry.wallType == 1) {
|
|
|
r = wallThickness / 2
|
|
r = wallThickness / 2
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
r = partitionThickness / 2
|
|
r = partitionThickness / 2
|
|
|
}
|
|
}
|
|
|
var len = this.layer.vectors[id].geometry.points.length;
|
|
var len = this.layer.vectors[id].geometry.points.length;
|
|
@@ -442,15 +444,24 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
currentPoint2.y = this.layer.vectors[id].geometry.points[endIndex].y;
|
|
currentPoint2.y = this.layer.vectors[id].geometry.points[endIndex].y;
|
|
|
|
|
|
|
|
//不考虑周围的墙,鼠标移动后,选中的墙本应该在的位置
|
|
//不考虑周围的墙,鼠标移动后,选中的墙本应该在的位置
|
|
|
- newdragline.push({ x: currentPoint1.x + dx * this.layer.res, y: currentPoint1.y - dy * this.layer.res });
|
|
|
|
|
- newdragline.push({ x: currentPoint2.x + dx * this.layer.res, y: currentPoint2.y - dy * this.layer.res });
|
|
|
|
|
|
|
+ newdragline.push({
|
|
|
|
|
+ x: currentPoint1.x + dx * this.layer.res,
|
|
|
|
|
+ y: currentPoint1.y - dy * this.layer.res
|
|
|
|
|
+ });
|
|
|
|
|
+ newdragline.push({
|
|
|
|
|
+ x: currentPoint2.x + dx * this.layer.res,
|
|
|
|
|
+ y: currentPoint2.y - dy * this.layer.res
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
//如果墙不是闭合的,就拖拽vector就行
|
|
//如果墙不是闭合的,就拖拽vector就行
|
|
|
if (this.layer.vectors[id].geometry.state == 1) {
|
|
if (this.layer.vectors[id].geometry.state == 1) {
|
|
|
for (var i = 0; i < this.layer.vectors[id].geometry.points.length; ++i) {
|
|
for (var i = 0; i < this.layer.vectors[id].geometry.points.length; ++i) {
|
|
|
var x = this.layer.vectors[id].geometry.points[i].x + dx * this.layer.res;
|
|
var x = this.layer.vectors[id].geometry.points[i].x + dx * this.layer.res;
|
|
|
var y = this.layer.vectors[id].geometry.points[i].y - dy * this.layer.res;
|
|
var y = this.layer.vectors[id].geometry.points[i].y - dy * this.layer.res;
|
|
|
- this.layer.vectors[id].geometry.points[i] = { x: x, y: y };
|
|
|
|
|
|
|
+ this.layer.vectors[id].geometry.points[i] = {
|
|
|
|
|
+ x: x,
|
|
|
|
|
+ y: y
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
//移动选中的点和线
|
|
//移动选中的点和线
|
|
|
if (this.currentState.currentLineId != null) {
|
|
if (this.currentState.currentLineId != null) {
|
|
@@ -550,8 +561,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
|
origin.point1 = Math.min(origin.point1, startIndex);
|
|
origin.point1 = Math.min(origin.point1, startIndex);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
if (endIndex > origin.point1 && (endIndex - origin.point1) != len - 1) {
|
|
if (endIndex > origin.point1 && (endIndex - origin.point1) != len - 1) {
|
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point1].thick = this.layer.vectors[id].geometry.wallInfo[endIndex].thick;
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point1].thick = this.layer.vectors[id].geometry.wallInfo[endIndex].thick;
|
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point1].height = this.layer.vectors[id].geometry.wallInfo[endIndex].height;
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point1].height = this.layer.vectors[id].geometry.wallInfo[endIndex].height;
|
|
@@ -570,8 +580,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
this.layer.vectors[id].geometry.state = 1;
|
|
this.layer.vectors[id].geometry.state = 1;
|
|
|
}
|
|
}
|
|
|
symbolFlag = true;
|
|
symbolFlag = true;
|
|
|
- }
|
|
|
|
|
- else if (this.currentState.currentLinePoint1Id != null) {
|
|
|
|
|
|
|
+ } else if (this.currentState.currentLinePoint1Id != null) {
|
|
|
this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.x = newWallPoint1.x;
|
|
this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.x = newWallPoint1.x;
|
|
|
this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.y = newWallPoint1.y;
|
|
this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.y = newWallPoint1.y;
|
|
|
}
|
|
}
|
|
@@ -592,8 +601,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
|
origin.point2 = Math.min(origin.point1, startIndex);
|
|
origin.point2 = Math.min(origin.point1, startIndex);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
if (endIndex > origin.point2 && (endIndex - origin.point2) != len - 1) {
|
|
if (endIndex > origin.point2 && (endIndex - origin.point2) != len - 1) {
|
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point2].thick = this.layer.vectors[id].geometry.wallInfo[endIndex].thick;
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point2].thick = this.layer.vectors[id].geometry.wallInfo[endIndex].thick;
|
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point2].height = this.layer.vectors[id].geometry.wallInfo[endIndex].height;
|
|
this.layer.vectors[id].geometry.wallInfo[origin.point2].height = this.layer.vectors[id].geometry.wallInfo[endIndex].height;
|
|
@@ -611,8 +619,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
this.layer.vectors[id].geometry.state = 1;
|
|
this.layer.vectors[id].geometry.state = 1;
|
|
|
}
|
|
}
|
|
|
symbolFlag = true;
|
|
symbolFlag = true;
|
|
|
- }
|
|
|
|
|
- else if (this.currentState.currentLinePoint2Id != null) {
|
|
|
|
|
|
|
+ } else if (this.currentState.currentLinePoint2Id != null) {
|
|
|
this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.x = newWallPoint2.x;
|
|
this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.x = newWallPoint2.x;
|
|
|
this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.y = newWallPoint2.y;
|
|
this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.y = newWallPoint2.y;
|
|
|
}
|
|
}
|
|
@@ -644,8 +651,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.points.splice(startIndex, 1);
|
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
this.layer.vectors[id].geometry.wallInfo.splice(startIndex, 1);
|
|
|
this.layer.select.selectWallCorner(id, index);
|
|
this.layer.select.selectWallCorner(id, index);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
index = 0;
|
|
index = 0;
|
|
|
this.layer.deleteVector(id);
|
|
this.layer.deleteVector(id);
|
|
|
this.currentState.currentWallId = null;
|
|
this.currentState.currentWallId = null;
|
|
@@ -656,8 +662,7 @@ Move.prototype.moveWallLine = function (id, dx, dy, startIndex, endIndex) {
|
|
|
if (BABYLON.Vector2.Distance(newWallPoint1, newWallPoint2) < 2 * r) {
|
|
if (BABYLON.Vector2.Distance(newWallPoint1, newWallPoint2) < 2 * r) {
|
|
|
this.layer.select.clearSelect();
|
|
this.layer.select.clearSelect();
|
|
|
this.layer.select.selectWallCorner(id, startIndex);
|
|
this.layer.select.selectWallCorner(id, startIndex);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[0].x = this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.x;
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[0].x = this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.x;
|
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[0].y = this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.y;
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[0].y = this.layer.vectors[this.currentState.currentLinePoint1Id].geometry.y;
|
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[1].x = this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.x;
|
|
this.layer.vectors[this.currentState.currentLineId].geometry.points[1].x = this.layer.vectors[this.currentState.currentLinePoint2Id].geometry.x;
|
|
@@ -721,14 +726,16 @@ Move.prototype.moveVirtualSymbol2 = function (symbol, point) {
|
|
|
var endpoint = this.calculateElement.getSymbolEndPoint2(point, symbol.attributes.wallId, symbol.attributes.wallstartindex, symbol.attributes.wallendindex, len);
|
|
var endpoint = this.calculateElement.getSymbolEndPoint2(point, symbol.attributes.wallId, symbol.attributes.wallstartindex, symbol.attributes.wallendindex, len);
|
|
|
if (endpoint == null) {
|
|
if (endpoint == null) {
|
|
|
return false;
|
|
return false;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
var thick = this.layer.getThickness(symbol.attributes.wallId, symbol.attributes.wallstartindex);
|
|
var thick = this.layer.getThickness(symbol.attributes.wallId, symbol.attributes.wallstartindex);
|
|
|
//更新端点
|
|
//更新端点
|
|
|
symbol.geometry.point1 = endpoint.newpoint1;
|
|
symbol.geometry.point1 = endpoint.newpoint1;
|
|
|
symbol.geometry.point2 = endpoint.newpoint2;
|
|
symbol.geometry.point2 = endpoint.newpoint2;
|
|
|
|
|
|
|
|
- var newPoint = { x: (endpoint.newpoint1.x + endpoint.newpoint2.x) / 2, y: (endpoint.newpoint1.y + endpoint.newpoint2.y) / 2 };
|
|
|
|
|
|
|
+ var newPoint = {
|
|
|
|
|
+ x: (endpoint.newpoint1.x + endpoint.newpoint2.x) / 2,
|
|
|
|
|
+ y: (endpoint.newpoint1.y + endpoint.newpoint2.y) / 2
|
|
|
|
|
+ };
|
|
|
symbol.geometry.wallType = this.layer.vectors[symbol.attributes.wallId].geometry.wallType;
|
|
symbol.geometry.wallType = this.layer.vectors[symbol.attributes.wallId].geometry.wallType;
|
|
|
symbol.attributes.toward = this.calculateLine.getToward(symbol.geometry.point1, symbol.geometry.point2, point);
|
|
symbol.attributes.toward = this.calculateLine.getToward(symbol.geometry.point1, symbol.geometry.point2, point);
|
|
|
symbol.geometry.points = this.calculateElement.getSymbolPoints(endpoint.newpoint1, endpoint.newpoint2, symbol.geometry.geoType, symbol.attributes.toward, thick);
|
|
symbol.geometry.points = this.calculateElement.getSymbolPoints(endpoint.newpoint1, endpoint.newpoint2, symbol.geometry.geoType, symbol.attributes.toward, thick);
|
|
@@ -768,8 +775,7 @@ Move.prototype.moveExistSymbol = function (lastpoint, point, id) {
|
|
|
point1 = this.layer.vectors[wallid].geometry.points[startIndex];
|
|
point1 = this.layer.vectors[wallid].geometry.points[startIndex];
|
|
|
if (endIndex != null && typeof (endIndex) != undefined) {
|
|
if (endIndex != null && typeof (endIndex) != undefined) {
|
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
endIndex = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, startIndex, this.layer.vectors[wallid].geometry.state);
|
|
endIndex = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, startIndex, this.layer.vectors[wallid].geometry.state);
|
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
|
}
|
|
}
|
|
@@ -789,8 +795,7 @@ Move.prototype.moveExistSymbol = function (lastpoint, point, id) {
|
|
|
point1 = this.layer.vectors[wallid].geometry.points[startIndex];
|
|
point1 = this.layer.vectors[wallid].geometry.points[startIndex];
|
|
|
if (endIndex) {
|
|
if (endIndex) {
|
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
point2 = this.layer.vectors[wallid].geometry.points[endIndex];
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
endIndex = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, startIndex, this.layer.vectors[wallid].geometry.state);
|
|
endIndex = this.calculateElement.getNextIndex(this.layer.vectors[wallid].geometry.points, startIndex, this.layer.vectors[wallid].geometry.state);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -813,15 +818,16 @@ Move.prototype.moveExistSymbol = function (lastpoint, point, id) {
|
|
|
|
|
|
|
|
point1 = this.layer.vectors[wallid].geometry.points[this.currentState.selectWallSet.index];
|
|
point1 = this.layer.vectors[wallid].geometry.points[this.currentState.selectWallSet.index];
|
|
|
point2 = this.layer.vectors[wallid].geometry.points[this.currentState.selectWallSet.endindex];
|
|
point2 = this.layer.vectors[wallid].geometry.points[this.currentState.selectWallSet.endindex];
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
alert("Move:618");
|
|
alert("Move:618");
|
|
|
}
|
|
}
|
|
|
symbol.attributes.toward = this.calculateLine.getToward(symbol.geometry.point1, symbol.geometry.point2, point);
|
|
symbol.attributes.toward = this.calculateLine.getToward(symbol.geometry.point1, symbol.geometry.point2, point);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
var line = this.calculateLine.createLine(point1, point2);
|
|
var line = this.calculateLine.createLine(point1, point2);
|
|
|
- joinpoint = { x: point.x, y: point.y };
|
|
|
|
|
|
|
+ joinpoint = {
|
|
|
|
|
+ x: point.x,
|
|
|
|
|
+ y: point.y
|
|
|
|
|
+ };
|
|
|
point = this.calculateLine.getJoinLinePoint(point, line);
|
|
point = this.calculateLine.getJoinLinePoint(point, line);
|
|
|
if (!this.calculateElement.lineContain(point1, point2, point, 1)) {
|
|
if (!this.calculateElement.lineContain(point1, point2, point, 1)) {
|
|
|
return;
|
|
return;
|
|
@@ -834,8 +840,14 @@ Move.prototype.moveExistSymbol = function (lastpoint, point, id) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var sp1 = { x: symbol.geometry.point1.x, y: symbol.geometry.point1.y };
|
|
|
|
|
- var sp2 = { x: symbol.geometry.point2.x, y: symbol.geometry.point2.y };
|
|
|
|
|
|
|
+ var sp1 = {
|
|
|
|
|
+ x: symbol.geometry.point1.x,
|
|
|
|
|
+ y: symbol.geometry.point1.y
|
|
|
|
|
+ };
|
|
|
|
|
+ var sp2 = {
|
|
|
|
|
+ x: symbol.geometry.point2.x,
|
|
|
|
|
+ y: symbol.geometry.point2.y
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
this.calculateElement.updateSymbolEndPoint(symbol, point, wallid, startIndex, endIndex);
|
|
this.calculateElement.updateSymbolEndPoint(symbol, point, wallid, startIndex, endIndex);
|
|
|
|
|
|
|
@@ -867,7 +879,10 @@ Move.prototype.moveSymbolEndpoint = function (point, selectindex) {
|
|
|
var selectPoint = this.draggingSymbol2dPoint.selectPoint;
|
|
var selectPoint = this.draggingSymbol2dPoint.selectPoint;
|
|
|
var noselectPoint = this.draggingSymbol2dPoint.noselectPoint;
|
|
var noselectPoint = this.draggingSymbol2dPoint.noselectPoint;
|
|
|
|
|
|
|
|
- var mid = { x: (selectPoint.x + noselectPoint.x) / 2, y: (selectPoint.y + noselectPoint.y) / 2 };
|
|
|
|
|
|
|
+ var mid = {
|
|
|
|
|
+ x: (selectPoint.x + noselectPoint.x) / 2,
|
|
|
|
|
+ y: (selectPoint.y + noselectPoint.y) / 2
|
|
|
|
|
+ };
|
|
|
var line = this.calculateLine.createLine(this.layer.vectors[wallid].geometry.points[index1], this.layer.vectors[wallid].geometry.points[index2]);
|
|
var line = this.calculateLine.createLine(this.layer.vectors[wallid].geometry.points[index1], this.layer.vectors[wallid].geometry.points[index2]);
|
|
|
var join = this.calculateLine.getJoinLinePoint(point, line);
|
|
var join = this.calculateLine.getJoinLinePoint(point, line);
|
|
|
|
|
|
|
@@ -879,8 +894,7 @@ Move.prototype.moveSymbolEndpoint = function (point, selectindex) {
|
|
|
var symbol = this.layer.vectors[this.currentState.currentSymbolId];
|
|
var symbol = this.layer.vectors[this.currentState.currentSymbolId];
|
|
|
if (!this.calculateLine.containPoint(point1, point2, symbol.geometry.point1) || !this.calculateLine.containPoint(point1, point2, symbol.geometry.point2)) {
|
|
if (!this.calculateLine.containPoint(point1, point2, symbol.geometry.point1) || !this.calculateLine.containPoint(point1, point2, symbol.geometry.point2)) {
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
- else if (this.calculateLine.containPoint(mid, join, selectPoint) || this.calculateLine.containPoint(mid, selectPoint, join)) {
|
|
|
|
|
|
|
+ } else if (this.calculateLine.containPoint(mid, join, selectPoint) || this.calculateLine.containPoint(mid, selectPoint, join)) {
|
|
|
if (BABYLON.Vector2.Distance(point1, symbol.geometry.point1) < symbolMinLen || BABYLON.Vector2.Distance(point2, symbol.geometry.point1) < symbolMinLen || BABYLON.Vector2.Distance(point1, symbol.geometry.point2) < symbolMinLen || BABYLON.Vector2.Distance(point2, symbol.geometry.point2) < symbolMinLen) {
|
|
if (BABYLON.Vector2.Distance(point1, symbol.geometry.point1) < symbolMinLen || BABYLON.Vector2.Distance(point2, symbol.geometry.point1) < symbolMinLen || BABYLON.Vector2.Distance(point1, symbol.geometry.point2) < symbolMinLen || BABYLON.Vector2.Distance(point2, symbol.geometry.point2) < symbolMinLen) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -891,11 +905,9 @@ Move.prototype.moveSymbolEndpoint = function (point, selectindex) {
|
|
|
this.layer.deleteSymbol(this.currentState.currentSymbolId, wallid);
|
|
this.layer.deleteSymbol(this.currentState.currentSymbolId, wallid);
|
|
|
this.layer.control.refreshCanvas = true;
|
|
this.layer.control.refreshCanvas = true;
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
- else if (BABYLON.Vector2.Distance(selectPoint, join) < symbolMinLen) {
|
|
|
|
|
|
|
+ } else if (BABYLON.Vector2.Distance(selectPoint, join) < symbolMinLen) {
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
dx = join.x - selectPoint.x;
|
|
dx = join.x - selectPoint.x;
|
|
|
dy = join.y - selectPoint.y;
|
|
dy = join.y - selectPoint.y;
|
|
|
|
|
|
|
@@ -916,8 +928,7 @@ Move.prototype.moveSymbolEndpoint = function (point, selectindex) {
|
|
|
|
|
|
|
|
this.layer.vectors[this.layer.select.selectSymbolIds.selects[0]].geometry.points[0] = join;
|
|
this.layer.vectors[this.layer.select.selectSymbolIds.selects[0]].geometry.points[0] = join;
|
|
|
this.layer.vectors[this.layer.select.selectSymbolIds.selects[0]].geometry.points[1] = noselectPoint;
|
|
this.layer.vectors[this.layer.select.selectSymbolIds.selects[0]].geometry.points[1] = noselectPoint;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
symbol.geometry.point2 = join;
|
|
symbol.geometry.point2 = join;
|
|
|
symbol.geometry.point1 = noselectPoint;
|
|
symbol.geometry.point1 = noselectPoint;
|
|
|
|
|
|
|
@@ -946,19 +957,16 @@ Move.prototype.moveSymbolsWithWallCorner = function (wallid, index) {
|
|
|
var symbol2ds = [];
|
|
var symbol2ds = [];
|
|
|
var movPoint = this.layer.vectors[wallid].geometry.points[index];
|
|
var movPoint = this.layer.vectors[wallid].geometry.points[index];
|
|
|
|
|
|
|
|
- console.log(this.layer.vectors[wallid].symbol2Ds)
|
|
|
|
|
for (var key in this.layer.vectors[wallid].symbol2Ds) {
|
|
for (var key in this.layer.vectors[wallid].symbol2Ds) {
|
|
|
var fixPoint = null;
|
|
var fixPoint = null;
|
|
|
var symbol2d = this.layer.vectors[wallid].symbol2Ds[key];
|
|
var symbol2d = this.layer.vectors[wallid].symbol2Ds[key];
|
|
|
if (symbol2d.attributes.wallstartindex == index) {
|
|
if (symbol2d.attributes.wallstartindex == index) {
|
|
|
symbol2ds.push(symbol2d);
|
|
symbol2ds.push(symbol2d);
|
|
|
fixPoint = this.layer.vectors[wallid].geometry.points[symbol2d.attributes.wallendindex];
|
|
fixPoint = this.layer.vectors[wallid].geometry.points[symbol2d.attributes.wallendindex];
|
|
|
- }
|
|
|
|
|
- else if (symbol2d.attributes.wallendindex == index) {
|
|
|
|
|
|
|
+ } else if (symbol2d.attributes.wallendindex == index) {
|
|
|
symbol2ds.push(symbol2d);
|
|
symbol2ds.push(symbol2d);
|
|
|
fixPoint = this.layer.vectors[wallid].geometry.points[symbol2d.attributes.wallstartindex];
|
|
fixPoint = this.layer.vectors[wallid].geometry.points[symbol2d.attributes.wallstartindex];
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
// break;
|
|
// break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -979,6 +987,7 @@ Move.prototype.moveSymbolsWithWallCorner = function (wallid, index) {
|
|
|
|
|
|
|
|
//随墙移动
|
|
//随墙移动
|
|
|
Move.prototype.moveSymbolsWithWallLine = function (id, startIndex, endIndex, dx, dy, flag) {
|
|
Move.prototype.moveSymbolsWithWallLine = function (id, startIndex, endIndex, dx, dy, flag) {
|
|
|
|
|
+ var a = 1 === 2
|
|
|
if (typeof (this.layer.vectors[id]) != "undefined" && this.layer.vectors[id].symbol2dsCount > 0) {
|
|
if (typeof (this.layer.vectors[id]) != "undefined" && this.layer.vectors[id].symbol2dsCount > 0) {
|
|
|
for (var key in this.layer.vectors[id].symbol2Ds) {
|
|
for (var key in this.layer.vectors[id].symbol2Ds) {
|
|
|
var newWallPoint1 = this.layer.vectors[id].geometry.points[startIndex];
|
|
var newWallPoint1 = this.layer.vectors[id].geometry.points[startIndex];
|
|
@@ -987,8 +996,7 @@ Move.prototype.moveSymbolsWithWallLine = function (id, startIndex, endIndex, dx,
|
|
|
if ((symbol2d.attributes.wallstartindex == startIndex && symbol2d.attributes.wallendindex == endIndex) || (symbol2d.attributes.wallstartindex == endIndex && symbol2d.attributes.wallendindex == startIndex)) {
|
|
if ((symbol2d.attributes.wallstartindex == startIndex && symbol2d.attributes.wallendindex == endIndex) || (symbol2d.attributes.wallstartindex == endIndex && symbol2d.attributes.wallendindex == startIndex)) {
|
|
|
if (!this.calculateLine.segmentContainPoint(newWallPoint1, newWallPoint2, symbol2d.geometry.point1) || !this.calculateLine.segmentContainPoint(newWallPoint1, newWallPoint2, symbol2d.geometry.point2)) {
|
|
if (!this.calculateLine.segmentContainPoint(newWallPoint1, newWallPoint2, symbol2d.geometry.point1) || !this.calculateLine.segmentContainPoint(newWallPoint1, newWallPoint2, symbol2d.geometry.point2)) {
|
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
var thick = this.layer.getThickness(this.currentState.currentWallId, this.currentState.currentstartlinePointIndex);
|
|
var thick = this.layer.getThickness(this.currentState.currentWallId, this.currentState.currentstartlinePointIndex);
|
|
|
|
|
|
|
|
if (!flag) {
|
|
if (!flag) {
|
|
@@ -999,8 +1007,7 @@ Move.prototype.moveSymbolsWithWallLine = function (id, startIndex, endIndex, dx,
|
|
|
symbol2d.geometry.point2.y = symbol2d.geometry.point2.y + dy;
|
|
symbol2d.geometry.point2.y = symbol2d.geometry.point2.y + dy;
|
|
|
|
|
|
|
|
symbol2d.select = false;
|
|
symbol2d.select = false;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
var point = this.calculateLine.getNewSymbolPoint(symbol2d, newWallPoint1, newWallPoint2);
|
|
var point = this.calculateLine.getNewSymbolPoint(symbol2d, newWallPoint1, newWallPoint2);
|
|
|
symbol2d.geometry.point1 = point.point1;
|
|
symbol2d.geometry.point1 = point.point1;
|
|
|
symbol2d.geometry.point2 = point.point2;
|
|
symbol2d.geometry.point2 = point.point2;
|
|
@@ -1009,13 +1016,11 @@ Move.prototype.moveSymbolsWithWallLine = function (id, startIndex, endIndex, dx,
|
|
|
|
|
|
|
|
symbol2d.geometry.points = this.calculateElement.getSymbolPoints(symbol2d.geometry.point1, symbol2d.geometry.point2, symbol2d.geometry.geoType, symbol2d.attributes.toward, thick);
|
|
symbol2d.geometry.points = this.calculateElement.getSymbolPoints(symbol2d.geometry.point1, symbol2d.geometry.point2, symbol2d.geometry.geoType, symbol2d.attributes.toward, thick);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if (symbol2d.attributes.wallstartindex == startIndex || symbol2d.attributes.wallendindex == startIndex) {
|
|
|
|
|
|
|
+ } else if (symbol2d.attributes.wallstartindex == startIndex || symbol2d.attributes.wallendindex == startIndex) {
|
|
|
if (this.calculateLine.segmentContainPoint(symbol2d.geometry.point1, symbol2d.geometry.point2, newWallPoint1)) {
|
|
if (this.calculateLine.segmentContainPoint(symbol2d.geometry.point1, symbol2d.geometry.point2, newWallPoint1)) {
|
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if (symbol2d.attributes.wallstartindex == endIndex || symbol2d.attributes.wallendindex == endIndex) {
|
|
|
|
|
|
|
+ } else if (symbol2d.attributes.wallstartindex == endIndex || symbol2d.attributes.wallendindex == endIndex) {
|
|
|
if (this.calculateLine.segmentContainPoint(symbol2d.geometry.point1, symbol2d.geometry.point2, newWallPoint2)) {
|
|
if (this.calculateLine.segmentContainPoint(symbol2d.geometry.point1, symbol2d.geometry.point2, newWallPoint2)) {
|
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
this.layer.deleteSymbol(symbol2d.id, symbol2d.attributes.wallId);
|
|
|
}
|
|
}
|
|
@@ -1034,13 +1039,11 @@ Move.prototype.updateSymbolIndex = function (id, startIndex) {
|
|
|
if (symbol2d.attributes.wallstartindex > startIndex) {
|
|
if (symbol2d.attributes.wallstartindex > startIndex) {
|
|
|
--symbol2d.attributes.wallstartindex;
|
|
--symbol2d.attributes.wallstartindex;
|
|
|
--this.layer.vectors[symbol2d.vectorid].startindex;
|
|
--this.layer.vectors[symbol2d.vectorid].startindex;
|
|
|
- }
|
|
|
|
|
- else if (symbol2d.attributes.wallstartindex == startIndex) {
|
|
|
|
|
|
|
+ } else if (symbol2d.attributes.wallstartindex == startIndex) {
|
|
|
if (symbol2d.attributes.wallstartindex != 0) {
|
|
if (symbol2d.attributes.wallstartindex != 0) {
|
|
|
--symbol2d.attributes.wallstartindex;
|
|
--symbol2d.attributes.wallstartindex;
|
|
|
--this.layer.vectors[symbol2d.vectorid].startindex;
|
|
--this.layer.vectors[symbol2d.vectorid].startindex;
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
symbol2d.attributes.wallstartindex = this.layer.vectors[id].geometry.points.length - 2;
|
|
symbol2d.attributes.wallstartindex = this.layer.vectors[id].geometry.points.length - 2;
|
|
|
this.layer.vectors[symbol2d.vectorid].startindex = this.layer.vectors[id].geometry.points.length - 2;
|
|
this.layer.vectors[symbol2d.vectorid].startindex = this.layer.vectors[id].geometry.points.length - 2;
|
|
|
}
|
|
}
|