Compare commits
4 Commits
f5e315eb03
...
2625dcdd08
| Author | SHA1 | Date | |
|---|---|---|---|
| 2625dcdd08 | |||
| d0156bf838 | |||
| 559c085183 | |||
| a8c7d05278 |
@ -837,7 +837,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
roofId : roofId,
|
roofId : roofId,
|
||||||
attributes : {
|
attributes : {
|
||||||
type: 'eaveHelpLine',
|
type: 'eaveHelpLine',
|
||||||
isStart : true
|
isStart : true,
|
||||||
|
pitch: wallLine.attributes.pitch,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//coordinateText(line)
|
//coordinateText(line)
|
||||||
@ -888,7 +889,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||||
newPStart.y = wallBaseLine.y1
|
newPStart.y = wallBaseLine.y1
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_start' });
|
||||||
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
|
const newPointX = Big(roofLine.x1).plus(moveDist).abs().toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
||||||
@ -912,7 +913,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
||||||
newPEnd.y = wallBaseLine.y2
|
newPEnd.y = wallBaseLine.y2
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'left_in_end' });
|
||||||
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
|
const newPointX = Big(roofLine.x1).plus(moveDist).toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
||||||
@ -946,17 +947,26 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x1 < inLine.x2) {
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y2, x: inLine.x2 },{ y: bStartY, x: wallLine.x2 }, 'pink')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
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')
|
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||||
findPoints.push({ y: aStartY, x: newPStart.x });
|
findPoints.push({ y: aStartY, x: newPStart.x, position: 'left_out_start' });
|
||||||
}else{
|
}else{
|
||||||
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
||||||
newPStart.y = Big(newPStart.y).minus(cLineY).toNumber();
|
newPStart.y = Big(newPStart.y).minus(cLineY).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x1 < inLine.x2) {
|
||||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1},{ y: newPStart.y, x: newPStart.x }, 'purple')
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
newPStart.y = wallLine.y1;
|
newPStart.y = wallLine.y1;
|
||||||
}
|
}
|
||||||
@ -964,6 +974,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isStartEnd.end){
|
if(isStartEnd.end){
|
||||||
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
const moveDist = Big(wallLine.x1).minus(wallBaseLine.x1).abs().toNumber()
|
||||||
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
|
const aStartY = Big(roofLine.y2).plus(moveDist).toNumber()
|
||||||
@ -978,18 +989,27 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x1 < inLine.x2) {
|
||||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 }, { y: bStartY, x: wallLine.x1 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
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')
|
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'left_out_end' });
|
||||||
}else{
|
}else{
|
||||||
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
||||||
newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber();
|
newPEnd.y = Big(newPEnd.y).plus(cLineY).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x1 < inLine.x2) {
|
||||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: newPEnd.y, x: newPEnd.x }, 'purple')
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
newPEnd.y = wallLine.y2
|
newPEnd.y = wallLine.y2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,7 +1025,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
ePoint = {x: wallBaseLine.x1, y: wallBaseLine.y1};
|
||||||
newPStart.y = wallBaseLine.y1
|
newPStart.y = wallBaseLine.y1
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_start'});
|
||||||
const newPointX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
|
const newPointX = Big(roofLine.x1).minus(moveDist).abs().toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y1).minus(0).abs().toNumber()
|
||||||
@ -1029,7 +1049,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
ePoint = {x: wallBaseLine.x2, y: wallBaseLine.y2};
|
||||||
newPEnd.y = wallBaseLine.y2
|
newPEnd.y = wallBaseLine.y2
|
||||||
|
|
||||||
findPoints.push({ x: ePoint.x, y: ePoint.y });
|
findPoints.push({ x: ePoint.x, y: ePoint.y, position: 'right_in_end' });
|
||||||
const newPointX = Big(roofLine.x1).minus(moveDist).toNumber()
|
const newPointX = Big(roofLine.x1).minus(moveDist).toNumber()
|
||||||
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
const pDist = Big(wallLine.x1).minus(roofLine.x1).abs().toNumber()
|
||||||
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
const pLineY = Big(roofLine.y2).minus(0).abs().toNumber()
|
||||||
@ -1062,17 +1082,25 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
if(Math.abs(wallBaseLine.y1 - wallLine.y1) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x2 < inLine.x1) {
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: bStartY, x: wallLine.x2 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getAddLine({ y: bStartY, x: wallLine.x2 }, { y: roofLine.y1, x: wallLine.x1 }, 'magenta')
|
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')
|
getAddLine({ y: newLine.y1, x: newLine.x1 }, { y: newLine.y2, x: wallLine.x2 }, 'Gray')
|
||||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_start' });
|
||||||
}else{
|
}else{
|
||||||
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
const cLineY = Big(wallBaseLine.x1).minus(wallLine.x1).abs().toNumber()
|
||||||
newPStart.y = Big(newPStart.y).plus(cLineY).toNumber();
|
newPStart.y = Big(newPStart.y).plus(cLineY).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x2 < inLine.x1 ) {
|
||||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: newPStart.y, x: newPStart.x }, 'purple')
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
newPStart.y = wallLine.y1;
|
newPStart.y = wallLine.y1;
|
||||||
}
|
}
|
||||||
@ -1093,18 +1121,26 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
let idx = (roofLines.length < index + 1)?0:index
|
let idx = (roofLines.length < index + 1)?0:index
|
||||||
const newLine = roofLines[idx+1];
|
const newLine = roofLines[idx+1];
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x2 < inLine.x1) {
|
||||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: inLine.y2, x: inLine.x2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: bStartY, x: wallLine.x1 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
if(Math.abs(wallBaseLine.y2 - wallLine.y2) < 0.1) {
|
||||||
getAddLine({ y: bStartY, x: wallLine.x1 }, { y: roofLine.y2, x: wallLine.x2 }, 'magenta')
|
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')
|
getAddLine({ y: newLine.y2, x: newLine.x2 }, { y: newLine.y1, x: wallLine.x1 }, 'Gray')
|
||||||
findPoints.push({ y: aStartY, x: newPEnd.x });
|
findPoints.push({ y: aStartY, x: newPEnd.x, position: 'right_out_end' });
|
||||||
}else{
|
}else{
|
||||||
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
const cLineY = Big(wallBaseLine.x2).minus(wallLine.x2).abs().toNumber()
|
||||||
newPEnd.y = Big(newPEnd.y).minus(cLineY).toNumber();
|
newPEnd.y = Big(newPEnd.y).minus(cLineY).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.x2 < inLine.x1) {
|
||||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 }, { y: newPEnd.y, x: newPEnd.x }, 'purple')
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
newPEnd.y = wallLine.y2;
|
newPEnd.y = wallLine.y2;
|
||||||
}
|
}
|
||||||
@ -1156,7 +1192,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
let idx = (0 >= index - 1)?roofLines.length:index
|
let idx = (0 >= index - 1)?roofLines.length:index
|
||||||
const pLineY = roofLines[idx-1].y1
|
const pLineY = roofLines[idx-1].y1
|
||||||
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
||||||
findPoints.push({ x: sPoint.x, y: sPoint.y });
|
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_start' });
|
||||||
|
|
||||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
@ -1177,7 +1213,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
let idx = roofLines.length < index + 1 ? 0 : index
|
let idx = roofLines.length < index + 1 ? 0 : index
|
||||||
const pLineY = roofLines[idx + 1].y2
|
const pLineY = roofLines[idx + 1].y2
|
||||||
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
||||||
findPoints.push({ x: sPoint.x, y: sPoint.y })
|
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'top_in_end' });
|
||||||
|
|
||||||
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
if (Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||||
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
@ -1202,17 +1238,26 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 > inLine.y1 ) {
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ x: inLine.x1, y: inLine.y1 }, { x: bStartX, y: wallLine.y1 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
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')
|
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_start' });
|
||||||
}else{
|
}else{
|
||||||
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
||||||
newPStart.x = Big(newPStart.x).plus(cLineX).toNumber();
|
newPStart.x = Big(newPStart.x).plus(cLineX).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 > inLine.y1 ) {
|
||||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 }, { y: newPStart.y, x: newPStart.x } , 'purple')
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
newPStart.x = wallLine.x1;
|
newPStart.x = wallLine.x1;
|
||||||
}
|
}
|
||||||
@ -1233,17 +1278,26 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 > inLine.y1 ){
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ x: inLine.x1, y: inLine.y1 },{ x: bStartX, y: wallLine.y1 }, 'pink')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
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')
|
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'top_out_end' });
|
||||||
}else{
|
}else{
|
||||||
const cLineX = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
|
const cLineX = Big(wallLine.y2).minus(wallBaseLine.y2).abs().toNumber()
|
||||||
newPEnd.x = Big(newPEnd.x).minus(cLineX).toNumber();
|
newPEnd.x = Big(newPEnd.x).minus(cLineX).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 > inLine.y1 ) {
|
||||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: newPEnd.y, x: newPEnd.x }, 'purple')
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
newPEnd.x = wallLine.x2;
|
newPEnd.x = wallLine.x2;
|
||||||
}
|
}
|
||||||
@ -1264,7 +1318,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
let idx = (0 > index - 1)?roofLines.length:index
|
let idx = (0 > index - 1)?roofLines.length:index
|
||||||
const pLineY = roofLines[idx-1].y1
|
const pLineY = roofLines[idx-1].y1
|
||||||
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
getAddLine({ x: newPStart.x, y: newPStart.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
||||||
findPoints.push({ x: sPoint.x, y: sPoint.y });
|
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_start' });
|
||||||
|
|
||||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
@ -1286,7 +1340,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
let idx = (roofLines.length < index + 1)?0:index
|
let idx = (roofLines.length < index + 1)?0:index
|
||||||
const pLineY = roofLines[idx+1].y2
|
const pLineY = roofLines[idx+1].y2
|
||||||
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
getAddLine({ x: newPEnd.x, y: newPEnd.y }, { x: sPoint.x, y: sPoint.y }, 'blue')
|
||||||
findPoints.push({ x: sPoint.x, y: sPoint.y });
|
findPoints.push({ x: sPoint.x, y: sPoint.y, position: 'bottom_in_end' });
|
||||||
|
|
||||||
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||||
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
getAddLine({ x: pLineX, y: pLineY }, { x: pLineX, y: newPointY }, 'green')
|
||||||
@ -1312,17 +1366,25 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
if(Math.abs(wallBaseLine.x1 - wallLine.x1) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 < inLine.y1 ) {
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ x: inLine.x1, y: inLine.y1 },{ x: bStartX, y: wallLine.y1 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x1, y: wallLine.y1 }, 'magenta')
|
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')
|
getAddLine({ x: newLine.x1, y: newLine.y1 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'bottom_out_start' });
|
||||||
}else{
|
}else{
|
||||||
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
const cLineX = Big(wallBaseLine.y1).minus(wallLine.y1).abs().toNumber()
|
||||||
newPStart.x = Big(newPStart.x).minus(cLineX).toNumber();
|
newPStart.x = Big(newPStart.x).minus(cLineX).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPStart.y, x: newPStart.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 < inLine.y1 ) {
|
||||||
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPStart.y, x: newPStart.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 }, { y: newPStart.y, x: newPStart.x }, 'purple')
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
newPStart.x = wallLine.x1;
|
newPStart.x = wallLine.x1;
|
||||||
}
|
}
|
||||||
@ -1344,17 +1406,25 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
if(Math.abs(wallBaseLine.x2 - wallLine.x2) < 0.1) {
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 < inLine.y1 ) {
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: inLine.x2, y: inLine.y2 }, 'pink')
|
||||||
|
}else{
|
||||||
|
getAddLine({ x: inLine.x2, y: inLine.y2 }, { x: bStartX, y: wallLine.y1 }, 'pink')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getAddLine({ x: bStartX, y: wallLine.y1 }, { x: roofLine.x2, y: wallLine.y2 }, 'magenta')
|
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')
|
getAddLine({ x: newLine.x2, y: newLine.y2 }, { x: newLine.x1, y: wallLine.y1 }, 'Gray')
|
||||||
findPoints.push({ x: aStartX, y: newPEnd.y });
|
findPoints.push({ x: aStartX, y: newPEnd.y, position: 'bottom_out_end' });
|
||||||
}else{
|
}else{
|
||||||
const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
|
const cLineX = Big(wallBaseLine.y2).minus(wallLine.y2).abs().toNumber()
|
||||||
newPEnd.x = Big(newPEnd.x).plus(cLineX).toNumber();
|
newPEnd.x = Big(newPEnd.x).plus(cLineX).toNumber();
|
||||||
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
const inLine = findLineContainingPoint(innerLines, { y: newPEnd.y, x: newPEnd.x })
|
||||||
if(inLine){
|
if(inLine){
|
||||||
|
if(inLine.y2 < inLine.y1 ) {
|
||||||
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
getAddLine({ y: newPEnd.y, x: newPEnd.x }, { y: inLine.y2, x: inLine.x2 }, 'purple')
|
||||||
|
}else{
|
||||||
|
getAddLine({ y: inLine.y1, x: inLine.x1 },{ y: newPEnd.y, x: newPEnd.x }, 'purple')
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
newPEnd.x = wallLine.x2;
|
newPEnd.x = wallLine.x2;
|
||||||
}
|
}
|
||||||
@ -1385,8 +1455,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode) => {
|
|||||||
|
|
||||||
if (findPoints.length > 0) {
|
if (findPoints.length > 0) {
|
||||||
// 모든 점에 대해 라인 업데이트를 누적
|
// 모든 점에 대해 라인 업데이트를 누적
|
||||||
return findPoints.reduce((lines, point) => {
|
return findPoints.reduce((innerLines, point) => {
|
||||||
return updateAndAddLine(lines, point);
|
return updateAndAddLine(innerLines, point);
|
||||||
}, [...innerLines]);
|
}, [...innerLines]);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3027,7 +3097,73 @@ function updateAndAddLine(innerLines, targetPoint) {
|
|||||||
|
|
||||||
// 단순 거리 비교: 타겟 포인트가 시작점에 더 가까우면 시작점을 수정(isUpdatingStart = true)
|
// 단순 거리 비교: 타겟 포인트가 시작점에 더 가까우면 시작점을 수정(isUpdatingStart = true)
|
||||||
//무조건 start
|
//무조건 start
|
||||||
const isUpdatingStart = true //distanceToStart < distanceToEnd;
|
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;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "top_out_start"){
|
||||||
|
if(foundLine.y2 >= foundLine.y1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "top_out_end"){
|
||||||
|
if(foundLine.y2 > foundLine.y1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "bottom_out_start"){
|
||||||
|
if(foundLine.y2 <= foundLine.y1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "bottom_out_end"){
|
||||||
|
if(foundLine.y2 <= foundLine.y1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "left_out_start"){
|
||||||
|
if(foundLine.x2 >= foundLine.x1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "left_out_end"){
|
||||||
|
if(foundLine.x2 >= foundLine.x1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "right_out_start"){
|
||||||
|
if(foundLine.x2 <= foundLine.x1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}else if(targetPoint.position === "right_out_end"){
|
||||||
|
if(foundLine.x2 <= foundLine.x1){
|
||||||
|
isUpdatingStart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const updatedLine = {
|
const updatedLine = {
|
||||||
...foundLine,
|
...foundLine,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user