Skip to content

Commit 968b0af

Browse files
committed
【API】【openlayers】
1.高性能图层新增要素设置和清除接口 2.高性能图层要素类Graphic支持设置要素属性 3.fix 高性能图层类相关注释
1 parent cbcd2a1 commit 968b0af

File tree

8 files changed

+227
-28
lines changed

8 files changed

+227
-28
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@
106106

107107
- `SuperMap.ThemeStyle` 参数 `strokeDashstyle` 类型 `dashot` 更改为 `dashdot`
108108

109+
- `ol.source.Graphic` 新增接口:
110+
111+
- `setGraphics`: 设置点要素
112+
113+
- `addGraphics`: 追加点要素
114+
115+
- `clear`: 移除所有要素
116+
117+
- `removeGraphics`: 移除所有要素
118+
119+
120+
- 高性能图层要素类 `ol.Graphic` 更改接口和参数:
121+
122+
- options新增参数 `attributes`,支持设置要素属性
123+
124+
- 增加 `setAttributes``getAttributes`接口
125+
109126
### for MapboxGL
110127

111128
- 废弃 `SuperMap.ElasticSearch``options.change` 参数,直接使用 `SuperMap.ElasticSearch.msearch` `SuperMap.ElasticSearch.msearch``callback` 参数

dist/iclient9-openlayers.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.js

Lines changed: 115 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31911,28 +31911,31 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
3191131911
/**
3191231912
* @class ol.Graphic
3191331913
* @category Visualization Graphic
31914-
* @classdesc 高效率点图层点要素类。
31915-
* @param geometry - {Object} 几何对象
31914+
* @classdesc 高效率点图层点要素类
31915+
* @param geometry - [ol.geom.Point]{@linkdoc-openlayers/ol.geom.Point} 几何对象
31916+
* @param attributes - {Object} 要素属性
3191631917
* @extends ol.Object{@linkdoc-openlayers/ol.Object}
3191731918
*/
3191831919
var Graphic = exports.Graphic = function (_ol$Object) {
3191931920
_inherits(Graphic, _ol$Object);
3192031921

31921-
function Graphic(geometry) {
31922+
function Graphic(geometry, attributes) {
3192231923
_classCallCheck(this, Graphic);
3192331924

3192431925
var _this = _possibleConstructorReturn(this, (Graphic.__proto__ || Object.getPrototypeOf(Graphic)).call(this));
3192531926

3192631927
if (geometry instanceof _openlayers2.default.geom.Geometry) {
3192731928
_this.geometry_ = geometry;
3192831929
}
31930+
_this.attributes_ = attributes;
3192931931
_this.setStyle();
3193031932
return _this;
3193131933
}
3193231934

3193331935
/**
3193431936
* @function ol.Graphic.prototype.clone
31935-
* @description 复制当前信息
31937+
* @description 克隆当前要素
31938+
* @return {ol.Graphic} 克隆后的要素
3193631939
*/
3193731940

3193831941

@@ -31942,13 +31945,15 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3194231945
var clone = new Graphic();
3194331946
clone.setId(this.id_);
3194431947
clone.setGeometry(this.geometry_);
31948+
clone.setAttributes(this.attributes_);
3194531949
clone.setStyle(this.style_);
3194631950
return clone;
3194731951
}
3194831952

3194931953
/**
3195031954
* @function ol.Graphic.prototype.getId
3195131955
* @description 获取当前ID
31956+
* @return {string} id
3195231957
*/
3195331958

3195431959
}, {
@@ -31959,7 +31964,8 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3195931964

3196031965
/**
3196131966
* @function ol.Graphic.prototype.setId
31962-
* @description 设置当前ID
31967+
* @description 设置当前要素ID
31968+
* @param id -{string} 要素ID
3196331969
*/
3196431970

3196531971
}, {
@@ -31970,7 +31976,8 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3197031976

3197131977
/**
3197231978
* @function ol.Graphic.prototype.getGeometry
31973-
* @description 获取当前几何信息
31979+
* @description 获取当前要素几何信息
31980+
* @return [ol.geom.Point]{@linkdoc-openlayers/ol.geom.Point} 要素几何信息
3197431981
*/
3197531982

3197631983
}, {
@@ -31981,8 +31988,8 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3198131988

3198231989
/**
3198331990
* @function ol.Graphic.prototype.setGeometry
31984-
* @description 设置当前几何信息
31985-
* @param geometry -{Object} 几何参数
31991+
* @description 设置当前要素几何信息
31992+
* @param geometry -[ol.geom.Point]{@linkdoc-openlayers/ol.geom.Point} 要素几何信息
3198631993
*/
3198731994

3198831995
}, {
@@ -31991,9 +31998,34 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3199131998
this.geometry_ = geometry;
3199231999
}
3199332000

32001+
/**
32002+
* @function ol.Graphic.prototype.setAttributes
32003+
* @description 设置要素属性
32004+
* @param attributes - {Object} 属性对象
32005+
*/
32006+
32007+
}, {
32008+
key: 'setAttributes',
32009+
value: function setAttributes(attributes) {
32010+
this.attributes_ = attributes;
32011+
}
32012+
32013+
/**
32014+
* @function ol.Graphic.prototype.getAttributes
32015+
* @description 获取要素属性
32016+
* @return {Object} 要素属性
32017+
*/
32018+
32019+
}, {
32020+
key: 'getAttributes',
32021+
value: function getAttributes() {
32022+
return this.attributes_;
32023+
}
32024+
3199432025
/**
3199532026
* @function ol.Graphic.prototype.getStyle
3199632027
* @description 获取样式
32028+
* @return [ol.style.Image]{@linkdoc-openlayers/ol.style.Image} ol.style.Image子类样式对象
3199732029
*/
3199832030

3199932031
}, {
@@ -32005,7 +32037,7 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3200532037
/**
3200632038
* @function ol.Graphic.prototype.setStyle
3200732039
* @description 设置样式
32008-
* @param style - {Object} 样式参数
32040+
* @param style - [ol.style.Image]{@linkdoc-openlayers/ol.style.Image} 样式,ol.style.Image子类样式对象
3200932041
*/
3201032042

3201132043
}, {
@@ -32021,6 +32053,7 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3202132053
/**
3202232054
* @function ol.Graphic.prototype.getStyleFunction
3202332055
* @description 获取样式函数
32056+
* @return {Function} 样式函数
3202432057
*/
3202532058

3202632059
}, {
@@ -32046,6 +32079,7 @@ var Graphic = exports.Graphic = function (_ol$Object) {
3204632079
value: function destroy() {
3204732080
this.id_ = null;
3204832081
this.geometry_ = null;
32082+
this.attributes_ = null;
3204932083
this.style_ = null;
3205032084
}
3205132085
}], [{
@@ -62949,7 +62983,8 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6294962983
* @description 获取在视图上的要素
6295062984
* @param coordinate -{string} 坐标
6295162985
* @param resolution -{number} 分辨率
62952-
* @param callback -{function} 回调函数
62986+
* @param callback -{function} 回调函数
62987+
* @param evtPixel - [ol.Pixel]{@linkdoc-openlayers/ol.html#.Pixel} 当前选中的屏幕像素坐标
6295362988
*/
6295462989
function _forEachFeatureAtCoordinate(coordinate, resolution, callback, evtPixel) {
6295562990
var graphics = me.getGraphicsInExtent();
@@ -62984,13 +63019,77 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6298463019
}
6298563020

6298663021
/**
62987-
* @function ol.source.Graphic.prototype._highLightClose
62988-
* @description 关闭高亮要素显示
62989-
* @private
63022+
* @function ol.source.Graphic.prototype.setGraphics
63023+
* @description 设置绘制的点要素,会覆盖之前的所有要素
63024+
* @param {Array<ol.Graphic>} graphics - 点要素对象数组
6299063025
*/
6299163026

6299263027

6299363028
_createClass(Graphic, [{
63029+
key: 'setGraphics',
63030+
value: function setGraphics(graphics) {
63031+
this.graphics_ = [];
63032+
var sGraphics = !_Util.Util.isArray(graphics) ? [graphics] : graphics.concat([]);
63033+
this.graphics_ = [].concat(sGraphics);
63034+
this.update();
63035+
}
63036+
63037+
/**
63038+
* @function ol.source.Graphic.prototype.addGraphics
63039+
* @description 追加点要素,不会覆盖之前的要素
63040+
* @param {Array<ol.Graphic>} graphics - 点要素对象数组
63041+
*/
63042+
63043+
}, {
63044+
key: 'addGraphics',
63045+
value: function addGraphics(graphics) {
63046+
this.graphics_ = this.graphics_ || [];
63047+
var sGraphics = !_Util.Util.isArray(graphics) ? [graphics] : graphics.concat([]);
63048+
this.graphics_ = this.graphics_.concat(sGraphics);
63049+
this.update();
63050+
}
63051+
63052+
/**
63053+
* @function ol.source.Graphic.prototype.clear
63054+
* @description 清除所有要素
63055+
*/
63056+
63057+
}, {
63058+
key: 'clear',
63059+
value: function clear() {
63060+
this.removeGraphics();
63061+
}
63062+
63063+
/**
63064+
* @function ol.source.Graphic.prototype.removeGraphics
63065+
* @description 清除所有要素
63066+
*/
63067+
63068+
}, {
63069+
key: 'removeGraphics',
63070+
value: function removeGraphics() {
63071+
this.graphics_ = [];
63072+
this.update();
63073+
}
63074+
63075+
/**
63076+
* @function ol.source.Graphic.prototype.update
63077+
* @description 更新图层
63078+
*/
63079+
63080+
}, {
63081+
key: 'update',
63082+
value: function update() {
63083+
this.changed();
63084+
}
63085+
63086+
/**
63087+
* @function ol.source.Graphic.prototype._highLightClose
63088+
* @description 关闭高亮要素显示
63089+
* @private
63090+
*/
63091+
63092+
}, {
6299463093
key: '_highLightClose',
6299563094
value: function _highLightClose() {
6299663095
this.selected = null;
@@ -63004,6 +63103,8 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6300463103
/**
6300563104
* @function ol.source.Graphic.prototype._highLight
6300663105
* @description 高亮显示选中要素
63106+
* @param center - {Array<number>} 中心点
63107+
* @param image - {ol.style.Style} 点样式
6300763108
* @param selectGraphic - {ol.Graphic} 高效率点图层点要素
6300863109
* @param evtPixel - [ol.Pixel]{@linkdoc-openlayers/ol.html#.Pixel} 当前选中的屏幕像素坐标
6300963110
* @private
@@ -66052,7 +66153,7 @@ module.exports = function (proj4) {
6605266153
/* 338 */
6605366154
/***/ (function(module) {
6605466155

66055-
module.exports = {"_args":[["proj4@2.3.15","E:\\git\\iClient9"]],"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"http://registry.npm.taobao.org/proj4/download/proj4-2.3.15.tgz","_spec":"2.3.15","_where":"E:\\git\\iClient9","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
66156+
module.exports = {"_from":"proj4@2.3.15","_id":"proj4@2.3.15","_inBundle":false,"_integrity":"sha1-WtBui8owvg/6OJpJ5FZfUfBtCJ4=","_location":"/proj4","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"proj4@2.3.15","name":"proj4","escapedName":"proj4","rawSpec":"2.3.15","saveSpec":null,"fetchSpec":"2.3.15"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/proj4/-/proj4-2.3.15.tgz","_shasum":"5ad06e8bca30be0ffa389a49e4565f51f06d089e","_spec":"proj4@2.3.15","_where":"F:\\dev\\iClient","author":"","bugs":{"url":"https://github.com/proj4js/proj4js/issues"},"bundleDependencies":false,"contributors":[{"name":"Mike Adair","email":"madair@dmsolutions.ca"},{"name":"Richard Greenwood","email":"rich@greenwoodmap.com"},{"name":"Calvin Metcalf","email":"calvin.metcalf@gmail.com"},{"name":"Richard Marsden","url":"http://www.winwaed.com"},{"name":"T. Mittan"},{"name":"D. Steinwand"},{"name":"S. Nelson"}],"dependencies":{"mgrs":"~0.0.2"},"deprecated":false,"description":"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.","devDependencies":{"browserify":"~12.0.1","chai":"~1.8.1","curl":"git://github.com/cujojs/curl.git","grunt":"~0.4.2","grunt-browserify":"~4.0.1","grunt-cli":"~0.1.13","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0","grunt-contrib-uglify":"~0.11.1","grunt-mocha-phantomjs":"~0.4.0","istanbul":"~0.2.4","mocha":"~1.17.1","tin":"~0.4.0"},"directories":{"test":"test","doc":"docs"},"homepage":"https://github.com/proj4js/proj4js#readme","jam":{"main":"dist/proj4.js","include":["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},"license":"MIT","main":"lib/index.js","name":"proj4","repository":{"type":"git","url":"git://github.com/proj4js/proj4js.git"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},"version":"2.3.15"};
6605666157

6605766158
/***/ }),
6605866159
/* 339 */

dist/iclient9-openlayers.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iclient9-openlayers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/include-openlayers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
inputScript("https://cdn.bootcss.com/Turf.js/4.6.1/turf.min.js");
4747
}
4848
if (!inArray(excludes, 'iclient9-openlayers')) {
49-
inputScript("../../dist/iclient9-openlayers.js");
49+
inputScript("../../dist/iclient9-openlayers.min.js");
5050
}
5151
if (!inArray(excludes, 'iclient9-openlayers-css')) {
5252
inputCSS("../../dist/iclient9-openlayers.min.css");

src/openlayers/overlay/Graphic.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ export class Graphic extends ol.source.ImageCanvas {
135135
* @description 获取在视图上的要素
136136
* @param coordinate -{string} 坐标
137137
* @param resolution -{number} 分辨率
138-
* @param callback -{function} 回调函数
138+
* @param callback -{function} 回调函数
139+
* @param evtPixel - [ol.Pixel]{@linkdoc-openlayers/ol.html#.Pixel} 当前选中的屏幕像素坐标
139140
*/
140141
function _forEachFeatureAtCoordinate(coordinate, resolution, callback, evtPixel) {
141142
let graphics = me.getGraphicsInExtent();
@@ -168,6 +169,55 @@ export class Graphic extends ol.source.ImageCanvas {
168169

169170
}
170171

172+
/**
173+
* @function ol.source.Graphic.prototype.setGraphics
174+
* @description 设置绘制的点要素,会覆盖之前的所有要素
175+
* @param {Array<ol.Graphic>} graphics - 点要素对象数组
176+
*/
177+
setGraphics(graphics) {
178+
this.graphics_ = [];
179+
let sGraphics = !Util.isArray(graphics) ? [graphics] : graphics.concat([]);
180+
this.graphics_ = [].concat(sGraphics);
181+
this.update();
182+
}
183+
184+
/**
185+
* @function ol.source.Graphic.prototype.addGraphics
186+
* @description 追加点要素,不会覆盖之前的要素
187+
* @param {Array<ol.Graphic>} graphics - 点要素对象数组
188+
*/
189+
addGraphics(graphics) {
190+
this.graphics_ = this.graphics_ || [];
191+
let sGraphics = !Util.isArray(graphics) ? [graphics] : graphics.concat([]);
192+
this.graphics_ = this.graphics_.concat(sGraphics);
193+
this.update();
194+
}
195+
196+
/**
197+
* @function ol.source.Graphic.prototype.clear
198+
* @description 清除所有要素
199+
*/
200+
clear() {
201+
this.removeGraphics();
202+
}
203+
204+
/**
205+
* @function ol.source.Graphic.prototype.removeGraphics
206+
* @description 清除所有要素
207+
*/
208+
removeGraphics() {
209+
this.graphics_ = [];
210+
this.update();
211+
}
212+
213+
/**
214+
* @function ol.source.Graphic.prototype.update
215+
* @description 更新图层
216+
*/
217+
update() {
218+
this.changed();
219+
}
220+
171221
/**
172222
* @function ol.source.Graphic.prototype._highLightClose
173223
* @description 关闭高亮要素显示
@@ -185,6 +235,8 @@ export class Graphic extends ol.source.ImageCanvas {
185235
/**
186236
* @function ol.source.Graphic.prototype._highLight
187237
* @description 高亮显示选中要素
238+
* @param center - {Array<number>} 中心点
239+
* @param image - {ol.style.Style} 点样式
188240
* @param selectGraphic - {ol.Graphic} 高效率点图层点要素
189241
* @param evtPixel - [ol.Pixel]{@linkdoc-openlayers/ol.html#.Pixel} 当前选中的屏幕像素坐标
190242
* @private

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy