| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d2863d0 commit 618e107
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -557,7 +557,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 557 | 557 | const { minScale, maxScale } = layer.visibleScale; | |
| 558 | 558 | const crs = this.map.getCRS(); | |
| 559 | 559 | layer.minzoom = Math.max(this._transformScaleToZoom(minScale, crs, layer.tileSize), 0); | |
| 560 | - layer.maxzoom = Math.min(this.map.getMaxZoom()+1, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001); | ||
| 560 | + layer.maxzoom = Math.min(this.map.getMaxZoom()+1, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001, 24); | ||
| 561 | 561 | } | |
| 562 | 562 | ||
| 563 | 563 | if (type === 'tile') { | |
@@ -1501,7 +1501,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 1501 | 1501 | }, | |
| 1502 | 1502 | layout, | |
| 1503 | 1503 | minzoom: minzoom || 0, | |
| 1504 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 1504 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 1505 | 1505 | }, | |
| 1506 | 1506 | layerInfo.layerID | |
| 1507 | 1507 | ); | |
@@ -1553,7 +1553,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 1553 | 1553 | visibility: layerInfo.visible | |
| 1554 | 1554 | }, | |
| 1555 | 1555 | minzoom: minzoom || 0, | |
| 1556 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 1556 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 1557 | 1557 | }; | |
| 1558 | 1558 | if (filter) { | |
| 1559 | 1559 | layerOptions.filter = filter; | |
@@ -1608,7 +1608,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 1608 | 1608 | 'icon-rotate': iconRotateExpression || ((layerInfo.style.rotation || 0) * 180) / Math.PI | |
| 1609 | 1609 | }, | |
| 1610 | 1610 | minzoom: minzoom || 0, | |
| 1611 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 1611 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 1612 | 1612 | }; | |
| 1613 | 1613 | if (filter) { | |
| 1614 | 1614 | layerOptions.filter = filter; | |
@@ -1660,7 +1660,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 1660 | 1660 | 'icon-color': style.fillColor | |
| 1661 | 1661 | }, | |
| 1662 | 1662 | minzoom: minzoom || 0, | |
| 1663 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 1663 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 1664 | 1664 | }; | |
| 1665 | 1665 | if (filter) { | |
| 1666 | 1666 | layerOptions.filter = filter; | |
@@ -1964,7 +1964,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 1964 | 1964 | visibility: visible | |
| 1965 | 1965 | }, | |
| 1966 | 1966 | minzoom: minzoom || 0, | |
| 1967 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 1967 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 1968 | 1968 | }; | |
| 1969 | 1969 | if (filterExpression.length > 1) { | |
| 1970 | 1970 | layerOptions.filter = filterExpression; | |
@@ -2082,7 +2082,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2082 | 2082 | 'icon-rotate': symbolStyle.rotation || 0 | |
| 2083 | 2083 | }, | |
| 2084 | 2084 | minzoom: minzoom || 0, | |
| 2085 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1, | ||
| 2085 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24), | ||
| 2086 | 2086 | filter: imagefilterExpression | |
| 2087 | 2087 | }, | |
| 2088 | 2088 | layerID | |
@@ -2117,7 +2117,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2117 | 2117 | 'icon-color': symbolStyle.fillColor | |
| 2118 | 2118 | }, | |
| 2119 | 2119 | minzoom: minzoom || 0, | |
| 2120 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1, | ||
| 2120 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24), | ||
| 2121 | 2121 | filter: svgfilterExpression | |
| 2122 | 2122 | }, | |
| 2123 | 2123 | layerID | |
@@ -2288,7 +2288,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2288 | 2288 | paint: this._transformStyleToMapBoxGl(defaultStyle, geomType), | |
| 2289 | 2289 | layout: {}, | |
| 2290 | 2290 | minzoom: minzoom || 0, | |
| 2291 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 2291 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 2292 | 2292 | }, | |
| 2293 | 2293 | markerLayerID | |
| 2294 | 2294 | ); | |
@@ -2306,7 +2306,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2306 | 2306 | visibility: layerInfo.visible | |
| 2307 | 2307 | }, | |
| 2308 | 2308 | minzoom: minzoom || 0, | |
| 2309 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 2309 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 2310 | 2310 | }, | |
| 2311 | 2311 | markerLayerID | |
| 2312 | 2312 | ); | |
@@ -2410,7 +2410,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2410 | 2410 | visibility: layerInfo.visible | |
| 2411 | 2411 | }, | |
| 2412 | 2412 | minzoom: minzoom || 0, | |
| 2413 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 2413 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 2414 | 2414 | }); | |
| 2415 | 2415 | if (addToMap) { | |
| 2416 | 2416 | this._addLayerSucceeded({ layerInfo, features }); | |
@@ -2617,7 +2617,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2617 | 2617 | paint: layerStyle.style, | |
| 2618 | 2618 | layout: layerStyle.layout || {}, | |
| 2619 | 2619 | minzoom: minzoom || 0, | |
| 2620 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 2620 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 2621 | 2621 | }; | |
| 2622 | 2622 | if (filter) { | |
| 2623 | 2623 | style.filter = filter; | |
@@ -2641,7 +2641,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2641 | 2641 | type: 'raster', | |
| 2642 | 2642 | tiles: url, | |
| 2643 | 2643 | minzoom: minzoom || 0, | |
| 2644 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1, | ||
| 2644 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24), | ||
| 2645 | 2645 | tileSize: isIserver ? this.rasterTileSize : tileSize, | |
| 2646 | 2646 | rasterSource: isIserver ? 'iserver' : '', | |
| 2647 | 2647 | prjCoordSys: | |
@@ -2664,7 +2664,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2664 | 2664 | type: 'raster', | |
| 2665 | 2665 | source: sourceId, | |
| 2666 | 2666 | minzoom: minzoom || 0, | |
| 2667 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1, | ||
| 2667 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24), | ||
| 2668 | 2668 | layout: { | |
| 2669 | 2669 | visibility: this._getVisibility(visibility) | |
| 2670 | 2670 | } | |
@@ -2847,7 +2847,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa | |||
| 2847 | 2847 | visibility: layerInfo.visible ? 'visible' : 'none' | |
| 2848 | 2848 | }, | |
| 2849 | 2849 | minzoom: minzoom || 0, | |
| 2850 | - maxzoom: maxzoom || this.map.getMaxZoom() + 1 | ||
| 2850 | + maxzoom: Math.min(maxzoom || this.map.getMaxZoom() + 1, 24) | ||
| 2851 | 2851 | }); | |
| 2852 | 2852 | this._addLayerSucceeded(); | |
| 2853 | 2853 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4675,4 +4675,258 @@ it('add rangeLayer last end === fieldValue', (done) => { | |||
| 4675 | 4675 | expect(map.addLocalIdeographFontFamily).toHaveBeenCalledWith('sans-serif,微软雅黑,supermapol-icons'); | |
| 4676 | 4676 | webMapV2.clean(false); | |
| 4677 | 4677 | }); | |
| 4678 | + it('layermaxzoom <=24', (done) => { | ||
| 4679 | + const mapInfo = { | ||
| 4680 | + "maxScale": "1:144447.92746805", | ||
| 4681 | + "baseLayer": { | ||
| 4682 | + "layerType": "MAPBOXSTYLE", | ||
| 4683 | + "name": "Capital@World33font", | ||
| 4684 | + "dataSource": { | ||
| 4685 | + "type": "EXTERNAL", | ||
| 4686 | + "url": "http://localhost:8195/portalproxy/ad4c697aec15c20c/iserver/services/map-mvt-CapitalWorld33font/restjsr/v1/vectortile/maps/Capital%40World33font" | ||
| 4687 | + } | ||
| 4688 | + }, | ||
| 4689 | + "projection": "EPSG:4326", | ||
| 4690 | + "minScale": "1:591658710.909131", | ||
| 4691 | + "title": "Capital@World33font", | ||
| 4692 | + "version": "2.3.0", | ||
| 4693 | + } | ||
| 4694 | + const layerInfo = { | ||
| 4695 | + layerType: 'RANGE', | ||
| 4696 | + visible: 'visible', | ||
| 4697 | + themeSetting: { | ||
| 4698 | + themeField: 'TAX', | ||
| 4699 | + customSettings: {}, | ||
| 4700 | + segmentMethod: 'offset', | ||
| 4701 | + segmentCount: 6, | ||
| 4702 | + colors: ['#ffc6c4', '#f4a3a8', '#e38191', '#cc607d', '#ad466c', '#8b3058', '#672044'] | ||
| 4703 | + }, | ||
| 4704 | + name: 'DataSource:DEMARCACION_TERRITORIAL_Tax', | ||
| 4705 | + featureType: 'POLYGON', | ||
| 4706 | + style: { | ||
| 4707 | + strokeWidth: 1, | ||
| 4708 | + fillColor: '#8b3058', | ||
| 4709 | + fillOpacity: 0.9, | ||
| 4710 | + lineDash: 'solid', | ||
| 4711 | + strokeColor: '#ffffff', | ||
| 4712 | + type: 'POLYGON', | ||
| 4713 | + strokeOpacity: 1 | ||
| 4714 | + }, | ||
| 4715 | + projection: 'EPSG:4326', | ||
| 4716 | + enableFields: ['TAX'], | ||
| 4717 | + dataSource: { | ||
| 4718 | + type: 'REST_DATA', | ||
| 4719 | + url: 'http://test:8090/iserver/services/data-JSON_test/rest/data', | ||
| 4720 | + dataSourceName: 'DataSource:DEMARCACION_TERRITORIAL_Tax' | ||
| 4721 | + }, | ||
| 4722 | + layerID: 'DataSource:DEMARCACION_TERRITORIAL_Tax' | ||
| 4723 | + }; | ||
| 4724 | + const features = [ | ||
| 4725 | + { | ||
| 4726 | + type: 'Feature', | ||
| 4727 | + properties: { | ||
| 4728 | + TAX: '2.0E18', | ||
| 4729 | + index: '0' | ||
| 4730 | + }, | ||
| 4731 | + geometry: { | ||
| 4732 | + type: 'MultiPolygon' | ||
| 4733 | + }, | ||
| 4734 | + id: 1 | ||
| 4735 | + }, | ||
| 4736 | + { | ||
| 4737 | + type: 'Feature', | ||
| 4738 | + properties: { | ||
| 4739 | + TAX: '2.00000000000098E12', | ||
| 4740 | + index: '1' | ||
| 4741 | + }, | ||
| 4742 | + geometry: { | ||
| 4743 | + type: 'MultiPolygon' | ||
| 4744 | + }, | ||
| 4745 | + id: 2 | ||
| 4746 | + }, | ||
| 4747 | + { | ||
| 4748 | + type: 'Feature', | ||
| 4749 | + properties: { | ||
| 4750 | + TAX: '2.000000000098E10', | ||
| 4751 | + index: '2' | ||
| 4752 | + }, | ||
| 4753 | + geometry: { | ||
| 4754 | + type: 'MultiPolygon' | ||
| 4755 | + }, | ||
| 4756 | + id: 3 | ||
| 4757 | + }, | ||
| 4758 | + { | ||
| 4759 | + type: 'Feature', | ||
| 4760 | + properties: { | ||
| 4761 | + TAX: '2.000000000098E10', | ||
| 4762 | + index: '3' | ||
| 4763 | + }, | ||
| 4764 | + geometry: { | ||
| 4765 | + type: 'MultiPolygon' | ||
| 4766 | + }, | ||
| 4767 | + id: 4 | ||
| 4768 | + }, | ||
| 4769 | + { | ||
| 4770 | + type: 'Feature', | ||
| 4771 | + properties: { | ||
| 4772 | + TAX: '2.000000000098E10', | ||
| 4773 | + index: '4' | ||
| 4774 | + }, | ||
| 4775 | + geometry: { | ||
| 4776 | + type: 'MultiPolygon' | ||
| 4777 | + }, | ||
| 4778 | + id: 5 | ||
| 4779 | + }, | ||
| 4780 | + { | ||
| 4781 | + type: 'Feature', | ||
| 4782 | + properties: { | ||
| 4783 | + TAX: '2.000000000098E10', | ||
| 4784 | + index: '5' | ||
| 4785 | + }, | ||
| 4786 | + geometry: { | ||
| 4787 | + type: 'MultiPolygon' | ||
| 4788 | + }, | ||
| 4789 | + id: 6 | ||
| 4790 | + }, | ||
| 4791 | + { | ||
| 4792 | + type: 'Feature', | ||
| 4793 | + properties: { | ||
| 4794 | + TAX: '2.000000000098E10', | ||
| 4795 | + index: '6' | ||
| 4796 | + }, | ||
| 4797 | + geometry: { | ||
| 4798 | + type: 'MultiPolygon' | ||
| 4799 | + }, | ||
| 4800 | + id: 7 | ||
| 4801 | + }, | ||
| 4802 | + { | ||
| 4803 | + type: 'Feature', | ||
| 4804 | + properties: { | ||
| 4805 | + TAX: '2.000000000098E10', | ||
| 4806 | + index: '7' | ||
| 4807 | + }, | ||
| 4808 | + geometry: { | ||
| 4809 | + type: 'MultiPolygon' | ||
| 4810 | + }, | ||
| 4811 | + id: 8 | ||
| 4812 | + }, | ||
| 4813 | + { | ||
| 4814 | + type: 'Feature', | ||
| 4815 | + properties: { | ||
| 4816 | + TAX: '2.000000000098E10', | ||
| 4817 | + index: '8' | ||
| 4818 | + }, | ||
| 4819 | + geometry: { | ||
| 4820 | + type: 'MultiPolygon' | ||
| 4821 | + }, | ||
| 4822 | + id: 9 | ||
| 4823 | + }, | ||
| 4824 | + { | ||
| 4825 | + type: 'Feature', | ||
| 4826 | + properties: { | ||
| 4827 | + TAX: '2.000000000098E10', | ||
| 4828 | + index: '9' | ||
| 4829 | + }, | ||
| 4830 | + geometry: { | ||
| 4831 | + type: 'MultiPolygon' | ||
| 4832 | + }, | ||
| 4833 | + id: 10 | ||
| 4834 | + }, | ||
| 4835 | + { | ||
| 4836 | + type: 'Feature', | ||
| 4837 | + properties: { | ||
| 4838 | + TAX: '2.000000000098E10', | ||
| 4839 | + index: '10' | ||
| 4840 | + }, | ||
| 4841 | + geometry: { | ||
| 4842 | + type: 'MultiPolygon' | ||
| 4843 | + }, | ||
| 4844 | + id: 11 | ||
| 4845 | + }, | ||
| 4846 | + { | ||
| 4847 | + type: 'Feature', | ||
| 4848 | + properties: { | ||
| 4849 | + TAX: '2.000000000098E10', | ||
| 4850 | + index: '11' | ||
| 4851 | + }, | ||
| 4852 | + geometry: { | ||
| 4853 | + type: 'MultiPolygon' | ||
| 4854 | + }, | ||
| 4855 | + id: 12 | ||
| 4856 | + }, | ||
| 4857 | + { | ||
| 4858 | + type: 'Feature', | ||
| 4859 | + properties: { | ||
| 4860 | + TAX: '2.000000000098E10', | ||
| 4861 | + index: '12' | ||
| 4862 | + }, | ||
| 4863 | + geometry: { | ||
| 4864 | + type: 'MultiPolygon' | ||
| 4865 | + }, | ||
| 4866 | + id: 13 | ||
| 4867 | + }, | ||
| 4868 | + { | ||
| 4869 | + type: 'Feature', | ||
| 4870 | + properties: { | ||
| 4871 | + TAX: '2.000000000098E10', | ||
| 4872 | + index: '13' | ||
| 4873 | + }, | ||
| 4874 | + geometry: { | ||
| 4875 | + type: 'MultiPolygon' | ||
| 4876 | + }, | ||
| 4877 | + id: 14 | ||
| 4878 | + }, | ||
| 4879 | + { | ||
| 4880 | + type: 'Feature', | ||
| 4881 | + properties: { | ||
| 4882 | + TAX: '2.000000000098E10', | ||
| 4883 | + index: '14' | ||
| 4884 | + }, | ||
| 4885 | + geometry: { | ||
| 4886 | + type: 'MultiPolygon' | ||
| 4887 | + }, | ||
| 4888 | + id: 15 | ||
| 4889 | + }, | ||
| 4890 | + { | ||
| 4891 | + type: 'Feature', | ||
| 4892 | + properties: { | ||
| 4893 | + TAX: '2.000000000098E10', | ||
| 4894 | + index: '15' | ||
| 4895 | + }, | ||
| 4896 | + geometry: { | ||
| 4897 | + type: 'MultiPolygon' | ||
| 4898 | + }, | ||
| 4899 | + id: 16 | ||
| 4900 | + } | ||
| 4901 | + ]; | ||
| 4902 | + spyOn(FetchRequest, 'get').and.callFake((url) => { | ||
| 4903 | + if (url.indexOf('portal.json') > -1) { | ||
| 4904 | + return Promise.resolve(new Response(JSON.stringify(iportal_serviceProxy))); | ||
| 4905 | + } | ||
| 4906 | + if (url.indexOf('123/map.json') > -1) { | ||
| 4907 | + return Promise.resolve( | ||
| 4908 | + new Response( | ||
| 4909 | + JSON.stringify(mapInfo) | ||
| 4910 | + ) | ||
| 4911 | + ); | ||
| 4912 | + } | ||
| 4913 | + if (url.indexOf('/style.json')) { | ||
| 4914 | + return Promise.resolve(new Response(JSON.stringify(vectorTile_style))); | ||
| 4915 | + } | ||
| 4916 | + return Promise.resolve(new Response(JSON.stringify({}))); | ||
| 4917 | + }); | ||
| 4918 | + datavizWebmap = new WebMap('123', { | ||
| 4919 | + target: 'map', | ||
| 4920 | + serverUrl: 'http://fake/fakeiportal', | ||
| 4921 | + withCredentials: false | ||
| 4922 | + }); | ||
| 4923 | + datavizWebmap.on('mapcreatesucceeded', ({ map }) => { | ||
| 4924 | + expect(map).not.toBeUndefined(); | ||
| 4925 | + expect(map.getStyle().layers.length).toBe(1); | ||
| 4926 | + map.setMaxZoom(24); | ||
| 4927 | + datavizWebmap._handler._createVectorLayer(layerInfo,features); | ||
| 4928 | + expect(map.getStyle().layers[1].maxzoom).toBe(24); | ||
| 4929 | + done(); | ||
| 4930 | + }); | ||
| 4931 | + }); | ||
| 4678 | 4932 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments