| | |
| | | leafer=new Leafer({ view: 'canvas' }) |
| | | substringData() |
| | | points.value=[] |
| | | |
| | | |
| | | /*const radius = 50 |
| | | const cornerPoints = [] |
| | | const startX = 0 + radius // 左上角右移 |
| | | const startY = 0 |
| | | const endX = 0 |
| | | const endY = 0 + radius // 左上角下移 |
| | | const segments = 8 // 圆弧分段数,越多越平滑 |
| | | for (let i = 0; i <= segments; i++) { |
| | | const angle = (Math.PI / 2) * (i / segments) // 90度角分段 |
| | | const x = radius - radius * Math.cos(angle) |
| | | const y = radius - radius * Math.sin(angle) |
| | | cornerPoints.push(x, y) |
| | | } |
| | | points.value = [ |
| | | 0, 100, |
| | | ...cornerPoints, // 左上角圆弧点 |
| | | radius, 0, // 回到圆弧起始点 |
| | | 100, 0, // 右上角 |
| | | 100, 100 // 右下角 |
| | | // 左下角 |
| | | |
| | | ]*/ |
| | | |
| | | |
| | | let state=0 |
| | | |
| | | if(select3.value=="3"){ |
| | | points.value.push(datas1.value +parseInt(a1.value)/big,datas2.value,datas1.value +a1.value/big,datas2.value-parseInt(a2.value)/big,datas1.value,datas2.value-parseInt(a2.value)/big) |
| | | }else if(select3.value=="2"){ |
| | | points.value.push(datas1.value +parseInt(a1.value)/big,datas2.value,datas1.value,datas2.value-parseInt(a2.value)/big) |
| | | }else if(select3.value=="1"){ |
| | | }else if(select3.value=="1"&&aValue.value!=="0"&&aValue.value!==""){ |
| | | state=parseInt(a1.value) |
| | | const radius = state/big |
| | | const cornerPoints = [] |
| | | const segments = 8 // 圆弧分段数,越多越平滑 |
| | | for (let i = 0; i <= segments; i++) { |
| | | const angle = (Math.PI / 2) * (i / segments); |
| | | const x = radius - radius * Math.sin(angle); |
| | | const y = datas2.value - radius * (1 - Math.cos(angle)); |
| | | cornerPoints.push(x, y); |
| | | } |
| | | points.value.push(...cornerPoints, 0, datas2.value-radius) |
| | | }else{ |
| | | points.value.push(datas1.value - (parseInt(data3.value) / big), datas2.value + (parseInt(data4.value) / big)) |
| | | } |
| | | |
| | |
| | | points.value.push(datas3.value,datas4.value+parseInt(parseInt(b2.value))/big,datas3.value +parseInt(b1.value)/big,datas4.value+parseInt(b2.value)/big,datas3.value +parseInt(b1.value)/big,datas4.value) |
| | | }else if(select1.value=="2"){ |
| | | points.value.push(datas3.value,datas4.value+parseInt(parseInt(b2.value))/big,datas3.value +parseInt(b1.value)/big,datas4.value) |
| | | }else if(select1.value=="1"){ |
| | | }else if(select1.value=="1"&&bValue.value!=="0"&&bValue.value!==""){ |
| | | state=parseInt(b1.value) |
| | | const radius = state/big |
| | | const cornerPoints = [] |
| | | const segments = 8 // 圆弧分段数,越多越平滑 |
| | | for (let i = 0; i <= segments; i++) { |
| | | const angle = (Math.PI / 2) * (i / segments) // 90度角分段 |
| | | const x = radius - radius * Math.cos(angle) |
| | | const y = radius - radius * Math.sin(angle) |
| | | cornerPoints.push(x, y) |
| | | } |
| | | points.value.push(...cornerPoints, radius, 0) |
| | | }else{ |
| | | points.value.push(datas3.value + (parseInt(data5.value) / big), datas4.value - (parseInt(data6.value) / big)) |
| | | } |
| | | |
| | |
| | | points.value.push(datas5.value-parseInt(c1.value)/big,datas6.value,datas5.value -parseInt(c1.value)/big,datas6.value+parseInt(c2.value)/big,datas5.value,datas6.value +parseInt(c2.value)/big) |
| | | }else if(select2.value=="2"){ |
| | | points.value.push(datas5.value-parseInt(c1.value)/big,datas6.value,datas5.value,datas6.value +parseInt(c2.value)/big) |
| | | }else if(select2.value=="1"){ |
| | | }else if(select2.value=="1"&&cValue.value!=="0"&&cValue.value!==""){ |
| | | state=parseInt(c1.value) |
| | | const radius = state/big |
| | | const cornerPoints = [] |
| | | const segments = 8 // 圆弧分段数,越多越平滑 |
| | | for (let i = 0; i <= segments; i++) { |
| | | const angle = (Math.PI / 2) * (i / segments); |
| | | const x = (datas5.value -radius) + radius * Math.sin(angle); |
| | | const y = radius * (1 - Math.cos(angle)); |
| | | cornerPoints.push(x, y); |
| | | } |
| | | points.value.push(...cornerPoints, datas5.value, radius) |
| | | }else{ |
| | | points.value.push(datas5.value + (parseInt(data1.value) / big), datas6.value + (parseInt(data2.value) / big)) |
| | | } |
| | | |
| | |
| | | points.value.push(datas7.value,datas8.value-parseInt(d2.value)/big,datas7.value -parseInt(d1.value)/big,datas8.value-parseInt(d2.value)/big,datas7.value -parseInt(d1.value)/big,datas8.value) |
| | | }else if(select4.value=="2"){ |
| | | points.value.push(datas7.value,datas8.value-parseInt(d2.value)/big,datas7.value -parseInt(d1.value)/big,datas8.value) |
| | | }else if(select4.value=="1"){ |
| | | }else if(select4.value=="1"&&dValue.value!=="0"&&dValue.value!==""){ |
| | | state=parseInt(d1.value) |
| | | const radius = state/big |
| | | const cornerPoints = [] |
| | | const segments = 8 // 圆弧分段数,越多越平滑 |
| | | for (let i = 0; i <= segments; i++) { |
| | | const angle = (Math.PI / 2) * (i / segments); |
| | | const x = datas5.value -(radius- radius * Math.cos(angle)); |
| | | const y = datas2.value -(radius- radius * Math.sin(angle)); |
| | | cornerPoints.push(x, y); |
| | | } |
| | | points.value.push(...cornerPoints, datas5.value-radius, datas2.value) |
| | | }else{ |
| | | points.value.push(datas7.value - (parseInt(data7.value) / big), datas8.value - (parseInt(data8.value) / big)) |
| | | } |
| | | |
| | | let state=0 |
| | | if(select1.value=="1"&&bValue.value!=="0"){ |
| | | state=parseInt(b1.value) |
| | | } |
| | | if(select2.value=="1"&&cValue.value!=="0"){ |
| | | state=parseInt(c1.value) |
| | | } |
| | | if(select3.value=="1"&&aValue.value!=="0"){ |
| | | state=parseInt(a1.value) |
| | | } |
| | | if(select4.value=="1"&&dValue.value!=="0"){ |
| | | state=parseInt(d1.value) |
| | | } |
| | | if((select1.value=="1"&&bValue.value!=="0")||(select2.value=="1"&&cValue.value!=="0")||(select3.value=="1"&&aValue.value!=="0")||(select4.value=="1"&&dValue.value!=="0")){ |
| | | const polygon = new Polygon({ |
| | | points: points.value, |
| | | stroke: '#f00', |
| | | zIndex:2, |
| | | }) |
| | | leafer.add(polygon) |
| | | |
| | | /*if((select1.value=="1"&&bValue.value!=="0")||(select2.value=="1"&&cValue.value!=="0")||(select3.value=="1"&&aValue.value!=="0")||(select4.value=="1"&&dValue.value!=="0")){ |
| | | const polygon = new Polygon({ |
| | | points: points.value, |
| | | stroke: '#f00', |
| | |
| | | zIndex:2, |
| | | }) |
| | | leafer.add(polygon) |
| | | } |
| | | }*/ |
| | | |
| | | fileJson.value.polygon=[parseInt(a1.value),parseInt(a2.value),parseInt(b1.value),parseInt(b2.value), |
| | | parseInt(c1.value),parseInt(c2.value),parseInt(d1.value),parseInt(d2.value)] |