fix(source): 带洞的多边形不能正常绘制

This commit is contained in:
thinkinggis 2020-07-03 14:33:01 +08:00
parent 7fc223415c
commit 2b8ef495d9
6 changed files with 32 additions and 18 deletions

View File

@ -34,9 +34,9 @@ order: 2
- strokeWidth 文字描边宽度
- textAllowOverlap 是否允许文字压盖
- opacity 标注透明度
- spacing: `number` 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
- padding: `[number, number]` 文本相对锚点的偏移量 [x, y]
其他包括 text [style 的配置](../layer/point_layer/text#style)
- spacing: `number` 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
- padding: `[number, number]` 文本相对锚点的偏移量 [x, y]
其他包括 text [style 的配置](../layer/point_layer/text#style)
- fill 填充配置项 支持数据映射
- color 图层填充颜色,支持常量和数据映射

View File

@ -70,9 +70,9 @@ DrillDownLayer 提供默认提供通过 Layer 的交互事件,实现上钻下
- strokeWidth `number` 描边宽度 `2`
- textAllowOverlap: `boolean` 文字是否允许压盖 `true`
- opacity `number` 透明度 `1`
- spacing: `number` 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
- padding: `[number, number]` 文本相对锚点的偏移量 [x, y]
其他包括 text [style 的配置](../layer/point_layer/text#style)
- spacing: `number` 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
- padding: `[number, number]` 文本相对锚点的偏移量 [x, y]
其他包括 text [style 的配置](../layer/point_layer/text#style)
#### bubbleOption

View File

@ -87,7 +87,6 @@ export function polygonTriangulation(feature: IEncodeFeature) {
const { coordinates } = feature;
const flattengeo = earcut.flatten(coordinates as number[][][]);
const { vertices, dimensions, holes } = flattengeo;
return {
indices: earcut(vertices, holes, dimensions),
vertices,

View File

@ -48,7 +48,7 @@ export default function geoJSON(
(currentFeature: Feature<Geometries, Properties>, featureIndex: number) => {
const coord = getCoords(currentFeature);
const id = featureIndex;
if (currentFeature.geometry.type === 'Polygon') {
if (currentFeature.geometry.type === 'MultiPolygon') {
coord.forEach((coor) => {
const dataItem = {
...currentFeature.properties,

View File

@ -27,7 +27,9 @@ export default class HeatMapLayerDemo extends React.Component {
)
.then((res) => res.json())
.then((data) => {
const layer = new HeatmapLayer({})
const layer = new HeatmapLayer({
autoFit: true,
})
.source(data, {
parser: {
type: 'json',
@ -36,7 +38,7 @@ export default class HeatMapLayerDemo extends React.Component {
},
})
.size('count', [0, 1])
.shape('heatmap3D')
.shape('heatmap')
// weight映射通道
.style({
intensity: 10,
@ -55,6 +57,15 @@ export default class HeatMapLayerDemo extends React.Component {
},
});
scene.addLayer(layer);
setTimeout(() => {
layer.style({
rampColors: {
colors: ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'],
positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0],
},
});
console.log('更新完成')
}, 2000);
});
});

View File

@ -133,14 +133,18 @@ export default class TextLayerDemo extends React.Component {
})
.size('childrenNum', [10, 100000000])
// .color('red')
.color('childrenNum', [
'#D92568',
'#E3507E',
'#FC7AAB',
'#F1D3E5',
'#A7B5E3',
'#F2EEFF',
])
// .color('childrenNum', [
// '#D92568',
// '#E3507E',
// '#FC7AAB',
// '#F1D3E5',
// '#A7B5E3',
// '#F2EEFF',
// ])
.color('childrenNum*name', (childrenNum, name) => {
console.log(childrenNum, name);
return 'red';
})
.style({
opacity: 1.0,
});