Skip to content

Commit

Permalink
Remove support for sharding (#768)
Browse files Browse the repository at this point in the history
* remove support for sharding

* remove subdomain code
  • Loading branch information
AliyanH committed Feb 24, 2023
1 parent 0e006d2 commit dfa715e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 37 deletions.
16 changes: 1 addition & 15 deletions src/mapml/layers/MapMLLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,21 +926,7 @@ export var MapMLLayer = L.Layer.extend({

inputs.push(inp);
includesZoom = includesZoom || inp.hasAttribute("type") && inp.getAttribute("type").toLowerCase() === "zoom";
if (inp.hasAttribute('shard')) {
var id = inp.getAttribute('list');
inp.servers = [];
var servers = serverExtent.querySelectorAll('map-datalist#'+id + ' > map-option');
if (servers.length === 0 && inp.hasAttribute('value')) {
servers = inp.getAttribute('value').split('');
}
for (var s=0;s < servers.length;s++) {
if (servers[s].getAttribute) {
inp.servers.push(servers[s].getAttribute('value'));
} else {
inp.servers.push(servers[s]);
}
}
} else if (inp.tagName.toLowerCase() === 'map-select') {
if (inp.tagName.toLowerCase() === 'map-select') {
// use a throwaway div to parse the input from MapML into HTML
var div =document.createElement("div");
div.insertAdjacentHTML("afterbegin",inp.outerHTML);
Expand Down
8 changes: 0 additions & 8 deletions src/mapml/layers/TemplatedTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export var TemplatedTileLayer = L.TileLayer.extend({
L.setOptions(this, options);
this._setUpTileTemplateVars(template);

if (template.tile.subdomains) {
L.setOptions(this, L.extend(this.options, {subdomains: template.tile.subdomains}));
}
this._template = template;
this._initContainer();
// call the parent constructor with the template tref value, per the
Expand Down Expand Up @@ -166,7 +163,6 @@ export var TemplatedTileLayer = L.TileLayer.extend({
obj[this._template.pcrs.easting.right] = this._tileMatrixToPCRSPosition(coords, 'top-right').x;
obj[this._template.pcrs.northing.top] = this._tileMatrixToPCRSPosition(coords, 'top-left').y;
obj[this._template.pcrs.northing.bottom] = this._tileMatrixToPCRSPosition(coords, 'bottom-left').y;
obj[this._template.tile.server] = this._getSubdomain(coords);
for (var v in this._template.tile) {
if (["row","col","zoom","left","right","top","bottom"].indexOf(v) < 0) {
obj[v] = this._template.tile[v];
Expand Down Expand Up @@ -268,7 +264,6 @@ export var TemplatedTileLayer = L.TileLayer.extend({
axis = inputs[i].getAttribute("axis"),
name = inputs[i].getAttribute("name"),
position = inputs[i].getAttribute("position"),
shard = (type === "hidden" && inputs[i].hasAttribute("shard")),
select = (inputs[i].tagName.toLowerCase() === "map-select"),
value = inputs[i].getAttribute("value"),
min = inputs[i].getAttribute("min"),
Expand Down Expand Up @@ -374,9 +369,6 @@ export var TemplatedTileLayer = L.TileLayer.extend({
zoom.max = Number.parseInt(max,10);
}
template.zoom = zoom;
} else if (shard) {
template.tile.server = name;
template.tile.subdomains = inputs[i].servers.slice();
} else if (select) {
/*jshint -W104 */
const parsedselect = inputs[i].htmlselect;
Expand Down
8 changes: 1 addition & 7 deletions test/e2e/data/osm.mapml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
<map-body>
<map-extent units="OSMTILE" >
<map-input name="z" type="zoom" value="18" min="0" max="18"></map-input>
<map-input name="s" type="hidden" shard="true" list="servers"></map-input>
<map-datalist id="servers">
<map-option value="a"></map-option>
<map-option value="b"></map-option>
<map-option value="c"></map-option>
</map-datalist>
<map-input name="x" type="location" units="tilematrix" axis="column" min="0" max="262144" ></map-input>
<map-input name="y" type="location" units="tilematrix" axis="row" min="0" max="262144" ></map-input>
<map-link rel="tile" tref="http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" ></map-link>
<map-link rel="tile" tref="http://tile.openstreetmap.org/{z}/{x}/{y}.png" ></map-link>
</map-extent>
</map-body>
</mapml->
8 changes: 1 addition & 7 deletions test/e2e/data/tiles/cbmt/osm-changeProjection.mapml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
<map-body>
<map-extent units="OSMTILE">
<map-input name="z" type="zoom" min="9" max="18"></map-input>
<map-input name="s" type="hidden" shard="true" list="servers"></map-input>
<map-datalist id="servers">
<map-option value="a"></map-option>
<map-option value="b"></map-option>
<map-option value="c"></map-option>
</map-datalist>
<map-input name="x" type="location" units="tilematrix" axis="column"></map-input>
<map-input name="y" type="location" units="tilematrix" axis="row"></map-input>
<map-link rel="tile" tref="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"></map-link>
<map-link rel="tile" tref="https://tile.openstreetmap.org/{z}/{x}/{y}.png"></map-link>
</map-extent>
</map-body>
</mapml->

0 comments on commit dfa715e

Please sign in to comment.