From c5dd7a402ae7fb3921ddd1cc83e7c129a16bf405 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 2 Jul 2019 20:54:49 +0800 Subject: [PATCH 1/2] update version --- package.json | 2 +- src/global.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e242c1a41f..3ba6024873 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "1.2.0-beta.0", + "version": "1.2.0-beta.1", "description": "Large-scale WebGL-powered Geospatial Data Visualization", "main": "build/l7.js", "browser": "build/l7.js", diff --git a/src/global.js b/src/global.js index 7dbbc33359..136c0eb7e2 100644 --- a/src/global.js +++ b/src/global.js @@ -5,7 +5,7 @@ // const Global = {}; const FONT_FAMILY = '"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"'; const Global = { - version: '1.2.0-beta.0', + version: '1.2.0-beta.1', scene: { mapType: 'AMAP', zoom: 5, From 1eef58a29a167c1045a7cf1c2cfee38d7b60cadc Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Mon, 8 Jul 2019 16:10:22 +0800 Subject: [PATCH 2/2] feat(attr): add pattern --- demos/03_choropleths_polygon.html | 1 + src/attr/filter.js | 8 ++++---- src/attr/index.js | 2 ++ src/attr/pattern.js | 16 ++++++++++++++++ src/core/layer.js | 4 ++++ src/global.js | 1 + 6 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/attr/pattern.js diff --git a/demos/03_choropleths_polygon.html b/demos/03_choropleths_polygon.html index a9c6ba4da4..0700fcf2b9 100644 --- a/demos/03_choropleths_polygon.html +++ b/demos/03_choropleths_polygon.html @@ -81,6 +81,7 @@ scene.on('loaded', () => { } }) .shape('fill') + .pattern('id1') .active(true) .style({ opacity: 1 diff --git a/src/attr/filter.js b/src/attr/filter.js index 6a0b29f650..4e2b24ea1b 100644 --- a/src/attr/filter.js +++ b/src/attr/filter.js @@ -1,15 +1,15 @@ /* * @Author: ThinkGIS * @Date: 2018-06-14 20:13:18 - * @Last Modified by: ThinkGIS - * @Last Modified time: 2018-07-15 17:26:40 + * @Last Modified by: mikey.zhaopeng + * @Last Modified time: 2019-07-08 15:46:28 */ import Base from './base'; /** - * 视觉通道 symbol - * @class Attr.symbol + * 视觉通道 filter + * @class Attr.filter */ class Filter extends Base { constructor(cfg) { diff --git a/src/attr/index.js b/src/attr/index.js index eb4d45ba47..ef233b0018 100644 --- a/src/attr/index.js +++ b/src/attr/index.js @@ -7,6 +7,7 @@ import Shape from './shape'; import Position from './position'; import Symbol from './symbol'; import Filter from './filter'; +import Pattern from './pattern'; Base.Color = Color; Base.Size = Size; @@ -15,5 +16,6 @@ Base.Shape = Shape; Base.Position = Position; Base.Symbol = Symbol; Base.Filter = Filter; +Base.Pattern = Pattern; export default Base; diff --git a/src/attr/pattern.js b/src/attr/pattern.js new file mode 100644 index 0000000000..be4b34d29f --- /dev/null +++ b/src/attr/pattern.js @@ -0,0 +1,16 @@ + +import Base from './base'; + +/** + * 视觉通道 pattern + * @class Attr.pattern + */ +class Pattern extends Base { + constructor(cfg) { + super(cfg); + this.names = [ 'pattern' ]; + this.type = 'pattern'; + this.gradient = null; + } +} +export default Pattern; diff --git a/src/core/layer.js b/src/core/layer.js index cc7c82f962..f20c8535bd 100644 --- a/src/core/layer.js +++ b/src/core/layer.js @@ -176,6 +176,10 @@ export default class Layer extends Base { this._createAttrOption('shape', field, values, Global.shape); return this; } + pattern(field, values) { + this._createAttrOption('pattern', field, values, Global.pattern); + return this; + } /** * 是否允许使用默认的图形激活交互 * @param {Boolean} enable 是否允许激活开关 diff --git a/src/global.js b/src/global.js index 136c0eb7e2..f7cbf95720 100644 --- a/src/global.js +++ b/src/global.js @@ -21,6 +21,7 @@ const Global = { colors: [ 'rgb(103,0,31)', 'rgb(178,24,43)', 'rgb(214,96,77)', 'rgb(244,165,130)', 'rgb(253,219,199)', 'rgb(247,247,247)', 'rgb(209,229,240)', 'rgb(146,197,222)', 'rgb(67,147,195)', 'rgb(33,102,172)', 'rgb(5,48,97)' ], size: 10000, shape: 'circle', + pattern: '', snapArray: [ 0, 1, 2, 4, 5, 10 ], pointShape: { '2d': [ 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica' ],