수정중
This commit is contained in:
parent
3d69966e15
commit
6c8b424afd
@ -411,16 +411,45 @@ export const skeletonBuilder = (roofId, canvas, textMode) => {
|
|||||||
const absDy = Math.abs(dy)
|
const absDy = Math.abs(dy)
|
||||||
|
|
||||||
// 거리가 0이면 이미 같은 위치
|
// 거리가 0이면 이미 같은 위치
|
||||||
if (absDx === 0 && absDy === 0) return point
|
// if (absDx === 0 && absDy === 0) return point
|
||||||
|
|
||||||
const step = Math.min(absDx, absDy)
|
const step = Math.min(absDx, absDy)
|
||||||
if (step === 0) return point
|
// if (step === 0) return point
|
||||||
|
|
||||||
const nextX = point.x + Math.sign(dx) * step
|
const nextX = point.x + Math.sign(dx) * step
|
||||||
const nextY = point.y + Math.sign(dy) * step
|
const nextY = point.y + Math.sign(dy) * step
|
||||||
return {
|
return {
|
||||||
x: Number(nextX.toFixed(1)),
|
x: nextX,
|
||||||
y: Number(nextY.toFixed(1))
|
y: nextY
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const maxContactDistance = orderedBaseLinePoints.reduce((max, point, index) => {
|
||||||
|
const contactPoint = roofLineContactPoints[index]
|
||||||
|
if (!contactPoint) return max
|
||||||
|
const dist = Math.hypot(contactPoint.x - point.x, contactPoint.y - point.y)
|
||||||
|
return Math.max(max, dist)
|
||||||
|
}, 0)
|
||||||
|
|
||||||
|
let changRoofLinePoints = orderedBaseLinePoints.map((point, index) => {
|
||||||
|
const contactPoint = roofLineContactPoints[index]
|
||||||
|
if (!contactPoint) return point
|
||||||
|
|
||||||
|
const dx = contactPoint.x - point.x
|
||||||
|
const dy = contactPoint.y - point.y
|
||||||
|
const len = Math.hypot(dx, dy)
|
||||||
|
|
||||||
|
// 거리가 0이면 이미 같은 위치
|
||||||
|
if (len === 0) return point
|
||||||
|
|
||||||
|
const step = maxContactDistance
|
||||||
|
if (step === 0) return point
|
||||||
|
|
||||||
|
const nextX = point.x + (dx / len) * step
|
||||||
|
const nextY = point.y + (dy / len) * step
|
||||||
|
return {
|
||||||
|
x: nextX,
|
||||||
|
y: nextY
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -430,7 +459,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('points:', roofLineContactPoints)
|
console.log('points:', roofLineContactPoints)
|
||||||
const geoJSONPolygon = toGeoJSON(roofLineContactPoints)
|
const geoJSONPolygon = toGeoJSON(changRoofLinePoints)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// SkeletonBuilder는 닫히지 않은 폴리곤을 기대하므로 마지막 점 제거
|
// SkeletonBuilder는 닫히지 않은 폴리곤을 기대하므로 마지막 점 제거
|
||||||
@ -440,7 +469,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => {
|
|||||||
// 스켈레톤 데이터를 기반으로 내부선 생성
|
// 스켈레톤 데이터를 기반으로 내부선 생성
|
||||||
roof.innerLines = roof.innerLines || []
|
roof.innerLines = roof.innerLines || []
|
||||||
roof.innerLines = createInnerLinesFromSkeleton(roofId, canvas, skeleton, textMode)
|
roof.innerLines = createInnerLinesFromSkeleton(roofId, canvas, skeleton, textMode)
|
||||||
|
console.log("roofInnerLines:::", roof.innerLines);
|
||||||
// 캔버스에 스켈레톤 상태 저장
|
// 캔버스에 스켈레톤 상태 저장
|
||||||
if (!canvas.skeletonStates) {
|
if (!canvas.skeletonStates) {
|
||||||
canvas.skeletonStates = {}
|
canvas.skeletonStates = {}
|
||||||
@ -1900,7 +1929,7 @@ function addRawLine(id, skeletonLines, p1, p2, lineType, color, width, pitch, is
|
|||||||
};
|
};
|
||||||
|
|
||||||
skeletonLines.push(newLine);
|
skeletonLines.push(newLine);
|
||||||
console.log('skeletonLines', skeletonLines);
|
//console.log('skeletonLines', skeletonLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user