| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2808,7 +2808,7 @@ export class WebMap extends Observable { | |||
| 2808 | 2808 | attr._smiportal_imgLinkUrl !== '' | |
| 2809 | 2809 | ) { | |
| 2810 | 2810 | //上传的图片,加上当前地址 | |
| 2811 | - imgUrl = `${Util.getIPortalUrl()}resources/markerIcon/${attr._smiportal_imgLinkUrl}`; | ||
| 2811 | + imgUrl = `${this.server}/resources/markerIcon/${attr._smiportal_imgLinkUrl}`; | ||
| 2812 | 2812 | } | |
| 2813 | 2813 | attributes = { | |
| 2814 | 2814 | dataViz_description: attr._smiportal_description, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -248,7 +248,6 @@ describe('mapboxgl_WebMapV2_2', () => { | |||
| 248 | 248 | var datavizWebmap = new WebMap(id, options); | |
| 249 | 249 | datavizWebmap.on('mapcreatesucceeded', (data) => { | |
| 250 | 250 | expect(datavizWebmap.mapParams.title).toBe('zxy_2326'); | |
| 251 | - expect(datavizWebmap.map.getStyle().sources['2326底图'].tiles[0]).toBe('https://{s}.tile.fake/{z}/{x}/{y}.png'); | ||
| 252 | 251 | done(); | |
| 253 | 252 | }); | |
| 254 | 253 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ describe('openlayers_WebMap', () => { | |||
| 24 | 24 | const originCookie = window.document.cookie; | |
| 25 | 25 | const originalNavigator = window.navigator; | |
| 26 | 26 | var id = 1788054202; | |
| 27 | - let cookieValue; | ||
| 27 | + let cookieValue = ''; | ||
| 28 | 28 | const datsets = [ | |
| 29 | 29 | { | |
| 30 | 30 | name: 'test', | |
@@ -584,4 +584,67 @@ describe('openlayers_WebMap', () => { | |||
| 584 | 584 | ||
| 585 | 585 | var datavizWebmap = new WebMap(id, options); | |
| 586 | 586 | }); | |
| 587 | + it('getInternetMapInfo', () => { | ||
| 588 | + const webmap = new WebMap(id, { server: server }); | ||
| 589 | + const infoTencent = { layerType: 'tencent' }; | ||
| 590 | + webmap.getInternetMapInfo(infoTencent); | ||
| 591 | + expect(infoTencent.epsgCode).toBe('EPSG:3857'); | ||
| 592 | + | ||
| 593 | + const infoTIANDITU_TER_3857 = { layerType: 'TIANDITU_TER_3857' }; | ||
| 594 | + webmap.getInternetMapInfo(infoTIANDITU_TER_3857); | ||
| 595 | + expect(infoTIANDITU_TER_3857.epsgCode).toBe('EPSG:3857'); | ||
| 596 | + expect(infoTIANDITU_TER_3857.maxZoom).toBe(14); | ||
| 597 | + | ||
| 598 | + const infoGOOGLE = { layerType: 'GOOGLE' }; | ||
| 599 | + webmap.getInternetMapInfo(infoGOOGLE); | ||
| 600 | + expect(infoGOOGLE.iserverUrl).toBe('https://www.google.cn/maps'); | ||
| 601 | + | ||
| 602 | + const infoJAPAN_STD = { layerType: 'JAPAN_STD' }; | ||
| 603 | + webmap.getInternetMapInfo(infoJAPAN_STD); | ||
| 604 | + expect(infoJAPAN_STD.url).toBe('https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png'); | ||
| 605 | + | ||
| 606 | + expect(infoJAPAN_STD.minZoom).toBe(1); | ||
| 607 | + const infoJAPAN_PALE = { layerType: 'JAPAN_PALE' }; | ||
| 608 | + webmap.getInternetMapInfo(infoJAPAN_PALE); | ||
| 609 | + expect(infoJAPAN_PALE.minZoom).toBe(2); | ||
| 610 | + const infoJAPAN_RELIEF = { layerType: 'JAPAN_RELIEF' }; | ||
| 611 | + webmap.getInternetMapInfo(infoJAPAN_RELIEF); | ||
| 612 | + expect(infoJAPAN_RELIEF.minZoom).toBe(5); | ||
| 613 | + | ||
| 614 | + const infoJAPAN_ORT = { layerType: 'JAPAN_ORT' }; | ||
| 615 | + webmap.getInternetMapInfo(infoJAPAN_ORT); | ||
| 616 | + expect(infoJAPAN_ORT.level).toBe(2); | ||
| 617 | + }); | ||
| 618 | + it('geojsonToFeature', () => { | ||
| 619 | + const webmap = new WebMap(id, { server: server }); | ||
| 620 | + const geojsonData = { | ||
| 621 | + type: 'FeatureCollection', | ||
| 622 | + features: [ | ||
| 623 | + | ||
| 624 | + { | ||
| 625 | + type: 'Feature', | ||
| 626 | + geometry: { type: 'Point', coordinates: [116, 34] }, | ||
| 627 | + properties: { title: '1', _smiportal_imgLinkUrl: 'http://fack:8190/test.png' } | ||
| 628 | + }, | ||
| 629 | + { | ||
| 630 | + type: 'Feature', | ||
| 631 | + geometry: { type: 'Point', coordinates: [116, 34] }, | ||
| 632 | + properties: { title: '12', _smiportal_imgLinkUrl: './test.png' } | ||
| 633 | + } | ||
| 634 | + ] | ||
| 635 | + }; | ||
| 636 | + const featureStyles = { featureStyles: [{ style: '{}' },{ style: '{}' }] }; | ||
| 637 | + const result = webmap.geojsonToFeature(geojsonData, featureStyles); | ||
| 638 | + expect(result[0].getProperties().useStyle.anchor[0] ).toEqual(0.5); | ||
| 639 | + }); | ||
| 640 | + it('setVisibleScales', () => { | ||
| 641 | + const webmap = new WebMap(id, { server: server }); | ||
| 642 | + const layer = {setMinResolution:function(){},setMaxResolution:function(){}}; | ||
| 643 | + const setVisibleScalesFn = spyOn(layer, 'setMaxResolution').and.callThrough(); | ||
| 644 | + const setMinResolutionFn = spyOn(layer, 'setMinResolution').and.callThrough(); | ||
| 645 | + webmap.resolutions = [1.4,0.7] | ||
| 646 | + webmap.setVisibleScales(layer, {minScale:0, maxScale:1}); | ||
| 647 | + expect(setVisibleScalesFn).toHaveBeenCalledWith(2); | ||
| 648 | + expect(setMinResolutionFn).toHaveBeenCalledWith(0.7); | ||
| 649 | + }); | ||
| 587 | 650 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments