diff --git a/README.md b/README.md index e60bbef..3157e21 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,8 @@ Edit the styles of Esri Vector Basemaps via ArcGIS.com items > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > See the License for the specific language governing permissions and > limitations under the License. + +### 关于SetStyle错误的问题 +- https://developers.arcgis.com/javascript/3/jsapi/vectortilelayer-amd.html#setstyle + +- Changes the style properties used to render the layers. It is the equivalent of changing the entire CSS style sheet for a web page. It takes either a style object or a url to a style resource. When loading a style, it is the developer's responsibility to make sure that any relative urls in the style resolve correctly.(要由开发者对url路径进行处理!!!) diff --git a/js/main.js b/js/main.js index fc8c190..2653bb1 100644 --- a/js/main.js +++ b/js/main.js @@ -936,22 +936,31 @@ define([ // GET STYLE // esriRequest({ - url: lang.replace("{itemUrl}/resources/styles/root.json", this.selectedItem), + url: lang.replace("{url}/resources/styles/root.json", this.selectedItem), content: { f: "json" } }).then(function (style) { console.info("root.json", style); + + //需要把style里的url处理为绝对路径 + //..... + style.sources.esri.url = this.selectedItem.url; + style.sprite = this.selectedItem.url + "/resources/sprites/sprite"; + style.glyphs = this.selectedItem.url + "/resources/fonts/{fontstack}/{range}.pbf"; var isSecure = /https:/i; if(isSecure.test(window.location.protocol)) { style.glyphs = style.glyphs.replace(/http:/gi, "https:"); style.sprite = style.sprite.replace(/http:/gi, "https:"); style.sources.esri.url = style.sources.esri.url.replace(/http:/gi, "https:"); - } + } + + // VECTOR BASEMAP LAYER // // - THERE ARE SEVERAL WAYS TO CREATE VECTORTILELAYER... // HERE WE PASS IN THE STYLE DIRECTLY INTO THE CONSTRUCTOR this.vectorBasemapLayer = new VectorTileLayer(this._cloneVectorTileLayerStyle(style)); + //this.vectorBasemapLayer = new VectorTileLayer(lang.replace("{url}/resources/styles/root.json", this.selectedItem)); this.vectorBasemapLayer.on("error", function (evt) { console.warn("vectorBasemapLayer.error: ", evt.error); }.bind(this)); diff --git a/oauth.html b/oauth.html new file mode 100644 index 0000000..3cff162 --- /dev/null +++ b/oauth.html @@ -0,0 +1,164 @@ + + +
+ +