improvement: 设置color size 默认值

This commit is contained in:
thinkinggis 2020-03-25 23:56:42 +08:00
parent 7a71b92b17
commit 1adc722ebe
12 changed files with 19 additions and 22 deletions

View File

@ -85,7 +85,7 @@ export default class CityBuildModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 10 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -73,7 +73,7 @@ export default class ArcModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -69,7 +69,7 @@ export default class Arc3DModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -71,7 +71,7 @@ export default class GreatCircleModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -86,7 +86,7 @@ export default class RegisterStyleAttributePlugin implements ILayerPlugin {
size: 4,
update: (feature: IEncodeFeature, featureIdx: number) => {
const { color } = feature;
return !color || !color.length ? [0, 0, 0, 0] : color;
return !color || !color.length ? [1, 1, 1, 1] : color;
},
},
});

View File

@ -114,7 +114,7 @@ export default class FillModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 5 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -67,7 +67,7 @@ export default class ImageModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 5 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -79,7 +79,7 @@ export default class NormalModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 1 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -231,7 +231,7 @@ export default class TextModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 12 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -71,7 +71,7 @@ export default class ExtrudeModel extends BaseModel {
vertex: number[],
attributeIdx: number,
) => {
const { size } = feature;
const { size = 10 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number];
},
},

View File

@ -18,6 +18,10 @@ export default function json(data: IJsonData, cfg: IParserCfg): IParserData {
} // 点数据
if (x && y && x1 && y1) {
// 弧线 或者线段
// const prevLng = col[x];
// let lng = col[x1];
// lng += lng - prevLng > 180 ? -360 :
// prevLng - lng > 180 ? 360 : 0;
coords = [
[parseFloat(col[x]), parseFloat(col[y])],
[parseFloat(col[x1]), parseFloat(col[y1])],

View File

@ -12,7 +12,7 @@ export default class ArcLineDemo extends React.Component {
public async componentDidMount() {
const response = await fetch(
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
'https://gw.alipayobjects.com/os/bmw-prod/4ededeaa-f290-46b7-a042-08210433e8f9.csv',
);
const scene = new Scene({
id: 'map',
@ -36,24 +36,17 @@ export default class ArcLineDemo extends React.Component {
y1: 'lat2',
},
})
.size(1)
.shape('arc3d')
// .size(1)
.shape('arc')
.select({
color: 'red',
})
.active({
color: 'red',
})
.color('rgb(13,64,140)')
.animate({
enable: true,
interval: 0.1,
duration: 2,
trailLength: 1.0,
})
// .color('rgb(13,64,140)')
.style({
lineType: 'dash',
opacity: 0.5,
opacity: 1,
});
scene.addLayer(lineLayer);
scene.render();