improvement: 设置color size 默认值

This commit is contained in:
thinkinggis 2020-03-25 23:56:42 +08:00
parent 7a71b92b17
commit a7d4991c23
13 changed files with 21 additions and 24 deletions

View File

@ -73,7 +73,7 @@ export default class Zoom extends Control {
!this.disabled && !this.disabled &&
this.mapsService.getZoom() < this.mapsService.getMaxZoom() this.mapsService.getZoom() < this.mapsService.getMaxZoom()
) { ) {
this.mapsService.zoomIn(); this.mapsService.zoomIn({});
} }
} }
private zoomOut() { private zoomOut() {
@ -81,7 +81,7 @@ export default class Zoom extends Control {
!this.disabled && !this.disabled &&
this.mapsService.getZoom() > this.mapsService.getMinZoom() this.mapsService.getZoom() > this.mapsService.getMinZoom()
) { ) {
this.mapsService.zoomOut(); this.mapsService.zoomOut({});
} }
} }
private createButton( private createButton(

View File

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

View File

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

View File

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

View File

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

View File

@ -86,7 +86,7 @@ export default class RegisterStyleAttributePlugin implements ILayerPlugin {
size: 4, size: 4,
update: (feature: IEncodeFeature, featureIdx: number) => { update: (feature: IEncodeFeature, featureIdx: number) => {
const { color } = feature; 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[], vertex: number[],
attributeIdx: number, attributeIdx: number,
) => { ) => {
const { size } = feature; const { size = 5 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number]; return Array.isArray(size) ? [size[0]] : [size as number];
}, },
}, },

View File

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

View File

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

View File

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

View File

@ -71,7 +71,7 @@ export default class ExtrudeModel extends BaseModel {
vertex: number[], vertex: number[],
attributeIdx: number, attributeIdx: number,
) => { ) => {
const { size } = feature; const { size = 10 } = feature;
return Array.isArray(size) ? [size[0]] : [size as number]; 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) { if (x && y && x1 && y1) {
// 弧线 或者线段 // 弧线 或者线段
// const prevLng = col[x];
// let lng = col[x1];
// lng += lng - prevLng > 180 ? -360 :
// prevLng - lng > 180 ? 360 : 0;
coords = [ coords = [
[parseFloat(col[x]), parseFloat(col[y])], [parseFloat(col[x]), parseFloat(col[y])],
[parseFloat(col[x1]), parseFloat(col[y1])], [parseFloat(col[x1]), parseFloat(col[y1])],

View File

@ -12,7 +12,7 @@ export default class ArcLineDemo extends React.Component {
public async componentDidMount() { public async componentDidMount() {
const response = await fetch( 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({ const scene = new Scene({
id: 'map', id: 'map',
@ -36,24 +36,17 @@ export default class ArcLineDemo extends React.Component {
y1: 'lat2', y1: 'lat2',
}, },
}) })
.size(1) // .size(1)
.shape('arc3d') .shape('arc')
.select({ .select({
color: 'red', color: 'red',
}) })
.active({ .active({
color: 'red', color: 'red',
}) })
.color('rgb(13,64,140)') // .color('rgb(13,64,140)')
.animate({
enable: true,
interval: 0.1,
duration: 2,
trailLength: 1.0,
})
.style({ .style({
lineType: 'dash', opacity: 1,
opacity: 0.5,
}); });
scene.addLayer(lineLayer); scene.addLayer(lineLayer);
scene.render(); scene.render();