Compare commits

..

No commits in common. "559c0851833b346fade129a3e510641268c2b547" and "4a0eb66a3ca25fd0928b85d61f6010b677c45c78" have entirely different histories.

View File

@ -837,8 +837,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
roofId : roofId,
attributes : {
type: 'eaveHelpLine',
isStart : true,
pitch: wallLine.attributes.pitch,
isStart : true
}
});
//coordinateText(line)
@ -889,7 +888,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_start' });
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
@ -913,7 +912,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' });
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
@ -951,7 +950,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
findPoints.push({ y: aStartY, x: newPStart.x, position: 'left_out_start' });
findPoints.push({ y: aStartY, x: newPStart.x });
}else{
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
newPStart.y = Big(newPStart.y).minus(cLineY).toNumber();
@ -965,7 +964,6 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
}
if(isStartEnd.end){
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
@ -984,7 +982,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'left_out_end' });
findPoints.push({ y: aStartY, x: newPEnd.x });
}else{
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber();
@ -992,7 +990,6 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if(inLine){
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
}else {
newPEnd.y = wallLine.y2
}
@ -1008,7 +1005,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
newPStart.y = wallBaseLine.y1
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_start'});
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
@ -1032,7 +1029,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
newPEnd.y = wallBaseLine.y2
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_end' });
findPoints.push({ x: ePoint.x, y: ePoint.y });
const newPointX = Big(roofLine.x1).minus(moveDist).toNumber()
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
@ -1069,7 +1066,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_start' });
findPoints.push({ y: aStartY, x: newPEnd.x });
}else{
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
newPStart.y = Big(newPStart.y).plus(cLineY).toNumber();
@ -1101,7 +1098,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_end' });
findPoints.push({ y: aStartY, x: newPEnd.x });
}else{
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
newPEnd.y = Big(newPEnd.y).minus(cLineY).toNumber();
@ -1159,7 +1156,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
let idx = (0 >= index - 1)?roofLines.length:index
const pLineY = roofLines[idx-1].y1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_start' });
findPoints.push({ x: sPoint.x, y: sPoint.y });
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
@ -1180,7 +1177,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
let idx = roofLines.length < index + 1 ? 0 : index
const pLineY = roofLines[idx + 1].y2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_end' });
findPoints.push({ x: sPoint.x, y: sPoint.y })
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
@ -1209,7 +1206,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_start' });
findPoints.push({ x: aStartX, y: newPEnd.y });
}else{
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
newPStart.x = Big(newPStart.x).plus(cLineX).toNumber();
@ -1240,7 +1237,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_end' });
findPoints.push({ x: aStartX, y: newPEnd.y });
}else{
const cLineX = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
newPEnd.x = Big(newPEnd.x).minus(cLineX).toNumber();
@ -1267,7 +1264,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
let idx = (0 > index - 1)?roofLines.length:index
const pLineY = roofLines[idx-1].y1
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_start' });
findPoints.push({ x: sPoint.x, y: sPoint.y });
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
@ -1289,7 +1286,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
let idx = (roofLines.length < index + 1)?0:index
const pLineY = roofLines[idx+1].y2
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_end' });
findPoints.push({ x: sPoint.x, y: sPoint.y });
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
@ -1351,7 +1348,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
}
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'bottom_out_end' });
findPoints.push({ x: aStartX, y: newPEnd.y });
}else{
const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
newPEnd.x = Big(newPEnd.x).plus(cLineX).toNumber();
@ -1388,8 +1385,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
if (findPoints.length > 0) {
// 모든 점에 대해 라인 업데이트를 누적
return findPoints.reduce((innerLines, point) => {
return updateAndAddLine(innerLines, point);
return findPoints.reduce((lines, point) => {
return updateAndAddLine(lines, point);
}, [...innerLines]);
}
@ -3030,41 +3027,7 @@ function updateAndAddLine(innerLines, targetPoint) {
// 단순 거리 비교: 타겟 포인트가 시작점에 더 가까우면 시작점을 수정(isUpdatingStart = true)
//무조건 start
let isUpdatingStart = false //distanceToStart < distanceToEnd;
if(targetPoint.position === "top_in_start"){
if(foundLine.y2 >= foundLine.y1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "top_in_end"){
if(foundLine.y2 >= foundLine.y1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "bottom_in_start"){
if(foundLine.y2 <= foundLine.y1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "bottom_in_end"){
if(foundLine.y2 <= foundLine.y1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "left_in_start"){
if(foundLine.x2 >= foundLine.x1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "left_in_end"){
if(foundLine.x2 >= foundLine.x1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "right_in_start"){
if(foundLine.x2 <= foundLine.x1){
isUpdatingStart = true;
}
}else if(targetPoint.position === "right_in_end"){
if(foundLine.x2 <= foundLine.x1){
isUpdatingStart = true;
}
}
const isUpdatingStart = true //distanceToStart < distanceToEnd;
const updatedLine = {
...foundLine,