You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
608 lines
15 KiB
JavaScript
608 lines
15 KiB
JavaScript
const createAxisInfo = (size, minSize = 0) => {
|
|
const textY = minSize ? (360 / (size + (-minSize))) * minSize - 30 : -30;
|
|
let data = {};
|
|
let prps = [
|
|
{
|
|
type: 'plan',
|
|
size: 50,
|
|
color: 0x1890ff,
|
|
},
|
|
{
|
|
type: 'curveLine',
|
|
line: [
|
|
[0, minSize ? 0 : size / 2, 0],
|
|
[0, minSize ? minSize : 0, 90],
|
|
[0, size, 270],
|
|
[0, minSize ? 0 : size / 2, 360],
|
|
],
|
|
color: 0x1890ff,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, minSize, 0,
|
|
0, size, 0,
|
|
0, size, 360,
|
|
0, minSize, 360,
|
|
0, minSize, 0,
|
|
|
|
0, 0, 0,
|
|
50, 0, 0,
|
|
50, 0, 360,
|
|
0, 0, 360,
|
|
0, 0, 0,
|
|
|
|
// 0, minSize, 0,
|
|
// 0, size, 0,
|
|
// 50, size, 0,
|
|
// 50, minSize, 0,
|
|
// 0, minSize, 0,
|
|
],
|
|
color: 0x1890ff,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, 0, 90,
|
|
50, 0, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
10, 0, 0,
|
|
10, 0, 360,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'X',
|
|
num: 4,
|
|
margin: 10,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, (minSize ? minSize + (size / 2) : size / 4), 0,
|
|
0, (minSize ? minSize + (size / 2) : size / 4), 360,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Y',
|
|
num: 3,
|
|
margin: minSize ? size / 2 : size / 4,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, minSize, 90,
|
|
0, size, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
// {
|
|
// type: 'line',
|
|
// line: [
|
|
// 10, minSize, 0,
|
|
// 10, size, 0,
|
|
// ],
|
|
// color: 0xcccccc,
|
|
// position: 'X',
|
|
// num: 4,
|
|
// margin: 10,
|
|
// },
|
|
// {
|
|
// type: 'line',
|
|
// line: [
|
|
// 0, (minSize ? minSize + (size / 4) : size / 4), 0,
|
|
// 50, (minSize ? minSize + (size / 4) : size / 4), 0,
|
|
// ],
|
|
// color: 0xcccccc,
|
|
// position: 'Y',
|
|
// num: 3 + (minSize ? -minSize / (size / 4) : 0),
|
|
// margin: size / 4,
|
|
// },
|
|
{
|
|
type: 'text',
|
|
content: ['0'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['10'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [288, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['20'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [216, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['30'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [144, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['40'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [72, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['50'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#FF0000',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, -40, 360],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['0'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#0000cc',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [390, -40, 330],
|
|
textAlign: 'right',
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['90'],
|
|
w: 55,
|
|
h: 25,
|
|
color: '#0000cc',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [380, -40, 250],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['180'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: '#0000cc',
|
|
size: 20.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [380, -40, 160],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['270'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
size: 20.3,
|
|
color: '#0000cc',
|
|
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [380, -40, 70],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['360'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: '#0000cc',
|
|
size: 20.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [380, -40, -20],
|
|
},
|
|
]
|
|
let prpd = [
|
|
{
|
|
type: 'curveLine',
|
|
line: [
|
|
[0, minSize ? 0 : size / 2, 0],
|
|
[0, minSize ? minSize : 0, 90],
|
|
[0, size, 270],
|
|
[0, minSize ? 0 : size / 2, 360],
|
|
],
|
|
color: 0x1890ff,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, minSize, 0,
|
|
0, size, 0,
|
|
0, size, 360,
|
|
0, minSize, 360,
|
|
0, minSize, 0,
|
|
|
|
],
|
|
color: 0x1890ff,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, 0, 90,
|
|
50, 0, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, (minSize ? minSize + (size / 2) : size / 4), 0,
|
|
0, (minSize ? minSize + (size / 2) : size / 4), 360,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Y',
|
|
num: 3,
|
|
margin: minSize ? size / 2 : size / 4,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, minSize, 90,
|
|
0, size, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['0'],
|
|
w: 40,
|
|
h: 25,
|
|
color: '#0000cc',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, textY, 355],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['90'],
|
|
w: 47,
|
|
h: 25,
|
|
color: '#0000cc',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, textY, 270],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['180'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: '#0000cc',
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, textY, 180],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['270'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: '#0000cc',
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, textY, 90],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['360'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: '#0000cc',
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [360, textY, 0],
|
|
},
|
|
];
|
|
let prpd3d = [
|
|
{
|
|
type: 'plan',
|
|
line: [minSize ? size * 2 : size, 360, minSize],
|
|
color: 0x32494B,
|
|
},
|
|
{
|
|
type: 'curveLine',
|
|
line: [
|
|
[minSize ? 0 : size / 2, 0, 0],
|
|
[size, 0, 90],
|
|
[minSize, 0, 270],
|
|
[minSize ? 0 : size / 2, 0, 360],
|
|
],
|
|
color: 0xcccccc,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
minSize, 0, 0,
|
|
size, 0, 0,
|
|
size, 0, 360,
|
|
minSize, 0, 360,
|
|
minSize, 0, 0,
|
|
|
|
0, 0, 0,
|
|
0, 50, 0,
|
|
0, 50, 360,
|
|
0, 0, 360,
|
|
0, 0, 0,
|
|
],
|
|
color: 0xcccccc,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
minSize, 0, 90,
|
|
size, 0, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
(minSize ? minSize + (size / 2) : size / 4), 0, 0,
|
|
(minSize ? minSize + (size / 2) : size / 4), 0, 360,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'X',
|
|
num: 3,
|
|
margin: (minSize ? size / 2 : size / 4),
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, 0, 90,
|
|
0, 50, 90,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Z',
|
|
num: 3,
|
|
margin: 90,
|
|
},
|
|
{
|
|
type: 'line',
|
|
line: [
|
|
0, 10, 0,
|
|
0, 10, 360,
|
|
],
|
|
color: 0xcccccc,
|
|
position: 'Y',
|
|
num: 4,
|
|
margin: 10,
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['0'],
|
|
w: 40,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 20, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['10'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 72, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['20'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 144, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['30'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 216, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['40'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 288, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['50'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, 360, 380],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['0'],
|
|
w: 40,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? 200 : 400, -40, 330],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['90'],
|
|
w: 47,
|
|
h: 25,
|
|
color: 0xcccccc,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? 200 : 400, -40, 230],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['180'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: 0xcccccc,
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? 200 : 400, -40, 140],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['270'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: 0xcccccc,
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? 200 : 400, -40, 50],
|
|
},
|
|
{
|
|
type: 'text',
|
|
content: ['360'],
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
color: 0xcccccc,
|
|
size: 22.3,
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? 200 : 400, -40, -40],
|
|
},
|
|
]
|
|
let set = [7.2, 360 / (size + (-minSize)), 1];
|
|
let isGIS = size <= 80;
|
|
let YAxisText = minSize ? [
|
|
[size, 180],
|
|
[size / 2, 90],
|
|
[0, 0],
|
|
[minSize / 2, -90],
|
|
[minSize, -180],
|
|
] : [
|
|
[isGIS ? size == 80 ? 0 : `-${80 - size}` : size],
|
|
[isGIS ? `-${80 - (size * 0.75)}` : size * 0.75,],
|
|
[isGIS ? `-${80 - (size * 0.5)}` : size * 0.5,],
|
|
[isGIS ? `-${80 - (0.25 * size)}` : size * 0.25,],
|
|
[isGIS ? `-80` : 0,],
|
|
];
|
|
let infoNum = [
|
|
{
|
|
w: 55,
|
|
h: 25,
|
|
size: 16,
|
|
}, {
|
|
w: 55,
|
|
h: 25,
|
|
size: 22.3,
|
|
}, {
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
size: 20.3,
|
|
}, {
|
|
w: 75,
|
|
h: 25,
|
|
ch: 9,
|
|
cw: 5.7,
|
|
size: 20.3,
|
|
}, {
|
|
w: 115,
|
|
h: 32,
|
|
size: 28.3,
|
|
}
|
|
]
|
|
YAxisText.forEach((item, index) => {
|
|
item[0] = item[0].toString();
|
|
let length = item[0].length;
|
|
let info = {
|
|
type: 'text',
|
|
content: item,
|
|
w: infoNum[length - 1].w,
|
|
h: infoNum[length - 1].h,
|
|
cw: length >= 3 ? 5.7 : '',
|
|
ch: length >= 3 ? 9 : '',
|
|
size: infoNum[length - 1].size,
|
|
color: '#2E8B57',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [index, minSize ? item[1] : 360 - (index * 90), length === 1 ? 410 : 430],
|
|
textAlign: 'right',
|
|
};
|
|
let infoPrpd = {
|
|
type: 'text',
|
|
content: item,
|
|
w: infoNum[length - 1].w,
|
|
h: infoNum[length - 1].h,
|
|
cw: length >= 3 ? 5.7 : '',
|
|
ch: length >= 3 ? 9 : '',
|
|
size: infoNum[length - 1].size,
|
|
color: '#2E8B57',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [0, minSize ? item[1] : 360 - (index * 90), length === 1 ? 385 : 395],
|
|
textAlign: 'right',
|
|
};
|
|
let info3d = {
|
|
type: 'text',
|
|
content: item,
|
|
w: infoNum[length - 1].w,
|
|
h: infoNum[length - 1].h,
|
|
cw: length >= 3 ? 5.7 : '',
|
|
ch: length >= 3 ? 9 : '',
|
|
size: infoNum[length - 1].size,
|
|
color: '#2E8B57',
|
|
font: 'normal 500px Arial,sans-serif',
|
|
xyz: [minSize ? item[1] - 20 : 360 - (index * 90), -40, 380],
|
|
textAlign: 'right',
|
|
};
|
|
prps.push(info);
|
|
prpd.push(infoPrpd);
|
|
prpd3d.push(info3d);
|
|
})
|
|
data[size] = { set, prps, prpd, prpd3d }
|
|
return data;
|
|
}
|
|
export { createAxisInfo } |