sk2
This commit is contained in:
parent
c8727a71fd
commit
e3196488c2
@ -505,8 +505,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
const existingLines = new Set(); // 이미 추가된 라인을 추적하기 위한 Set
|
||||
|
||||
|
||||
skeletonLines.forEach(line => {
|
||||
let { p1, p2, attributes, lineStyle } = line;
|
||||
skeletonLines.forEach(sktLine => {
|
||||
let { p1, p2, attributes, lineStyle } = sktLine;
|
||||
|
||||
// 라인을 고유하게 식별할 수 있는 키 생성 (정규화된 좌표로 정렬하여 비교)
|
||||
const lineKey = [
|
||||
@ -520,8 +520,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
}
|
||||
|
||||
const direction = getLineDirection(
|
||||
{ x: line.p1.x, y: line.p1.y },
|
||||
{ x: line.p2.x, y: line.p2.y }
|
||||
{ x: sktLine.p1.x, y: sktLine.p1.y },
|
||||
{ x: sktLine.p2.x, y: sktLine.p2.y }
|
||||
);
|
||||
|
||||
const innerLine = new QLine([p1.x, p1.y, p2.x, p2.y], {
|
||||
@ -529,18 +529,18 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
fontSize: roof.fontSize,
|
||||
stroke: lineStyle.color,
|
||||
strokeWidth: lineStyle.width,
|
||||
name: (line.attributes.isOuterEdge)?'eaves': attributes.type,
|
||||
name: (sktLine.attributes.isOuterEdge)?'eaves': attributes.type,
|
||||
attributes: attributes,
|
||||
direction: direction,
|
||||
isBaseLine: line.attributes.isOuterEdge,
|
||||
lineName: (line.attributes.isOuterEdge)?'outerLine': attributes.type,
|
||||
selectable:(!line.attributes.isOuterEdge),
|
||||
isBaseLine: sktLine.attributes.isOuterEdge,
|
||||
lineName: (sktLine.attributes.isOuterEdge)?'outerLine': attributes.type,
|
||||
selectable:(!sktLine.attributes.isOuterEdge),
|
||||
roofId: roofId,
|
||||
});
|
||||
|
||||
//skeleton 라인에서 처마선은 삭제
|
||||
if(innerLine.lineName === 'outerLine'){
|
||||
|
||||
//line은 시계방향이다.p1 -> p2
|
||||
|
||||
let idx = 0;
|
||||
//const orgWallLine = wall.lines
|
||||
@ -560,12 +560,80 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
|
||||
if (!lineExists) {
|
||||
|
||||
addLines.push(line);
|
||||
addLines.push(sktLine);
|
||||
|
||||
console.log("addLines:::"+addLines)
|
||||
|
||||
let p1Line = findClosestRoofLine(p1, roof.lines)
|
||||
let p2Line = findClosestRoofLine(p2, roof.lines)
|
||||
let p1wallLine = findClosestRoofLine(p1, wall.lines)
|
||||
let p2wallLine = findClosestRoofLine(p2, wall.lines)
|
||||
|
||||
console.log("p1LineV",p1Line)
|
||||
console.log("p2LineV",p2Line)
|
||||
console.log("p1wallLineV",p1wallLine)
|
||||
console.log("p2wallLineV",p2wallLine)
|
||||
|
||||
//외벽선과 접점이 없으면
|
||||
if(p1Line.distance > 0 && p2Line.distance > 0) {
|
||||
|
||||
}
|
||||
if(p1Line.distance === 0 && p2Line.distance === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log("p1Line.line.startPoint.x:::::",p1Line.line.startPoint)
|
||||
console.log("p1Line.line.endPoint.x:::::",p1Line.line.endPoint)
|
||||
console.log("p2Line.line.startPoint.x:::::",p2Line.line.startPoint)
|
||||
console.log("p2Line.line.endPoint.x:::::",p2Line.line.endPoint)
|
||||
|
||||
console.log("p1,p2:::::",p1, p2)
|
||||
|
||||
if(isSamePoint(p1, p1Line.line.startPoint) || isSamePoint(p1, p1Line.line.endPoint)) {
|
||||
p1.y = p2wallLine.line.endPoint.y
|
||||
return
|
||||
|
||||
}
|
||||
if(isSamePoint(p2, p2Line.line.startPoint) || isSamePoint(p2, p2Line.line.endPoint)) {
|
||||
p2.y = p1wallLine.line.endPoint.y
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if(p1Line.distance > 0 && p2Line.distance === 0 ){
|
||||
console.log("수평이면 수평을 연장")
|
||||
|
||||
// p1.x = p1Line.line.endPoint.x
|
||||
// p1.y = p1Line.line.endPoint.y
|
||||
// p2.x = p1wallLine.line.endPoint.y
|
||||
// p2.y =
|
||||
|
||||
|
||||
}
|
||||
if(p1Line.distance === 0 && p2Line.distance > 0 ) {
|
||||
|
||||
console.log("수직이면 수평을 연장")
|
||||
// p1.x = p2Line.line.endPoint.x
|
||||
// p1.y = p2Line.line.endPoint.y
|
||||
// p2.x = p1wallLine.line.endPoint.x
|
||||
// p2.y = p1.y
|
||||
|
||||
}
|
||||
|
||||
|
||||
const linesAtP1 = roof.lines.filter(roofLines => {
|
||||
console.log(roofLines.startPoint, roofLines.endPoint);
|
||||
console.log(isSamePoint(roofLines.startPoint, p1))
|
||||
console.log(isSamePoint(roofLines.endPoint, p1))
|
||||
return isSamePoint(roofLines.startPoint, p1) || isSamePoint(roofLines.endPoint, p1);
|
||||
});
|
||||
|
||||
const linesAtP2 = roof.lines.filter(roofLines => {
|
||||
console.log(roofLines.startPoint, roofLines.endPoint);
|
||||
console.log(isSamePoint(roofLines.startPoint, p2))
|
||||
console.log(isSamePoint(roofLines.endPoint, p2))
|
||||
return isSamePoint(roofLines.startPoint, p2) || isSamePoint(roofLines.endPoint, p2);
|
||||
});
|
||||
|
||||
// if(p2Line.distance > p1Line.distance){
|
||||
// p1Line = p2Line;
|
||||
// p2Line = p1Line;
|
||||
@ -583,6 +651,29 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
// p2.y = p2Line.line.endPoint.y
|
||||
// }
|
||||
|
||||
const lineId = `${p1.x},${p1.y}-${p2.x},${p2.y}`;
|
||||
|
||||
const newLine2 = new QLine(
|
||||
[p1.x, p1.y, p2.x, p2.y],
|
||||
{
|
||||
parentId : roof.id,
|
||||
fontSize : roof.fontSize,
|
||||
stroke : 'yellow',
|
||||
strokeWidth: lineStyle.width,
|
||||
name : (sktLine.attributes.isOuterEdge) ? 'eaves' : attributes.type,
|
||||
attributes : attributes,
|
||||
direction : direction,
|
||||
isBaseLine : sktLine.attributes.isOuterEdge,
|
||||
lineName : (sktLine.attributes.isOuterEdge) ? 'outerLine' : attributes.type,
|
||||
selectable : (!sktLine.attributes.isOuterEdge),
|
||||
roofId : roofId,
|
||||
lineId: lineId
|
||||
}
|
||||
);
|
||||
|
||||
canvas.add(newLine2);
|
||||
|
||||
/*
|
||||
console.log("그리는 선::::",p1,p2)
|
||||
|
||||
console.log("그리는 선::::",p1Line,p2Line)
|
||||
@ -624,14 +715,22 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
if(yMatch){
|
||||
p1.x = p1Line.intersectionPoint.x;
|
||||
p1.y = p1Line.intersectionPoint.y;
|
||||
p2.x = p1Line.intersectionPoint.x;
|
||||
//p2.y = p2.y
|
||||
p2.x = p1.x;
|
||||
p2.y = p1wallLine.line.startPoint.y;
|
||||
console.log("p1LineV",p1Line)
|
||||
console.log("p2LineV",p2Line)
|
||||
console.log("p1wallLineV",p1wallLine)
|
||||
console.log("p2wallLineV",p2wallLine)
|
||||
}
|
||||
if(xMatch){
|
||||
p1.x = p2Line.intersectionPoint.x;
|
||||
p1.y = p2Line.intersectionPoint.y;
|
||||
//p2.x = p2.x
|
||||
p2.y = p2Line.intersectionPoint.y;
|
||||
p2.x = p2wallLine.line.endPoint.x;
|
||||
p2.y = p1.y;
|
||||
console.log("p1LineH",p1Line)
|
||||
console.log("p2LineH",p2Line)
|
||||
console.log("p1wallLineH",p1wallLine)
|
||||
console.log("p2wallLineH",p2wallLine)
|
||||
}
|
||||
|
||||
|
||||
@ -640,31 +739,11 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
||||
console.log("New p1:", p1);
|
||||
|
||||
console.log("New p2:", p2);
|
||||
if( !xMatch && !yMatch) {
|
||||
const lineId = `${p1.x},${p1.y}-${p2.x},${p2.y}`;
|
||||
|
||||
const newLine2 = new QLine(
|
||||
[p1.x, p1.y, p2.x, p2.y],
|
||||
{
|
||||
parentId : roof.id,
|
||||
fontSize : roof.fontSize,
|
||||
stroke : 'red',
|
||||
strokeWidth: lineStyle.width,
|
||||
name : (line.attributes.isOuterEdge) ? 'eaves' : attributes.type,
|
||||
attributes : attributes,
|
||||
direction : direction,
|
||||
isBaseLine : line.attributes.isOuterEdge,
|
||||
lineName : (line.attributes.isOuterEdge) ? 'outerLine' : attributes.type,
|
||||
selectable : (!line.attributes.isOuterEdge),
|
||||
roofId : roofId,
|
||||
lineId: lineId
|
||||
}
|
||||
);
|
||||
|
||||
canvas.add(newLine2);
|
||||
}
|
||||
|
||||
if( !xMatch && !yMatch) {
|
||||
//그림
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user