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' ],