@@ -17,7 +17,7 @@ import axios from 'axios';
1717 * @param {String } [option.layerName] 地图名
1818 * @param {String } option.style 样式json文件路径或者MVT-JSON对象,当为url时等于styleUrl;当为vectortilejson等于vectortilejson
1919 * @param {String } [option.styleUrl] 样式json文件路径,有styleUrl就可以直接读取styleUrl里的信息;不然就是加载中地发布的矢量瓦片,使用ip,port和layerName先拼接styleUrl路径再进行查询。
20- * @param {String } [option.vectortilejson] 矢量瓦片json对象,直接取json对象,不需要再去请求。
20+ * @param {Object } [option.vectortilejson] 矢量瓦片json对象,直接取json对象,不需要再去请求。
2121 * @param {Cesium.TilingScheme } [option.tilingScheme] 矢量瓦片瓦片切分规则:经纬度还是墨卡托
2222 * @param {String } [option.token] 第三方需要的token,比如mapbox
2323 * @param {String } [option.show=true] 是否可见
@@ -48,14 +48,26 @@ export class VectorTileLayer {
4848 this . threadId = options . threadId || Math . random ( ) * 10000 ;
4949 this . show = options . show ;
5050 this . style = options . style ;
51+ this . styleUrl = options . styleUrl ;
5152 this . tilingScheme = options . tilingScheme ;
5253 this . provider = null ;
5354
55+ console . log ( options , this ) ;
56+
5457 this . initDevicePixelRatio ( ) ;
5558 //this.bindEvent();
59+
5660 if ( this . style ) {
5761 if ( this . style . indexOf ( 'http' ) >= 0 ) {
5862 //如果是个网络地址,就通过url请求获取矢量瓦片json对象
63+ this . url = this . style ;
64+ this . requestVectortileJson ( ) ;
65+ } else {
66+ this . requestStyleData ( ) ;
67+ }
68+ } else if ( this . styleUrl ) {
69+ if ( this . styleUrl . indexOf ( 'http' ) >= 0 ) {
70+ this . url = this . styleUrl ;
5971 this . requestVectortileJson ( ) ;
6072 } else {
6173 this . requestStyleData ( ) ;
0 commit comments