123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_themeLabel"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <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, themeService, themeLabel, themeParameters, themeLayer,
- url = host + "/iserver/services/map-world/rest/maps/World";
- map = L.map('map', {
- crs: L.CRS.EPSG4326,
- center: [0, 0],
- maxZoom: 18,
- zoom: 1
- });
- L.supermap.tiledMapLayer(url, {noWrap: true, transparent: true}).addTo(map);
- createTheme();
- function createTheme() {
- themeService = L.supermap.themeService(url);
- var style1 = new SuperMap.ServerTextStyle({
- fontHeight: 4,
- foreColor: new SuperMap.ServerColor(100, 20, 50),
- sizeFixed: true,
- bold: true
- });
- var style2 = new SuperMap.ServerTextStyle({
- fontHeight: 4,
- foreColor: new SuperMap.ServerColor(250, 0, 0),
- sizeFixed: true,
- bold: true
- });
- var style3 = new SuperMap.ServerTextStyle({
- fontHeight: 4,
- foreColor: new SuperMap.ServerColor(93, 95, 255),
- sizeFixed: true,
- bold: true
- });
- var themeLabelItem1 = new SuperMap.ThemeLabelItem({
- start: 0.0,
- end: 7800000,
- style: style1
- });
- var themeLabelItem2 = new SuperMap.ThemeLabelItem({
- start: 7800000,
- end: 15000000,
- style: style2
- });
- var themeLabelItem3 = new SuperMap.ThemeLabelItem({
- start: 15000000,
- end: 30000000,
- style: style3
- });
- var themeLabelItem4 = new SuperMap.ThemeLabelItem({
- start: 0.0,
- end: 55,
- style: style1
- });
- var themeLabelItem5 = new SuperMap.ThemeLabelItem({
- start: 55,
- end: 109,
- style: style2
- });
- var themeLabelItem6 = new SuperMap.ThemeLabelItem({
- start: 109,
- end: 300,
- style: style3
- });
- themeLabel = new SuperMap.ThemeLabel({
- matrixCells: [
- [new SuperMap.LabelThemeCell({
- themeLabel: new SuperMap.ThemeLabel({
- labelExpression: "CAP_POP",
- rangeExpression: "CAP_POP",
- numericPrecision: 0,
- items: [themeLabelItem1, themeLabelItem2, themeLabelItem3]
- })
- })],
- [new SuperMap.LabelThemeCell({
- themeLabel: new SuperMap.ThemeLabel({
- labelExpression: "CAPITAL",
- rangeExpression: "SmID",
- numericPrecision: 0,
- items: [themeLabelItem4, themeLabelItem5, themeLabelItem6]
- })
- })]
- ],
- background: new SuperMap.ThemeLabelBackground({
- backStyle: new SuperMap.ServerStyle({
- fillForeColor: new SuperMap.ServerColor(179, 209, 193),
- fillOpaqueRate: 60,
- lineWidth: 0.1
- }),
- labelBackShape: "RECT"
- })
- });
- themeParameters = new SuperMap.ThemeParameters({
- themes: [themeLabel],
- datasetNames: ["Capitals"],
- dataSourceNames: ["World"]
- });
- themeService.getThemeInfo(themeParameters, function (serviceResult) {
- var result = serviceResult.result;
- if (result && result.newResourceID) {
- themeLayer = L.supermap.tiledMapLayer(url, {
- noWrap: true,
- cacheEnabled: false,
- transparent: true,
- layersID: result.newResourceID
- }).addTo(map);
- }
- });
- }
- </script>
- </body>
- </html>
|