-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增对接 地图服务影像栅格图层 gamma 参数,新增创建临时图层示例 review by luox
- Loading branch information
1 parent
b55ceba
commit 2fe2994
Showing
24 changed files
with
495 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!--******************************************************************** | ||
* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved. | ||
*********************************************************************--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title data-i18n="resources.title_createTempLayer"></title> | ||
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script> | ||
</head> | ||
<style> | ||
#toolbar { | ||
position: absolute; | ||
top: 50px; | ||
right: 10px; | ||
width: 300px; | ||
text-align: center; | ||
z-index: 500; | ||
border-radius: 4px; | ||
} | ||
</style> | ||
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0"> | ||
<div id="toolbar" class="panel panel-primary"> | ||
<div class="panel-heading"> | ||
<h5 class="panel-title text-center" data-i18n="resources.title_createTempLayer"></h5> | ||
</div> | ||
<div class="panel-body content"> | ||
<div style="margin-bottom: 5px; text-align: left;"> | ||
<span data-i18n="resources.text_gammaParamBounds"></span> | ||
</div> | ||
<div class="panel"> | ||
<div class="input-group"> | ||
<span class="input-group-addon" data-i18n="resources.text_gamma"></span> | ||
<input id="gammaParam" value="1" class="form-control"></input> | ||
</div> | ||
</div> | ||
<input | ||
type="button" | ||
class="btn btn-default" | ||
data-i18n="[value]resources.text_create" | ||
onclick="createTempLayer()" | ||
/> | ||
</div> | ||
</div> | ||
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div> | ||
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script> | ||
<script type="text/javascript"> | ||
var host = window.isLocal ? window.server : 'https://iserver.supermap.io'; | ||
var map, | ||
tempLayer, | ||
url = host + '/iserver/services/map-World/rest/maps/World'; | ||
map = L.map('map', { | ||
preferCanvas: true, | ||
crs: L.CRS.EPSG4326, | ||
center: { lon: 0, lat: 0 }, | ||
maxZoom: 18, | ||
zoom: 2 | ||
}); | ||
createTempLayer(); | ||
|
||
function createTempLayer() { | ||
new L.supermap.LayerInfoService(url).getLayersInfo().then((serviceResult) => { | ||
var result = serviceResult.result; | ||
result.subLayers.layers.map(function (layer, index) { | ||
if (index === 15) { | ||
layer.gamma = document.getElementById("gammaParam").value || 1; | ||
result.subLayers.layers = [layer]; | ||
new L.supermap.LayerInfoService(url) | ||
.setLayersInfo( | ||
new L.supermap.SetLayersInfoParameters({ | ||
layersInfo: result | ||
}) | ||
) | ||
.then((res) => { | ||
tempLayer && tempLayer.remove(); | ||
tempLayer = new L.supermap.TiledMapLayer(url, { | ||
noWrap: true, | ||
cacheEnabled: false, | ||
transparent: true, | ||
layersID: res.result.newResourceID | ||
}) | ||
tempLayer.addTo(map); | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!--******************************************************************** | ||
* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved. | ||
*********************************************************************--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title data-i18n="resources.title_createTempLayer"></title> | ||
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script> | ||
</head> | ||
<style> | ||
#toolbar { | ||
position: absolute; | ||
top: 50px; | ||
right: 10px; | ||
width: 300px; | ||
text-align: center; | ||
z-index: 500; | ||
border-radius: 4px; | ||
} | ||
</style> | ||
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0"> | ||
<div id="toolbar" class="panel panel-primary"> | ||
<div class="panel-heading"> | ||
<h5 class="panel-title text-center" data-i18n="resources.title_createTempLayer"></h5> | ||
</div> | ||
<div class="panel-body content"> | ||
<div style="margin-bottom: 5px; text-align: left;"> | ||
<span data-i18n="resources.text_gammaParamBounds"></span> | ||
</div> | ||
<div class="panel"> | ||
<div class="input-group"> | ||
<span class="input-group-addon" data-i18n="resources.text_gamma"></span> | ||
<input id="gammaParam" value="1" class="form-control"></input> | ||
</div> | ||
</div> | ||
<input | ||
type="button" | ||
class="btn btn-default" | ||
data-i18n="[value]resources.text_create" | ||
onclick="createTempLayer()" | ||
/> | ||
</div> | ||
</div> | ||
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div> | ||
<script type="text/javascript" src="../../dist/mapboxgl/include-mapboxgl.js"></script> | ||
<span id="show"></span> | ||
<script type="text/javascript"> | ||
var host = window.isLocal ? window.server : 'https://iserver.supermap.io'; | ||
var infowin, | ||
url = host + '/iserver/services/map-World/rest/maps/World'; | ||
var map = new mapboxgl.Map({ | ||
container: 'map', | ||
style: { | ||
version: 8, | ||
sources: {}, | ||
layers: [] | ||
}, | ||
center: [0, 0], | ||
zoom: 2 | ||
}); | ||
map.on('load', function () { | ||
createTempLayer(); | ||
}); | ||
|
||
function createTempLayer() { | ||
new mapboxgl.supermap.LayerInfoService(url).getLayersInfo().then((serviceResult) => { | ||
var result = serviceResult.result; | ||
result.subLayers.layers.map(function (layer, index) { | ||
if (index === 15) { | ||
layer.gamma = document.getElementById('gammaParam').value || 1; | ||
result.subLayers.layers = [layer]; | ||
new mapboxgl.supermap.LayerInfoService(url) | ||
.setLayersInfo( | ||
new mapboxgl.supermap.SetLayersInfoParameters({ | ||
layersInfo: result | ||
}) | ||
) | ||
.then((res) => { | ||
var result = res.result; | ||
if (result && result.newResourceID) { | ||
if (map.getLayer('layer')) { | ||
map.removeLayer('layer'); | ||
map.removeSource('layer'); | ||
} | ||
map.addLayer({ | ||
id: 'layer', | ||
type: 'raster', | ||
source: { | ||
type: 'raster', | ||
tiles: [ | ||
'http://localhost:8090/iserver/services/map-World/rest/maps/World/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&noWrap=true&layersID=' + | ||
result.newResourceID | ||
], | ||
tileSize: 256 | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<!--******************************************************************** | ||
* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved. | ||
*********************************************************************--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title data-i18n="resources.title_createTempLayer"></title> | ||
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script> | ||
</head> | ||
<style> | ||
#toolbar { | ||
position: absolute; | ||
top: 50px; | ||
right: 10px; | ||
width: 300px; | ||
text-align: center; | ||
z-index: 500; | ||
border-radius: 4px; | ||
} | ||
</style> | ||
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0"> | ||
<div id="toolbar" class="panel panel-primary"> | ||
<div class="panel-heading"> | ||
<h5 class="panel-title text-center" data-i18n="resources.title_createTempLayer"></h5> | ||
</div> | ||
<div class="panel-body content"> | ||
<div style="margin-bottom: 5px; text-align: left;"> | ||
<span data-i18n="resources.text_gammaParamBounds"></span> | ||
</div> | ||
<div class="panel"> | ||
<div class="input-group"> | ||
<span class="input-group-addon" data-i18n="resources.text_gamma"></span> | ||
<input id="gammaParam" value="1" class="form-control"></input> | ||
</div> | ||
</div> | ||
<input | ||
type="button" | ||
class="btn btn-default" | ||
data-i18n="[value]resources.text_create" | ||
onclick="createTempLayer()" | ||
/> | ||
</div> | ||
</div> | ||
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div> | ||
<script type="text/javascript" src="../../dist/maplibregl/include-maplibregl.js"></script> | ||
<script type="text/javascript"> | ||
var host = window.isLocal ? window.server : 'https://iserver.supermap.io'; | ||
var url = host + '/iserver/services/map-World/rest/maps/World'; | ||
var map = new maplibregl.Map({ | ||
container: 'map', | ||
style: { | ||
version: 8, | ||
sources: {}, | ||
layers: [] | ||
}, | ||
center: [0, 0], | ||
zoom: 2 | ||
}); | ||
createTempLayer(); | ||
|
||
function createTempLayer() { | ||
new maplibregl.supermap.LayerInfoService(url).getLayersInfo().then((serviceResult) => { | ||
var result = serviceResult.result; | ||
result.subLayers.layers.map(function (layer, index) { | ||
if (index === 15) { | ||
layer.gamma = document.getElementById("gammaParam").value || 1; | ||
result.subLayers.layers = [layer]; | ||
new maplibregl.supermap.LayerInfoService(url) | ||
.setLayersInfo( | ||
new maplibregl.supermap.SetLayersInfoParameters({ | ||
layersInfo: result | ||
}) | ||
) | ||
.then((res) => { | ||
var result = res.result; | ||
if (result && result.newResourceID) { | ||
if (map.getLayer('layer')) { | ||
map.removeLayer('layer'); | ||
map.removeSource('layer'); | ||
} | ||
map.addLayer({ | ||
id: 'layer', | ||
type: 'raster', | ||
source: { | ||
type: 'raster', | ||
tiles: [ | ||
'http://localhost:8090/iserver/services/map-World/rest/maps/World/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&noWrap=true&layersID=' + | ||
result.newResourceID | ||
], | ||
tileSize: 256 | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.