변별로 설정 1차 운영서버 반영

This commit is contained in:
Jaeyoung Lee 2025-12-17 17:33:16 +09:00
parent f3cd10931d
commit 3a8769bd91
2 changed files with 2013 additions and 473 deletions

View File

@ -2,11 +2,10 @@ import { fabric } from 'fabric'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { QLine } from '@/components/fabric/QLine' import { QLine } from '@/components/fabric/QLine'
import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util' import { distanceBetweenPoints, findTopTwoIndexesByDistance, getDirectionByPoint, sortedPointLessEightPoint, sortedPoints } from '@/util/canvas-util'
import { calculateAngle, drawGableRoof, drawRidgeRoof, drawShedRoof, toGeoJSON } from '@/util/qpolygon-utils' import { calculateAngle, drawGableRoof, drawRoofByAttribute, drawShedRoof, toGeoJSON } from '@/util/qpolygon-utils'
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common' import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
import Big from 'big.js' import Big from 'big.js'
import { drawSkeletonRidgeRoof } from '@/util/skeleton-utils'
export const QPolygon = fabric.util.createClass(fabric.Polygon, { export const QPolygon = fabric.util.createClass(fabric.Polygon, {
type: 'QPolygon', type: 'QPolygon',
@ -313,14 +312,18 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
} }
const getParallelEavesLines = function (shedLines, lines) { const getParallelEavesLines = function (shedLines, lines) {
const eavesLines = lines.filter((line) => line.attributes?.type === LINE_TYPE.WALLLINE.EAVES)
const referenceAngle = calculateAngle(shedLines[0].startPoint, shedLines[0].endPoint) const referenceAngle = calculateAngle(shedLines[0].startPoint, shedLines[0].endPoint)
const otherSideLines = lines.filter((line) => {
return eavesLines.filter((line) => { const lineAngle = calculateAngle(line.startPoint, line.endPoint)
const eavesAngle = calculateAngle(line.startPoint, line.endPoint) return Math.abs(referenceAngle - lineAngle) === 180
return Math.abs(referenceAngle - eavesAngle) === 180
}) })
const containNotEaves = otherSideLines.filter((line) => line.attributes?.type !== LINE_TYPE.WALLLINE.EAVES)
if (containNotEaves.length === 0) {
return otherSideLines
} else {
return []
}
} }
const parallelEaves = getParallelEavesLines(shedLines, lines) const parallelEaves = getParallelEavesLines(shedLines, lines)
@ -346,7 +349,7 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
drawShedRoof(this.id, this.canvas, textMode) drawShedRoof(this.id, this.canvas, textMode)
} else { } else {
console.log('변별로 설정') console.log('변별로 설정')
drawRidgeRoof(this.id, this.canvas, textMode) drawRoofByAttribute(this.id, this.canvas, textMode)
} }
}, },

File diff suppressed because it is too large Load Diff