@@ -313,6 +313,48 @@ Zondy.Source.MapDocSource = MapDocSource;
313313/// <param {string} opt_name 图层名称,无实际意义可为null.</param>
314314/// <param {string} opt_docName 要显示的地图文档名称.</param>
315315/// <param name="opt_options" type="Object">属性键值对</param>
316+ /**
317+ * @class Zondy.Map.Doc
318+ * @classdesc Doc显示矢量地图文档,与MapDocTileLayer的区别是Doc方法只会返回一张图片,而MapDocTileLayer会将地图裁成多张返回
319+ * @description Zondy.Map.Doc
320+ * @param opt_name - {String} 可选项,显示瓦片地图的名称,无实际意义,可为NULL。
321+ * @param opt_docName - {String} 必选项,动态裁图的矢量地图文档的名称(IGServer上发布的实际名称)
322+ * @param opt_options - {Object} 必选项,设置其他属性键值对对象。对象中的属性来自本类的属性。例如:{key1:value1, key2:value2 …}
323+ * @param {String } [opt_options.ip = ''] 必选项,服务器ip地址,本地为“127.0.0.1”或“localhost”。
324+ * @param {String } [opt_options.port = '6163'] 必选项,服务器端口号,默认值6163
325+ * @param {String } [opt_options.token = ''] 可选项,服务访问控制,如果在 MapGIS Server Manager 服务管理中开启token,须设置此项,其key值可在设置处获取。
326+ * @param {String } [opt_options.f = 'png'] 可选项,图像类型,取值为:jpg|png|gif,默认值png
327+ * @param {String } [opt_options.layers = ''] 可选项,控制矢量地图文档中图层的显示,显示状态有四种形式:show:表示只显示指定图层;hide:表示隐藏不需要显示的图层;include:表示显示除默认图层(地图文档内图层状态为可见的图层)外,另追加指定图层;exclude:表示从默认图层列表里删除指定图层后进行显示;语法为:“layers=显示状态:图层序号,图层序号...”,如“layers=show:1,2,3”。当不设置此项时,表示显示全部图层。
328+ * @param {String } [opt_options.filters = 'false'] 可选项,图层过滤条件,它由多个键值对组成,值为您所要设定的过滤条件。如:'1:ID>4,3:ID>1”。过滤条件中用到的符号包括“==”、“!=”、“<”、“>”、“<=”、“>=”、“..”、“~”等,当包含中文条件时,请使用UTF-8编码格式,其中“:”和“,”为保留字符,用于表示键值对概念和分隔不同图层的条件,请不要将这2个字符用于自定义条件中,javascitpt中请使用encodeURI()函数编码后再代入filters参数中。
329+ * @param {Zondy.Object.CDisplayStyle } [opt_options.style = ''] 可选项,地图文档显示样式参数
330+ * @param {Zondy.Object.CGetImageBySRSID } [opt_options.proj = ''] 可选项,动态投影参数,设置地图文档在服务器端重新投影所需的空间参考系对象。
331+ * @param {String } [opt_options.guid = ''] 可选项,地图文档缓存的唯一标识,一般无需赋值。
332+ * @example
333+ <script type="text/javascript">
334+ //定义地图文档图层和地图
335+ var mapDocLayer, map;
336+ // 初始化地图显示
337+ function init() {
338+ //初始化地图容器
339+ map = new ol.Map({
340+ target: "mapCon",
341+ view: new ol.View({
342+ center: [(108.34341 + 116.150939561213) / 2, (29.0125822276524 + 33.2932017737021) / 2],
343+ zoom: 6,
344+ projection: "EPSG:4326"
345+ })
346+ });
347+ var { protocol, ip, port } = window.webclient;
348+ //初始化地图文档图层对象
349+ mapDocLayer = new Zondy.Map.Doc("MapGIS IGS MapDocLayer", "Hubei4326", {
350+ ip: `${ip}`,
351+ port: `${port}`
352+ });
353+ //将地图文档图层加载到地图中
354+ map.addLayer(mapDocLayer);
355+ }
356+ </script>
357+ */
316358var Doc = function ( opt_name , opt_docName , opt_options ) {
317359 this . options = opt_options ? opt_options : { } ;
318360
@@ -339,6 +381,12 @@ inherits(Doc, ImageLayer);
339381 * Source for MapGIS servers
340382 * 刷新地图,重新取图,但保留了原有的GUID的标识
341383 */
384+ /**
385+ * @function Zondy.Map.Doc.refresh
386+ * @description 刷新地图,重新取图,但保留了原有的guid的标识。
387+ * @example
388+ * mapDocLayer.refresh()
389+ */
342390Doc . prototype . refresh = function ( ) {
343391 this . setSource ( null ) ;
344392
@@ -365,6 +413,14 @@ Doc.prototype.refresh = function () {
365413 * 获取地图样式
366414 * 样式类型 Zondy.Object.CDisplayStyle
367415 */
416+
417+ /**
418+ * @function Zondy.Map.Doc.getStyle
419+ * @description 获取地图文档显示样式参数信息。
420+ * @return {Zondy.Object.CDisplayStyle[] } 描述地图文档显示样式的参数信息.
421+ * @example
422+ * mapDocLayer.getStyle()
423+ */
368424Doc . prototype . getStyle = function ( ) {
369425 return this . options . style !== undefined ? this . options . style : null ;
370426} ;
@@ -373,6 +429,13 @@ Doc.prototype.getStyle = function () {
373429 * Source for MapGIS servers
374430 * 设置地图样式
375431 */
432+ /**
433+ * @function Zondy.Map.Doc.setStyle(opt_style)
434+ * @description 设置地图文档显示样式参数信息。
435+ * @param opt_style - {Zondy.Object.CDisplayStyle[]} 地图文档显示样式参数。
436+ * @example
437+ * mapDocLayer.setStyle(opt_style)
438+ */
376439Doc . prototype . setStyle = function ( opt_style ) {
377440 if ( opt_style !== undefined && opt_style !== null ) {
378441 this . style = opt_style ;
@@ -385,6 +448,17 @@ Doc.prototype.setStyle = function (opt_style) {
385448 * opt_layers 指定需要被取图的图层序列号,以“,”分隔,如1,2,3
386449 * opt_type 状态类型,赋值类型为Zondy.Enum.Map.LayerStatusType
387450 */
451+ /**
452+ * @function Zondy.Map.Doc.setLayerStatus(opt_layers, opt_type)
453+ * @description 设置地图文档显示样式参数信息。
454+ * @param opt_layers - {String} 指定需要被取图的图层序列号,以“,”分隔,如“1,2,3”
455+ * @param opt_type - {Zondy.Enum.Map.LayerStatusType} 图层状态类型,show:只显示show参数指定了图层序号的图层,
456+ * hide:显示除hide参数指定图层外所有的图层,include:除显示默认图层(地图文档内图层状态为可见的图层)外,另追加这些被指定的图层显示,追加的这些图层必须为地图中包含的图层
457+ * exclude:从默认图层列表里删除exclude参数指定的图层后,进行显示
458+ * @example
459+ * //第0个图层隐藏
460+ * mapDocLayer.setLayerStatus(0,'hide')
461+ */
388462Doc . prototype . setLayerStatus = function ( opt_layers , opt_type ) {
389463 if ( opt_layers !== null && opt_type !== null ) {
390464 var layersStatus = opt_type + ":" + opt_layers ;
@@ -403,6 +477,17 @@ Doc.prototype.setLayerStatus = function (opt_layers, opt_type) {
403477 * 如:1:name='中华人民共和国'
404478 * 如:FIRST_FIRS='Asia'
405479 */
480+ /**
481+ * @function Zondy.Map.mapDocLayer.setFilters(opt_filters)
482+ * @description 设置地图文档图层过滤条件。
483+ * @param opt_filters - {String} 过滤条件。如:'1:ID>4,3:ID>1”。
484+ 过滤条件中用到的符号包括“==”、“!=”、“<”、“>”、“<=”、“>=”、“..”、“~”等,当包含中文条件时,请使用UTF-8编码格式,其中“:”和“,”为保留字符,用于表示键值对概念和分隔不同图层的条件,请不要将这2个字符用于自定义条件中,javascitpt中请使用encodeURI()函数编码后再代入filters参数中。
485+ * @example
486+ //显示第0个图层,所有id大于1的数据
487+ * var opt_style = '0:id>1';
488+ * mapDocLayer.setFilters(opt_filters)
489+ * mapDocLayer.refresh()
490+ */
406491Doc . prototype . setFilters = function ( opt_filters ) {
407492 if ( opt_filters !== null && opt_filters . toString ( ) !== "" ) {
408493 this . filters = opt_filters ;
0 commit comments