지붕 덮개 points 조정 및 기능 수정
This commit is contained in:
parent
b5f86115e3
commit
c667e44596
@ -1815,9 +1815,13 @@ export function useMode() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
wall.attributes = {
|
wall.set({
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
attributes: {
|
||||||
roofId: roof.id,
|
roofId: roof.id,
|
||||||
}
|
},
|
||||||
|
})
|
||||||
|
|
||||||
//외벽선 삭제
|
//외벽선 삭제
|
||||||
canvas
|
canvas
|
||||||
|
|||||||
@ -764,7 +764,7 @@ export const drawRidgeRoof = (roofId, canvas, settingModalFirstOptions) => {
|
|||||||
drawHips(roof, canvas, textMode)
|
drawHips(roof, canvas, textMode)
|
||||||
connectLinePoint(roof, canvas, textMode)
|
connectLinePoint(roof, canvas, textMode)
|
||||||
modifyRidge(roof, canvas, textMode)
|
modifyRidge(roof, canvas, textMode)
|
||||||
// drawCenterLine(roof, canvas, textMode)
|
drawCenterLine(roof, canvas, textMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -776,8 +776,6 @@ export const drawRidgeRoof = (roofId, canvas, settingModalFirstOptions) => {
|
|||||||
*/
|
*/
|
||||||
const drawRidge = (roof, canvas, textMode) => {
|
const drawRidge = (roof, canvas, textMode) => {
|
||||||
console.log('roof.lines : ', roof.lines)
|
console.log('roof.lines : ', roof.lines)
|
||||||
console.log('textMode : ', textMode)
|
|
||||||
|
|
||||||
const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines // 외벽의 라인
|
const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines // 외벽의 라인
|
||||||
const roofLines = roof.lines // 지붕의 라인
|
const roofLines = roof.lines // 지붕의 라인
|
||||||
let ridgeRoof = []
|
let ridgeRoof = []
|
||||||
@ -802,7 +800,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
|
|
||||||
// 지붕의 길이가 짧은 순으로 정렬
|
// 지붕의 길이가 짧은 순으로 정렬
|
||||||
ridgeRoof.sort((a, b) => a.length - b.length)
|
ridgeRoof.sort((a, b) => a.length - b.length)
|
||||||
console.log('마루 순서 : ', ridgeRoof.map((item) => item.length).join(','))
|
|
||||||
|
|
||||||
ridgeRoof.forEach((item) => {
|
ridgeRoof.forEach((item) => {
|
||||||
if (getMaxRidge(roofLines.length) > roof.ridges.length) {
|
if (getMaxRidge(roofLines.length) > roof.ridges.length) {
|
||||||
@ -826,8 +823,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
let ridgeMaxLength = Big(Math.max(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize)).div(10)
|
let ridgeMaxLength = Big(Math.max(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize)).div(10)
|
||||||
let ridgeMinLength = Big(Math.min(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize)).div(10)
|
let ridgeMinLength = Big(Math.min(prevRoof.attributes.planeSize, nextRoof.attributes.planeSize)).div(10)
|
||||||
|
|
||||||
console.log('ridgeMinLength : ', ridgeMinLength.toNumber(), 'ridgeMaxLength : ', ridgeMaxLength.toNumber())
|
|
||||||
|
|
||||||
const currentAngle = Math.atan2(currentY2.minus(currentY1).toNumber(), currentX2.minus(currentX1).toNumber()) * (180 / Math.PI)
|
const currentAngle = Math.atan2(currentY2.minus(currentY1).toNumber(), currentX2.minus(currentX1).toNumber()) * (180 / Math.PI)
|
||||||
anotherRoof
|
anotherRoof
|
||||||
.filter((roof) => isInnerLine(prevRoof, currentRoof, nextRoof, roof))
|
.filter((roof) => isInnerLine(prevRoof, currentRoof, nextRoof, roof))
|
||||||
@ -860,13 +855,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
.plus(Big(nextRoof.y1).minus(Big(nextRoof.y2)).times(10).round().pow(2))
|
.plus(Big(nextRoof.y1).minus(Big(nextRoof.y2)).times(10).round().pow(2))
|
||||||
.sqrt()
|
.sqrt()
|
||||||
.div(10)
|
.div(10)
|
||||||
console.log('ridgeMinLength : ', ridgeMinLength.toNumber())
|
|
||||||
console.log('check ridgeMinLength', calcLinePlaneSize({
|
|
||||||
x1: nextRoof.x1,
|
|
||||||
y1: nextRoof.y1,
|
|
||||||
x2: nextRoof.x2,
|
|
||||||
y2: nextRoof.y2,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
if (currentAngle === 90 || currentAngle === 270) {
|
if (currentAngle === 90 || currentAngle === 270) {
|
||||||
currentY2 = innerRoof.y1
|
currentY2 = innerRoof.y1
|
||||||
@ -878,13 +866,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
.plus(Big(nextRoof.y1).minus(Big(nextRoof.y2)).times(10).round().pow(2))
|
.plus(Big(nextRoof.y1).minus(Big(nextRoof.y2)).times(10).round().pow(2))
|
||||||
.sqrt()
|
.sqrt()
|
||||||
.div(10)
|
.div(10)
|
||||||
console.log('ridgeMinLength : ', ridgeMinLength.toNumber())
|
|
||||||
console.log('check ridgeMinLength', calcLinePlaneSize({
|
|
||||||
x1: nextRoof.x1,
|
|
||||||
y1: nextRoof.y1,
|
|
||||||
x2: innerRoof.x2,
|
|
||||||
y2: nextRoof.y2,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Math.abs(currentAngle - ibAngle) === 0) {
|
if (Math.abs(currentAngle - ibAngle) === 0) {
|
||||||
@ -898,13 +879,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
.plus(Big(prevRoof.y1).minus(Big(innerRoof.y1)).times(10).round().pow(2))
|
.plus(Big(prevRoof.y1).minus(Big(innerRoof.y1)).times(10).round().pow(2))
|
||||||
.sqrt()
|
.sqrt()
|
||||||
.div(10)
|
.div(10)
|
||||||
console.log('ridgeMinLength : ', ridgeMinLength.toNumber())
|
|
||||||
console.log('check ridgeMinLength', calcLinePlaneSize({
|
|
||||||
x1: prevRoof.x1,
|
|
||||||
y1: prevRoof.y1,
|
|
||||||
x2: prevRoof.x2,
|
|
||||||
y2: innerRoof.y1,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
if (currentAngle === 90 || currentAngle === 270) {
|
if (currentAngle === 90 || currentAngle === 270) {
|
||||||
currentY1 = innerRoof.y2
|
currentY1 = innerRoof.y2
|
||||||
@ -916,13 +890,6 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
.plus(Big(prevRoof.y2).minus(prevRoof.y2).times(10).round().pow(2))
|
.plus(Big(prevRoof.y2).minus(prevRoof.y2).times(10).round().pow(2))
|
||||||
.sqrt()
|
.sqrt()
|
||||||
.div(10)
|
.div(10)
|
||||||
console.log('ridgeMinLength : ', ridgeMinLength.toNumber())
|
|
||||||
console.log('check ridgeMinLength', calcLinePlaneSize({
|
|
||||||
x1: prevRoof.x1,
|
|
||||||
y1: prevRoof.y1,
|
|
||||||
x2: innerRoof.x2,
|
|
||||||
y2: prevRoof.y2,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1012,19 +979,8 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
const diffX = Big(intersectLine.x).minus(startXPoint).round(1).abs().lt(1) ? Big(0) : Big(intersectLine.x).minus(startXPoint).round(1)
|
const diffX = Big(intersectLine.x).minus(startXPoint).round(1).abs().lt(1) ? Big(0) : Big(intersectLine.x).minus(startXPoint).round(1)
|
||||||
const diffY = Big(intersectLine.y).minus(startYPoint).round(1).abs().lt(1) ? Big(0) : Big(intersectLine.y).minus(startYPoint).round(1)
|
const diffY = Big(intersectLine.y).minus(startYPoint).round(1).abs().lt(1) ? Big(0) : Big(intersectLine.y).minus(startYPoint).round(1)
|
||||||
// 시작점에서 ridgeBaseLength 만큼 떨어진 지점까지 용마루 길이로 본다.
|
// 시작점에서 ridgeBaseLength 만큼 떨어진 지점까지 용마루 길이로 본다.
|
||||||
console.log('diffX : ', diffX.toNumber(), 'diffY : ', diffY.toNumber())
|
|
||||||
console.log('ridgeBaseLength : ', ridgeBaseLength.toNumber())
|
|
||||||
console.log('Math.sign(diffX.toNumber()) : ', Math.sign(diffX.toNumber()), diffX.abs().minus(ridgeBaseLength).toNumber())
|
|
||||||
console.log('Math.sign(diffY.toNumber()) : ', Math.sign(diffY.toNumber()), diffY.abs().minus(ridgeBaseLength).toNumber())
|
|
||||||
endXPoint = startXPoint.plus(Big(Math.sign(diffX.toNumber())).times(diffX.abs().minus(ridgeBaseLength)))
|
endXPoint = startXPoint.plus(Big(Math.sign(diffX.toNumber())).times(diffX.abs().minus(ridgeBaseLength)))
|
||||||
endYPoint = startYPoint.plus(Big(Math.sign(diffY.toNumber())).times(diffY.abs().minus(ridgeBaseLength)))
|
endYPoint = startYPoint.plus(Big(Math.sign(diffY.toNumber())).times(diffY.abs().minus(ridgeBaseLength)))
|
||||||
console.log(
|
|
||||||
'intersectLine : ',
|
|
||||||
Big(intersectLine.x).minus(startXPoint).round(1).toNumber(),
|
|
||||||
Big(intersectLine.y).minus(startYPoint).round(1).toNumber(),
|
|
||||||
)
|
|
||||||
console.log('startXPoint : ', startXPoint.toNumber(), 'startYPoint : ', startYPoint.toNumber())
|
|
||||||
console.log('endXPoint : ', endXPoint.toNumber(), 'endYPoint : ', endYPoint.toNumber())
|
|
||||||
|
|
||||||
// 시작점에서 종료점까지의 평면길이
|
// 시작점에서 종료점까지의 평면길이
|
||||||
//startXPoint.minus(endXPoint).abs().pow(2).plus(startYPoint.minus(endYPoint).abs().pow(2)).sqrt()
|
//startXPoint.minus(endXPoint).abs().pow(2).plus(startYPoint.minus(endYPoint).abs().pow(2)).sqrt()
|
||||||
@ -1037,12 +993,14 @@ const drawRidge = (roof, canvas, textMode) => {
|
|||||||
}),
|
}),
|
||||||
).div(10)
|
).div(10)
|
||||||
// 현재 지붕선과 마주하는 지붕선을 잇는 선분의 교차점까지의 길이
|
// 현재 지붕선과 마주하는 지붕선을 잇는 선분의 교차점까지의 길이
|
||||||
const intersectLength = Big(calcLinePlaneSize({
|
const intersectLength = Big(
|
||||||
|
calcLinePlaneSize({
|
||||||
x1: midX.toNumber(),
|
x1: midX.toNumber(),
|
||||||
y1: midY.toNumber(),
|
y1: midY.toNumber(),
|
||||||
x2: intersectLine.x,
|
x2: intersectLine.x,
|
||||||
y2: intersectLine.y,
|
y2: intersectLine.y,
|
||||||
})).div(10)
|
}),
|
||||||
|
).div(10)
|
||||||
//마주하는 지붕선까지의 길이가 현재 지붕선의 이전, 다음 지붕선의 길이보다 작을때
|
//마주하는 지붕선까지의 길이가 현재 지붕선의 이전, 다음 지붕선의 길이보다 작을때
|
||||||
if (intersectLength.lt(Big(prevRoof.attributes.planeSize).div(10)) && intersectLength.lt(Big(nextRoof.attributes.planeSize).div(10))) {
|
if (intersectLength.lt(Big(prevRoof.attributes.planeSize).div(10)) && intersectLength.lt(Big(nextRoof.attributes.planeSize).div(10))) {
|
||||||
endXPoint = startXPoint
|
endXPoint = startXPoint
|
||||||
@ -1191,7 +1149,6 @@ export const segmentsOverlap = (line1, line2) => {
|
|||||||
* @param textMode
|
* @param textMode
|
||||||
*/
|
*/
|
||||||
const drawHips = (roof, canvas, textMode) => {
|
const drawHips = (roof, canvas, textMode) => {
|
||||||
console.log('textMode : ', textMode)
|
|
||||||
const roofLines = roof.lines
|
const roofLines = roof.lines
|
||||||
const ridgeLines = canvas?.getObjects().filter((object) => object.name === LINE_TYPE.SUBLINE.RIDGE && object.attributes.roofId === roof.id)
|
const ridgeLines = canvas?.getObjects().filter((object) => object.name === LINE_TYPE.SUBLINE.RIDGE && object.attributes.roofId === roof.id)
|
||||||
|
|
||||||
@ -1232,12 +1189,15 @@ const drawHips = (roof, canvas, textMode) => {
|
|||||||
}),
|
}),
|
||||||
actualSize:
|
actualSize:
|
||||||
prevDegree === currentDegree
|
prevDegree === currentDegree
|
||||||
? calcLineActualSize({
|
? calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x1,
|
x1: currentRoof.x1,
|
||||||
y1: currentRoof.y1,
|
y1: currentRoof.y1,
|
||||||
x2: ridgeCoordinate.x1,
|
x2: ridgeCoordinate.x1,
|
||||||
y2: ridgeCoordinate.y1,
|
y2: ridgeCoordinate.y1,
|
||||||
}, currentDegree)
|
},
|
||||||
|
currentDegree,
|
||||||
|
)
|
||||||
: 0,
|
: 0,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -1267,12 +1227,15 @@ const drawHips = (roof, canvas, textMode) => {
|
|||||||
}),
|
}),
|
||||||
actualSize:
|
actualSize:
|
||||||
prevDegree === currentDegree
|
prevDegree === currentDegree
|
||||||
? calcLineActualSize({
|
? calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x2,
|
x1: currentRoof.x2,
|
||||||
y1: currentRoof.y2,
|
y1: currentRoof.y2,
|
||||||
x2: ridgeCoordinate.x1,
|
x2: ridgeCoordinate.x1,
|
||||||
y2: ridgeCoordinate.y1,
|
y2: ridgeCoordinate.y1,
|
||||||
}, currentDegree)
|
},
|
||||||
|
currentDegree,
|
||||||
|
)
|
||||||
: 0,
|
: 0,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -1318,8 +1281,6 @@ const drawHips = (roof, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('currentRoof : ', currentRoof.length)
|
|
||||||
console.log(ridgePoints)
|
|
||||||
ridgePoints = ridgePoints.reduce((prev, current) => {
|
ridgePoints = ridgePoints.reduce((prev, current) => {
|
||||||
if (prev !== undefined) {
|
if (prev !== undefined) {
|
||||||
// Math.abs(prev.x - currentRoof.x1)
|
// Math.abs(prev.x - currentRoof.x1)
|
||||||
@ -1355,12 +1316,15 @@ const drawHips = (roof, canvas, textMode) => {
|
|||||||
}),
|
}),
|
||||||
actualSize:
|
actualSize:
|
||||||
prevDegree === currentDegree
|
prevDegree === currentDegree
|
||||||
? calcLineActualSize({
|
? calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x1,
|
x1: currentRoof.x1,
|
||||||
y1: currentRoof.y1,
|
y1: currentRoof.y1,
|
||||||
x2: ridgePoints.x,
|
x2: ridgePoints.x,
|
||||||
y2: ridgePoints.y,
|
y2: ridgePoints.y,
|
||||||
}, currentDegree)
|
},
|
||||||
|
currentDegree,
|
||||||
|
)
|
||||||
: 0,
|
: 0,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -1369,11 +1333,6 @@ const drawHips = (roof, canvas, textMode) => {
|
|||||||
roof.innerLines.push(hip)
|
roof.innerLines.push(hip)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
roof.innerLines.forEach((hip) => {
|
|
||||||
console.log('hip 길이 : ', hip.attributes.planeSize, ' actual : ', hip.attributes.actualSize)
|
|
||||||
hip.textMode = 'actual'
|
|
||||||
hip.addLengthText()
|
|
||||||
})
|
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,7 +1350,6 @@ const connectLinePoint = (polygon, canvas, textMode) => {
|
|||||||
const lineDegrees = [
|
const lineDegrees = [
|
||||||
...new Set(polygon.lines.map((line) => (line.attributes.pitch > 0 ? getDegreeByChon(line.attributes.pitch) : line.attributes.degree))),
|
...new Set(polygon.lines.map((line) => (line.attributes.pitch > 0 ? getDegreeByChon(line.attributes.pitch) : line.attributes.degree))),
|
||||||
]
|
]
|
||||||
console.log('lineDegrees : ', lineDegrees)
|
|
||||||
|
|
||||||
//마루
|
//마루
|
||||||
polygon.ridges.forEach((ridge) => {
|
polygon.ridges.forEach((ridge) => {
|
||||||
@ -1987,8 +1945,6 @@ const changeGableRoof = (currentRoof, canvas, textMode) => {
|
|||||||
hipLines = hipLines.filter(
|
hipLines = hipLines.filter(
|
||||||
(hip) => (hip.x1 === currentRoof.x1 && hip.y1 === currentRoof.y1) || (hip.x1 === currentRoof.x2 && hip.y1 === currentRoof.y2),
|
(hip) => (hip.x1 === currentRoof.x1 && hip.y1 === currentRoof.y1) || (hip.x1 === currentRoof.x2 && hip.y1 === currentRoof.y2),
|
||||||
)
|
)
|
||||||
console.log('ridgeLines : ', ridgeLines)
|
|
||||||
console.log('hipLines : ', hipLines)
|
|
||||||
|
|
||||||
if (hipLines === undefined || hipLines.length === 0) {
|
if (hipLines === undefined || hipLines.length === 0) {
|
||||||
hipLines = innerLines.filter(
|
hipLines = innerLines.filter(
|
||||||
@ -2076,12 +2032,15 @@ const changeGableRoof = (currentRoof, canvas, textMode) => {
|
|||||||
x2: midX.toNumber(),
|
x2: midX.toNumber(),
|
||||||
y2: midY.toNumber(),
|
y2: midY.toNumber(),
|
||||||
}),
|
}),
|
||||||
actualSize: calcLineActualSize({
|
actualSize: calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x1,
|
x1: currentRoof.x1,
|
||||||
y1: currentRoof.y1,
|
y1: currentRoof.y1,
|
||||||
x2: midX.toNumber(),
|
x2: midX.toNumber(),
|
||||||
y2: midY.toNumber(),
|
y2: midY.toNumber(),
|
||||||
}, Big(90 - prevDegree)),
|
},
|
||||||
|
Big(90 - prevDegree),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
canvas?.add(hip1)
|
canvas?.add(hip1)
|
||||||
@ -2376,8 +2335,8 @@ const changeHipAndGableRoof = (currentRoof, canvas, textMode) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const gableDegree = i === 0 ? prevDegree : nextDegree
|
|
||||||
hipLines.forEach((hip, i) => {
|
hipLines.forEach((hip, i) => {
|
||||||
|
const gableDegree = i === 0 ? prevDegree : nextDegree
|
||||||
const gableLine = new QLine([hip.x2, hip.y2, currentRoof.attributes.ridgeCoordinate.x1, currentRoof.attributes.ridgeCoordinate.y1], {
|
const gableLine = new QLine([hip.x2, hip.y2, currentRoof.attributes.ridgeCoordinate.x1, currentRoof.attributes.ridgeCoordinate.y1], {
|
||||||
parentId: roof.id,
|
parentId: roof.id,
|
||||||
fontSize: roof.fontSize,
|
fontSize: roof.fontSize,
|
||||||
@ -2602,7 +2561,7 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
let hipY1 = (Math.sign(currentRoof.y1 - midY) * currentRoof.attributes.width) / 2
|
let hipY1 = (Math.sign(currentRoof.y1 - midY) * currentRoof.attributes.width) / 2
|
||||||
|
|
||||||
const gableDegree = currentRoof.attributes.degree > 0 ? currentRoof.attributes.degree : getDegreeByChon(currentRoof.attributes.pitch)
|
const gableDegree = currentRoof.attributes.degree > 0 ? currentRoof.attributes.degree : getDegreeByChon(currentRoof.attributes.pitch)
|
||||||
const gable1 = new QLine([midX.plus(hipX1).toNumber(), midY.plus(hipY1).toNumber(), hipX2.toNumber(), hipY2.toNumber()], {
|
const gable1 = new QLine([midX.plus(hipX1).toNumber(), midY.plus(hipY1).toNumber(), hipX2, hipY2], {
|
||||||
parentId: roof.id,
|
parentId: roof.id,
|
||||||
fontSize: roof.fontSize,
|
fontSize: roof.fontSize,
|
||||||
stroke: '#1083E3',
|
stroke: '#1083E3',
|
||||||
@ -2615,15 +2574,15 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
planeSize: calcLinePlaneSize({
|
planeSize: calcLinePlaneSize({
|
||||||
x1: midX.plus(hipX1).toNumber(),
|
x1: midX.plus(hipX1).toNumber(),
|
||||||
y1: midY.plus(hipY1).toNumber(),
|
y1: midY.plus(hipY1).toNumber(),
|
||||||
x2: hipX2.toNumber(),
|
x2: hipX2,
|
||||||
y2: hipY2.toNumber(),
|
y2: hipY2,
|
||||||
}),
|
}),
|
||||||
actualSize: calcLineActualSize(
|
actualSize: calcLineActualSize(
|
||||||
{
|
{
|
||||||
x1: midX.plus(hipX1).toNumber(),
|
x1: midX.plus(hipX1).toNumber(),
|
||||||
y1: midY.plus(hipY1).toNumber(),
|
y1: midY.plus(hipY1).toNumber(),
|
||||||
x2: hipX2.toNumber(),
|
x2: hipX2,
|
||||||
y2: hipY2.toNumber(),
|
y2: hipY2,
|
||||||
},
|
},
|
||||||
Big(90 - gableDegree).toNumber(),
|
Big(90 - gableDegree).toNumber(),
|
||||||
),
|
),
|
||||||
@ -2639,7 +2598,7 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
hipX1 = (Math.sign(currentRoof.x2 - midX) * currentRoof.attributes.width) / 2
|
hipX1 = (Math.sign(currentRoof.x2 - midX) * currentRoof.attributes.width) / 2
|
||||||
hipY1 = (Math.sign(currentRoof.y2 - midY) * currentRoof.attributes.width) / 2
|
hipY1 = (Math.sign(currentRoof.y2 - midY) * currentRoof.attributes.width) / 2
|
||||||
|
|
||||||
const gable2 = new QLine([midX.plus(hipX1).toNumber(), midY.plus(hipY1).toNumber(), hipX2.toNumber(), hipY2.toNumber()], {
|
const gable2 = new QLine([midX.plus(hipX1).toNumber(), midY.plus(hipY1).toNumber(), hipX2, hipY2], {
|
||||||
parentId: roof.id,
|
parentId: roof.id,
|
||||||
fontSize: roof.fontSize,
|
fontSize: roof.fontSize,
|
||||||
stroke: '#1083E3',
|
stroke: '#1083E3',
|
||||||
@ -2652,15 +2611,15 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
planeSize: calcLinePlaneSize({
|
planeSize: calcLinePlaneSize({
|
||||||
x1: midX.plus(hipX1).toNumber(),
|
x1: midX.plus(hipX1).toNumber(),
|
||||||
y1: midY.plus(hipY1).toNumber(),
|
y1: midY.plus(hipY1).toNumber(),
|
||||||
x2: hipX2.toNumber(),
|
x2: hipX2,
|
||||||
y2: hipY2.toNumber(),
|
y2: hipY2,
|
||||||
}),
|
}),
|
||||||
actualSize: calcLineActualSize(
|
actualSize: calcLineActualSize(
|
||||||
{
|
{
|
||||||
x1: midX.plus(hipX1).toNumber(),
|
x1: midX.plus(hipX1).toNumber(),
|
||||||
y1: midY.plus(hipY1).toNumber(),
|
y1: midY.plus(hipY1).toNumber(),
|
||||||
x2: hipX2.toNumber(),
|
x2: hipX2,
|
||||||
y2: hipY2.toNumber(),
|
y2: hipY2,
|
||||||
},
|
},
|
||||||
Big(90 - gableDegree).toNumber(),
|
Big(90 - gableDegree).toNumber(),
|
||||||
),
|
),
|
||||||
@ -2705,12 +2664,15 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
roofId: roof.id,
|
roofId: roof.id,
|
||||||
currentRoofId: currentRoof.id,
|
currentRoofId: currentRoof.id,
|
||||||
planeSize: calcLinePlaneSize({ x1: currentRoof.x1, y1: currentRoof.y1, x2: gable1.x1, y2: gable1.y1 }),
|
planeSize: calcLinePlaneSize({ x1: currentRoof.x1, y1: currentRoof.y1, x2: gable1.x1, y2: gable1.y1 }),
|
||||||
actualSize: calcLineActualSize({
|
actualSize: calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x1,
|
x1: currentRoof.x1,
|
||||||
y1: currentRoof.y1,
|
y1: currentRoof.y1,
|
||||||
x2: gable1.x1,
|
x2: gable1.x1,
|
||||||
y2: gable1.y1,
|
y2: gable1.y1,
|
||||||
}, Big(90 - prevDegree).toNumber()),
|
},
|
||||||
|
Big(90 - prevDegree).toNumber(),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// const hip1Base = ((Math.abs(hip1.x1 - hip1.x2) + Math.abs(hip1.y1 - hip1.y2)) / 2) * 10
|
// const hip1Base = ((Math.abs(hip1.x1 - hip1.x2) + Math.abs(hip1.y1 - hip1.y2)) / 2) * 10
|
||||||
@ -2732,12 +2694,15 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
roofId: roof.id,
|
roofId: roof.id,
|
||||||
currentRoofId: currentRoof.id,
|
currentRoofId: currentRoof.id,
|
||||||
planeSize: calcLinePlaneSize({ x1: currentRoof.x2, y1: currentRoof.y2, x2: gable2.x1, y2: gable2.y1 }),
|
planeSize: calcLinePlaneSize({ x1: currentRoof.x2, y1: currentRoof.y2, x2: gable2.x1, y2: gable2.y1 }),
|
||||||
actualSize: calcLineActualSize({
|
actualSize: calcLineActualSize(
|
||||||
|
{
|
||||||
x1: currentRoof.x2,
|
x1: currentRoof.x2,
|
||||||
y1: currentRoof.y2,
|
y1: currentRoof.y2,
|
||||||
x2: gable2.x1,
|
x2: gable2.x1,
|
||||||
y2: gable2.y1,
|
y2: gable2.y1,
|
||||||
}, Big(90 - nextDegree).toNumber()),
|
},
|
||||||
|
Big(90 - nextDegree).toNumber(),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// const hip2Base = ((Math.abs(hip2.x1 - hip2.x2) + Math.abs(hip2.y1 - hip2.y2)) / 2) * 10
|
// const hip2Base = ((Math.abs(hip2.x1 - hip2.x2) + Math.abs(hip2.y1 - hip2.y2)) / 2) * 10
|
||||||
@ -2746,8 +2711,6 @@ const changeJerkInHeadRoof = (currentRoof, canvas, textMode) => {
|
|||||||
// hip2.attributes.actualSize = Math.round(Math.sqrt(Math.pow(hip2.attributes.planeSize, 2) + Math.pow(hip2Height, 2)))
|
// hip2.attributes.actualSize = Math.round(Math.sqrt(Math.pow(hip2.attributes.planeSize, 2) + Math.pow(hip2Height, 2)))
|
||||||
canvas?.add(hip2)
|
canvas?.add(hip2)
|
||||||
|
|
||||||
console.log('currentRoof.id : ', currentRoof.id)
|
|
||||||
|
|
||||||
// hip1.set({ visible: false })
|
// hip1.set({ visible: false })
|
||||||
hip1.setViewLengthText(false)
|
hip1.setViewLengthText(false)
|
||||||
// gable3.set({ visible: false })
|
// gable3.set({ visible: false })
|
||||||
@ -3253,7 +3216,6 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
const hips = roof.innerLines.filter(
|
const hips = roof.innerLines.filter(
|
||||||
(line) => (currentRoof.x1 === line.x1 && currentRoof.y1 === line.y1) || (currentRoof.x2 === line.x1 && currentRoof.y2 === line.y1),
|
(line) => (currentRoof.x1 === line.x1 && currentRoof.y1 === line.y1) || (currentRoof.x2 === line.x1 && currentRoof.y2 === line.y1),
|
||||||
)
|
)
|
||||||
// console.log('hips : ', hips)
|
|
||||||
|
|
||||||
const ridge = roof.innerLines
|
const ridge = roof.innerLines
|
||||||
.filter((line) => line.name === LINE_TYPE.SUBLINE.RIDGE)
|
.filter((line) => line.name === LINE_TYPE.SUBLINE.RIDGE)
|
||||||
@ -3279,41 +3241,17 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
return prevDistance < currentDistance ? prev : current
|
return prevDistance < currentDistance ? prev : current
|
||||||
}, null)
|
}, null)
|
||||||
/*console.log('currentRoof : ', currentRoof.attributes.planeSize, currentRoof)
|
|
||||||
console.log(
|
|
||||||
roof.innerLines
|
|
||||||
.filter((line) => line.name === LINE_TYPE.SUBLINE.RIDGE)
|
|
||||||
.filter((line) => {
|
|
||||||
if (currentRoof.x1 === currentRoof.x2) {
|
|
||||||
console.log('currentRoof.x1 === currentRoof.x2', line.x1 === line.x2, line)
|
|
||||||
if (line.x1 === line.x2) {
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('currentRoof.x1 !== currentRoof.x2', line.y1 === line.y2, line)
|
|
||||||
if (line.y1 === line.y2) {
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
console.log('currentRoof.x1 === currentRoof.x2 : ', currentRoof.x1 === currentRoof.x2)
|
|
||||||
console.log('ridge : ', ridge)
|
|
||||||
console.log('hips : ', hips)*/
|
|
||||||
let points = []
|
let points = []
|
||||||
if (hips.length === 2 && Math.abs(hips[0].x2 - hips[1].x2) < 1 && Math.abs(hips[0].y2 - hips[1].y2) < 1) {
|
if (hips.length === 2 && Math.abs(hips[0].x2 - hips[1].x2) < 1 && Math.abs(hips[0].y2 - hips[1].y2) < 1) {
|
||||||
// console.log('삼각')
|
|
||||||
const x1 = (currentRoof.x1 + currentRoof.x2) / 2
|
const x1 = (currentRoof.x1 + currentRoof.x2) / 2
|
||||||
const y1 = (currentRoof.y1 + currentRoof.y2) / 2
|
const y1 = (currentRoof.y1 + currentRoof.y2) / 2
|
||||||
points.push(x1, y1, hips[0].x2, hips[0].y2)
|
points.push(x1, y1, hips[0].x2, hips[0].y2)
|
||||||
} else if (hips.length > 1) {
|
} else if (hips.length > 1) {
|
||||||
// console.log('삼각 아님')
|
|
||||||
if (
|
if (
|
||||||
((ridge?.x1 === hips[0].x2 && ridge?.y1 === hips[0].y2) || (ridge?.x2 === hips[0].x2 && ridge?.y2 === hips[0].y2)) &&
|
((ridge?.x1 === hips[0].x2 && ridge?.y1 === hips[0].y2) || (ridge?.x2 === hips[0].x2 && ridge?.y2 === hips[0].y2)) &&
|
||||||
((ridge?.x1 === hips[1].x2 && ridge?.y1 === hips[1].y2) || (ridge?.x2 === hips[1].x2 && ridge?.y2 === hips[1].y2))
|
((ridge?.x1 === hips[1].x2 && ridge?.y1 === hips[1].y2) || (ridge?.x2 === hips[1].x2 && ridge?.y2 === hips[1].y2))
|
||||||
) {
|
) {
|
||||||
//사각이면 마루와 현재 라인 사이에 길이를 구한다
|
//사각이면 마루와 현재 라인 사이에 길이를 구한다
|
||||||
// console.log('사각')
|
|
||||||
if (Math.sign(currentRoof.x1 - currentRoof.x2) === 0) {
|
if (Math.sign(currentRoof.x1 - currentRoof.x2) === 0) {
|
||||||
const yPoints = [currentRoof.y1, currentRoof.y2, ridge.y1, ridge.y2].sort((a, b) => a - b)
|
const yPoints = [currentRoof.y1, currentRoof.y2, ridge.y1, ridge.y2].sort((a, b) => a - b)
|
||||||
const x1 = (currentRoof.x1 + currentRoof.x2) / 2
|
const x1 = (currentRoof.x1 + currentRoof.x2) / 2
|
||||||
@ -3338,7 +3276,6 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log('사각 아님')
|
|
||||||
if (Math.sign(currentRoof.x1 - currentRoof.x2) === 0) {
|
if (Math.sign(currentRoof.x1 - currentRoof.x2) === 0) {
|
||||||
let xPoints = []
|
let xPoints = []
|
||||||
xPoints.push(ridge?.x1, ridge?.x2)
|
xPoints.push(ridge?.x1, ridge?.x2)
|
||||||
@ -3424,7 +3361,6 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// console.log('else : ')
|
|
||||||
if (currentRoof.attributes.type === LINE_TYPE.WALLLINE.JERKINHEAD) {
|
if (currentRoof.attributes.type === LINE_TYPE.WALLLINE.JERKINHEAD) {
|
||||||
const gables = canvas
|
const gables = canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
@ -3461,6 +3397,7 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (points !== null) {
|
if (points !== null) {
|
||||||
|
const currentDegree = currentRoof.attributes.pitch > 0 ? getDegreeByChon(currentRoof.attributes.pitch) : currentRoof.attributes.degree
|
||||||
const pitchSizeLine = new QLine(points, {
|
const pitchSizeLine = new QLine(points, {
|
||||||
parentId: roof.id,
|
parentId: roof.id,
|
||||||
stroke: '#000000',
|
stroke: '#000000',
|
||||||
@ -3468,22 +3405,16 @@ const drawCenterLine = (roof, canvas, textMode) => {
|
|||||||
strokeDashArray: [5, 5],
|
strokeDashArray: [5, 5],
|
||||||
selectable: false,
|
selectable: false,
|
||||||
fontSize: roof.fontSize,
|
fontSize: roof.fontSize,
|
||||||
|
textMode: textMode,
|
||||||
attributes: {
|
attributes: {
|
||||||
roofId: roof.id,
|
roofId: roof.id,
|
||||||
type: 'pitchSizeLine',
|
type: 'pitchSizeLine',
|
||||||
|
planeSize: calcLineActualSize({ x1: points[0], y1: points[1], x2: points[2], y2: points[3] }, currentDegree),
|
||||||
|
actualSize: calcLineActualSize({ x1: points[0], y1: points[1], x2: points[2], y2: points[3] }, currentDegree),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
canvas.add(pitchSizeLine)
|
canvas.add(pitchSizeLine)
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
|
||||||
const adjust = Math.sqrt(
|
|
||||||
Math.pow(Math.round(Math.abs(pitchSizeLine.x1 - pitchSizeLine.x2) * 10), 2) +
|
|
||||||
Math.pow(Math.round(Math.abs(pitchSizeLine.y1 - pitchSizeLine.y2) * 10), 2),
|
|
||||||
)
|
|
||||||
const currentDegree = currentRoof.attributes.pitch > 0 ? getDegreeByChon(currentRoof.attributes.pitch) : currentRoof.attributes.degree
|
|
||||||
const height = Math.tan(currentDegree * (Math.PI / 180)) * adjust
|
|
||||||
const lengthText = Math.round(Math.sqrt(Math.pow(adjust, 2) + Math.pow(height, 2)))
|
|
||||||
pitchSizeLine.setLengthText(lengthText)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user