From a967513aaf97d1d88fdb4b34f271391710ce40eb Mon Sep 17 00:00:00 2001 From: glennvorhes <glennvorhes@statuscode200.com> Date: Mon, 15 Apr 2019 21:08:54 -0500 Subject: [PATCH] port to ol5 --- dist/_tests/demos/mapPopup.js | 24 ++++--- dist/_tests/demos/mapPopup.js.map | 2 +- dist/_tests/demos/my_little_test.js | 3 +- dist/_tests/demos/my_little_test.js.map | 2 +- dist/_tests/demos/slider-test.d.ts | 4 +- dist/_tests/demos/slider-test.js.map | 2 +- dist/collections/ItsLayerCollection.d.ts | 8 +-- dist/collections/ItsLayerCollection.js | 2 +- dist/collections/ItsLayerCollection.js.map | 2 +- dist/layers/LayerBase.d.ts | 17 ++--- dist/layers/LayerBase.js.map | 2 +- dist/layers/LayerBaseVector.d.ts | 31 +++++---- dist/layers/LayerBaseVector.js | 11 +-- dist/layers/LayerBaseVector.js.map | 2 +- dist/layers/LayerBaseVectorEsri.d.ts | 1 - dist/layers/LayerBaseVectorEsri.js | 4 +- dist/layers/LayerBaseVectorEsri.js.map | 2 +- dist/layers/LayerBaseVectorGeoJson.d.ts | 9 +-- dist/layers/LayerBaseVectorGeoJson.js | 4 +- dist/layers/LayerBaseVectorGeoJson.js.map | 2 +- dist/layers/LayerBaseXyzTile.d.ts | 15 ++-- dist/layers/LayerBaseXyzTile.js | 15 ++-- dist/layers/LayerBaseXyzTile.js.map | 2 +- dist/layers/LayerEsriMapServer.d.ts | 18 ++--- dist/layers/LayerEsriMapServer.js | 18 ++--- dist/layers/LayerEsriMapServer.js.map | 2 +- dist/layers/LayerEsriTile.js.map | 2 +- dist/layers/LayerItsInventory.js | 25 ++++--- dist/layers/LayerItsInventory.js.map | 2 +- dist/layers/LayerRealEarthTile.js.map | 2 +- dist/mixin/RealEarthAnimateTile.d.ts | 7 +- dist/mixin/RealEarthAnimateTile.js.map | 2 +- dist/mixin/RealEarthAnimateVector.d.ts | 7 +- dist/mixin/RealEarthAnimateVector.js.map | 2 +- dist/olHelpers/SortedFeatures.d.ts | 12 ++-- dist/olHelpers/SortedFeatures.js | 4 +- dist/olHelpers/SortedFeatures.js.map | 2 +- dist/olHelpers/esriToOlStyle.d.ts | 7 +- dist/olHelpers/esriToOlStyle.js | 28 ++++---- dist/olHelpers/esriToOlStyle.js.map | 2 +- dist/olHelpers/extentUtil.d.ts | 14 ++-- dist/olHelpers/extentUtil.js | 5 -- dist/olHelpers/extentUtil.js.map | 2 +- dist/olHelpers/geocode.d.ts | 4 +- dist/olHelpers/geocode.js | 25 ++++--- dist/olHelpers/geocode.js.map | 2 +- dist/olHelpers/layerSwipe.d.ts | 3 +- dist/olHelpers/layerSwipe.js.map | 2 +- dist/olHelpers/mapInteractionBase.d.ts | 8 +-- dist/olHelpers/mapInteractionBase.js | 1 + dist/olHelpers/mapInteractionBase.js.map | 2 +- dist/olHelpers/mapMoveCls.d.ts | 4 +- dist/olHelpers/mapMoveCls.js.map | 2 +- dist/olHelpers/mapPopupCls.d.ts | 29 ++++---- dist/olHelpers/mapPopupCls.js | 29 ++++---- dist/olHelpers/mapPopupCls.js.map | 2 +- dist/olHelpers/mapToBase64.d.ts | 13 +--- dist/olHelpers/mapToBase64.js | 7 -- dist/olHelpers/mapToBase64.js.map | 2 +- dist/olHelpers/projections.d.ts | 8 +-- dist/olHelpers/projections.js | 10 +-- dist/olHelpers/projections.js.map | 2 +- dist/olHelpers/propertiesZoomStyle.d.ts | 5 +- dist/olHelpers/propertiesZoomStyle.js.map | 2 +- dist/olHelpers/quickMap.d.ts | 4 +- dist/olHelpers/quickMap.js.map | 2 +- dist/olHelpers/quickMapBase.d.ts | 4 +- dist/olHelpers/quickMapBase.js | 31 ++++++--- dist/olHelpers/quickMapBase.js.map | 2 +- dist/olHelpers/quickMapMulti.d.ts | 4 +- dist/olHelpers/quickMapMulti.js.map | 2 +- dist/reactComponents/SelectArea.d.ts | 9 +-- dist/reactComponents/SelectArea.js | 16 +++-- dist/reactComponents/SelectArea.js.map | 2 +- dist/reactComponents/helpers/get_map.d.ts | 5 +- dist/reactComponents/helpers/get_map.js.map | 2 +- package.json | 7 +- src/_tests/demos/mapPopup.ts | 22 +++--- src/_tests/demos/my_little_test.ts | 2 +- src/_tests/demos/slider-test.ts | 5 +- src/collections/ItsLayerCollection.ts | 8 +-- src/layers/LayerBase.ts | 17 ++--- src/layers/LayerBaseVector.ts | 46 +++++++------ src/layers/LayerBaseVectorEsri.ts | 4 +- src/layers/LayerBaseVectorGeoJson.ts | 11 +-- src/layers/LayerBaseXyzTile.ts | 27 +++----- src/layers/LayerEsriMapServer.ts | 34 ++++----- src/layers/LayerEsriTile.ts | 1 + src/layers/LayerItsInventory.ts | 37 ++++++---- src/layers/LayerRealEarthTile.ts | 1 + src/mixin/RealEarthAnimateTile.ts | 7 +- src/mixin/RealEarthAnimateVector.ts | 7 +- src/olHelpers/SortedFeatures.ts | 12 ++-- src/olHelpers/esriToOlStyle.ts | 44 ++++++------ src/olHelpers/extentUtil.ts | 18 ++--- src/olHelpers/geocode.ts | 31 ++++++--- src/olHelpers/layerSwipe.ts | 19 +++--- src/olHelpers/mapInteractionBase.ts | 8 ++- src/olHelpers/mapMoveCls.ts | 5 +- src/olHelpers/mapPopupCls.ts | 76 ++++++++++++--------- src/olHelpers/mapToBase64.ts | 14 ++-- src/olHelpers/projections.ts | 9 +-- src/olHelpers/propertiesZoomStyle.ts | 9 +-- src/olHelpers/quickMap.ts | 4 +- src/olHelpers/quickMapBase.ts | 36 +++++++--- src/olHelpers/quickMapMulti.ts | 5 +- src/reactComponents/SelectArea.tsx | 29 +++++--- src/reactComponents/helpers/get_map.ts | 9 +-- tsconfig.json | 25 +++++-- 109 files changed, 619 insertions(+), 544 deletions(-) diff --git a/dist/_tests/demos/mapPopup.js b/dist/_tests/demos/mapPopup.js index d7cf3b6..ed3e2fd 100644 --- a/dist/_tests/demos/mapPopup.js +++ b/dist/_tests/demos/mapPopup.js @@ -4,9 +4,11 @@ */ Object.defineProperty(exports, "__esModule", { value: true }); var quickMap_1 = require("../../olHelpers/quickMap"); -var LayerBaseVectorGeoJson_1 = require("../../layers/LayerBaseVectorGeoJson"); -var ol = require("custom-ol"); +var layers_1 = require("../../layers"); var mapPopup_1 = require("../../olHelpers/mapPopup"); +var Style_1 = require("ol/style/Style"); +var Stroke_1 = require("ol/style/Stroke"); +var Fill_1 = require("ol/style/Fill"); var reg = { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, @@ -36,29 +38,29 @@ var reg2 = { ] }; var map = quickMap_1.default({ addGeocode: true }); -var regionLayer = new LayerBaseVectorGeoJson_1.LayerBaseVectorGeoJson('', { +var regionLayer = new layers_1.LayerBaseVectorGeoJson('', { minZoom: 6, maxZoom: 12, name: 'WisDOT Regions', - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style_1.default({ + fill: new Fill_1.default({ color: 'blue' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke_1.default({ color: 'yellow', width: 5 }) }) }); -var regionLayer2 = new LayerBaseVectorGeoJson_1.LayerBaseVectorGeoJson('', { +var regionLayer2 = new layers_1.LayerBaseVectorGeoJson('', { minZoom: 6, maxZoom: 12, name: 'WisDOT Regions', - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style_1.default({ + fill: new Fill_1.default({ color: 'red' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke_1.default({ color: 'yellow', width: 5 }) @@ -82,5 +84,5 @@ window['map'] = map; // } // ]; // let legend = new LayerLegend(layerArray, 'legend-container', {}); -console.log('it works'); +// console.log('it works'); //# sourceMappingURL=mapPopup.js.map \ No newline at end of file diff --git a/dist/_tests/demos/mapPopup.js.map b/dist/_tests/demos/mapPopup.js.map index f26bc7e..5e5ac86 100644 --- a/dist/_tests/demos/mapPopup.js.map +++ b/dist/_tests/demos/mapPopup.js.map @@ -1 +1 @@ -{"version":3,"file":"mapPopup.js","sourceRoot":"","sources":["../../../src/_tests/demos/mapPopup.ts"],"names":[],"mappings":";AAAA;;GA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6CAA6C;AAC7C,2BAA2B;AAC3B,0BAA0B;AAC1B,2CAA2C;AAC3C,QAAQ;AACR,KAAK;AAEL,oEAAoE;AAEpE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/18/2015.\r\n */\r\n\r\n\r\nimport ItsLayerCollection from '../../collections/ItsLayerCollection';\r\nimport LayerLegend from '../../collections/LayerLegend';\r\nimport quickMap from '../../olHelpers/quickMap';\r\nimport {LayerBaseVectorGeoJson} from '../../layers/LayerBaseVectorGeoJson';\r\nimport ol = require(\"custom-ol\");\r\nimport {mapPopup} from '../../olHelpers/mapPopup';\r\n\r\n\r\n\r\nconst reg = {\r\n \"type\": \"FeatureCollection\",\r\n \"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\"}},\r\n \"features\": [\r\n {\r\n \"type\": \"Feature\",\r\n \"properties\": {},\r\n \"geometry\": {\r\n \"type\": \"Polygon\",\r\n \"coordinates\": [[[-91.4232, 43.9834], [-91.3246, 43.9834], [-91.3465, 44.0162], [-91.3082, 44.0655], [-91.2205, 44.0546], [-91.1767, 44.0874], [-91.1493, 44.0819], [-90.9741, 44.071], [-90.9741, 44.071], [-90.9796, 44.1312], [-90.9084, 44.1586], [-90.4921, 44.1586], [-90.3114, 44.1531], [-90.3114, 44.2463], [-90.0813, 44.2463], [-89.9006, 44.2517], [-89.928, 44.197], [-89.9061, 44.1805], [-89.928, 44.1531], [-89.9718, 44.1696], [-90.0266, 44.071], [-89.9608, 43.9779], [-89.9499, 43.9231], [-89.9828, 43.9122], [-89.9608, 43.8629], [-89.8513, 43.7698], [-89.7856, 43.6383], [-89.5994, 43.6438], [-89.2434, 43.6438], [-89.0079, 43.6328], [-88.8874, 43.6328], [-88.3999, 43.6328], [-88.3999, 43.5452], [-88.4163, 43.1947], [-88.5368, 43.1947], [-88.5423, 42.8442], [-88.5478, 42.8442], [-88.7778, 42.8442], [-88.7778, 42.4936], [-88.9421, 42.4936], [-89.3639, 42.4991], [-89.4022, 42.4991], [-89.8404, 42.5046], [-89.928, 42.5046], [-90.4264, 42.5046], [-90.64, 42.5101], [-90.7112, 42.636], [-90.8974, 42.6744], [-91.0672, 42.7511], [-91.1548, 42.9866], [-91.1767, 43.0797], [-91.1767, 43.1344], [-91.0562, 43.2549], [-91.1055, 43.3152], [-91.2041, 43.3535], [-91.2041, 43.4247], [-91.2315, 43.4576], [-91.2151, 43.5014], [-91.2698, 43.6164], [-91.2589, 43.7259], [-91.2424, 43.7752], [-91.2863, 43.8464]]]\r\n }\r\n }\r\n ]\r\n};\r\n\r\nconst reg2 = {\r\n \"type\": \"FeatureCollection\",\r\n \"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\"}},\r\n \"features\": [\r\n {\r\n \"type\": \"Feature\",\r\n \"properties\": {},\r\n \"geometry\": {\r\n \"type\": \"Polygon\",\r\n \"coordinates\": [[[-93.0, 45.0], [-94.0, 45.0], [-94.0, 46.0], [-93.0, 46.0], [-93.0, 45.0]]]\r\n }\r\n }\r\n ]\r\n};\r\n\r\nlet map = quickMap({addGeocode: true});\r\n\r\n\r\n\r\n\r\n\r\nlet regionLayer = new LayerBaseVectorGeoJson(\r\n '',\r\n {\r\n minZoom: 6,\r\n maxZoom: 12,\r\n name: 'WisDOT Regions',\r\n style: new ol.style.Style({\r\n fill: new ol.style.Fill({\r\n color: 'blue'\r\n }),\r\n stroke: new ol.style.Stroke({\r\n color: 'yellow',\r\n width: 5\r\n })\r\n })\r\n });\r\n\r\nlet regionLayer2 = new LayerBaseVectorGeoJson(\r\n '',\r\n {\r\n minZoom: 6,\r\n maxZoom: 12,\r\n name: 'WisDOT Regions',\r\n style: new ol.style.Style({\r\n fill: new ol.style.Fill({\r\n color: 'red'\r\n }),\r\n stroke: new ol.style.Stroke({\r\n color: 'yellow',\r\n width: 5\r\n })\r\n })\r\n });\r\n\r\nregionLayer.addFeatures(reg);\r\nregionLayer2.addFeatures(reg2);\r\n\r\nmap.addLayer(regionLayer.olLayer);\r\nmap.addLayer(regionLayer2.olLayer);\r\n\r\nmapPopup.addVectorPopup(regionLayer2, (p) => {return 'cats'});\r\n\r\n\r\nwindow['map'] = map;\r\n//\r\n// let itsLayerCollection = new ItsLayerCollection(map);\r\n//\r\n// let layerArray = [\r\n// {\r\n// groupName: 'ITS Inventory Layers',\r\n// collapse: false,\r\n// addCheck: true,\r\n// items: itsLayerCollection.layers\r\n// }\r\n// ];\r\n\r\n// let legend = new LayerLegend(layerArray, 'legend-container', {});\r\n\r\nconsole.log('it works');\r\n"]} \ No newline at end of file +{"version":3,"file":"mapPopup.js","sourceRoot":"","sources":["../../../src/_tests/demos/mapPopup.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,qDAAgD;AAChD,uCAAoD;AACpD,qDAAkD;AAClD,wCAAmC;AACnC,0CAAqC;AACrC,sCAAiC;AAIjC,IAAM,GAAG,GAAG;IACR,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,EAAC,MAAM,EAAE,+BAA+B,EAAC,EAAC;IAChF,UAAU,EAAE;QACR;YACI,MAAM,EAAE,SAAS;YACjB,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE;gBACR,MAAM,EAAE,SAAS;gBACjB,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAA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,WAAW,CAAC,IAAI,CAAC,CAAC;AAE/B,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAClC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAEnC,mBAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,UAAC,CAAC,IAAM,OAAO,MAAM,CAAA,CAAA,CAAC,CAAC,CAAC;AAG9D,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;AACpB,EAAE;AACF,wDAAwD;AACxD,EAAE;AACF,qBAAqB;AACrB,QAAQ;AACR,6CAA6C;AAC7C,2BAA2B;AAC3B,0BAA0B;AAC1B,2CAA2C;AAC3C,QAAQ;AACR,KAAK;AAEL,oEAAoE;AAEpE,2BAA2B","sourcesContent":["/**\r\n * Created by gavorhes on 12/18/2015.\r\n */\r\n\r\n\r\nimport quickMap from '../../olHelpers/quickMap';\r\nimport {LayerBaseVectorGeoJson} from '../../layers';\r\nimport {mapPopup} from '../../olHelpers/mapPopup';\r\nimport Style from 'ol/style/Style';\r\nimport Stroke from 'ol/style/Stroke';\r\nimport Fill from 'ol/style/Fill';\r\n\r\n\r\n\r\nconst reg = {\r\n \"type\": \"FeatureCollection\",\r\n \"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\"}},\r\n \"features\": [\r\n {\r\n \"type\": \"Feature\",\r\n \"properties\": {},\r\n \"geometry\": {\r\n \"type\": \"Polygon\",\r\n \"coordinates\": [[[-91.4232, 43.9834], [-91.3246, 43.9834], [-91.3465, 44.0162], [-91.3082, 44.0655], [-91.2205, 44.0546], [-91.1767, 44.0874], [-91.1493, 44.0819], [-90.9741, 44.071], [-90.9741, 44.071], [-90.9796, 44.1312], [-90.9084, 44.1586], [-90.4921, 44.1586], [-90.3114, 44.1531], [-90.3114, 44.2463], [-90.0813, 44.2463], [-89.9006, 44.2517], [-89.928, 44.197], [-89.9061, 44.1805], [-89.928, 44.1531], [-89.9718, 44.1696], [-90.0266, 44.071], [-89.9608, 43.9779], [-89.9499, 43.9231], [-89.9828, 43.9122], [-89.9608, 43.8629], [-89.8513, 43.7698], [-89.7856, 43.6383], [-89.5994, 43.6438], [-89.2434, 43.6438], [-89.0079, 43.6328], [-88.8874, 43.6328], [-88.3999, 43.6328], [-88.3999, 43.5452], [-88.4163, 43.1947], [-88.5368, 43.1947], [-88.5423, 42.8442], [-88.5478, 42.8442], [-88.7778, 42.8442], [-88.7778, 42.4936], [-88.9421, 42.4936], [-89.3639, 42.4991], [-89.4022, 42.4991], [-89.8404, 42.5046], [-89.928, 42.5046], [-90.4264, 42.5046], [-90.64, 42.5101], [-90.7112, 42.636], [-90.8974, 42.6744], [-91.0672, 42.7511], [-91.1548, 42.9866], [-91.1767, 43.0797], [-91.1767, 43.1344], [-91.0562, 43.2549], [-91.1055, 43.3152], [-91.2041, 43.3535], [-91.2041, 43.4247], [-91.2315, 43.4576], [-91.2151, 43.5014], [-91.2698, 43.6164], [-91.2589, 43.7259], [-91.2424, 43.7752], [-91.2863, 43.8464]]]\r\n }\r\n }\r\n ]\r\n};\r\n\r\nconst reg2 = {\r\n \"type\": \"FeatureCollection\",\r\n \"crs\": {\"type\": \"name\", \"properties\": {\"name\": \"urn:ogc:def:crs:OGC:1.3:CRS84\"}},\r\n \"features\": [\r\n {\r\n \"type\": \"Feature\",\r\n \"properties\": {},\r\n \"geometry\": {\r\n \"type\": \"Polygon\",\r\n \"coordinates\": [[[-93.0, 45.0], [-94.0, 45.0], [-94.0, 46.0], [-93.0, 46.0], [-93.0, 45.0]]]\r\n }\r\n }\r\n ]\r\n};\r\n\r\nlet map = quickMap({addGeocode: true});\r\n\r\n\r\n\r\n\r\n\r\nlet regionLayer = new LayerBaseVectorGeoJson(\r\n '',\r\n {\r\n minZoom: 6,\r\n maxZoom: 12,\r\n name: 'WisDOT Regions',\r\n style: new Style({\r\n fill: new Fill({\r\n color: 'blue'\r\n }),\r\n stroke: new Stroke({\r\n color: 'yellow',\r\n width: 5\r\n })\r\n })\r\n });\r\n\r\nlet regionLayer2 = new LayerBaseVectorGeoJson(\r\n '',\r\n {\r\n minZoom: 6,\r\n maxZoom: 12,\r\n name: 'WisDOT Regions',\r\n style: new Style({\r\n fill: new Fill({\r\n color: 'red'\r\n }),\r\n stroke: new Stroke({\r\n color: 'yellow',\r\n width: 5\r\n })\r\n })\r\n });\r\n\r\nregionLayer.addFeatures(reg);\r\nregionLayer2.addFeatures(reg2);\r\n\r\nmap.addLayer(regionLayer.olLayer);\r\nmap.addLayer(regionLayer2.olLayer);\r\n\r\nmapPopup.addVectorPopup(regionLayer2, (p) => {return 'cats'});\r\n\r\n\r\nwindow['map'] = map;\r\n//\r\n// let itsLayerCollection = new ItsLayerCollection(map);\r\n//\r\n// let layerArray = [\r\n// {\r\n// groupName: 'ITS Inventory Layers',\r\n// collapse: false,\r\n// addCheck: true,\r\n// items: itsLayerCollection.layers\r\n// }\r\n// ];\r\n\r\n// let legend = new LayerLegend(layerArray, 'legend-container', {});\r\n\r\n// console.log('it works');\r\n"]} \ No newline at end of file diff --git a/dist/_tests/demos/my_little_test.js b/dist/_tests/demos/my_little_test.js index 7117456..d69535d 100644 --- a/dist/_tests/demos/my_little_test.js +++ b/dist/_tests/demos/my_little_test.js @@ -1,6 +1,7 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +// import ol = require('custom-ol'); // let g = new +Object.defineProperty(exports, "__esModule", { value: true }); var media_control_1 = require("../../domUtil/media-control"); // // diff --git a/dist/_tests/demos/my_little_test.js.map b/dist/_tests/demos/my_little_test.js.map index 1fddec5..4d67f78 100644 --- a/dist/_tests/demos/my_little_test.js.map +++ b/dist/_tests/demos/my_little_test.js.map @@ -1 +1 @@ -{"version":3,"file":"my_little_test.js","sourceRoot":"","sources":["../../../src/_tests/demos/my_little_test.ts"],"names":[],"mappings":";;AACA,cAAc;AAKd,6DAAwD;AACxD,EAAE;AACF,EAAE;AAGF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAE7B,EAAE;AACF,mCAAmC;AACnC,EAAE;AACF,oBAAoB;AAGpB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAI1B,YAAa,GAAe;IAAf,oBAAA,EAAA,OAAe;IACxB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,EAAE,CAAC,CAAC,CAAC,CAAC;AAEN,IAAI,OAAO,GAAG,IAAI,4BAAY,CAAC,KAAK,CAAC,CAAC;AAEtC,EAAE;AACF,EAAE;AACF,oBAAoB;AACpB,EAAE;AACF,EAAE;AACF,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,uBAAuB;AACvB,EAAE","sourcesContent":["import ol = require('custom-ol');\r\n// let g = new\r\n\r\n\r\n\r\n\r\nimport {MediaControl} from '../../domUtil/media-control'\r\n//\r\n//\r\n\r\n\r\nconsole.log('eat this fish');\r\nconsole.log('eat this fish');\r\nconsole.log('eat this bird');\r\n\r\n//\r\n// let g = new ol3.source.Vector();\r\n//\r\n// console.log(olx);\r\n\r\n\r\nconsole.log('i am here5');\r\n\r\n\r\n\r\nfunction me (eat: number = 1){\r\n console.log(eat, 'one');\r\n}\r\n\r\nme(1);\r\n\r\nvar control = new MediaControl('map');\r\n\r\n//\r\n//\r\n// console.log(ol3);\r\n//\r\n//\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log('here');\r\n//\r\n"]} \ No newline at end of file +{"version":3,"file":"my_little_test.js","sourceRoot":"","sources":["../../../src/_tests/demos/my_little_test.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,cAAc;;AAKd,6DAAwD;AACxD,EAAE;AACF,EAAE;AAGF,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAE7B,EAAE;AACF,mCAAmC;AACnC,EAAE;AACF,oBAAoB;AAGpB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAI1B,YAAa,GAAe;IAAf,oBAAA,EAAA,OAAe;IACxB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,EAAE,CAAC,CAAC,CAAC,CAAC;AAEN,IAAI,OAAO,GAAG,IAAI,4BAAY,CAAC,KAAK,CAAC,CAAC;AAEtC,EAAE;AACF,EAAE;AACF,oBAAoB;AACpB,EAAE;AACF,EAAE;AACF,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,0CAA0C;AAC1C,uBAAuB;AACvB,EAAE","sourcesContent":["// import ol = require('custom-ol');\r\n// let g = new\r\n\r\n\r\n\r\n\r\nimport {MediaControl} from '../../domUtil/media-control'\r\n//\r\n//\r\n\r\n\r\nconsole.log('eat this fish');\r\nconsole.log('eat this fish');\r\nconsole.log('eat this bird');\r\n\r\n//\r\n// let g = new ol3.source.Vector();\r\n//\r\n// console.log(olx);\r\n\r\n\r\nconsole.log('i am here5');\r\n\r\n\r\n\r\nfunction me (eat: number = 1){\r\n console.log(eat, 'one');\r\n}\r\n\r\nme(1);\r\n\r\nvar control = new MediaControl('map');\r\n\r\n//\r\n//\r\n// console.log(ol3);\r\n//\r\n//\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log(definedAndNotNull(\"fish\"));\r\n// console.log('here');\r\n//\r\n"]} \ No newline at end of file diff --git a/dist/_tests/demos/slider-test.d.ts b/dist/_tests/demos/slider-test.d.ts index c08d028..cd9fa23 100644 --- a/dist/_tests/demos/slider-test.d.ts +++ b/dist/_tests/demos/slider-test.d.ts @@ -4,14 +4,14 @@ * Created by gavorhes on 6/22/2016. */ import { TipSliders, TipPresetConfig, TipSliderConfig } from '../../collections/Sliders'; -import ol = require('custom-ol'); +import Map from 'ol/Map'; import 'jquery-ui'; export interface ITipConfig { slidersConfig: Array<TipSliderConfig>; presetConfig: Array<TipPresetConfig>; tipSegmentLayerMinZoom: number; sliders: TipSliders; - _map: ol.Map; + _map: Map; $loadingGif: JQuery; $presetSelector: JQuery; $regionSelector: JQuery; diff --git a/dist/_tests/demos/slider-test.js.map b/dist/_tests/demos/slider-test.js.map index 64f9671..bfc9bff 100644 --- a/dist/_tests/demos/slider-test.js.map +++ b/dist/_tests/demos/slider-test.js.map @@ -1 +1 @@ -{"version":3,"file":"slider-test.js","sourceRoot":"","sources":["../../../src/_tests/demos/slider-test.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,qDAAuF;AACvF,0BAA6B;AAE7B,qBAAmB;AAmBN,QAAA,SAAS,GAAG;IACrB,WAAW,EAAE,CAAC,CAAC,cAAc,CAAC;IAC9B,eAAe,EAAE,CAAC,CAAC,kBAAkB,CAAC;IACtC,eAAe,EAAE,CAAC,CAAC,kBAAkB,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,mBAAmB,CAAC;IACxC,sBAAsB,EAAE,EAAE;IAC1B,aAAa,EAAE;QACP;YACI,KAAK,EAAE,MAAM;YACb,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;aACnC;SACJ;QACD;YACI,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAA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,GAAG,OAAO,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 6/22/2016.\r\n */\r\nimport {TipSliders, TipPresetConfig, TipSliderConfig} from '../../collections/Sliders';\r\nimport $ = require('jquery');\r\nimport ol = require('custom-ol');\r\nimport 'jquery-ui';\r\n\r\n\r\n\r\nexport interface ITipConfig{\r\n slidersConfig: Array<TipSliderConfig>;\r\n presetConfig: Array<TipPresetConfig>;\r\n tipSegmentLayerMinZoom: number;\r\n sliders: TipSliders;\r\n _map: ol.Map;\r\n $loadingGif: JQuery;\r\n $presetSelector: JQuery;\r\n $regionSelector: JQuery;\r\n $versionSelector: JQuery;\r\n itsLayerCollection: any;\r\n tipSegmentLayer: any;\r\n metamanagerSegments: any;\r\n}\r\n\r\nexport const tipConfig = {\r\n $loadingGif: $('#loading-gif'),\r\n $presetSelector: $('#preset-selector'),\r\n $regionSelector: $('#region-selector'),\r\n $versionSelector: $('#version-selector'),\r\n tipSegmentLayerMinZoom: 10,\r\n slidersConfig: [\r\n {\r\n label: 'AADT',\r\n yearOptions: [\r\n {label: '1', column: 'aadtyr_1'}\r\n ]\r\n },\r\n {\r\n label: 'AADT Future',\r\n yearOptions: [\r\n {label: '5', column: 'aadtyr_5'},\r\n {label: '10', column: 'aadtyr_10'},\r\n {label: '15', column: 'aadtyr_15'},\r\n {label: '20', column: 'aadtyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'Growth',\r\n yearOptions: [\r\n {label: '5', column: 'growth_5'},\r\n {label: '10', column: 'growth_10'},\r\n {label: '15', column: 'growth_15'},\r\n {label: '20', column: 'growth_20'}\r\n ]\r\n },\r\n {\r\n label: 'Truck',\r\n yearOptions: [\r\n {label: '1', column: 'trkdyr_1'},\r\n {label: '20', column: 'trkdyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'LOS',\r\n yearOptions: [\r\n {label: '1', column: 'losyr_1'}\r\n ]\r\n },\r\n {\r\n label: 'LOS Future',\r\n yearOptions: [\r\n {label: '5', column: 'losyr_5'},\r\n {label: '10', column: 'losyr_10'},\r\n {label: '15', column: 'losyr_15'},\r\n {label: '20', column: 'losyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'Crash Rate',\r\n yearOptions: [\r\n {label: 1, column: 'crash_rate'}\r\n ]\r\n },\r\n {\r\n label: 'Severity',\r\n yearOptions: [\r\n {label: 1, column: 'crash_severity'}\r\n ]\r\n },\r\n {\r\n label: 'Weather',\r\n yearOptions: [\r\n {label: 1, column: 'weather'}\r\n ]\r\n },\r\n {\r\n label: 'Event',\r\n yearOptions: [\r\n {label: 1, column: 'event'}\r\n ]\r\n }\r\n ] as Array<TipSliderConfig>,\r\n presetConfig: [\r\n {\r\n label: 'Default TIP',\r\n presets: [\r\n {column: 'aadtyr_1', value: 10.0},\r\n {column: 'aadtyr_20', value: 7.0},\r\n {column: 'growth_20', value: 7.0},\r\n {column: 'trkdyr_1', value: 4.0},\r\n {column: 'losyr_1', value: 12.0},\r\n {column: 'losyr_20', value: 12.0},\r\n {column: 'crash_rate', value: 15.0},\r\n {column: 'crash_severity', value: 13.0},\r\n {column: 'weather', value: 9.0},\r\n {column: 'event', value: 11.0}\r\n ]\r\n },\r\n {\r\n label: 'Safety',\r\n presets: [\r\n {column: 'aadtyr_1', value: 20.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 0.0},\r\n {column: 'losyr_1', value: 0.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 40.0},\r\n {column: 'crash_severity', value: 40.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Mobility Present',\r\n presets: [\r\n {column: 'aadtyr_1', value: 25.0},\r\n {column: 'aadtyr_20', value: 25.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 25.0},\r\n {column: 'losyr_1', value: 25.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Mobility Future',\r\n presets: [\r\n {column: 'aadtyr_1', value: 0.0},\r\n {column: 'aadtyr_20', value: 25.0},\r\n {column: 'growth_20', value: 25.0},\r\n {column: 'trkdyr_1', value: 25.0},\r\n {column: 'losyr_1', value: 0.0},\r\n {column: 'losyr_20', value: 25.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Service',\r\n presets: [\r\n {column: 'aadtyr_1', value: 30.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 10.0},\r\n {column: 'trkdyr_1', value: 0.0},\r\n {column: 'losyr_1', value: 30.0},\r\n {column: 'losyr_20', value: 30.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Freight Performance',\r\n presets: [\r\n {column: 'aadtyr_1', value: 20.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 60.0},\r\n {column: 'losyr_1', value: 20.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n }\r\n ] as Array<TipPresetConfig>\r\n\r\n} as ITipConfig;\r\n\r\ntipConfig.$presetSelector.append('<option value=\"0\" disabled=>Custom</option>');\r\n\r\nlet sliders = new TipSliders(tipConfig.slidersConfig, tipConfig.presetConfig, 'slider-container',\r\n tipConfig.$presetSelector, tipConfig.$regionSelector, tipConfig.$regionSelector, (chg) => {console.log(chg)});\r\n\r\n// sliders.changedCallback = (chg) => {console.log(chg)};\r\n\r\nwindow['glob'] = sliders;\r\nwindow['hat'] = sliders;\r\nwindow['bird'] = sliders;\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"slider-test.js","sourceRoot":"","sources":["../../../src/_tests/demos/slider-test.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,qDAAuF;AACvF,0BAA6B;AAG7B,qBAAmB;AAmBN,QAAA,SAAS,GAAG;IACrB,WAAW,EAAE,CAAC,CAAC,cAAc,CAAC;IAC9B,eAAe,EAAE,CAAC,CAAC,kBAAkB,CAAC;IACtC,eAAe,EAAE,CAAC,CAAC,kBAAkB,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,mBAAmB,CAAC;IACxC,sBAAsB,EAAE,EAAE;IAC1B,aAAa,EAAE;QACP;YACI,KAAK,EAAE,MAAM;YACb,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;aACnC;SACJ;QACD;YACI,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;gBAChC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;gBAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;gBAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;aACrC;SACJ;QACD;YACI,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;gBAChC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;gBAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;gBAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WA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AM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAC;gBAClC,EAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAC;gBACtC,EAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAC;gBAC/B,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAC;aAChC;SACJ;KACsB;CAEpB,CAAC;AAEhB,iBAAS,CAAC,eAAe,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAC;AAEhF,IAAI,OAAO,GAAG,IAAI,oBAAU,CAAC,iBAAS,CAAC,aAAa,EAAE,iBAAS,CAAC,YAAY,EAAE,kBAAkB,EAC5F,iBAAS,CAAC,eAAe,EAAE,iBAAS,CAAC,eAAe,EAAE,iBAAS,CAAC,eAAe,EAAE,UAAC,GAAG,IAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA,CAAA,CAAC,CAAC,CAAC;AAElH,yDAAyD;AAEzD,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;AACzB,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AACxB,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 6/22/2016.\r\n */\r\nimport {TipSliders, TipPresetConfig, TipSliderConfig} from '../../collections/Sliders';\r\nimport $ = require('jquery');\r\n// import ol = require('custom-ol');\r\nimport Map from 'ol/Map';\r\nimport 'jquery-ui';\r\n\r\n\r\n\r\nexport interface ITipConfig{\r\n slidersConfig: Array<TipSliderConfig>;\r\n presetConfig: Array<TipPresetConfig>;\r\n tipSegmentLayerMinZoom: number;\r\n sliders: TipSliders;\r\n _map: Map;\r\n $loadingGif: JQuery;\r\n $presetSelector: JQuery;\r\n $regionSelector: JQuery;\r\n $versionSelector: JQuery;\r\n itsLayerCollection: any;\r\n tipSegmentLayer: any;\r\n metamanagerSegments: any;\r\n}\r\n\r\nexport const tipConfig = {\r\n $loadingGif: $('#loading-gif'),\r\n $presetSelector: $('#preset-selector'),\r\n $regionSelector: $('#region-selector'),\r\n $versionSelector: $('#version-selector'),\r\n tipSegmentLayerMinZoom: 10,\r\n slidersConfig: [\r\n {\r\n label: 'AADT',\r\n yearOptions: [\r\n {label: '1', column: 'aadtyr_1'}\r\n ]\r\n },\r\n {\r\n label: 'AADT Future',\r\n yearOptions: [\r\n {label: '5', column: 'aadtyr_5'},\r\n {label: '10', column: 'aadtyr_10'},\r\n {label: '15', column: 'aadtyr_15'},\r\n {label: '20', column: 'aadtyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'Growth',\r\n yearOptions: [\r\n {label: '5', column: 'growth_5'},\r\n {label: '10', column: 'growth_10'},\r\n {label: '15', column: 'growth_15'},\r\n {label: '20', column: 'growth_20'}\r\n ]\r\n },\r\n {\r\n label: 'Truck',\r\n yearOptions: [\r\n {label: '1', column: 'trkdyr_1'},\r\n {label: '20', column: 'trkdyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'LOS',\r\n yearOptions: [\r\n {label: '1', column: 'losyr_1'}\r\n ]\r\n },\r\n {\r\n label: 'LOS Future',\r\n yearOptions: [\r\n {label: '5', column: 'losyr_5'},\r\n {label: '10', column: 'losyr_10'},\r\n {label: '15', column: 'losyr_15'},\r\n {label: '20', column: 'losyr_20'}\r\n ]\r\n },\r\n {\r\n label: 'Crash Rate',\r\n yearOptions: [\r\n {label: 1, column: 'crash_rate'}\r\n ]\r\n },\r\n {\r\n label: 'Severity',\r\n yearOptions: [\r\n {label: 1, column: 'crash_severity'}\r\n ]\r\n },\r\n {\r\n label: 'Weather',\r\n yearOptions: [\r\n {label: 1, column: 'weather'}\r\n ]\r\n },\r\n {\r\n label: 'Event',\r\n yearOptions: [\r\n {label: 1, column: 'event'}\r\n ]\r\n }\r\n ] as Array<TipSliderConfig>,\r\n presetConfig: [\r\n {\r\n label: 'Default TIP',\r\n presets: [\r\n {column: 'aadtyr_1', value: 10.0},\r\n {column: 'aadtyr_20', value: 7.0},\r\n {column: 'growth_20', value: 7.0},\r\n {column: 'trkdyr_1', value: 4.0},\r\n {column: 'losyr_1', value: 12.0},\r\n {column: 'losyr_20', value: 12.0},\r\n {column: 'crash_rate', value: 15.0},\r\n {column: 'crash_severity', value: 13.0},\r\n {column: 'weather', value: 9.0},\r\n {column: 'event', value: 11.0}\r\n ]\r\n },\r\n {\r\n label: 'Safety',\r\n presets: [\r\n {column: 'aadtyr_1', value: 20.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 0.0},\r\n {column: 'losyr_1', value: 0.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 40.0},\r\n {column: 'crash_severity', value: 40.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Mobility Present',\r\n presets: [\r\n {column: 'aadtyr_1', value: 25.0},\r\n {column: 'aadtyr_20', value: 25.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 25.0},\r\n {column: 'losyr_1', value: 25.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Mobility Future',\r\n presets: [\r\n {column: 'aadtyr_1', value: 0.0},\r\n {column: 'aadtyr_20', value: 25.0},\r\n {column: 'growth_20', value: 25.0},\r\n {column: 'trkdyr_1', value: 25.0},\r\n {column: 'losyr_1', value: 0.0},\r\n {column: 'losyr_20', value: 25.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Service',\r\n presets: [\r\n {column: 'aadtyr_1', value: 30.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 10.0},\r\n {column: 'trkdyr_1', value: 0.0},\r\n {column: 'losyr_1', value: 30.0},\r\n {column: 'losyr_20', value: 30.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n },\r\n {\r\n label: 'Freight Performance',\r\n presets: [\r\n {column: 'aadtyr_1', value: 20.0},\r\n {column: 'aadtyr_20', value: 0.0},\r\n {column: 'growth_20', value: 0.0},\r\n {column: 'trkdyr_1', value: 60.0},\r\n {column: 'losyr_1', value: 20.0},\r\n {column: 'losyr_20', value: 0.0},\r\n {column: 'crash_rate', value: 0.0},\r\n {column: 'crash_severity', value: 0.0},\r\n {column: 'weather', value: 0.0},\r\n {column: 'event', value: 0.0}\r\n ]\r\n }\r\n ] as Array<TipPresetConfig>\r\n\r\n} as ITipConfig;\r\n\r\ntipConfig.$presetSelector.append('<option value=\"0\" disabled=>Custom</option>');\r\n\r\nlet sliders = new TipSliders(tipConfig.slidersConfig, tipConfig.presetConfig, 'slider-container',\r\n tipConfig.$presetSelector, tipConfig.$regionSelector, tipConfig.$regionSelector, (chg) => {console.log(chg)});\r\n\r\n// sliders.changedCallback = (chg) => {console.log(chg)};\r\n\r\nwindow['glob'] = sliders;\r\nwindow['hat'] = sliders;\r\nwindow['bird'] = sliders;\r\n\r\n"]} \ No newline at end of file diff --git a/dist/collections/ItsLayerCollection.d.ts b/dist/collections/ItsLayerCollection.d.ts index 5c01e24..6a5f968 100644 --- a/dist/collections/ItsLayerCollection.d.ts +++ b/dist/collections/ItsLayerCollection.d.ts @@ -1,14 +1,14 @@ /** * Created by gavorhes on 12/14/2015. */ -import ol = require('custom-ol'); import LayerItsInventory from "../layers/LayerItsInventory"; +import Map from 'ol/Map'; export declare class ItsLayerCollection { - _map: ol.Map; + _map: Map; _layers: Array<LayerItsInventory>; /** * Create a collection of all ITS layers - * @param {ol.Map} theMap the openlayers map + * @param theMap the openlayers map * @param {Array} [exclude=[]] array of Its layer identifiers to exclude * * BLUE Bluetooth Detector - Bluetooth Detector @@ -29,7 +29,7 @@ export declare class ItsLayerCollection { * TOWER Tower - The towers * TRENCH */ - constructor(theMap: ol.Map, exclude?: Array<string>); + constructor(theMap: Map, exclude?: Array<string>); /** * Return the array of layers in this collection * @returns {Array<LayerItsInventory>} an array of layers diff --git a/dist/collections/ItsLayerCollection.js b/dist/collections/ItsLayerCollection.js index 84b46af..ffcbccf 100644 --- a/dist/collections/ItsLayerCollection.js +++ b/dist/collections/ItsLayerCollection.js @@ -96,7 +96,7 @@ var itsConfig = [ var ItsLayerCollection = /** @class */ (function () { /** * Create a collection of all ITS layers - * @param {ol.Map} theMap the openlayers map + * @param theMap the openlayers map * @param {Array} [exclude=[]] array of Its layer identifiers to exclude * * BLUE Bluetooth Detector - Bluetooth Detector diff --git a/dist/collections/ItsLayerCollection.js.map b/dist/collections/ItsLayerCollection.js.map index 5223c74..f2e3854 100644 --- a/dist/collections/ItsLayerCollection.js.map +++ b/dist/collections/ItsLayerCollection.js.map @@ -1 +1 @@ -{"version":3,"file":"ItsLayerCollection.js","sourceRoot":"","sources":["../../src/collections/ItsLayerCollection.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,uCAAyC;AACzC,2CAAsC;AAEtC,iEAA4D;AAC5D,IAAI,EAAE,GAAG,iBAAO,CAAC,aAAa,CAAC,CAAC;AAGhC,IAAI,SAAS,GAAG;IACZ;QACI,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,EAAE;QACX,aAAa,EAAE;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE;gBACP,CAAC,iBAAiB,EAAE,SAAS,EAAE,cAAc,CAAC;aACjD;SACJ;KACJ;IACD;QACI,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,K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BAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/14/2015.\r\n */\r\n\r\nimport * as colors from '../util/colors';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport LayerItsInventory from \"../layers/LayerItsInventory\";\r\nlet nm = provide('collections');\r\n\r\n\r\nlet itsConfig = [\r\n {\r\n name: 'Camera',\r\n itsType: 'cctv',\r\n minZoom: 11,\r\n itsIconConfig: {\r\n prop: 'owner',\r\n defaultName: 'WisDOT',\r\n defaultIcon: 'cctv.png',\r\n iconArray: [\r\n ['City of Madison', 'Madison', 'cctv-mad.png']\r\n ]\r\n }\r\n },\r\n {\r\n name: 'Message Signs',\r\n itsType: 'DMS',\r\n minZoom: 11,\r\n itsIconConfig: {\r\n prop: 'dmsType',\r\n defaultName: 'DMS',\r\n defaultIcon: 'dms.png',\r\n iconArray: [\r\n ['pcms', 'PCMS', 'pcms.png']\r\n ]\r\n }\r\n },\r\n {name: 'ATR', itsType: 'atr', minZoom: 8, itsIcon: 'atr.png', visible: false},\r\n {name: 'Lighting', itsType: 'light', minZoom: 16, itsIcon: 'streetlight.png', visible: false, onDemand: true},\r\n {name: 'Bluetooth', itsType: 'blue', minZoom: 10, itsIcon: 'bluetooth.png', visible: false},\r\n {name: 'Cabinets', itsType: 'cabinet', minZoom: 10, itsIcon: 'cabinet.png', visible: false},\r\n {name: 'Hut', itsType: 'hut', minZoom: 10, itsIcon: 'hut.png', visible: false},\r\n {name: 'Vault', itsType: 'vault', minZoom: 13, itsIcon: 'vault.png', visible: false},\r\n {name: 'Advisory Radio', itsType: 'har', minZoom: 10, itsIcon: 'har.png', visible: false},\r\n {\r\n name: 'Loop Detectors',\r\n itsType: 'loop',\r\n legendCollapse: true,\r\n minZoom: 14,\r\n visible: false,\r\n itsIconConfig: {\r\n prop: 'dtctrType',\r\n defaultName: 'Other',\r\n defaultIcon: 'loopdetectorother.png',\r\n iconArray: [\r\n ['detector', 'Detector', 'loopdetector.png'],\r\n ['long', 'Long', 'loopdetectorlong.png'],\r\n ['zone', 'Zone', 'loopdetectorzone.png']\r\n ]\r\n },\r\n onDemand: true\r\n },\r\n {name: 'Microwave', itsType: 'microwave', minZoom: 14, itsIcon: 'microwave.png', visible: false},\r\n {name: 'Pull Box', itsType: 'pull', minZoom: 14, itsIcon: 'pullbox.png', visible: false, onDemand: true},\r\n {name: 'RWIS', itsType: 'rwis', minZoom: 7, itsIcon: 'rwis.png', visible: false},\r\n {name: 'Ramp Gates', itsType: 'gate', minZoom: 10, itsIcon: 'rampgate.png', visible: false},\r\n {name: 'Ramp Meter', itsType: 'meter', minZoom: 10, itsIcon: 'rampmeter.png', visible: false},\r\n {name: 'Signal', itsType: 'signal', minZoom: 13, itsIcon: 'signal.png', visible: false, onDemand: true},\r\n {name: 'Tower', itsType: 'tower', minZoom: 10, itsIcon: 'tower.png', visible: false},\r\n {\r\n name: 'Trench',\r\n itsType: 'trench',\r\n onDemand: true,\r\n visible: false,\r\n onDemandDelay: 500,\r\n minZoom: 15,\r\n legendCollapse: true,\r\n itsLineConfig: {\r\n prop: 'owner',\r\n defaultName: 'Other',\r\n //defaultWidth: 7,\r\n defaultColor: colors.hexAlphaToRgbOrRgba('#747474', 0.8),\r\n lineArray: [\r\n ['WisDOT', 'WisDOT', colors.hexAlphaToRgbOrRgba('#FF032F', 0.7)],\r\n ['WIN', 'WIN', colors.hexAlphaToRgbOrRgba('#FFC632', 0.7)],\r\n ['USXchange', 'USXchange', colors.hexAlphaToRgbOrRgba('#2DFF46', 0.7)],\r\n ['AT&T', 'AT&T', colors.hexAlphaToRgbOrRgba('#ff2be5', 0.7)],\r\n ['Touch America', 'Touch America', colors.hexAlphaToRgbOrRgba('#52f3ff', 0.7)],\r\n ['Qwest', 'Qwest', colors.hexAlphaToRgbOrRgba('#9278ff', 0.7)],\r\n ['McLeodUSA', 'McLeodUSA', colors.hexAlphaToRgbOrRgba('#2926FF', 0.7)],\r\n ['CINC', 'CINC', colors.hexAlphaToRgbOrRgba('#CB00FF', 0.7)],\r\n ['City of Madison', 'Madison', colors.hexAlphaToRgbOrRgba('#000380', 0.7)]\r\n ]\r\n }\r\n }\r\n];\r\n\r\n\r\nexport class ItsLayerCollection {\r\n _map: ol.Map;\r\n _layers: Array<LayerItsInventory>;\r\n\r\n\r\n /**\r\n * Create a collection of all ITS layers\r\n * @param {ol.Map} theMap the openlayers map\r\n * @param {Array} [exclude=[]] array of Its layer identifiers to exclude\r\n *\r\n * BLUE Bluetooth Detector - Bluetooth Detector\r\n * CABINET Cabinets - The cabinets\r\n * CCTV Camera - Traffic Cameras\r\n * HUT Communication Hut - Communication Hut\r\n * VAULT Communication Vault - The communication vaults\r\n * HAR Highway Advisory Radio - Advisory Radios\r\n * LIGHT Lighting - Lighting\r\n * LOOP Loop Detectors - Loop Detectors\r\n * DMS Message Board - Message Boards and Signs\r\n * MICROWAVE Microwave Detector - Microwave Detectors\r\n * PULL Pull Box - A pull box\r\n * RWIS RWIS - Road weather information system\r\n * GATE Ramp Gate - The ramp Gates\r\n * METER Ramp Meter - The ramp meters\r\n * SIGNAL Signal - Traffic Signal\r\n * TOWER Tower - The towers\r\n * TRENCH\r\n */\r\n constructor(theMap: ol.Map, exclude?: Array<string>) {\r\n\r\n this._map = theMap;\r\n this._layers = [];\r\n\r\n exclude = typeof exclude == 'object' ? exclude : [];\r\n\r\n for (let i = 0; i < itsConfig.length; i++) {\r\n let lyrConfig = itsConfig[i];\r\n let addLayer = true;\r\n\r\n for (let j = 0; j < exclude.length; j++) {\r\n if (exclude[j] == lyrConfig.itsType) {\r\n addLayer = false;\r\n break;\r\n }\r\n }\r\n\r\n if (addLayer) {\r\n let inventLyr = new LayerItsInventory(lyrConfig);\r\n this._map.addLayer(inventLyr.olLayer);\r\n this._layers.push(inventLyr);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Return the array of layers in this collection\r\n * @returns {Array<LayerItsInventory>} an array of layers\r\n */\r\n get layers(): LayerItsInventory[] {\r\n return this._layers;\r\n }\r\n\r\n}\r\n\r\nnm.ItsLayerCollection = ItsLayerCollection;\r\nexport default ItsLayerCollection;\r\n"]} \ No newline at end of file +{"version":3,"file":"ItsLayerCollection.js","sourceRoot":"","sources":["../../src/collections/ItsLayerCollection.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,uCAAyC;AACzC,2CAAsC;AACtC,iEAA4D;AAC5D,IAAI,EAAE,GAAG,iBAAO,CAAC,aAAa,CAAC,CAAC;AAIhC,IAAI,SAAS,GAAG;IACZ;QACI,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,EAAE;QACX,aAAa,EAAE;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE;gBACP,CAAC,iBAAiB,EAAE,SAAS,EAAE,cAAc,CAAC;aACjD;SACJ;KACJ;IACD;QACI,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE;QACX,aAAa,EAAE;YACX,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,SAAS;YACtB,SAAS,EAAE;gBACP,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;aAC/B;SACJ;KACJ;IACD,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAC;IAC7E,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAC;IAC7G,EAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,KAAK,EAAC;IAC3F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C,EAAE,EAAE;gBACrC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE;oBACjC,QAAQ,GAAG,KAAK,CAAC;oBACjB,MAAM;iBACT;aACJ;YAED,IAAI,QAAQ,EAAE;gBACV,IAAI,SAAS,GAAG,IAAI,2BAAiB,CAAC,SAAS,CAAC,CAAC;gBACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAChC;SACJ;IACL,CAAC;IAMD,sBAAI,sCAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;;;OAAA;IAEL,yBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,gDAAkB;AAgE/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/14/2015.\r\n */\r\n\r\nimport * as colors from '../util/colors';\r\nimport provide from '../util/provide';\r\nimport LayerItsInventory from \"../layers/LayerItsInventory\";\r\nlet nm = provide('collections');\r\nimport Map from 'ol/Map';\r\n\r\n\r\nlet itsConfig = [\r\n {\r\n name: 'Camera',\r\n itsType: 'cctv',\r\n minZoom: 11,\r\n itsIconConfig: {\r\n prop: 'owner',\r\n defaultName: 'WisDOT',\r\n defaultIcon: 'cctv.png',\r\n iconArray: [\r\n ['City of Madison', 'Madison', 'cctv-mad.png']\r\n ]\r\n }\r\n },\r\n {\r\n name: 'Message Signs',\r\n itsType: 'DMS',\r\n minZoom: 11,\r\n itsIconConfig: {\r\n prop: 'dmsType',\r\n defaultName: 'DMS',\r\n defaultIcon: 'dms.png',\r\n iconArray: [\r\n ['pcms', 'PCMS', 'pcms.png']\r\n ]\r\n }\r\n },\r\n {name: 'ATR', itsType: 'atr', minZoom: 8, itsIcon: 'atr.png', visible: false},\r\n {name: 'Lighting', itsType: 'light', minZoom: 16, itsIcon: 'streetlight.png', visible: false, onDemand: true},\r\n {name: 'Bluetooth', itsType: 'blue', minZoom: 10, itsIcon: 'bluetooth.png', visible: false},\r\n {name: 'Cabinets', itsType: 'cabinet', minZoom: 10, itsIcon: 'cabinet.png', visible: false},\r\n {name: 'Hut', itsType: 'hut', minZoom: 10, itsIcon: 'hut.png', visible: false},\r\n {name: 'Vault', itsType: 'vault', minZoom: 13, itsIcon: 'vault.png', visible: false},\r\n {name: 'Advisory Radio', itsType: 'har', minZoom: 10, itsIcon: 'har.png', visible: false},\r\n {\r\n name: 'Loop Detectors',\r\n itsType: 'loop',\r\n legendCollapse: true,\r\n minZoom: 14,\r\n visible: false,\r\n itsIconConfig: {\r\n prop: 'dtctrType',\r\n defaultName: 'Other',\r\n defaultIcon: 'loopdetectorother.png',\r\n iconArray: [\r\n ['detector', 'Detector', 'loopdetector.png'],\r\n ['long', 'Long', 'loopdetectorlong.png'],\r\n ['zone', 'Zone', 'loopdetectorzone.png']\r\n ]\r\n },\r\n onDemand: true\r\n },\r\n {name: 'Microwave', itsType: 'microwave', minZoom: 14, itsIcon: 'microwave.png', visible: false},\r\n {name: 'Pull Box', itsType: 'pull', minZoom: 14, itsIcon: 'pullbox.png', visible: false, onDemand: true},\r\n {name: 'RWIS', itsType: 'rwis', minZoom: 7, itsIcon: 'rwis.png', visible: false},\r\n {name: 'Ramp Gates', itsType: 'gate', minZoom: 10, itsIcon: 'rampgate.png', visible: false},\r\n {name: 'Ramp Meter', itsType: 'meter', minZoom: 10, itsIcon: 'rampmeter.png', visible: false},\r\n {name: 'Signal', itsType: 'signal', minZoom: 13, itsIcon: 'signal.png', visible: false, onDemand: true},\r\n {name: 'Tower', itsType: 'tower', minZoom: 10, itsIcon: 'tower.png', visible: false},\r\n {\r\n name: 'Trench',\r\n itsType: 'trench',\r\n onDemand: true,\r\n visible: false,\r\n onDemandDelay: 500,\r\n minZoom: 15,\r\n legendCollapse: true,\r\n itsLineConfig: {\r\n prop: 'owner',\r\n defaultName: 'Other',\r\n //defaultWidth: 7,\r\n defaultColor: colors.hexAlphaToRgbOrRgba('#747474', 0.8),\r\n lineArray: [\r\n ['WisDOT', 'WisDOT', colors.hexAlphaToRgbOrRgba('#FF032F', 0.7)],\r\n ['WIN', 'WIN', colors.hexAlphaToRgbOrRgba('#FFC632', 0.7)],\r\n ['USXchange', 'USXchange', colors.hexAlphaToRgbOrRgba('#2DFF46', 0.7)],\r\n ['AT&T', 'AT&T', colors.hexAlphaToRgbOrRgba('#ff2be5', 0.7)],\r\n ['Touch America', 'Touch America', colors.hexAlphaToRgbOrRgba('#52f3ff', 0.7)],\r\n ['Qwest', 'Qwest', colors.hexAlphaToRgbOrRgba('#9278ff', 0.7)],\r\n ['McLeodUSA', 'McLeodUSA', colors.hexAlphaToRgbOrRgba('#2926FF', 0.7)],\r\n ['CINC', 'CINC', colors.hexAlphaToRgbOrRgba('#CB00FF', 0.7)],\r\n ['City of Madison', 'Madison', colors.hexAlphaToRgbOrRgba('#000380', 0.7)]\r\n ]\r\n }\r\n }\r\n];\r\n\r\n\r\nexport class ItsLayerCollection {\r\n _map: Map;\r\n _layers: Array<LayerItsInventory>;\r\n\r\n\r\n /**\r\n * Create a collection of all ITS layers\r\n * @param theMap the openlayers map\r\n * @param {Array} [exclude=[]] array of Its layer identifiers to exclude\r\n *\r\n * BLUE Bluetooth Detector - Bluetooth Detector\r\n * CABINET Cabinets - The cabinets\r\n * CCTV Camera - Traffic Cameras\r\n * HUT Communication Hut - Communication Hut\r\n * VAULT Communication Vault - The communication vaults\r\n * HAR Highway Advisory Radio - Advisory Radios\r\n * LIGHT Lighting - Lighting\r\n * LOOP Loop Detectors - Loop Detectors\r\n * DMS Message Board - Message Boards and Signs\r\n * MICROWAVE Microwave Detector - Microwave Detectors\r\n * PULL Pull Box - A pull box\r\n * RWIS RWIS - Road weather information system\r\n * GATE Ramp Gate - The ramp Gates\r\n * METER Ramp Meter - The ramp meters\r\n * SIGNAL Signal - Traffic Signal\r\n * TOWER Tower - The towers\r\n * TRENCH\r\n */\r\n constructor(theMap: Map, exclude?: Array<string>) {\r\n\r\n this._map = theMap;\r\n this._layers = [];\r\n\r\n exclude = typeof exclude == 'object' ? exclude : [];\r\n\r\n for (let i = 0; i < itsConfig.length; i++) {\r\n let lyrConfig = itsConfig[i];\r\n let addLayer = true;\r\n\r\n for (let j = 0; j < exclude.length; j++) {\r\n if (exclude[j] == lyrConfig.itsType) {\r\n addLayer = false;\r\n break;\r\n }\r\n }\r\n\r\n if (addLayer) {\r\n let inventLyr = new LayerItsInventory(lyrConfig);\r\n this._map.addLayer(inventLyr.olLayer);\r\n this._layers.push(inventLyr);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Return the array of layers in this collection\r\n * @returns {Array<LayerItsInventory>} an array of layers\r\n */\r\n get layers(): LayerItsInventory[] {\r\n return this._layers;\r\n }\r\n\r\n}\r\n\r\nnm.ItsLayerCollection = ItsLayerCollection;\r\nexport default ItsLayerCollection;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerBase.d.ts b/dist/layers/LayerBase.d.ts index 442dea4..2586366 100644 --- a/dist/layers/LayerBase.d.ts +++ b/dist/layers/LayerBase.d.ts @@ -1,6 +1,7 @@ /// <reference types="jquery" /> /// <reference types="jqueryui" /> -import ol = require('custom-ol'); +import { Source } from 'ol/source'; +import Layer from 'ol/layer/Layer'; export interface LayerBaseOptions { id?: string; name?: string; @@ -32,14 +33,14 @@ export declare abstract class LayerBase { protected _params: any; protected _id: string; protected _name: string; - protected _source: ol.source.Source; + protected _source: Source; protected _animate: boolean; protected _legendCollapse: boolean; protected _maxResolution: number; protected _minResolution: number; protected _$legendDiv: JQuery; loadCallback: Function; - protected _olLayer: ol.layer.Layer; + protected _olLayer: Layer; protected _applyCollapseCalled: boolean; /** * The base layer for all others @@ -58,7 +59,7 @@ export declare abstract class LayerBase { * @param {boolean} [options.legendCheckbox=true] - if the legend item should have a checkbox for visibility * @param {boolean} [options.legendContent=undefined] - additional content to add to the legend */ - constructor(url: string, options?: LayerBaseOptions); + protected constructor(url: string, options?: LayerBaseOptions); /** * base load function, sets _loaded = true if it is not already * @protected @@ -172,8 +173,8 @@ export declare abstract class LayerBase { * get the layer source * @type {*} */ - readonly source: ol.source.Source; - protected getSource(): ol.source.Source; + readonly source: Source; + protected getSource(): Source; /** * get the z index */ @@ -185,7 +186,7 @@ export declare abstract class LayerBase { /** * the the ol layer */ - readonly olLayer: ol.layer.Layer; - protected getOlLayer(): ol.layer.Layer; + readonly olLayer: Layer; + protected getOlLayer(): Layer; } export default LayerBase; diff --git a/dist/layers/LayerBase.js.map b/dist/layers/LayerBase.js.map index 02253f4..98c3919 100644 --- a/dist/layers/LayerBase.js.map +++ b/dist/layers/LayerBase.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerBase.js","sourceRoot":"","sources":["../../src/layers/LayerBase.ts"],"names":[],"mappings":";;AAAA,0EAA4E;AAC5E,2CAAsC;AAEtC,6CAAwC;AACxC,0BAA6B;AAE7B,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAmB7B;;;GAGG;AACH;IA0BI;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAY,GAAW,EAAE,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QACnD,OAAO,GAAG,OAAO,IAAI,EAAsB,CAAC;QAE5C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzB,MAAM,aAAa,CAAC;SACvB;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAGhB,IAAI,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,IAAI,CAAC,eAAe,GAAG,OAAO,OAAO,CAAC,cAAc,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC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AD,CAAC,AAxZD,IAwZC;AAxZqB,8BAAS;AA0Z/B,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;AACzB,kBAAe,SAAS,CAAC","sourcesContent":["import * as zoomResolutionConvert from '../olHelpers/zoomResolutionConvert';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport makeGuid from '../util/makeGuid';\r\nimport $ = require('jquery');\r\n\r\nconst nm = provide('layers');\r\n\r\n\r\nexport interface LayerBaseOptions{\r\n id?: string;\r\n name?: string;\r\n opacity?: number;\r\n visible?: boolean;\r\n minZoom?: number;\r\n maxZoom?: number;\r\n params?: any;\r\n zIndex?: number;\r\n loadCallback?: Function;\r\n legendCollapse?: boolean;\r\n legendCheckbox?: boolean;\r\n legendContent?: string;\r\n}\r\n\r\n\r\n/**\r\n * The base layer class\r\n * @abstract\r\n */\r\nexport abstract class LayerBase {\r\n\r\n protected _legendCheckbox: boolean;\r\n protected _url: string;\r\n protected _opacity: number;\r\n protected _minZoom: number;\r\n protected _maxZoom: number;\r\n protected _visible: boolean;\r\n protected _loaded: boolean;\r\n protected _zIndex: number;\r\n protected _legendContent: string;\r\n protected _params: any;\r\n protected _id: string;\r\n protected _name: string;\r\n protected _source: ol.source.Source;\r\n protected _animate: boolean;\r\n protected _legendCollapse: boolean;\r\n protected _maxResolution: number;\r\n protected _minResolution: number;\r\n protected _$legendDiv: JQuery;\r\n loadCallback: Function;\r\n protected _olLayer: ol.layer.Layer;\r\n protected _applyCollapseCalled: boolean;\r\n\r\n\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id=makeGuid()] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] - the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] - the z index for the layer\r\n * @param {function} [options.loadCallback] - function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] - if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] - if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent=undefined] - additional content to add to the legend\r\n */\r\n constructor(url: string, options: LayerBaseOptions = {}) {\r\n options = options || {} as LayerBaseOptions;\r\n\r\n if (typeof url !== 'string') {\r\n throw 'Invalid URL';\r\n }\r\n this._url = url;\r\n\r\n\r\n this._params = typeof options.params == 'object' ? options.params : {};\r\n this._legendCollapse = typeof options.legendCollapse == 'boolean' ? options.legendCollapse : false;\r\n this._legendCheckbox = typeof options.legendCheckbox == 'boolean' ? options.legendCheckbox : true;\r\n\r\n this.id = options.id || makeGuid();\r\n this._name = options.name || 'Unnamed Layer';\r\n this.animate = false;\r\n this._opacity = typeof options.opacity == 'number' ? options.opacity : 1;\r\n\r\n if (this._opacity > 1) {\r\n this._opacity = 1;\r\n } else if (this._opacity < 0) {\r\n this._opacity = 0;\r\n }\r\n\r\n this._visible = typeof options.visible === 'boolean' ? options.visible : true;\r\n\r\n this._source = undefined;\r\n\r\n /**\r\n *\r\n * @protected\r\n */\r\n this._olLayer = undefined;\r\n this._loaded = false;\r\n\r\n this._maxResolution = zoomResolutionConvert.zoomToResolution(options.minZoom);\r\n if (typeof this._maxResolution !== 'undefined') {\r\n this._maxResolution += 0.00001;\r\n }\r\n this._minResolution = zoomResolutionConvert.zoomToResolution(options.maxZoom);\r\n\r\n this._minZoom = typeof options.minZoom == 'number' ? options.minZoom : undefined;\r\n this._maxZoom = typeof options.maxZoom == 'number' ? options.maxZoom : undefined;\r\n this._zIndex = typeof options.zIndex == 'number' ? options.zIndex : 0;\r\n\r\n this.loadCallback = typeof options.loadCallback == 'function' ? options.loadCallback : function () {\r\n };\r\n\r\n\r\n this._legendContent = '';\r\n\r\n if (this._legendCheckbox) {\r\n this._legendContent += `<input type=\"checkbox\" ${this.visible ? 'checked' : ''} ` +\r\n `class=\"legend-check\" id=\"${this.id}-legend-layer-check\"><span></span>`;\r\n this._legendContent += `<label for=\"${this.id}-legend-layer-check\" class=\"legend-layer-name\">${this.name}</label>`;\r\n } else {\r\n this._legendContent += `<label class=\"legend-layer-name\">${this.name}</label>`;\r\n }\r\n\r\n this._$legendDiv = null;\r\n this._applyCollapseCalled = false;\r\n this._addLegendContent(typeof options.legendContent === 'string' ? options.legendContent : undefined);\r\n }\r\n\r\n /**\r\n * base load function, sets _loaded = true if it is not already\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n if (this.loaded == true) {\r\n return true;\r\n } else {\r\n this._loaded = true;\r\n\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Get the legend html, be sure to only add to the DOM once\r\n * @returns {string} html for layer wrapped in a div\r\n */\r\n getLegendDiv() {\r\n return `<div class=\"legend-layer-div\" id=\"${this.id}-legend-layer-div\">${this._legendContent}</div>`;\r\n }\r\n\r\n /**\r\n *\r\n * @param additionalContent - additional content to add to legend\r\n * @private\r\n */\r\n _addLegendContent(additionalContent='') {\r\n\r\n let addCollapse = additionalContent.indexOf('<ul>') > -1;\r\n\r\n if (addCollapse) {\r\n additionalContent = '<span class=\"legend-items-expander\" title=\"Expand/Collapse\">▼</span>' + additionalContent;\r\n }\r\n\r\n this._legendContent += additionalContent;\r\n\r\n this._$legendDiv = $(`#${this.id}-legend-layer-div`);\r\n\r\n if (this._$legendDiv.length > 0) {\r\n this._$legendDiv.append(additionalContent);\r\n this.applyCollapse();\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=] - additonal content to add\r\n */\r\n addLegendContent(additionalContent: string) {\r\n this._addLegendContent(additionalContent);\r\n }\r\n\r\n applyCollapse(): void {\r\n if (this._applyCollapseCalled) {\r\n console.log('collapse already applied');\r\n\r\n return undefined;\r\n }\r\n\r\n this._$legendDiv = $(`#${this.id}-legend-layer-div`);\r\n\r\n if (this._$legendDiv.length > 0) {\r\n\r\n let $expander = this._$legendDiv.find('.legend-items-expander');\r\n\r\n if ($expander.length > 0) {\r\n this._applyCollapseCalled = true;\r\n\r\n $expander.click(function () {\r\n let $this = $(this);\r\n\r\n $this.siblings('ul').slideToggle();\r\n\r\n if ($this.hasClass('legend-layer-group-collapsed')) {\r\n $this.removeClass('legend-layer-group-collapsed');\r\n $this.html('▼');\r\n } else {\r\n $this.addClass('legend-layer-group-collapsed');\r\n $this.html('▶');\r\n }\r\n });\r\n\r\n if (this._legendCollapse) {\r\n $expander.trigger('click');\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * trick to refresh the layer\r\n */\r\n refresh() {\r\n if (this.source) {\r\n this.source.refresh();\r\n }\r\n }\r\n\r\n get id(): string{\r\n return this._id;\r\n }\r\n\r\n set id(newId: string){\r\n this._id = newId;\r\n }\r\n\r\n get animate(): boolean{\r\n return this._animate;\r\n }\r\n\r\n set animate(animate: boolean){\r\n this._animate = animate;\r\n }\r\n\r\n /**\r\n * get the legend content\r\n * @type {string}\r\n */\r\n get legendContent(): string {\r\n return this._legendContent;\r\n }\r\n\r\n /**\r\n * set the legend content directly\r\n * @param {string} newVal - new content\r\n * @protected\r\n */\r\n set legendContent(newVal: string) {\r\n this._legendContent = newVal;\r\n }\r\n\r\n /**\r\n * get the map get params\r\n * @type {object}\r\n */\r\n get params(): {[s: string]: any} {\r\n return this._params;\r\n }\r\n\r\n /**\r\n * set the map get params\r\n * @param {object} newParams - new get params\r\n * @protected\r\n */\r\n set params(newParams: {[s: string]: any}) {\r\n this._params = newParams;\r\n }\r\n\r\n /**\r\n * get the minimum resolution\r\n * @type {number|*}\r\n */\r\n get minResolution(): number {\r\n return this._minResolution;\r\n }\r\n\r\n /**\r\n * get the maximum resolution\r\n * @type {number|*}\r\n */\r\n get maxResolution(): number {\r\n return this._maxResolution;\r\n }\r\n\r\n /**\r\n * get min zoom\r\n * @type {number|*}\r\n */\r\n get minZoom(): number {\r\n return this._minZoom;\r\n }\r\n\r\n /**\r\n * get max zoom\r\n * @type {number|*}\r\n */\r\n get maxZoom(): number {\r\n return this._maxZoom;\r\n }\r\n\r\n /**\r\n * get the url\r\n * @type {string}\r\n */\r\n get url(): string {\r\n return this._url;\r\n }\r\n\r\n /**\r\n * Get the layer visibility\r\n * @type {boolean}\r\n */\r\n get visible(): boolean {\r\n return this._visible;\r\n }\r\n\r\n /**\r\n * set the visibility\r\n * @param visibility\r\n */\r\n set visible(visibility: boolean) {\r\n this.setVisible(visibility);\r\n }\r\n\r\n protected setVisible(visibility: boolean) {\r\n this._visible = visibility;\r\n if (this.olLayer) {\r\n this.olLayer.setVisible(this._visible);\r\n if (visibility && !this._loaded) {\r\n this._load();\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Get the layer opacity\r\n * @type {number}\r\n */\r\n get opacity(): number {\r\n return this._opacity;\r\n }\r\n\r\n /**\r\n * Set the layer opacity\r\n * @param {number} opacity - layer opacity\r\n */\r\n set opacity(opacity: number) {\r\n this._opacity = opacity;\r\n if (this.olLayer) {\r\n this.olLayer.setOpacity(this._opacity);\r\n }\r\n }\r\n\r\n /**\r\n * Get the layer name\r\n * @type {string}\r\n */\r\n get name(): string {\r\n return this._name;\r\n }\r\n\r\n /**\r\n * set the layer name\r\n * @param {string} newName - the new name\r\n */\r\n set name(newName: string) {\r\n this._name = newName;\r\n }\r\n\r\n /**\r\n * Check if the layer is loaded\r\n * @type {boolean}\r\n */\r\n get loaded():boolean {\r\n return this._loaded;\r\n }\r\n\r\n /**\r\n * get the layer source\r\n * @type {*}\r\n */\r\n get source(): ol.source.Source {\r\n return this.getSource();\r\n }\r\n\r\n\r\n protected getSource(): ol.source.Source{\r\n return this._source;\r\n }\r\n\r\n /**\r\n * get the z index\r\n */\r\n get zIndex(): number {\r\n return this._zIndex;\r\n }\r\n\r\n /**\r\n * set the z index\r\n */\r\n set zIndex(newZ: number) {\r\n this._zIndex = newZ;\r\n }\r\n\r\n protected setZIndex(newZ: number){\r\n\r\n }\r\n\r\n /**\r\n * the the ol layer\r\n */\r\n get olLayer(): ol.layer.Layer {\r\n return this.getOlLayer();\r\n }\r\n\r\n protected getOlLayer(): ol.layer.Layer{\r\n return this._olLayer;\r\n }\r\n}\r\n\r\nnm.LayerBase = LayerBase;\r\nexport default LayerBase;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerBase.js","sourceRoot":"","sources":["../../src/layers/LayerBase.ts"],"names":[],"mappings":";;AAAA,0EAA4E;AAC5E,2CAAsC;AACtC,6CAAwC;AAGxC,0BAA6B;AAE7B,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAmB7B;;;GAGG;AACH;IA0BI;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAsB,GAAW,EAAE,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QAC7D,OAAO,GAAG,OAAO,IAAI,EAAsB,CAAC;QAE5C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzB,MAAM,aAAa,CAAC;SACvB;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAGhB,IAAI,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,IAAI,CAAC,eAAe,GAAG,OAAO,OAAO,CAAC,cAAc,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,OAAO,OAAO,CAAC,cAAc,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;QAElG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,kBAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC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AAC,OAAO,EAAE;gBACd,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC1C;QACL,CAAC;;;OAXA;IAiBD,sBAAI,2BAAI;QAJR;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;QAED;;;WAGG;aACH,UAAS,OAAe;YACpB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;QACzB,CAAC;;;OARA;IAcD,sBAAI,6BAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;;;OAAA;IAMD,sBAAI,6BAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC;;;OAAA;IAGS,6BAAS,GAAnB;QACI,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAKD,sBAAI,6BAAM;QAHV;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;QAED;;WAEG;aACH,UAAW,IAAY;YACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC;;;OAPA;IASS,6BAAS,GAAnB,UAAoB,IAAY;IAEhC,CAAC;IAKD,sBAAI,8BAAO;QAHX;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;;;OAAA;IAES,8BAAU,GAApB;QACI,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IACL,gBAAC;AAAD,CAAC,AAxZD,IAwZC;AAxZqB,8BAAS;AA0Z/B,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;AACzB,kBAAe,SAAS,CAAC","sourcesContent":["import * as zoomResolutionConvert from '../olHelpers/zoomResolutionConvert';\r\nimport provide from '../util/provide';\r\nimport makeGuid from '../util/makeGuid';\r\nimport {Vector, Source} from 'ol/source';\r\nimport Layer from 'ol/layer/Layer';\r\nimport $ = require('jquery');\r\n\r\nconst nm = provide('layers');\r\n\r\n\r\nexport interface LayerBaseOptions{\r\n id?: string;\r\n name?: string;\r\n opacity?: number;\r\n visible?: boolean;\r\n minZoom?: number;\r\n maxZoom?: number;\r\n params?: any;\r\n zIndex?: number;\r\n loadCallback?: Function;\r\n legendCollapse?: boolean;\r\n legendCheckbox?: boolean;\r\n legendContent?: string;\r\n}\r\n\r\n\r\n/**\r\n * The base layer class\r\n * @abstract\r\n */\r\nexport abstract class LayerBase {\r\n\r\n protected _legendCheckbox: boolean;\r\n protected _url: string;\r\n protected _opacity: number;\r\n protected _minZoom: number;\r\n protected _maxZoom: number;\r\n protected _visible: boolean;\r\n protected _loaded: boolean;\r\n protected _zIndex: number;\r\n protected _legendContent: string;\r\n protected _params: any;\r\n protected _id: string;\r\n protected _name: string;\r\n protected _source: Source;\r\n protected _animate: boolean;\r\n protected _legendCollapse: boolean;\r\n protected _maxResolution: number;\r\n protected _minResolution: number;\r\n protected _$legendDiv: JQuery;\r\n loadCallback: Function;\r\n protected _olLayer: Layer;\r\n protected _applyCollapseCalled: boolean;\r\n\r\n\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id=makeGuid()] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] - the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] - the z index for the layer\r\n * @param {function} [options.loadCallback] - function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] - if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] - if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent=undefined] - additional content to add to the legend\r\n */\r\n protected constructor(url: string, options: LayerBaseOptions = {}) {\r\n options = options || {} as LayerBaseOptions;\r\n\r\n if (typeof url !== 'string') {\r\n throw 'Invalid URL';\r\n }\r\n this._url = url;\r\n\r\n\r\n this._params = typeof options.params == 'object' ? options.params : {};\r\n this._legendCollapse = typeof options.legendCollapse == 'boolean' ? options.legendCollapse : false;\r\n this._legendCheckbox = typeof options.legendCheckbox == 'boolean' ? options.legendCheckbox : true;\r\n\r\n this.id = options.id || makeGuid();\r\n this._name = options.name || 'Unnamed Layer';\r\n this.animate = false;\r\n this._opacity = typeof options.opacity == 'number' ? options.opacity : 1;\r\n\r\n if (this._opacity > 1) {\r\n this._opacity = 1;\r\n } else if (this._opacity < 0) {\r\n this._opacity = 0;\r\n }\r\n\r\n this._visible = typeof options.visible === 'boolean' ? options.visible : true;\r\n\r\n this._source = undefined;\r\n\r\n /**\r\n *\r\n * @protected\r\n */\r\n this._olLayer = undefined;\r\n this._loaded = false;\r\n\r\n this._maxResolution = zoomResolutionConvert.zoomToResolution(options.minZoom);\r\n if (typeof this._maxResolution !== 'undefined') {\r\n this._maxResolution += 0.00001;\r\n }\r\n this._minResolution = zoomResolutionConvert.zoomToResolution(options.maxZoom);\r\n\r\n this._minZoom = typeof options.minZoom == 'number' ? options.minZoom : undefined;\r\n this._maxZoom = typeof options.maxZoom == 'number' ? options.maxZoom : undefined;\r\n this._zIndex = typeof options.zIndex == 'number' ? options.zIndex : 0;\r\n\r\n this.loadCallback = typeof options.loadCallback == 'function' ? options.loadCallback : function () {\r\n };\r\n\r\n\r\n this._legendContent = '';\r\n\r\n if (this._legendCheckbox) {\r\n this._legendContent += `<input type=\"checkbox\" ${this.visible ? 'checked' : ''} ` +\r\n `class=\"legend-check\" id=\"${this.id}-legend-layer-check\"><span></span>`;\r\n this._legendContent += `<label for=\"${this.id}-legend-layer-check\" class=\"legend-layer-name\">${this.name}</label>`;\r\n } else {\r\n this._legendContent += `<label class=\"legend-layer-name\">${this.name}</label>`;\r\n }\r\n\r\n this._$legendDiv = null;\r\n this._applyCollapseCalled = false;\r\n this._addLegendContent(typeof options.legendContent === 'string' ? options.legendContent : undefined);\r\n }\r\n\r\n /**\r\n * base load function, sets _loaded = true if it is not already\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n if (this.loaded == true) {\r\n return true;\r\n } else {\r\n this._loaded = true;\r\n\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Get the legend html, be sure to only add to the DOM once\r\n * @returns {string} html for layer wrapped in a div\r\n */\r\n getLegendDiv() {\r\n return `<div class=\"legend-layer-div\" id=\"${this.id}-legend-layer-div\">${this._legendContent}</div>`;\r\n }\r\n\r\n /**\r\n *\r\n * @param additionalContent - additional content to add to legend\r\n * @private\r\n */\r\n _addLegendContent(additionalContent='') {\r\n\r\n let addCollapse = additionalContent.indexOf('<ul>') > -1;\r\n\r\n if (addCollapse) {\r\n additionalContent = '<span class=\"legend-items-expander\" title=\"Expand/Collapse\">▼</span>' + additionalContent;\r\n }\r\n\r\n this._legendContent += additionalContent;\r\n\r\n this._$legendDiv = $(`#${this.id}-legend-layer-div`);\r\n\r\n if (this._$legendDiv.length > 0) {\r\n this._$legendDiv.append(additionalContent);\r\n this.applyCollapse();\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=] - additonal content to add\r\n */\r\n addLegendContent(additionalContent: string) {\r\n this._addLegendContent(additionalContent);\r\n }\r\n\r\n applyCollapse(): void {\r\n if (this._applyCollapseCalled) {\r\n console.log('collapse already applied');\r\n\r\n return undefined;\r\n }\r\n\r\n this._$legendDiv = $(`#${this.id}-legend-layer-div`);\r\n\r\n if (this._$legendDiv.length > 0) {\r\n\r\n let $expander = this._$legendDiv.find('.legend-items-expander');\r\n\r\n if ($expander.length > 0) {\r\n this._applyCollapseCalled = true;\r\n\r\n $expander.click(function () {\r\n let $this = $(this);\r\n\r\n $this.siblings('ul').slideToggle();\r\n\r\n if ($this.hasClass('legend-layer-group-collapsed')) {\r\n $this.removeClass('legend-layer-group-collapsed');\r\n $this.html('▼');\r\n } else {\r\n $this.addClass('legend-layer-group-collapsed');\r\n $this.html('▶');\r\n }\r\n });\r\n\r\n if (this._legendCollapse) {\r\n $expander.trigger('click');\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * trick to refresh the layer\r\n */\r\n refresh() {\r\n if (this.source) {\r\n this.source.refresh();\r\n }\r\n }\r\n\r\n get id(): string{\r\n return this._id;\r\n }\r\n\r\n set id(newId: string){\r\n this._id = newId;\r\n }\r\n\r\n get animate(): boolean{\r\n return this._animate;\r\n }\r\n\r\n set animate(animate: boolean){\r\n this._animate = animate;\r\n }\r\n\r\n /**\r\n * get the legend content\r\n * @type {string}\r\n */\r\n get legendContent(): string {\r\n return this._legendContent;\r\n }\r\n\r\n /**\r\n * set the legend content directly\r\n * @param {string} newVal - new content\r\n * @protected\r\n */\r\n set legendContent(newVal: string) {\r\n this._legendContent = newVal;\r\n }\r\n\r\n /**\r\n * get the map get params\r\n * @type {object}\r\n */\r\n get params(): {[s: string]: any} {\r\n return this._params;\r\n }\r\n\r\n /**\r\n * set the map get params\r\n * @param {object} newParams - new get params\r\n * @protected\r\n */\r\n set params(newParams: {[s: string]: any}) {\r\n this._params = newParams;\r\n }\r\n\r\n /**\r\n * get the minimum resolution\r\n * @type {number|*}\r\n */\r\n get minResolution(): number {\r\n return this._minResolution;\r\n }\r\n\r\n /**\r\n * get the maximum resolution\r\n * @type {number|*}\r\n */\r\n get maxResolution(): number {\r\n return this._maxResolution;\r\n }\r\n\r\n /**\r\n * get min zoom\r\n * @type {number|*}\r\n */\r\n get minZoom(): number {\r\n return this._minZoom;\r\n }\r\n\r\n /**\r\n * get max zoom\r\n * @type {number|*}\r\n */\r\n get maxZoom(): number {\r\n return this._maxZoom;\r\n }\r\n\r\n /**\r\n * get the url\r\n * @type {string}\r\n */\r\n get url(): string {\r\n return this._url;\r\n }\r\n\r\n /**\r\n * Get the layer visibility\r\n * @type {boolean}\r\n */\r\n get visible(): boolean {\r\n return this._visible;\r\n }\r\n\r\n /**\r\n * set the visibility\r\n * @param visibility\r\n */\r\n set visible(visibility: boolean) {\r\n this.setVisible(visibility);\r\n }\r\n\r\n protected setVisible(visibility: boolean) {\r\n this._visible = visibility;\r\n if (this.olLayer) {\r\n this.olLayer.setVisible(this._visible);\r\n if (visibility && !this._loaded) {\r\n this._load();\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Get the layer opacity\r\n * @type {number}\r\n */\r\n get opacity(): number {\r\n return this._opacity;\r\n }\r\n\r\n /**\r\n * Set the layer opacity\r\n * @param {number} opacity - layer opacity\r\n */\r\n set opacity(opacity: number) {\r\n this._opacity = opacity;\r\n if (this.olLayer) {\r\n this.olLayer.setOpacity(this._opacity);\r\n }\r\n }\r\n\r\n /**\r\n * Get the layer name\r\n * @type {string}\r\n */\r\n get name(): string {\r\n return this._name;\r\n }\r\n\r\n /**\r\n * set the layer name\r\n * @param {string} newName - the new name\r\n */\r\n set name(newName: string) {\r\n this._name = newName;\r\n }\r\n\r\n /**\r\n * Check if the layer is loaded\r\n * @type {boolean}\r\n */\r\n get loaded():boolean {\r\n return this._loaded;\r\n }\r\n\r\n /**\r\n * get the layer source\r\n * @type {*}\r\n */\r\n get source(): Source {\r\n return this.getSource();\r\n }\r\n\r\n\r\n protected getSource(): Source{\r\n return this._source;\r\n }\r\n\r\n /**\r\n * get the z index\r\n */\r\n get zIndex(): number {\r\n return this._zIndex;\r\n }\r\n\r\n /**\r\n * set the z index\r\n */\r\n set zIndex(newZ: number) {\r\n this._zIndex = newZ;\r\n }\r\n\r\n protected setZIndex(newZ: number){\r\n\r\n }\r\n\r\n /**\r\n * the the ol layer\r\n */\r\n get olLayer(): Layer {\r\n return this.getOlLayer();\r\n }\r\n\r\n protected getOlLayer(): Layer{\r\n return this._olLayer;\r\n }\r\n}\r\n\r\nnm.LayerBase = LayerBase;\r\nexport default LayerBase;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerBaseVector.d.ts b/dist/layers/LayerBaseVector.d.ts index 4465a72..d57341b 100644 --- a/dist/layers/LayerBaseVector.d.ts +++ b/dist/layers/LayerBaseVector.d.ts @@ -1,6 +1,11 @@ import { LayerBase, LayerBaseOptions } from './LayerBase'; import MapMoveCls from '../olHelpers/mapMoveCls'; -import ol = require('custom-ol'); +import Style from 'ol/style/Style'; +import Feature from 'ol/Feature'; +import Vector from 'ol/layer/Vector'; +import VectorSource from 'ol/source/Vector'; +import Projection from 'ol/proj/Projection'; +import { iStyleFunc } from "../olHelpers/esriToOlStyle"; export interface makeMapMoveParams { /** * @@ -17,12 +22,12 @@ export interface makeMapMoveParams { } export interface LayerBaseVectorOptions extends LayerBaseOptions { autoLoad?: boolean; - style?: ol.style.Style | Array<ol.style.Style> | ol.StyleFunction; + style?: Style | Style[] | iStyleFunc; onDemand?: boolean; onDemandDelay?: number; mapMoveMakeGetParams?: makeMapMoveParams; mapMoveObj?: MapMoveCls; - renderOrder?: (a: ol.Feature, b: ol.Feature) => number; + renderOrder?: (a: Feature, b: Feature) => number; } /** * The Vector layer base @@ -30,17 +35,17 @@ export interface LayerBaseVectorOptions extends LayerBaseOptions { * @abstract */ export declare class LayerBaseVector extends LayerBase { - _olLayer: ol.layer.Vector; - _source: ol.source.Vector; - _style: ol.style.Style | Array<ol.style.Style> | ol.StyleFunction; + _olLayer: Vector; + _source: VectorSource; + _style: Style | Array<Style> | iStyleFunc; _autoLoad: boolean; _onDemand: boolean; _onDemandDelay: number; _mapMoveMakeGetParams: makeMapMoveParams; _mapMoveParams: any; _mapMove: MapMoveCls; - _projectionMap: ol.proj.Projection; - _projection4326: ol.proj.Projection; + _projectionMap: Projection; + _projection4326: Projection; /** * The base vector layer * @param {string} url - pass an empty string to prevent default load and add from a json source @@ -118,12 +123,12 @@ export declare class LayerBaseVector extends LayerBase { * set the style * @param style - the style or function */ - style: ol.StyleFunction | Array<ol.style.Style> | ol.style.Style; + style: Array<Style> | Style | iStyleFunc; /** * get the map CRS if it is defined by the map move object */ readonly mapCrs: string; - readonly mapProj: ol.proj.Projection; + readonly mapProj: Projection; /** * get the map move object * @type {MapMoveCls|*} @@ -144,15 +149,15 @@ export declare class LayerBaseVector extends LayerBase { * get the layer vector source * @override */ - readonly source: ol.source.Vector; + readonly source: VectorSource; /** * array of ol features */ - readonly features: Array<ol.Feature>; + readonly features: Array<Feature>; /** * */ - readonly olLayer: ol.layer.Vector; + readonly olLayer: Vector; protected setZIndex(newZ: number): void; } export default LayerBaseVector; diff --git a/dist/layers/LayerBaseVector.js b/dist/layers/LayerBaseVector.js index 0cb7805..fdd43f6 100644 --- a/dist/layers/LayerBaseVector.js +++ b/dist/layers/LayerBaseVector.js @@ -13,8 +13,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); var LayerBase_1 = require("./LayerBase"); var mapMove_1 = require("../olHelpers/mapMove"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); +// import ol = require('custom-ol'); var $ = require("jquery"); +var Vector_1 = require("ol/layer/Vector"); +var Vector_2 = require("ol/source/Vector"); +var Projection_1 = require("ol/proj/Projection"); var nm = provide_1.default('layers'); /** * The Vector layer base @@ -79,8 +82,8 @@ var LayerBaseVector = /** @class */ (function (_super) { _this._mapMove.checkInit(); _this._mapMove.addVectorLayer(_this); } - _this._source = new ol.source.Vector(); - _this._olLayer = new ol.layer.Vector({ + _this._source = new Vector_2.default(); + _this._olLayer = new Vector_1.default({ source: _this._source, visible: _this.visible, style: _this.style, @@ -90,7 +93,7 @@ var LayerBaseVector = /** @class */ (function (_super) { }); _this.olLayer.setZIndex(_this._zIndex); _this._projectionMap = null; - _this._projection4326 = new ol.proj.Projection({ code: "EPSG:4326" }); + _this._projection4326 = new Projection_1.default({ code: "EPSG:4326" }); _this._olLayer.setOpacity(_this.opacity); return _this; } diff --git a/dist/layers/LayerBaseVector.js.map b/dist/layers/LayerBaseVector.js.map index 57daafe..e726ac3 100644 --- a/dist/layers/LayerBaseVector.js.map +++ b/dist/layers/LayerBase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;WAIG;aACH,UAAY,UAAU;YAClB,iBAAM,UAAU,YAAC,UAAU,CAAC,CAAC;YAE7B,IAAI,IAAI,CAAC,SAAS,EAAE;gBAChB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aACrC;QACL,CAAC;;;OAbA;IAmBD,sBAAI,mCAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,SAAS,EAAsB,CAAC;QAChD,CAAC;;;OAAA;IAKD,sBAAI,qCAAQ;QAHZ;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC;;;OAAA;IAKD,sBAAI,oCAAO;QAHX;;WAEG;aACH;YACI,OAAO,iBAAM,UAAU,WAAqB,CAAC;QACjD,CAAC;;;OAAA;IAES,mCAAS,GAAnB,UAAoB,IAAY;QAC5B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACL,sBAAC;AAAD,CAAC,AAhRD,CAAqC,qBAAS,GAgR7C;AAhRY,0CAAe;AAkR5B,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC;AACrC,kBAAe,eAAe,CAAC","sourcesContent":["import {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport mapMove from '../olHelpers/mapMove';\r\nimport MapMoveCls from '../olHelpers/mapMoveCls'\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\n\r\nconst nm = provide('layers');\r\n\r\nexport interface makeMapMoveParams {\r\n /**\r\n *\r\n * @param lyr\r\n * @param extent\r\n * @param zoomLevel\r\n */\r\n (lyr: LayerBaseVector, extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel?: number): any\r\n}\r\n\r\n\r\n\r\nexport interface LayerBaseVectorOptions extends LayerBaseOptions{\r\n autoLoad?: boolean;\r\n style?: ol.style.Style|Array<ol.style.Style>|ol.StyleFunction;\r\n onDemand?: boolean;\r\n onDemandDelay?: number;\r\n mapMoveMakeGetParams?: makeMapMoveParams;\r\n mapMoveObj?: MapMoveCls;\r\n renderOrder?: (a: ol.Feature, b: ol.Feature) => number;\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * The Vector layer base\r\n * @augments LayerBase\r\n * @abstract\r\n */\r\nexport class LayerBaseVector extends LayerBase {\r\n _olLayer: ol.layer.Vector;\r\n _source: ol.source.Vector;\r\n _style: ol.style.Style|Array<ol.style.Style>|ol.StyleFunction;\r\n _autoLoad: boolean;\r\n _onDemand: boolean;\r\n _onDemandDelay: number;\r\n _mapMoveMakeGetParams: makeMapMoveParams;\r\n _mapMoveParams: any;\r\n _mapMove: MapMoveCls;\r\n _projectionMap: ol.proj.Projection;\r\n _projection4326: ol.proj.Projection;\r\n\r\n\r\n\r\n /**\r\n * The base vector layer\r\n * @param {string} url - pass an empty string to prevent default load and add from a json source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n */\r\n constructor(url: string, options: LayerBaseVectorOptions = {}) {\r\n super(url, options);\r\n\r\n options = options as LayerBaseVectorOptions;\r\n\r\n //prevent regular load if no url has been provided\r\n if (this.url.trim() == '') {\r\n this._loaded = true;\r\n }\r\n\r\n this._style = typeof options.style == 'undefined' ? undefined : options.style;\r\n\r\n if (this.visible) {\r\n this._autoLoad = true;\r\n } else {\r\n this._autoLoad = (typeof options['autoLoad'] == 'boolean' ? options['autoLoad'] : false);\r\n }\r\n\r\n this._onDemand = typeof options.onDemand == 'boolean' ? options.onDemand : false;\r\n this._onDemandDelay = typeof options.onDemandDelay == 'number' ? options.onDemandDelay : 300;\r\n\r\n if (options.mapMoveObj) {\r\n this._mapMove = options.mapMoveObj;\r\n } else {\r\n this._mapMove = this._onDemand ? mapMove : undefined;\r\n }\r\n\r\n\r\n this._mapMoveMakeGetParams = typeof options.mapMoveMakeGetParams == 'function' ? options.mapMoveMakeGetParams :\r\n function () {return {};};\r\n\r\n if (this._onDemand) {\r\n this._loaded = true;\r\n this._mapMoveParams = {};\r\n this._mapMove.checkInit();\r\n this._mapMove.addVectorLayer(this);\r\n }\r\n\r\n this._source = new ol.source.Vector();\r\n\r\n\r\n this._olLayer = new ol.layer.Vector(\r\n {\r\n source: this._source,\r\n visible: this.visible,\r\n style: this.style,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution,\r\n renderOrder: options.renderOrder\r\n }\r\n );\r\n\r\n this.olLayer.setZIndex(this._zIndex);\r\n\r\n this._projectionMap = null;\r\n this._projection4326 = new ol.proj.Projection({code: \"EPSG:4326\"});\r\n this._olLayer.setOpacity(this.opacity)\r\n }\r\n\r\n /**\r\n * dummy to be overridden\r\n * @param {object} featureCollection - geojson or esrijson object\r\n */\r\n addFeatures(featureCollection: Object) {\r\n console.log('Layer vector base addFeatures is a placeholder and does nothing');\r\n }\r\n\r\n /**\r\n * Before call to map move callback, can prevent call by returning false\r\n * @param {number} zoom - zoom level\r\n * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution'\r\n * @returns {boolean} if the call should proceed\r\n */\r\n mapMoveBefore(zoom: number, evtType: string) {\r\n if (this.minZoom !== undefined) {\r\n if (zoom < this.minZoom) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this.maxZoom !== undefined) {\r\n if (zoom > this.maxZoom) {\r\n return false;\r\n }\r\n }\r\n\r\n return this.visible;\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel: number) {\r\n this._mapMoveParams = {};\r\n $.extend(this._mapMoveParams, this.params);\r\n $.extend(this._mapMoveParams, this._mapMoveMakeGetParams(this, extent, zoomLevel));\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d - the json response\r\n */\r\n mapMoveCallback(d: Object) {\r\n if (this.source) {\r\n this._source.clear();\r\n }\r\n }\r\n\r\n /**\r\n * clear features in the layer\r\n */\r\n clear() {\r\n if (this._source) {\r\n this._source.clear();\r\n }\r\n }\r\n\r\n /**\r\n * get on demand delay in miliseconds\r\n */\r\n get onDemandDelay(): number {\r\n return this._onDemandDelay;\r\n }\r\n\r\n /**\r\n * get if the layer is autoloaded\r\n */\r\n get autoLoad(): boolean {\r\n return this._autoLoad;\r\n }\r\n\r\n /**\r\n * get the style definition\r\n */\r\n get style(): ol.StyleFunction|Array<ol.style.Style>|ol.style.Style {\r\n return this._style;\r\n }\r\n\r\n /**\r\n * set the style\r\n * @param style - the style or function\r\n */\r\n set style(style: ol.StyleFunction|Array<ol.style.Style>|ol.style.Style) {\r\n this._style = style;\r\n this.olLayer.setStyle(this._style as ol.style.Style);\r\n }\r\n\r\n /**\r\n * get the map CRS if it is defined by the map move object\r\n */\r\n get mapCrs(): string {\r\n return this.mapProj == null ? null : this.mapProj.getCode();\r\n }\r\n\r\n get mapProj(): ol.proj.Projection{\r\n if (this._projectionMap != null){\r\n return this._projectionMap;\r\n }\r\n\r\n if (this._mapMove) {\r\n this._projectionMap = this._mapMove.map.getView().getProjection();\r\n return this._projectionMap;\r\n } else {\r\n return null;\r\n }\r\n\r\n }\r\n\r\n /**\r\n * get the map move object\r\n * @type {MapMoveCls|*}\r\n */\r\n get mapMove(): MapMoveCls {\r\n return this._mapMove;\r\n }\r\n\r\n /**\r\n * map move params\r\n * @type {object}\r\n */\r\n get mapMoveParams() {\r\n return this._mapMoveParams;\r\n }\r\n\r\n get visible(): boolean{\r\n return this._visible;\r\n }\r\n\r\n /**\r\n * Set the layer visibility\r\n * @type {boolean}\r\n * @override\r\n */\r\n set visible(visibility) {\r\n super.setVisible(visibility);\r\n\r\n if (this._onDemand) {\r\n this.mapMove.triggerLyrLoad(this);\r\n }\r\n }\r\n\r\n /**\r\n * get the layer vector source\r\n * @override\r\n */\r\n get source(): ol.source.Vector {\r\n return this.getSource() as ol.source.Vector;\r\n }\r\n\r\n /**\r\n * array of ol features\r\n */\r\n get features(): Array<ol.Feature> {\r\n return this.source.getFeatures();\r\n }\r\n\r\n /**\r\n *\r\n */\r\n get olLayer(): ol.layer.Vector {\r\n return super.getOlLayer() as ol.layer.Vector;\r\n }\r\n\r\n protected setZIndex(newZ: number) {\r\n this.olLayer.setZIndex(newZ);\r\n }\r\n}\r\n\r\nnm.LayerBaseVector = LayerBaseVector;\r\nexport default LayerBaseVector;\r\n\r\n\r\n\r\n\r\n\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerBaseVector.js","sourceRoot":"","sources":["../../src/layers/LayerBaseVector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAwD;AACxD,gDAA2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;aACrC;QACL,CAAC;;;OAbA;IAmBD,sBAAI,mCAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,SAAS,EAAkB,CAAC;QAC5C,CAAC;;;OAAA;IAKD,sBAAI,qCAAQ;QAHZ;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC;;;OAAA;IAKD,sBAAI,oCAAO;QAHX;;WAEG;aACH;YACI,OAAO,iBAAM,UAAU,WAAY,CAAC;QACxC,CAAC;;;OAAA;IAES,mCAAS,GAAnB,UAAoB,IAAY;QAC5B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IACL,sBAAC;AAAD,CAAC,AAhRD,CAAqC,qBAAS,GAgR7C;AAhRY,0CAAe;AAkR5B,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC;AACrC,kBAAe,eAAe,CAAC","sourcesContent":["import {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport mapMove from '../olHelpers/mapMove';\r\nimport MapMoveCls from '../olHelpers/mapMoveCls'\r\nimport provide from '../util/provide';\r\n// import ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport Style from 'ol/style/Style';\r\nimport Feature from 'ol/Feature';\r\nimport Vector from 'ol/layer/Vector'\r\nimport VectorSource from 'ol/source/Vector';\r\nimport Projection from 'ol/proj/Projection';\r\nimport {iStyleFunc} from \"../olHelpers/esriToOlStyle\";\r\n\r\nconst nm = provide('layers');\r\n\r\nexport interface makeMapMoveParams {\r\n /**\r\n *\r\n * @param lyr\r\n * @param extent\r\n * @param zoomLevel\r\n */\r\n (lyr: LayerBaseVector, extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel?: number): any\r\n}\r\n\r\n\r\n\r\nexport interface LayerBaseVectorOptions extends LayerBaseOptions{\r\n autoLoad?: boolean;\r\n style?: Style|Style[]|iStyleFunc;\r\n onDemand?: boolean;\r\n onDemandDelay?: number;\r\n mapMoveMakeGetParams?: makeMapMoveParams;\r\n mapMoveObj?: MapMoveCls;\r\n renderOrder?: (a: Feature, b: Feature) => number;\r\n\r\n}\r\n\r\n\r\n\r\n/**\r\n * The Vector layer base\r\n * @augments LayerBase\r\n * @abstract\r\n */\r\nexport class LayerBaseVector extends LayerBase {\r\n _olLayer: Vector;\r\n _source: VectorSource;\r\n _style: Style|Array<Style>|iStyleFunc;\r\n _autoLoad: boolean;\r\n _onDemand: boolean;\r\n _onDemandDelay: number;\r\n _mapMoveMakeGetParams: makeMapMoveParams;\r\n _mapMoveParams: any;\r\n _mapMove: MapMoveCls;\r\n _projectionMap: Projection;\r\n _projection4326: Projection;\r\n\r\n\r\n\r\n /**\r\n * The base vector layer\r\n * @param {string} url - pass an empty string to prevent default load and add from a json source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n */\r\n constructor(url: string, options: LayerBaseVectorOptions = {}) {\r\n super(url, options);\r\n\r\n options = options as LayerBaseVectorOptions;\r\n\r\n //prevent regular load if no url has been provided\r\n if (this.url.trim() == '') {\r\n this._loaded = true;\r\n }\r\n\r\n this._style = typeof options.style == 'undefined' ? undefined : options.style;\r\n\r\n if (this.visible) {\r\n this._autoLoad = true;\r\n } else {\r\n this._autoLoad = (typeof options['autoLoad'] == 'boolean' ? options['autoLoad'] : false);\r\n }\r\n\r\n this._onDemand = typeof options.onDemand == 'boolean' ? options.onDemand : false;\r\n this._onDemandDelay = typeof options.onDemandDelay == 'number' ? options.onDemandDelay : 300;\r\n\r\n if (options.mapMoveObj) {\r\n this._mapMove = options.mapMoveObj;\r\n } else {\r\n this._mapMove = this._onDemand ? mapMove : undefined;\r\n }\r\n\r\n\r\n this._mapMoveMakeGetParams = typeof options.mapMoveMakeGetParams == 'function' ? options.mapMoveMakeGetParams :\r\n function () {return {};};\r\n\r\n if (this._onDemand) {\r\n this._loaded = true;\r\n this._mapMoveParams = {};\r\n this._mapMove.checkInit();\r\n this._mapMove.addVectorLayer(this);\r\n }\r\n\r\n this._source = new VectorSource();\r\n\r\n\r\n this._olLayer = new Vector(\r\n {\r\n source: this._source,\r\n visible: this.visible,\r\n style: this.style,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution,\r\n renderOrder: options.renderOrder\r\n }\r\n );\r\n\r\n this.olLayer.setZIndex(this._zIndex);\r\n\r\n this._projectionMap = null;\r\n this._projection4326 = new Projection({code: \"EPSG:4326\"});\r\n this._olLayer.setOpacity(this.opacity)\r\n }\r\n\r\n /**\r\n * dummy to be overridden\r\n * @param {object} featureCollection - geojson or esrijson object\r\n */\r\n addFeatures(featureCollection: Object) {\r\n console.log('Layer vector base addFeatures is a placeholder and does nothing');\r\n }\r\n\r\n /**\r\n * Before call to map move callback, can prevent call by returning false\r\n * @param {number} zoom - zoom level\r\n * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution'\r\n * @returns {boolean} if the call should proceed\r\n */\r\n mapMoveBefore(zoom: number, evtType: string) {\r\n if (this.minZoom !== undefined) {\r\n if (zoom < this.minZoom) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this.maxZoom !== undefined) {\r\n if (zoom > this.maxZoom) {\r\n return false;\r\n }\r\n }\r\n\r\n return this.visible;\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel: number) {\r\n this._mapMoveParams = {};\r\n $.extend(this._mapMoveParams, this.params);\r\n $.extend(this._mapMoveParams, this._mapMoveMakeGetParams(this, extent, zoomLevel));\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d - the json response\r\n */\r\n mapMoveCallback(d: Object) {\r\n if (this.source) {\r\n this._source.clear();\r\n }\r\n }\r\n\r\n /**\r\n * clear features in the layer\r\n */\r\n clear() {\r\n if (this._source) {\r\n this._source.clear();\r\n }\r\n }\r\n\r\n /**\r\n * get on demand delay in miliseconds\r\n */\r\n get onDemandDelay(): number {\r\n return this._onDemandDelay;\r\n }\r\n\r\n /**\r\n * get if the layer is autoloaded\r\n */\r\n get autoLoad(): boolean {\r\n return this._autoLoad;\r\n }\r\n\r\n /**\r\n * get the style definition\r\n */\r\n get style(): Array<Style>|Style|iStyleFunc {\r\n return this._style;\r\n }\r\n\r\n /**\r\n * set the style\r\n * @param style - the style or function\r\n */\r\n set style(style: Style[]|Style|iStyleFunc) {\r\n this._style = style;\r\n this.olLayer.setStyle(this._style as Style);\r\n }\r\n\r\n /**\r\n * get the map CRS if it is defined by the map move object\r\n */\r\n get mapCrs(): string {\r\n return this.mapProj == null ? null : this.mapProj.getCode();\r\n }\r\n\r\n get mapProj(): Projection{\r\n if (this._projectionMap != null){\r\n return this._projectionMap;\r\n }\r\n\r\n if (this._mapMove) {\r\n this._projectionMap = this._mapMove.map.getView().getProjection();\r\n return this._projectionMap;\r\n } else {\r\n return null;\r\n }\r\n\r\n }\r\n\r\n /**\r\n * get the map move object\r\n * @type {MapMoveCls|*}\r\n */\r\n get mapMove(): MapMoveCls {\r\n return this._mapMove;\r\n }\r\n\r\n /**\r\n * map move params\r\n * @type {object}\r\n */\r\n get mapMoveParams() {\r\n return this._mapMoveParams;\r\n }\r\n\r\n get visible(): boolean{\r\n return this._visible;\r\n }\r\n\r\n /**\r\n * Set the layer visibility\r\n * @type {boolean}\r\n * @override\r\n */\r\n set visible(visibility) {\r\n super.setVisible(visibility);\r\n\r\n if (this._onDemand) {\r\n this.mapMove.triggerLyrLoad(this);\r\n }\r\n }\r\n\r\n /**\r\n * get the layer vector source\r\n * @override\r\n */\r\n get source(): VectorSource {\r\n return this.getSource() as VectorSource;\r\n }\r\n\r\n /**\r\n * array of ol features\r\n */\r\n get features(): Array<Feature> {\r\n return this.source.getFeatures();\r\n }\r\n\r\n /**\r\n *\r\n */\r\n get olLayer(): Vector {\r\n return super.getOlLayer() as Vector;\r\n }\r\n\r\n protected setZIndex(newZ: number) {\r\n this.olLayer.setZIndex(newZ);\r\n }\r\n}\r\n\r\nnm.LayerBaseVector = LayerBaseVector;\r\nexport default LayerBaseVector;\r\n\r\n\r\n\r\n\r\n\r\n\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerBaseVectorEsri.d.ts b/dist/layers/LayerBaseVectorEsri.d.ts index c7199c3..7ff551b 100644 --- a/dist/layers/LayerBaseVectorEsri.d.ts +++ b/dist/layers/LayerBaseVectorEsri.d.ts @@ -2,7 +2,6 @@ * Created by gavorhes on 11/2/2015. */ import { LayerBaseVector, LayerBaseVectorOptions } from './LayerBaseVector'; -import ol = require('custom-ol'); /** * Helper to return the url to the service on the production server * @param {string} folder diff --git a/dist/layers/LayerBaseVectorEsri.js b/dist/layers/LayerBaseVectorEsri.js index 2ab2e6a..feb5c15 100644 --- a/dist/layers/LayerBaseVectorEsri.js +++ b/dist/layers/LayerBaseVectorEsri.js @@ -16,9 +16,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); var LayerBaseVector_1 = require("./LayerBaseVector"); var esriToOl = require("../olHelpers/esriToOlStyle"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var $ = require("jquery"); var nm = provide_1.default('layers'); +var EsriJSON_1 = require("ol/format/EsriJSON"); /** * Helper to return the url to the service on the production server * @param {string} folder @@ -78,7 +78,7 @@ var LayerBaseVectorEsri = /** @class */ (function (_super) { options.params['outSR'] = options.outSR || 3857; _this = _super.call(this, url, options) || this; _this._outSR = _this.params['outSR']; - _this._esriFormat = new ol.format.EsriJSON(); + _this._esriFormat = new EsriJSON_1.default(); if (_this._url[_this._url.length - 1] !== '/') { _this._url += '/'; } diff --git a/dist/layers/LayerBaseVectorEsri.js.map b/dist/layers/LayerBaseVectorEsri.js.map index fc69f97..6d19854 100644 --- a/dist/layers/LayerBaseVectorEsri.js.map +++ b/dist/layers/LayerBaseVectorEsri.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerBaseVectorEsri.js","sourceRoot":"","sources":["../../src/layers/LayerBaseVectorEsri.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,qDAA0E;AAC1E,qDAAuD;AACvD,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;AAC7B,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAG3B;;;;;;GAMG;AACH,wBAA+B,MAAc,EAAE,OAAe,EAAE,KAAa;IACzE,OAAO,yEAAuE,MAAM,SAAI,OAAO,mBAAc,KAAO,CAAA;AACxH,CAAC;AAFD,wCAEC;AAUD;;;GAGG;AACH;IAAyC,uCAAe;IAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;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AAmB;AAuKhC,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC7C,kBAAe,mBAAmB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/2/2015.\r\n */\r\n\r\nimport {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector';\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nlet nm = provide('layers');\r\n\r\n\r\n/**\r\n * Helper to return the url to the service on the production server\r\n * @param {string} folder\r\n * @param {string} service\r\n * @param {number} layer\r\n * @returns {string}\r\n */\r\nexport function makeServiceUrl(folder: string, service: string, layer: number): string{\r\n return `https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/${folder}/${service}/MapServer/${layer}`\r\n}\r\n\r\nexport interface LayerBaseVectorEsriOptions extends LayerBaseVectorOptions{\r\n format?: string;\r\n outSR?: number;\r\n where?: string;\r\n outFields?: string;\r\n useEsriStyle?: boolean;\r\n}\r\n\r\n/**\r\n * Base layer for esri vector layers\r\n * @augments LayerBaseVector\r\n */\r\nexport class LayerBaseVectorEsri extends LayerBaseVector {\r\n _outSR: number;\r\n _esriFormat: ol.format.EsriJSON;\r\n _urlCopy: string;\r\n _useEsriStyle: boolean;\r\n\r\n /**\r\n * The base vector layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} [options.where=1=1] the layer filter clause\r\n * @param {string} [options.outFields=*] comma separated list of output fields, defaults to all\r\n * @param {string} [options.format=pjson] the format the retrieve the data\r\n * @param {number} [options.outSR=3857] the output spatial reference, defaults to web mercator\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n * @param {boolean} [options.collapseLegend=false] if the legend should be initially collapsed\r\n * @param {number} [options.mapMoveMakeGetParams=function(extent, zoomLevel){}] function to create additional map move params\r\n */\r\n constructor(url: string, options: LayerBaseVectorEsriOptions) {\r\n\r\n if (typeof options.params != 'object') {\r\n options.params = {};\r\n }\r\n options.params['where'] = options.where || '1=1';\r\n options.params['outFields'] = options.outFields || '*';\r\n options.params['f'] = options.format || 'pjson';\r\n options.params['outSR'] = options.outSR || 3857;\r\n\r\n super(url, options);\r\n this._outSR = this.params['outSR'];\r\n this._esriFormat = new ol.format.EsriJSON();\r\n\r\n if (this._url[this._url.length - 1] !== '/') {\r\n this._url += '/';\r\n }\r\n\r\n this._urlCopy = this.url;\r\n this._url += 'query?callback=?';\r\n\r\n if (this.autoLoad || this.visible) {\r\n this._load();\r\n }\r\n\r\n this._useEsriStyle = typeof options.useEsriStyle == 'boolean' ? options.useEsriStyle : false;\r\n\r\n if (this._useEsriStyle) {\r\n this.addLegendContent();\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content to add to legend\r\n */\r\n addLegendContent(additionalContent?: string) {\r\n if (!this._useEsriStyle) {\r\n super.addLegendContent(additionalContent);\r\n } else {\r\n $.get(this._urlCopy + '?f=pjson&callback=?', {}, (d) => {\r\n if (d['subLayers'].length > 0) {\r\n alert('should only use single feature layers, not groups');\r\n\r\n return;\r\n }\r\n\r\n let newStyleAndLegend = esriToOl.makeFeatureServiceLegendAndSymbol(d);\r\n this.style = newStyleAndLegend.style;\r\n super.addLegendContent(newStyleAndLegend.legend);\r\n }, 'json');\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add feature collection\r\n * @param {object} featureCollection - features as esrijson\r\n */\r\n addFeatures(featureCollection: Object) {\r\n let feats = this._esriFormat.readFeatures(featureCollection);\r\n this.source.addFeatures(feats);\r\n }\r\n\r\n /**\r\n * trigger load features\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n if (super._load()) {\r\n return true;\r\n }\r\n $.get(this._url, this.params, (d) => {\r\n this.addFeatures(d);\r\n this.loadCallback(this);\r\n }, 'json').fail(() => {\r\n this._loaded = false;\r\n });\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel: number) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n this.mapMoveParams['geometry'] = `${extent.minX},${extent.minY},${extent.maxX},${extent.maxY}`;\r\n this.mapMoveParams['geometryType'] = 'esriGeometryEnvelope';\r\n this.mapMoveParams['spatialRel'] = 'esriSpatialRelIntersects';\r\n this.mapMoveParams['spatialRel'] = 'esriSpatialRelIntersects';\r\n this.mapMoveParams['inSR'] = 3857;\r\n if (this._outSR == 3857) {\r\n this.mapMoveParams['geometryPrecision'] = 1;\r\n }\r\n }\r\n\r\n /**\r\n * Before call to map move callback, can prevent call by returning false\r\n * @param {number} zoom - zoom level\r\n * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution'\r\n * @returns {boolean} if the call should proceed\r\n */\r\n mapMoveBefore(zoom: number, evtType: string) {\r\n return super.mapMoveBefore(zoom, evtType);\r\n //if (super.mapMoveBefore(zoom, evtType)){\r\n // //place holder for additional processing\r\n // return true;\r\n //} else {\r\n // return false;\r\n //}\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d - the json response\r\n */\r\n mapMoveCallback(d: Object) {\r\n super.mapMoveCallback(d);\r\n this.source.addFeatures(this._esriFormat.readFeatures(d));\r\n }\r\n}\r\n\r\nnm.LayerBaseVectorEsri = LayerBaseVectorEsri;\r\nexport default LayerBaseVectorEsri;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerBaseVectorEsri.js","sourceRoot":"","sources":["../../src/layers/LayerBaseVectorEsri.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,qDAA0E;AAC1E,qDAAuD;AACvD,2CAAsC;AACtC,0BAA6B;AAC7B,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,+CAA0C;AAG1C;;;;;;GAMG;AACH,wBAA+B,MAAc,EAAE,OAAe,EAAE,KAAa;IACzE,OAAO,yEAAuE,MAAM,SAAI,OAAO,mBAAc,KAAO,CAAA;AACxH,CAAC;AAFD,wCAEC;AAUD;;;GAGG;AACH;IAAyC,uCAAe;IAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,6BAAY,GAAW,EAAE,OAAmC;QAA5D,iBA8BC;QA5BG,IAAI,OAAO,OAAO,CAAC,MAAM,IAAI,QAAQ,EAAE;YACnC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC;SACvB;QACD,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACjD,OAAO,CAAC,MAA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,SAAI,MAAM,CAAC,IAAI,SAAI,MAAM,CAAC,IAAI,SAAI,MAAM,CAAC,IAAM,CAAC;QAC/F,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,sBAAsB,CAAC;QAC5D,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,0BAA0B,CAAC;QAC9D,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,0BAA0B,CAAC;QAC9D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAClC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACrB,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;SAC/C;IACL,CAAC;IAED;;;;;OAKG;IACH,2CAAa,GAAb,UAAc,IAAY,EAAE,OAAe;QACvC,OAAO,iBAAM,aAAa,YAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1C,0CAA0C;QAC1C,8CAA8C;QAC9C,kBAAkB;QAClB,UAAU;QACV,mBAAmB;QACnB,GAAG;IACP,CAAC;IAED;;;OAGG;IACH,6CAAe,GAAf,UAAgB,CAAS;QACrB,iBAAM,eAAe,YAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACL,0BAAC;AAAD,CAAC,AArKD,CAAyC,iCAAe,GAqKvD;AArKY,kDAAmB;AAuKhC,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC7C,kBAAe,mBAAmB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/2/2015.\r\n */\r\n\r\nimport {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector';\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\nimport provide from '../util/provide';\r\nimport $ = require('jquery');\r\nlet nm = provide('layers');\r\nimport EsriJSON from 'ol/format/EsriJSON';\r\n\r\n\r\n/**\r\n * Helper to return the url to the service on the production server\r\n * @param {string} folder\r\n * @param {string} service\r\n * @param {number} layer\r\n * @returns {string}\r\n */\r\nexport function makeServiceUrl(folder: string, service: string, layer: number): string{\r\n return `https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/${folder}/${service}/MapServer/${layer}`\r\n}\r\n\r\nexport interface LayerBaseVectorEsriOptions extends LayerBaseVectorOptions{\r\n format?: string;\r\n outSR?: number;\r\n where?: string;\r\n outFields?: string;\r\n useEsriStyle?: boolean;\r\n}\r\n\r\n/**\r\n * Base layer for esri vector layers\r\n * @augments LayerBaseVector\r\n */\r\nexport class LayerBaseVectorEsri extends LayerBaseVector {\r\n _outSR: number;\r\n _esriFormat: ol.format.EsriJSON;\r\n _urlCopy: string;\r\n _useEsriStyle: boolean;\r\n\r\n /**\r\n * The base vector layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} [options.where=1=1] the layer filter clause\r\n * @param {string} [options.outFields=*] comma separated list of output fields, defaults to all\r\n * @param {string} [options.format=pjson] the format the retrieve the data\r\n * @param {number} [options.outSR=3857] the output spatial reference, defaults to web mercator\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n * @param {boolean} [options.collapseLegend=false] if the legend should be initially collapsed\r\n * @param {number} [options.mapMoveMakeGetParams=function(extent, zoomLevel){}] function to create additional map move params\r\n */\r\n constructor(url: string, options: LayerBaseVectorEsriOptions) {\r\n\r\n if (typeof options.params != 'object') {\r\n options.params = {};\r\n }\r\n options.params['where'] = options.where || '1=1';\r\n options.params['outFields'] = options.outFields || '*';\r\n options.params['f'] = options.format || 'pjson';\r\n options.params['outSR'] = options.outSR || 3857;\r\n\r\n super(url, options);\r\n this._outSR = this.params['outSR'];\r\n this._esriFormat = new EsriJSON();\r\n\r\n if (this._url[this._url.length - 1] !== '/') {\r\n this._url += '/';\r\n }\r\n\r\n this._urlCopy = this.url;\r\n this._url += 'query?callback=?';\r\n\r\n if (this.autoLoad || this.visible) {\r\n this._load();\r\n }\r\n\r\n this._useEsriStyle = typeof options.useEsriStyle == 'boolean' ? options.useEsriStyle : false;\r\n\r\n if (this._useEsriStyle) {\r\n this.addLegendContent();\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content to add to legend\r\n */\r\n addLegendContent(additionalContent?: string) {\r\n if (!this._useEsriStyle) {\r\n super.addLegendContent(additionalContent);\r\n } else {\r\n $.get(this._urlCopy + '?f=pjson&callback=?', {}, (d) => {\r\n if (d['subLayers'].length > 0) {\r\n alert('should only use single feature layers, not groups');\r\n\r\n return;\r\n }\r\n\r\n let newStyleAndLegend = esriToOl.makeFeatureServiceLegendAndSymbol(d);\r\n this.style = newStyleAndLegend.style;\r\n super.addLegendContent(newStyleAndLegend.legend);\r\n }, 'json');\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add feature collection\r\n * @param {object} featureCollection - features as esrijson\r\n */\r\n addFeatures(featureCollection: Object) {\r\n let feats = this._esriFormat.readFeatures(featureCollection);\r\n this.source.addFeatures(feats);\r\n }\r\n\r\n /**\r\n * trigger load features\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n if (super._load()) {\r\n return true;\r\n }\r\n $.get(this._url, this.params, (d) => {\r\n this.addFeatures(d);\r\n this.loadCallback(this);\r\n }, 'json').fail(() => {\r\n this._loaded = false;\r\n });\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: {minX: number, minY: number, maxX: number, maxY: number}, zoomLevel: number) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n this.mapMoveParams['geometry'] = `${extent.minX},${extent.minY},${extent.maxX},${extent.maxY}`;\r\n this.mapMoveParams['geometryType'] = 'esriGeometryEnvelope';\r\n this.mapMoveParams['spatialRel'] = 'esriSpatialRelIntersects';\r\n this.mapMoveParams['spatialRel'] = 'esriSpatialRelIntersects';\r\n this.mapMoveParams['inSR'] = 3857;\r\n if (this._outSR == 3857) {\r\n this.mapMoveParams['geometryPrecision'] = 1;\r\n }\r\n }\r\n\r\n /**\r\n * Before call to map move callback, can prevent call by returning false\r\n * @param {number} zoom - zoom level\r\n * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution'\r\n * @returns {boolean} if the call should proceed\r\n */\r\n mapMoveBefore(zoom: number, evtType: string) {\r\n return super.mapMoveBefore(zoom, evtType);\r\n //if (super.mapMoveBefore(zoom, evtType)){\r\n // //place holder for additional processing\r\n // return true;\r\n //} else {\r\n // return false;\r\n //}\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d - the json response\r\n */\r\n mapMoveCallback(d: Object) {\r\n super.mapMoveCallback(d);\r\n this.source.addFeatures(this._esriFormat.readFeatures(d));\r\n }\r\n}\r\n\r\nnm.LayerBaseVectorEsri = LayerBaseVectorEsri;\r\nexport default LayerBaseVectorEsri;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerBaseVectorGeoJson.d.ts b/dist/layers/LayerBaseVectorGeoJson.d.ts index ad78203..b64b026 100644 --- a/dist/layers/LayerBaseVectorGeoJson.d.ts +++ b/dist/layers/LayerBaseVectorGeoJson.d.ts @@ -2,11 +2,12 @@ * Created by gavorhes on 11/2/2015. */ import { LayerBaseVector, LayerBaseVectorOptions } from './LayerBaseVector'; -import ol = require('custom-ol'); import { MapMoveCls } from "../olHelpers/mapMoveCls"; +import Projection from 'ol/proj/Projection'; +import GeoJSON from 'ol/format/GeoJSON'; export interface crsTransform { - dataProjection?: ol.proj.Projection; - featureProjection?: ol.proj.Projection; + dataProjection?: Projection; + featureProjection?: Projection; } export interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions { transform?: crsTransform; @@ -17,7 +18,7 @@ export interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions { * @augments LayerBaseVector */ export declare class LayerBaseVectorGeoJson extends LayerBaseVector { - _geoJsonFormat: ol.format.GeoJSON; + _geoJsonFormat: GeoJSON; _transform: crsTransform; /** * @param {string|null} url - resource url, set to '' to make blank layer diff --git a/dist/layers/LayerBaseVectorGeoJson.js b/dist/layers/LayerBaseVectorGeoJson.js index 76bc634..ef1560e 100644 --- a/dist/layers/LayerBaseVectorGeoJson.js +++ b/dist/layers/LayerBaseVectorGeoJson.js @@ -15,10 +15,10 @@ var __extends = (this && this.__extends) || (function () { Object.defineProperty(exports, "__esModule", { value: true }); var LayerBaseVector_1 = require("./LayerBaseVector"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var $ = require("jquery"); var proj = require("../olHelpers/projections"); var projections_1 = require("../olHelpers/projections"); +var GeoJSON_1 = require("ol/format/GeoJSON"); var nm = provide_1.default('layers'); /** * The Vector GeoJson Layer @@ -58,7 +58,7 @@ var LayerBaseVectorGeoJson = /** @class */ (function (_super) { var _this = this; url = typeof url == 'string' ? url : ''; _this = _super.call(this, url, options) || this; - _this._geoJsonFormat = new ol.format.GeoJSON(); + _this._geoJsonFormat = new GeoJSON_1.default(); _this._transform = options.transform || {}; _this._transform.dataProjection = _this._transform.dataProjection || proj.proj4326; _this._transform.featureProjection = _this._transform.featureProjection || projections_1.proj3857; diff --git a/dist/layers/LayerBaseVectorGeoJson.js.map b/dist/layers/LayerBaseVectorGeoJson.js.map index 10998d8..2fe13f8 100644 --- a/dist/layers/LayerBaseVectorGeoJson.js.map +++ b/dist/layers/LayerBaseVectorGeoJson.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerBaseVectorGeoJson.js","sourceRoot":"","sources":["../../src/layers/LayerBaseVectorGeoJson.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,qDAA0E;AAC1E,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;AAE7B,+CAAiD;AACjD,wDAAkD;AAElD,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAa3B;;;GAGG;AACH;IAA4C,0CAAe;IAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gCAAY,GAAY,EAAE,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAArE,iBAaC;QAZG,GAAG,GAAG,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,QAAA,kBAAM,GAAG,EAAE,OAAO,CAAC,SAAC;QAEpB,KAAI,CAAC,cAAc,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAE9C,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QA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,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc,EAAC,CAAC,CAAC,CAAC;IACjH,CAAC;IACL,6BAAC;AAAD,CAAC,AA/FD,CAA4C,iCAAe,GA+F1D;AA/FY,wDAAsB;AAiGnC,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACnD,kBAAe,sBAAsB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/2/2015.\r\n */\r\n\r\nimport {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {MapMoveCls} from \"../olHelpers/mapMoveCls\";\r\nimport * as proj from '../olHelpers/projections';\r\nimport {proj3857} from \"../olHelpers/projections\";\r\n\r\nlet nm = provide('layers');\r\n\r\nexport interface crsTransform {\r\n dataProjection?: ol.proj.Projection;\r\n featureProjection?: ol.proj.Projection;\r\n}\r\n\r\n\r\nexport interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions {\r\n transform?: crsTransform;\r\n mapMoveObj?: MapMoveCls;\r\n}\r\n\r\n/**\r\n * The Vector GeoJson Layer\r\n * @augments LayerBaseVector\r\n */\r\nexport class LayerBaseVectorGeoJson extends LayerBaseVector {\r\n _geoJsonFormat: ol.format.GeoJSON;\r\n _transform: crsTransform;\r\n\r\n /**\r\n * @param {string|null} url - resource url, set to '' to make blank layer\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n *\r\n * @param {object} [options.transform={}] SR transform, set as false for no transform\r\n * @param {string} options.transform.dataProjection=EPSG:4326 the data CRS\r\n * @param {string} options.transform.featureProjection=EPSG:3857 the feature/map CRS\r\n * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n */\r\n constructor(url?: string, options: LayerBaseVectorGeoJsonOptions = {}) {\r\n url = typeof url == 'string' ? url : '';\r\n super(url, options);\r\n\r\n this._geoJsonFormat = new ol.format.GeoJSON();\r\n\r\n this._transform = options.transform || {};\r\n this._transform.dataProjection = this._transform.dataProjection || proj.proj4326;\r\n this._transform.featureProjection = this._transform.featureProjection || proj3857;\r\n\r\n if (this.autoLoad || this.visible) {\r\n this._load();\r\n }\r\n }\r\n\r\n /**\r\n * add feature collection\r\n * @param {object} featureCollection - as geojson object\r\n */\r\n addFeatures(featureCollection: any) {\r\n this.source.addFeatures(\r\n this._geoJsonFormat.readFeatures(featureCollection,\r\n {dataProjection: this._transform.dataProjection,\r\n featureProjection: this._transform.featureProjection}\r\n )\r\n );\r\n }\r\n\r\n\r\n /**\r\n * trigger load features\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n\r\n if (super._load()) {\r\n return true;\r\n }\r\n\r\n $.get(this._url,\r\n this._params,\r\n (d) => {\r\n this.addFeatures(d);\r\n this.loadCallback(this);\r\n }, 'json').fail(\r\n function () {\r\n this._loaded = false;\r\n }\r\n );\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d the json response\r\n * @override\r\n */\r\n mapMoveCallback(d: Object) {\r\n super.mapMoveCallback(d);\r\n this._source.addFeatures(this._geoJsonFormat.readFeatures(d,\r\n {featureProjection: this._transform.featureProjection, dataProjection: this._transform.dataProjection}));\r\n }\r\n}\r\n\r\nnm.LayerBaseVectorGeoJson = LayerBaseVectorGeoJson;\r\nexport default LayerBaseVectorGeoJson;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerBaseVectorGeoJson.js","sourceRoot":"","sources":["../../src/layers/LayerBaseVectorGeoJson.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,qDAA0E;AAC1E,2CAAsC;AACtC,0BAA6B;AAE7B,+CAAiD;AACjD,wDAAkD;AAElD,6CAAuC;AAEvC,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAa3B;;;GAGG;AACH;IAA4C,0CAAe;IAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gCAAY,GAAY,EAAE,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAArE,iBAaC;QAZG,GAAG,GAAG,OAAO,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,QAAA,kBAAM,GAAG,EAAE,OAAO,CAAC,SAAC;QAEpB,KAAI,CAAC,cAAc,GAAG,IAAI,iBAAO,EAAE,CAAC;QAEpC,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC1C,KAAI,CAAC,UAAU,CAAC,cAAc,GAAG,KAAI,CAAC,UAAU,CAAC,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC;QACjF,KAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,KAAI,CAAC,UAAU,CAAC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GA+F1D;AA/FY,wDAAsB;AAiGnC,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACnD,kBAAe,sBAAsB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/2/2015.\r\n */\r\n\r\nimport {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector';\r\nimport provide from '../util/provide';\r\nimport $ = require('jquery');\r\nimport {MapMoveCls} from \"../olHelpers/mapMoveCls\";\r\nimport * as proj from '../olHelpers/projections';\r\nimport {proj3857} from \"../olHelpers/projections\";\r\nimport Projection from 'ol/proj/Projection';\r\nimport GeoJSON from 'ol/format/GeoJSON'\r\n\r\nlet nm = provide('layers');\r\n\r\nexport interface crsTransform {\r\n dataProjection?: Projection;\r\n featureProjection?: Projection;\r\n}\r\n\r\n\r\nexport interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions {\r\n transform?: crsTransform;\r\n mapMoveObj?: MapMoveCls;\r\n}\r\n\r\n/**\r\n * The Vector GeoJson Layer\r\n * @augments LayerBaseVector\r\n */\r\nexport class LayerBaseVectorGeoJson extends LayerBaseVector {\r\n _geoJsonFormat: GeoJSON;\r\n _transform: crsTransform;\r\n\r\n /**\r\n * @param {string|null} url - resource url, set to '' to make blank layer\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n *\r\n * @param {object} [options.transform={}] SR transform, set as false for no transform\r\n * @param {string} options.transform.dataProjection=EPSG:4326 the data CRS\r\n * @param {string} options.transform.featureProjection=EPSG:3857 the feature/map CRS\r\n * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n */\r\n constructor(url?: string, options: LayerBaseVectorGeoJsonOptions = {}) {\r\n url = typeof url == 'string' ? url : '';\r\n super(url, options);\r\n\r\n this._geoJsonFormat = new GeoJSON();\r\n\r\n this._transform = options.transform || {};\r\n this._transform.dataProjection = this._transform.dataProjection || proj.proj4326;\r\n this._transform.featureProjection = this._transform.featureProjection || proj3857;\r\n\r\n if (this.autoLoad || this.visible) {\r\n this._load();\r\n }\r\n }\r\n\r\n /**\r\n * add feature collection\r\n * @param {object} featureCollection - as geojson object\r\n */\r\n addFeatures(featureCollection: any) {\r\n this.source.addFeatures(\r\n this._geoJsonFormat.readFeatures(featureCollection,\r\n {dataProjection: this._transform.dataProjection,\r\n featureProjection: this._transform.featureProjection}\r\n )\r\n );\r\n }\r\n\r\n\r\n /**\r\n * trigger load features\r\n * @protected\r\n * @returns {boolean} if already loaded\r\n */\r\n _load() {\r\n\r\n if (super._load()) {\r\n return true;\r\n }\r\n\r\n $.get(this._url,\r\n this._params,\r\n (d) => {\r\n this.addFeatures(d);\r\n this.loadCallback(this);\r\n }, 'json').fail(\r\n function () {\r\n this._loaded = false;\r\n }\r\n );\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * callback function on map move\r\n * @param {object} d the json response\r\n * @override\r\n */\r\n mapMoveCallback(d: Object) {\r\n super.mapMoveCallback(d);\r\n this._source.addFeatures(this._geoJsonFormat.readFeatures(d,\r\n {featureProjection: this._transform.featureProjection, dataProjection: this._transform.dataProjection}));\r\n }\r\n}\r\n\r\nnm.LayerBaseVectorGeoJson = LayerBaseVectorGeoJson;\r\nexport default LayerBaseVectorGeoJson;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerBaseXyzTile.d.ts b/dist/layers/LayerBaseXyzTile.d.ts index c67341a..861382f 100644 --- a/dist/layers/LayerBaseXyzTile.d.ts +++ b/dist/layers/LayerBaseXyzTile.d.ts @@ -2,7 +2,8 @@ * Created by gavorhes on 12/4/2015. */ import { LayerBase, LayerBaseOptions } from './LayerBase'; -import ol = require('custom-ol'); +import XYZ from 'ol/source/XYZ'; +import Tile from 'ol/layer/Tile'; /** * XYZ tile * @augments LayerBase @@ -27,15 +28,7 @@ export declare class LayerBaseXyzTile extends LayerBase { * @param {boolean} [options.useEsriStyle=false] if the map service style should be used */ constructor(url: string, options?: LayerBaseOptions); - /** - * - * @returns {ol.source.XYZ} the vector source - */ - readonly source: ol.source.XYZ; - /** - * - * @returns {ol.layer.Tile|ol.layer.Base|undefined} the ol layer - */ - readonly olLayer: ol.layer.Tile; + readonly source: XYZ; + readonly olLayer: Tile; } export default LayerBaseXyzTile; diff --git a/dist/layers/LayerBaseXyzTile.js b/dist/layers/LayerBaseXyzTile.js index a65e297..b170cb6 100644 --- a/dist/layers/LayerBaseXyzTile.js +++ b/dist/layers/LayerBaseXyzTile.js @@ -15,8 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); */ var LayerBase_1 = require("./LayerBase"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var nm = provide_1.default('layers'); +var XYZ_1 = require("ol/source/XYZ"); +var Tile_1 = require("ol/layer/Tile"); /** * XYZ tile * @augments LayerBase @@ -44,8 +45,8 @@ var LayerBaseXyzTile = /** @class */ (function (_super) { function LayerBaseXyzTile(url, options) { if (options === void 0) { options = {}; } var _this = _super.call(this, url, options) || this; - _this._source = new ol.source.XYZ({ url: _this.url == '' ? undefined : _this.url }); - _this._olLayer = new ol.layer.Tile({ + _this._source = new XYZ_1.default({ url: _this.url == '' ? undefined : _this.url }); + _this._olLayer = new Tile_1.default({ source: _this._source, visible: _this.visible, opacity: _this.opacity, @@ -56,10 +57,6 @@ var LayerBaseXyzTile = /** @class */ (function (_super) { return _this; } Object.defineProperty(LayerBaseXyzTile.prototype, "source", { - /** - * - * @returns {ol.source.XYZ} the vector source - */ get: function () { return this._source; }, @@ -67,10 +64,6 @@ var LayerBaseXyzTile = /** @class */ (function (_super) { configurable: true }); Object.defineProperty(LayerBaseXyzTile.prototype, "olLayer", { - /** - * - * @returns {ol.layer.Tile|ol.layer.Base|undefined} the ol layer - */ get: function () { return this._olLayer; }, diff --git a/dist/layers/LayerBaseXyzTile.js.map b/dist/layers/LayerBaseXyzTile.js.map index 2bb8b81..8fc3a2c 100644 --- a/dist/layers/LayerBaseXyzTile.js.map +++ b/dist/layers/LayerBaseXyzTile.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerBaseXyzTile.js","sourceRoot":"","sources":["../../src/layers/LayerBaseXyzTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,yCAAwD;AACxD,2CAAsC;AACtC,8BAAiC;AACjC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAG7B;;;GAGG;AACH;IAAsC,oCAAS;IAG3C;;;;;;;;;;;;;;;;;OAiBG;IACH,0BAAY,GAAW,EAAE,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QAAvD,YACI,kBAAM,GAAG,EAAE,OAAO,CAAC,SAYtB;QAXG,KAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAC,GAAG,EAAE,KAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAI,CAAC,GAAG,EAAC,CAAC,CAAC;QAE/E,KAAI,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;YAC9B,MAAM,EAAE,KAAI,CAAC,OAAwB;YACrC,OAAO,EAAE,KAAI,CAAC,OAAO;YACrB,OAAO,EAAE,KAAI,CAAC,OAAO;YACrB,aAAa,EAAE,KAAI,CAAC,cAAc;YAClC,aAAa,EAAE,KAAI,CAAC,cAAc;SACrC,CAAE,CAAC;QAEJ,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;;IAC1C,CAAC;IAMD,sBAAI,oCAAM;QAJV;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,OAAwB,CAAC;QACzC,CAAC;;;OAAA;IAMD,sBAAI,qCAAO;QAJX;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,QAAyB,CAAC;QAC1C,CAAC;;;OAAA;IACL,uBAAC;AAAD,CAAC,AAnDD,CAAsC,qBAAS,GAmD9C;AAnDY,4CAAgB;AAqD7B,EAAE,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACvC,kBAAe,gBAAgB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nconst nm = provide('layers');\r\n\r\n\r\n/**\r\n * XYZ tile\r\n * @augments LayerBase\r\n */\r\nexport class LayerBaseXyzTile extends LayerBase {\r\n\r\n\r\n /**\r\n * The XYZ tile layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n */\r\n constructor(url: string, options: LayerBaseOptions = {}) {\r\n super(url, options);\r\n this._source = new ol.source.XYZ({url: this.url == '' ? undefined : this.url});\r\n\r\n this._olLayer = new ol.layer.Tile({\r\n source: this._source as ol.source.XYZ,\r\n visible: this.visible,\r\n opacity: this.opacity,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution\r\n } );\r\n\r\n this._olLayer.setZIndex(this._zIndex);\r\n }\r\n\r\n /**\r\n *\r\n * @returns {ol.source.XYZ} the vector source\r\n */\r\n get source(): ol.source.XYZ {\r\n return this._source as ol.source.XYZ;\r\n }\r\n\r\n /**\r\n *\r\n * @returns {ol.layer.Tile|ol.layer.Base|undefined} the ol layer\r\n */\r\n get olLayer() : ol.layer.Tile {\r\n return this._olLayer as ol.layer.Tile;\r\n }\r\n}\r\n\r\nnm.LayerBaseXyzTile = LayerBaseXyzTile;\r\nexport default LayerBaseXyzTile;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerBaseXyzTile.js","sourceRoot":"","sources":["../../src/layers/LayerBaseXyzTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,yCAAwD;AACxD,2CAAsC;AACtC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B,qCAAgC;AAChC,sCAAiC;AAGjC;;;GAGG;AACH;IAAsC,oCAAS;IAG3C;;;;;;;;;;;;;;;;;OAiBG;IACH,0BAAY,GAAW,EAAE,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QAAvD,YACI,kBAAM,GAAG,EAAE,OAAO,CAAC,SAYtB;QAXG,KAAI,CAAC,OAAO,GAAG,IAAI,aAAG,CAAC,EAAC,GAAG,EAAE,KAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAI,CAAC,GAAG,EAAC,CAAC,CAAC;QAErE,KAAI,CAAC,QAAQ,GAAG,IAAI,cAAI,CAAC;YACrB,MAAM,EAAE,KAAI,CAAC,OAAc;YAC3B,OAAO,EAAE,KAAI,CAAC,OAAO;YACrB,OAAO,EAAE,KAAI,CAAC,OAAO;YACrB,aAAa,EAAE,KAAI,CAAC,cAAc;YAClC,aAAa,EAAE,KAAI,CAAC,cAAc;SACrC,CAAE,CAAC;QAEJ,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAI,CAAC,OAAO,CAAC,CAAC;;IAC1C,CAAC;IAGD,sBAAI,oCAAM;aAAV;YACI,OAAO,IAAI,CAAC,OAAc,CAAC;QAC/B,CAAC;;;OAAA;IAGD,sBAAI,qCAAO;aAAX;YACI,OAAO,IAAI,CAAC,QAAgB,CAAC;QACjC,CAAC;;;OAAA;IACL,uBAAC;AAAD,CAAC,AA7CD,CAAsC,qBAAS,GA6C9C;AA7CY,4CAAgB;AA+C7B,EAAE,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACvC,kBAAe,gBAAgB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport provide from '../util/provide';\r\nconst nm = provide('layers');\r\nimport XYZ from 'ol/source/XYZ';\r\nimport Tile from 'ol/layer/Tile';\r\n\r\n\r\n/**\r\n * XYZ tile\r\n * @augments LayerBase\r\n */\r\nexport class LayerBaseXyzTile extends LayerBase {\r\n\r\n\r\n /**\r\n * The XYZ tile layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n */\r\n constructor(url: string, options: LayerBaseOptions = {}) {\r\n super(url, options);\r\n this._source = new XYZ({url: this.url == '' ? undefined : this.url});\r\n\r\n this._olLayer = new Tile({\r\n source: this._source as XYZ,\r\n visible: this.visible,\r\n opacity: this.opacity,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution\r\n } );\r\n\r\n this._olLayer.setZIndex(this._zIndex);\r\n }\r\n\r\n\r\n get source(): XYZ {\r\n return this._source as XYZ;\r\n }\r\n\r\n\r\n get olLayer() : Tile {\r\n return this._olLayer as Tile;\r\n }\r\n}\r\n\r\nnm.LayerBaseXyzTile = LayerBaseXyzTile;\r\nexport default LayerBaseXyzTile;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerEsriMapServer.d.ts b/dist/layers/LayerEsriMapServer.d.ts index 6b916ab..c244e07 100644 --- a/dist/layers/LayerEsriMapServer.d.ts +++ b/dist/layers/LayerEsriMapServer.d.ts @@ -3,7 +3,9 @@ * Created by gavorhes on 12/7/2015. */ import { LayerBase, LayerBaseOptions } from './LayerBase'; -import ol = require('custom-ol'); +import EsriJSON from 'ol/format/EsriJSON'; +import TileArcGISRestSource from 'ol/source/TileArcGISRest'; +import TileLayer from 'ol/layer/Tile'; /** * Helper to return the url to the service on the production server * @param {string} folder @@ -22,7 +24,7 @@ export interface LayerEsriMapServerOptions extends LayerBaseOptions { * @augments LayerBase */ export declare class LayerEsriMapServer extends LayerBase { - _esriFormat: ol.format.EsriJSON; + _esriFormat: EsriJSON; _popupRequest: JQueryXHR; _showLayers: number[]; /** @@ -53,15 +55,7 @@ export declare class LayerEsriMapServer extends LayerBase { getPopupInfo(queryParams: { [s: string]: any; }): void; - /** - * - * @returns {ol.source.TileArcGISRest} the vector source - */ - readonly source: ol.source.TileArcGISRest; - /** - * - * @returns the ol layer - */ - readonly olLayer: ol.layer.Tile; + readonly source: TileArcGISRestSource; + readonly olLayer: TileLayer; } export default LayerEsriMapServer; diff --git a/dist/layers/LayerEsriMapServer.js b/dist/layers/LayerEsriMapServer.js index 9f67dde..b130b28 100644 --- a/dist/layers/LayerEsriMapServer.js +++ b/dist/layers/LayerEsriMapServer.js @@ -17,8 +17,10 @@ var LayerBase_1 = require("./LayerBase"); var esriToOl = require("../olHelpers/esriToOlStyle"); var mapPopup_1 = require("../olHelpers/mapPopup"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var $ = require("jquery"); +var EsriJSON_1 = require("ol/format/EsriJSON"); +var TileArcGISRest_1 = require("ol/source/TileArcGISRest"); +var Tile_1 = require("ol/layer/Tile"); var nm = provide_1.default('layers'); /** * Helper to return the url to the service on the production server @@ -76,12 +78,12 @@ var LayerEsriMapServer = /** @class */ (function (_super) { function LayerEsriMapServer(url, options) { if (options === void 0) { options = {}; } var _this = _super.call(this, url, options) || this; - _this._source = new ol.source.TileArcGISRest({ + _this._source = new TileArcGISRest_1.default({ url: _this.url == '' ? undefined : _this.url, params: typeof options.showLayers == 'undefined' ? undefined : { layers: 'show:' + options.showLayers.join(',') } }); _this._showLayers = options.showLayers || []; - _this._olLayer = new ol.layer.Tile({ + _this._olLayer = new Tile_1.default({ source: _this._source, visible: _this.visible, opacity: _this.opacity, @@ -90,7 +92,7 @@ var LayerEsriMapServer = /** @class */ (function (_super) { }); _this._olLayer.setZIndex(_this._zIndex); options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false; - _this._esriFormat = new ol.format.EsriJSON(); + _this._esriFormat = new EsriJSON_1.default(); _this._popupRequest = null; options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true; if (options.getLegend) { @@ -156,10 +158,6 @@ var LayerEsriMapServer = /** @class */ (function (_super) { }); }; Object.defineProperty(LayerEsriMapServer.prototype, "source", { - /** - * - * @returns {ol.source.TileArcGISRest} the vector source - */ get: function () { return _super.prototype.getSource.call(this); }, @@ -167,10 +165,6 @@ var LayerEsriMapServer = /** @class */ (function (_super) { configurable: true }); Object.defineProperty(LayerEsriMapServer.prototype, "olLayer", { - /** - * - * @returns the ol layer - */ get: function () { return _super.prototype.getOlLayer.call(this); }, diff --git a/dist/layers/LayerEsriMapServer.js.map b/dist/layers/LayerEsriMapServer.js.map index 74e8274..0517cb3 100644 --- a/dist/layers/LayerEsriMapServer.js.map +++ b/dist/layers/LayerEsriMapServer.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerEsriMapServer.js","sourceRoot":"","sources":["../../src/layers/LayerEsriMapServer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,yCAAwD;AACxD,qDAAuD;AACvD,kDAA6C;AAC7C,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;AAE7B,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAI7B;;;;;GAKG;AACH,wBAA+B,MAAc,EAAE,OAAe;IAC1D,OAAO,yEAAuE,MAAM,SAAI,OAAO,eAAY,CAAA;AAC/G,CAAC;AAFD,wCAEC;AAED,uBAA8B,MAAc,EAAE,OAAe;IACzD,IAAI,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;IACrC,IAAI,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC;IAE9B,IAAI,GAAG,GAAG,gBAAc,MAAM,SAAI,OAAS,CAAC;IAE5C,IAAI,GAAG,CAAC,OAAO,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC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C/D;iBACJ;gBAED,SAAS,IAAI,UAAU,CAAC;gBAExB,kBAAQ,CAAC,yBAAyB,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;aAC5G;QACL,CAAC,EAAE,MAAM,CAAC,CAAC;QAEX,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YACtB,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;QAChC,CAAC,CAAC,CAAC;IAEP,CAAC;IAMD,sBAAI,sCAAM;QAJV;;;WAGG;aACH;YACI,OAAO,iBAAM,SAAS,WAA8B,CAAC;QACzD,CAAC;;;OAAA;IAMD,sBAAI,uCAAO;QAJX;;;WAGG;aACH;YACI,OAAO,iBAAM,UAAU,WAAmB,CAAC;QAC/C,CAAC;;;OAAA;IACL,yBAAC;AAAD,CAAC,AAxJD,CAAwC,qBAAS,GAwJhD;AAxJY,gDAAkB;AAyJ/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/7/2015.\r\n */\r\nimport {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\n\r\nconst nm = provide('layers');\r\n\r\n\r\n\r\n/**\r\n * Helper to return the url to the service on the production server\r\n * @param {string} folder\r\n * @param {string} service\r\n * @returns {string}\r\n */\r\nexport function makeServiceUrl(folder: string, service: string): string{\r\n return `https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/${folder}/${service}/MapServer`\r\n}\r\n\r\nexport function localCacheUrl(folder: string, service: string): string{\r\n let windowLocation = window.location;\r\n let loc = windowLocation.href;\r\n\r\n let url = `/mapserver/${folder}/${service}`;\r\n\r\n if (loc.indexOf('transportal.cee.wisc.edu') > -1){\r\n if (loc.toLowerCase().indexOf('webmapsstage') > -1){\r\n url = 'https://transportal.cee.wisc.edu/gis/webmapsstage' + url;\r\n } else {\r\n url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url\r\n }\r\n } else if (parseInt(windowLocation.port) !== 8081){\r\n url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url\r\n }\r\n\r\n\r\n return url;\r\n}\r\n\r\n\r\n\r\n\r\nexport interface LayerEsriMapServerOptions extends LayerBaseOptions {\r\n addPopup?: boolean;\r\n showLayers?: Array<number>;\r\n getLegend?: boolean;\r\n}\r\n\r\n/**\r\n * esri mapserver layer\r\n * @augments LayerBase\r\n */\r\nexport class LayerEsriMapServer extends LayerBase {\r\n _esriFormat: ol.format.EsriJSON;\r\n _popupRequest: JQueryXHR;\r\n _showLayers: number[];\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {string} url - resource url\r\n * @param {object} [options] - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.addPopup=false] if a popup should be added\r\n * @param {undefined|Array<number>} [options.showLayers=undefined] if a popup should be added\r\n */\r\n constructor(url: string, options: LayerEsriMapServerOptions = {}) {\r\n\r\n super(url, options);\r\n this._source = new ol.source.TileArcGISRest(\r\n {\r\n url: this.url == '' ? undefined : this.url,\r\n params: typeof options.showLayers == 'undefined' ? undefined : {layers: 'show:' + options.showLayers.join(',')}\r\n }\r\n );\r\n\r\n this._showLayers = options.showLayers || [];\r\n\r\n this._olLayer = new ol.layer.Tile({\r\n source: this._source as ol.source.Tile,\r\n visible: this.visible,\r\n opacity: this.opacity,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution\r\n });\r\n\r\n\r\n this._olLayer.setZIndex(this._zIndex);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false;\r\n\r\n this._esriFormat = new ol.format.EsriJSON();\r\n this._popupRequest = null;\r\n\r\n options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true;\r\n\r\n if (options.getLegend){\r\n this.addLegendContent();\r\n }\r\n\r\n if (options.addPopup) {\r\n mapPopup.addMapServicePopup(this);\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content for legend\r\n */\r\n addLegendContent(additionalContent?: string) {\r\n let urlCopy = this.url;\r\n\r\n if (urlCopy[urlCopy.length - 1] !== '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'legend?f=pjson&callback=?';\r\n\r\n $.get(urlCopy, {}, (d) => {\r\n let newHtml = esriToOl.makeMapServiceLegend(d, this._showLayers);\r\n super.addLegendContent(newHtml);\r\n }, 'json');\r\n }\r\n\r\n\r\n getPopupInfo(queryParams: {[s: string]: any}) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n let urlCopy = this.url;\r\n\r\n if (urlCopy[urlCopy.length - 1] != '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'identify?callback=?';\r\n\r\n let __this = this;\r\n\r\n if (this._popupRequest != null) {\r\n this._popupRequest.abort();\r\n }\r\n\r\n\r\n this._popupRequest = $.get(urlCopy, queryParams, function (d) {\r\n for (let r of d['results']) {\r\n\r\n let popupHtml = '<table class=\"esri-popup-table\">';\r\n\r\n for (let a in r['attributes']) {\r\n if (r['attributes'].hasOwnProperty(a)) {\r\n let attrVal = r['attributes'][a];\r\n\r\n if (attrVal == null || attrVal.toString().toLowerCase() == 'null') {\r\n continue;\r\n }\r\n\r\n let attr = a;\r\n if (attr.length > 14) {\r\n attr = attr.slice(0, 11) + '...';\r\n }\r\n\r\n popupHtml += `<tr><td>${attr}</td><td>${attrVal}</td></tr>`;\r\n }\r\n }\r\n\r\n popupHtml += '</table>';\r\n\r\n mapPopup.addMapServicePopupContent(__this._esriFormat.readFeature(r), __this, popupHtml, r['layerName']);\r\n }\r\n }, 'json');\r\n\r\n this._popupRequest.always(function () {\r\n __this._popupRequest = null;\r\n });\r\n\r\n }\r\n\r\n /**\r\n *\r\n * @returns {ol.source.TileArcGISRest} the vector source\r\n */\r\n get source(): ol.source.TileArcGISRest {\r\n return super.getSource() as ol.source.TileArcGISRest;\r\n }\r\n\r\n /**\r\n *\r\n * @returns the ol layer\r\n */\r\n get olLayer(): ol.layer.Tile {\r\n return super.getOlLayer() as ol.layer.Tile;\r\n }\r\n}\r\nnm.LayerEsriMapServer = LayerEsriMapServer;\r\nexport default LayerEsriMapServer;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerEsriMapServer.js","sourceRoot":"","sources":["../../src/layers/LayerEsriMapServer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,yCAAwD;AACxD,qDAAuD;AACvD,kDAA6C;AAC7C,2CAAsC;AACtC,0BAA6B;AAC7B,+CAA0C;AAC1C,2DAA2D;AAC3D,sCAAsC;AAGtC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAG7B;;;;;GAKG;AACH,wBAA+B,MAAc,EAAE,OAAe;IAC1D,OAAO,yEAAuE,MAAM,SAAI,OAAO,eAAY,CAAA;AAC/G,CAAC;AAFD,wCAEC;AAED,uBAA8B,MAAc,EAAE,OAAe;IACzD,IAAI,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;IACrC,IAAI,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,CAAC,GAAG,KAAK,CAAC;yBACpC;wBAED,SAAS,IAAI,aAAW,IAAI,iBAAY,OAAO,eAAY,CAAC;qBAC/D;iBACJ;gBAED,SAAS,IAAI,UAAU,CAAC;gBAExB,kBAAQ,CAAC,yBAAyB,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;aAC5G;QACL,CAAC,EAAE,MAAM,CAAC,CAAC;QAEX,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YACtB,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;QAChC,CAAC,CAAC,CAAC;IAEP,CAAC;IAGD,sBAAI,sCAAM;aAAV;YACI,OAAO,iBAAM,SAAS,WAA0B,CAAC;QACrD,CAAC;;;OAAA;IAGD,sBAAI,uCAAO;aAAX;YACI,OAAO,iBAAM,UAAU,WAAe,CAAC;QAC3C,CAAC;;;OAAA;IACL,yBAAC;AAAD,CAAC,AAlJD,CAAwC,qBAAS,GAkJhD;AAlJY,gDAAkB;AAmJ/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/7/2015.\r\n */\r\nimport {LayerBase, LayerBaseOptions} from './LayerBase';\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport $ = require('jquery');\r\nimport EsriJSON from 'ol/format/EsriJSON';\r\nimport TileArcGISRestSource from 'ol/source/TileArcGISRest'\r\nimport TileLayer from 'ol/layer/Tile';\r\nimport TileSource from 'ol/source/Tile';\r\n\r\nconst nm = provide('layers');\r\n\r\n\r\n/**\r\n * Helper to return the url to the service on the production server\r\n * @param {string} folder\r\n * @param {string} service\r\n * @returns {string}\r\n */\r\nexport function makeServiceUrl(folder: string, service: string): string{\r\n return `https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/${folder}/${service}/MapServer`\r\n}\r\n\r\nexport function localCacheUrl(folder: string, service: string): string{\r\n let windowLocation = window.location;\r\n let loc = windowLocation.href;\r\n\r\n let url = `/mapserver/${folder}/${service}`;\r\n\r\n if (loc.indexOf('transportal.cee.wisc.edu') > -1){\r\n if (loc.toLowerCase().indexOf('webmapsstage') > -1){\r\n url = 'https://transportal.cee.wisc.edu/gis/webmapsstage' + url;\r\n } else {\r\n url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url\r\n }\r\n } else if (parseInt(windowLocation.port) !== 8081){\r\n url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url\r\n }\r\n\r\n\r\n return url;\r\n}\r\n\r\n\r\n\r\n\r\nexport interface LayerEsriMapServerOptions extends LayerBaseOptions {\r\n addPopup?: boolean;\r\n showLayers?: Array<number>;\r\n getLegend?: boolean;\r\n}\r\n\r\n/**\r\n * esri mapserver layer\r\n * @augments LayerBase\r\n */\r\nexport class LayerEsriMapServer extends LayerBase {\r\n _esriFormat: EsriJSON;\r\n _popupRequest: JQueryXHR;\r\n _showLayers: number[];\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {string} url - resource url\r\n * @param {object} [options] - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.addPopup=false] if a popup should be added\r\n * @param {undefined|Array<number>} [options.showLayers=undefined] if a popup should be added\r\n */\r\n constructor(url: string, options: LayerEsriMapServerOptions = {}) {\r\n\r\n super(url, options);\r\n this._source = new TileArcGISRestSource(\r\n {\r\n url: this.url == '' ? undefined : this.url,\r\n params: typeof options.showLayers == 'undefined' ? undefined : {layers: 'show:' + options.showLayers.join(',')}\r\n }\r\n );\r\n\r\n this._showLayers = options.showLayers || [];\r\n\r\n this._olLayer = new TileLayer({\r\n source: this._source as TileSource,\r\n visible: this.visible,\r\n opacity: this.opacity,\r\n minResolution: this._minResolution,\r\n maxResolution: this._maxResolution\r\n });\r\n\r\n\r\n this._olLayer.setZIndex(this._zIndex);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false;\r\n\r\n this._esriFormat = new EsriJSON();\r\n this._popupRequest = null;\r\n\r\n options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true;\r\n\r\n if (options.getLegend){\r\n this.addLegendContent();\r\n }\r\n\r\n if (options.addPopup) {\r\n mapPopup.addMapServicePopup(this);\r\n }\r\n }\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content for legend\r\n */\r\n addLegendContent(additionalContent?: string) {\r\n let urlCopy = this.url;\r\n\r\n if (urlCopy[urlCopy.length - 1] !== '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'legend?f=pjson&callback=?';\r\n\r\n $.get(urlCopy, {}, (d) => {\r\n let newHtml = esriToOl.makeMapServiceLegend(d, this._showLayers);\r\n super.addLegendContent(newHtml);\r\n }, 'json');\r\n }\r\n\r\n\r\n getPopupInfo(queryParams: {[s: string]: any}) {\r\n if (!this.visible) {\r\n return;\r\n }\r\n\r\n let urlCopy = this.url;\r\n\r\n if (urlCopy[urlCopy.length - 1] != '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'identify?callback=?';\r\n\r\n let __this = this;\r\n\r\n if (this._popupRequest != null) {\r\n this._popupRequest.abort();\r\n }\r\n\r\n\r\n this._popupRequest = $.get(urlCopy, queryParams, function (d) {\r\n for (let r of d['results']) {\r\n\r\n let popupHtml = '<table class=\"esri-popup-table\">';\r\n\r\n for (let a in r['attributes']) {\r\n if (r['attributes'].hasOwnProperty(a)) {\r\n let attrVal = r['attributes'][a];\r\n\r\n if (attrVal == null || attrVal.toString().toLowerCase() == 'null') {\r\n continue;\r\n }\r\n\r\n let attr = a;\r\n if (attr.length > 14) {\r\n attr = attr.slice(0, 11) + '...';\r\n }\r\n\r\n popupHtml += `<tr><td>${attr}</td><td>${attrVal}</td></tr>`;\r\n }\r\n }\r\n\r\n popupHtml += '</table>';\r\n\r\n mapPopup.addMapServicePopupContent(__this._esriFormat.readFeature(r), __this, popupHtml, r['layerName']);\r\n }\r\n }, 'json');\r\n\r\n this._popupRequest.always(function () {\r\n __this._popupRequest = null;\r\n });\r\n\r\n }\r\n\r\n\r\n get source(): TileArcGISRestSource {\r\n return super.getSource() as TileArcGISRestSource;\r\n }\r\n\r\n\r\n get olLayer(): TileLayer {\r\n return super.getOlLayer() as TileLayer;\r\n }\r\n}\r\nnm.LayerEsriMapServer = LayerEsriMapServer;\r\nexport default LayerEsriMapServer;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerEsriTile.js.map b/dist/layers/LayerEsriTile.js.map index 99a547c..a732ab3 100644 --- a/dist/layers/LayerEsriTile.js.map +++ b/dist/layers/LayerEsriTile.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerEsriTile.js","sourceRoot":"","sources":["../../src/layers/LayerEsriTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAsC;AACtC,uDAAoD;AAEpD,qDAAuD;AAGvD,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAM7B;;;GAGG;AACH;IAAmC,iCAAgB;IAG/C;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAAY,GAAW,EAAE,OAAkC;QAAlC,wBAA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AAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;gBAC/C,gBAAc,CAAC,IAAI,CAAC,KAAI,EAAE,OAAO,CAAC,CAAC;YACvC,CAAC,EAAE,MAAM,CAAC,CAAC;SACd;IACL,CAAC;IAGL,oBAAC;AAAD,CAAC,AAtED,CAAmC,mCAAgB,GAsElD;AAtEY,sCAAa;AAwE1B,EAAE,CAAC,gBAAgB,GAAG,aAAa,CAAC;AACpC,kBAAe,aAAa,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport {LayerBaseXyzTile} from './LayerBaseXyzTile';\r\nimport {LayerBaseOptions} from './LayerBase'\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\n\r\n\r\nconst nm = provide('layers');\r\n\r\nexport interface LayerEsriTileOptions extends LayerBaseOptions{\r\n useEsriStyle?: boolean\r\n}\r\n\r\n/**\r\n * Esri tile\r\n * @augments LayerBaseXyzTile\r\n */\r\nexport class LayerEsriTile extends LayerBaseXyzTile {\r\n _useEsriStyle: boolean;\r\n\r\n /**\r\n * The Esri tile layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n */\r\n constructor(url: string, options: LayerEsriTileOptions = {}) {\r\n if (url.search(/\\/$/) == -1) {\r\n url += '/';\r\n }\r\n url += 'tile/{z}/{y}/{x}';\r\n\r\n super(url, options);\r\n\r\n this._useEsriStyle = typeof options.useEsriStyle == 'boolean' ? options.useEsriStyle : false;\r\n\r\n if (this._useEsriStyle) {\r\n this.addLegendContent();\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content for legend\r\n */\r\n addLegendContent(additionalContent = ''): void {\r\n if (!this._useEsriStyle) {\r\n super.addLegendContent(additionalContent);\r\n } else {\r\n let urlCopy = this.url;\r\n\r\n let mapServerIndex = urlCopy.toLowerCase().indexOf('mapserver');\r\n if (mapServerIndex > -1) {\r\n urlCopy = urlCopy.slice(0, mapServerIndex + 9);\r\n } else {\r\n return;\r\n }\r\n\r\n if (urlCopy[urlCopy.length - 1] !== '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'legend?f=pjson&callback=?';\r\n\r\n let superAddLegend = super.addLegendContent;\r\n\r\n $.get(urlCopy, {}, (d) => {\r\n let newHtml = esriToOl.makeMapServiceLegend(d);\r\n superAddLegend.call(this, newHtml);\r\n }, 'json');\r\n }\r\n }\r\n\r\n\r\n}\r\n\r\nnm.LayerBaseXyzTile = LayerEsriTile;\r\nexport default LayerEsriTile;\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerEsriTile.js","sourceRoot":"","sources":["../../src/layers/LayerEsriTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAsC;AACtC,uDAAoD;AAEpD,qDAAuD;AAGvD,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAM7B;;;GAGG;AACH;IAAmC,iCAAgB;IAG/C;;;;;;;;;;;;;;;;;OAiBG;IACH,uBAAY,GAAW,EAAE,OAAkC;QAAlC,wBAAA,EAAA,YAAkC;QAA3D,iBAaC;QAZG,IAAI,GAAG,CAAC,MAAM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,IAAI,CAAC,KAAI,EAAE,OAAO,CAAC,CAAC;YACvC,CAAC,EAAE,MAAM,CAAC,CAAC;SACd;IACL,CAAC;IAGL,oBAAC;AAAD,CAAC,AAvED,CAAmC,mCAAgB,GAuElD;AAvEY,sCAAa;AAyE1B,EAAE,CAAC,gBAAgB,GAAG,aAAa,CAAC;AACpC,kBAAe,aAAa,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport {LayerBaseXyzTile} from './LayerBaseXyzTile';\r\nimport {LayerBaseOptions} from './LayerBase'\r\nimport * as esriToOl from '../olHelpers/esriToOlStyle';\r\n\r\n\r\nconst nm = provide('layers');\r\n\r\nexport interface LayerEsriTileOptions extends LayerBaseOptions{\r\n useEsriStyle?: boolean\r\n}\r\n\r\n/**\r\n * Esri tile\r\n * @augments LayerBaseXyzTile\r\n */\r\nexport class LayerEsriTile extends LayerBaseXyzTile {\r\n _useEsriStyle: boolean;\r\n\r\n /**\r\n * The Esri tile layer\r\n * @param {string} url - url for source\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n * @param {boolean} [options.useEsriStyle=false] if the map service style should be used\r\n */\r\n constructor(url: string, options: LayerEsriTileOptions = {}) {\r\n if (url.search(/\\/$/) == -1) {\r\n url += '/';\r\n }\r\n url += 'tile/{z}/{y}/{x}';\r\n\r\n super(url, options);\r\n\r\n this._useEsriStyle = typeof options.useEsriStyle == 'boolean' ? options.useEsriStyle : false;\r\n\r\n if (this._useEsriStyle) {\r\n this.addLegendContent();\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add additional content to the legend\r\n * @param {string} [additionalContent=''] additional content for legend\r\n */\r\n addLegendContent(additionalContent = ''): void {\r\n if (!this._useEsriStyle) {\r\n super.addLegendContent(additionalContent);\r\n } else {\r\n let urlCopy = this.url;\r\n\r\n let mapServerIndex = urlCopy.toLowerCase().indexOf('mapserver');\r\n if (mapServerIndex > -1) {\r\n urlCopy = urlCopy.slice(0, mapServerIndex + 9);\r\n } else {\r\n return;\r\n }\r\n\r\n\r\n if (urlCopy[urlCopy.length - 1] !== '/') {\r\n urlCopy += '/';\r\n }\r\n\r\n urlCopy += 'legend?f=pjson&callback=?';\r\n\r\n let superAddLegend = super.addLegendContent;\r\n\r\n $.get(urlCopy, {}, (d) => {\r\n let newHtml = esriToOl.makeMapServiceLegend(d);\r\n superAddLegend.call(this, newHtml);\r\n }, 'json');\r\n }\r\n }\r\n\r\n\r\n}\r\n\r\nnm.LayerBaseXyzTile = LayerEsriTile;\r\nexport default LayerEsriTile;\r\n\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerItsInventory.js b/dist/layers/LayerItsInventory.js index 75c8e79..696d97b 100644 --- a/dist/layers/LayerItsInventory.js +++ b/dist/layers/LayerItsInventory.js @@ -16,9 +16,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); var LayerBaseVectorGeoJson_1 = require("./LayerBaseVectorGeoJson"); var mapPopup_1 = require("../olHelpers/mapPopup"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var $ = require("jquery"); var projections_1 = require("../olHelpers/projections"); +var Style_1 = require("ol/style/Style"); +var Icon_1 = require("ol/style/Icon"); +var Stroke_1 = require("ol/style/Stroke"); +var Point_1 = require("ol/geom/Point"); var nm = provide_1.default('layers'); function checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { "use strict"; @@ -85,16 +88,16 @@ function defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig); var _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/'; if (itsIcon) { - return new ol.style.Style({ - image: new ol.style.Icon({ + return new Style_1.default({ + image: new Icon_1.default({ src: _iconUrlRoot + itsIcon, crossOrigin: 'anonymous' }) }); } else if (itsLineStyle) { - return new ol.style.Style({ - stroke: new ol.style.Stroke({ + return new Style_1.default({ + stroke: new Stroke_1.default({ color: itsLineStyle.color, width: itsLineStyle.width }) @@ -111,8 +114,8 @@ function defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { break; } } - return [new ol.style.Style({ - image: new ol.style.Icon({ + return [new Style_1.default({ + image: new Icon_1.default({ src: iconUrl, crossOrigin: 'anonymous' }) @@ -132,8 +135,8 @@ function defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { break; } } - return [new ol.style.Style({ - stroke: new ol.style.Stroke({ + return [new Style_1.default({ + stroke: new Stroke_1.default({ color: colr, width: width }) @@ -272,10 +275,10 @@ var LayerItsInventory = /** @class */ (function (_super) { */ LayerItsInventory.prototype.mapMoveMakeGetParams = function (extent, zoomLevel) { _super.prototype.mapMoveMakeGetParams.call(this, extent, zoomLevel); - var lowerLeft = new ol.geom.Point([extent.minX, extent.minY]); + var lowerLeft = new Point_1.default([extent.minX, extent.minY]); lowerLeft.transform(this.mapProj, this._projection4326); var lowerLeftCoordinates = lowerLeft.getCoordinates(); - var upperRight = new ol.geom.Point([extent.maxX, extent.maxY]); + var upperRight = new Point_1.default([extent.maxX, extent.maxY]); upperRight.transform(this.mapProj, this._projection4326); var upperRightCoordinates = upperRight.getCoordinates(); $.extend(this.mapMoveParams, { diff --git a/dist/layers/LayerItsInventory.js.map b/dist/layers/LayerItsInventory.js.map index 7ffa02f..c156103 100644 --- a/dist/layers/LayerItsInventory.js.map +++ b/dist/layers/LayerItsInventory.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerItsInventory.js","sourceRoot":"","sources":["../../src/layers/LayerItsInventory.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,mEAA+F;AAC/F,kDAA6C;AAC7C,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;AAC7B,wDAA2D;AAE3D,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAoC3B,0BAA0B,OAAe,EAAE,YAAwB,EAAE,aAA0B,EAAE,aAA0B;IACvH,YAAY,CAAC;IAEb,sDAAsD;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE;QAC5B,WAAW,EAAE,CAAC;KACjB;IAED,IAAI,OAAO,YAAY,IAAI,QAAQ,EAAE;QACjC,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACxF,WAAW,EAAE,CAAC;KACjB;IAED,IAAI,OAAO,aAAa,IAAI,QAAQ,EAAE;QAClC,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,IAAI,OAAO,CAAC;QAEjE,IAAI,OAAO,aAAa,CAAC,SAAS,IAAI,WAAW,EAAE;YAC/C,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;SAChC;QAED,WAAW,EAAE,CAAC;KACjB;IAED,IAAI,OAAO,aAAa,IAAI,QAAQ,EAAE;QAClC,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,IAAI,OAAO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B,MAAkE,EAAE,SAAiB;QACtG,iBAAM,oBAAoB,YAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC9C,IAAI,SAAS,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,IAAI,oBAAoB,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;QACtD,IAAI,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,qBAAqB,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;QAExD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EACvB;YACI,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;SAC9B,CAAC,CAAC;IACX,CAAC;IACL,wBAAC;AAAD,CAAC,AA9GD,CAAuC,+CAAsB,GA8G5D;AA9GY,8CAAiB;AAgH9B,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACzC,kBAAe,iBAAiB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\n\r\nimport {LayerBaseVectorGeoJson, LayerBaseVectorGeoJsonOptions} from './LayerBaseVectorGeoJson';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {proj4326, proj3857} from '../olHelpers/projections'\r\n\r\nlet nm = provide('layers');\r\n\r\n\r\nexport interface iLineStyle {\r\n color: string;\r\n width?: number\r\n}\r\n\r\nexport interface iMultiConfig {\r\n prop: string;\r\n defaultName: string;\r\n}\r\n\r\nexport interface iIconConfig extends iMultiConfig {\r\n defaultIcon: string;\r\n iconArray: string[][]\r\n}\r\n\r\nexport interface iLineConfig extends iMultiConfig {\r\n defaultColor: string;\r\n defaultWidth?: number;\r\n lineArray: any[][]\r\n}\r\n\r\nexport interface iLayerItsInventory extends LayerBaseVectorGeoJsonOptions {\r\n itsType: string;\r\n addPopup?: boolean;\r\n itsIcon?: string;\r\n itsLineStyle?: iLineStyle;\r\n itsIconConfig?: iIconConfig;\r\n itsLineConfig?: iLineConfig\r\n}\r\n\r\n\r\n\r\n\r\nfunction checkStyleNumber(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig) {\r\n \"use strict\";\r\n\r\n //make sure one and only one configuration is defined;\r\n let configCount = 0;\r\n if (typeof itsIcon == 'string') {\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineStyle == 'object') {\r\n itsLineStyle.width = typeof itsLineStyle.width == 'number' ? itsLineStyle.width : 5;\r\n itsLineStyle.color = typeof itsLineStyle.color == 'string' ? itsLineStyle.color : 'red';\r\n configCount++;\r\n }\r\n\r\n if (typeof itsIconConfig == 'object') {\r\n itsIconConfig.defaultName = itsIconConfig.defaultName || 'Other';\r\n\r\n if (typeof itsIconConfig.iconArray == 'undefined') {\r\n itsIconConfig.iconArray = [];\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineConfig == 'object') {\r\n itsLineConfig.defaultName = itsLineConfig.defaultName || 'Other';\r\n itsLineConfig.defaultWidth = itsLineConfig.defaultWidth || 5;\r\n itsLineConfig.defaultColor = itsLineConfig.defaultColor || 'red';\r\n\r\n\r\n if (typeof itsLineConfig.lineArray == 'undefined') {\r\n itsLineConfig.lineArray = [];\r\n }\r\n\r\n // set the width if not defined\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n if (itsLineConfig.lineArray[i].length == 3) {\r\n itsLineConfig.lineArray[i].push(5);\r\n }\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (configCount > 1) {\r\n throw 'Only one style config can be defined';\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {*} undefined, style, or style function\r\n */\r\nfunction defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig): ol.style.Style | Array<ol.style.Style> | ol.StyleFunction {\r\n \"use strict\";\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: _iconUrlRoot + itsIcon,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n });\r\n } else if (itsLineStyle) {\r\n return new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: itsLineStyle.color,\r\n width: itsLineStyle.width\r\n })\r\n });\r\n } else if (itsIconConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsIconConfig.prop];\r\n let iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon;\r\n\r\n for (let i = 0; i < itsIconConfig.iconArray.length; i++) {\r\n let thisProp = itsIconConfig.iconArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n iconUrl = _iconUrlRoot + thisProp[2];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: iconUrl,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n })];\r\n };\r\n } else if (itsLineConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsLineConfig.prop];\r\n let colr = itsLineConfig.defaultColor || 'red';\r\n let width = itsLineConfig.defaultWidth || 5;\r\n\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n let thisProp = itsLineConfig.lineArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n colr = thisProp[2];\r\n width = thisProp[3];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: colr,\r\n width: width\r\n })\r\n })];\r\n };\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction defineLegend(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig) {\r\n \"use strict\";\r\n\r\n let iconHeight = 17;\r\n\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return `<img src=\"${_iconUrlRoot + itsIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n } else if (itsLineStyle) {\r\n return `<hr style=\"height: ${itsLineStyle.width}px; background-color: ${itsLineStyle.color}\">`;\r\n } else if (itsIconConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n\r\n for (let a of itsIconConfig.iconArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${a[1]}</span><img src=\"${_iconUrlRoot + a[2]}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n }\r\n\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsIconConfig.defaultName}</span>` +\r\n `<img src=\"${_iconUrlRoot + itsIconConfig.defaultIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\"></li>`;\r\n\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else if (itsLineConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n for (let ls of itsLineConfig.lineArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${ls[1]}</span>` +\r\n `<hr style=\"height: ${ls[3]}px; background-color: ${ls[2]}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsLineConfig.defaultName}</span>` +\r\n `<hr style=\"height: ${itsLineConfig.defaultWidth}px; background-color: ${itsLineConfig.defaultColor}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else {\r\n return '';\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Its Layer class\r\n * @augments LayerBaseVectorGeoJson\r\n */\r\nexport class LayerItsInventory extends LayerBaseVectorGeoJson {\r\n\r\n /**\r\n * ITS device layer, types available at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} options.itsType the ITS device type, use the url flag at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {boolean} [options.addPopup=true] if the popup should be added automatically\r\n *\r\n * @param {string} [options.itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [options.itsLineStyle=undefined] A single line style\r\n * @param {string} options.itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [options.itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches\r\n * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5]\r\n */\r\n constructor(options: iLayerItsInventory) {\r\n if (typeof options.itsType !== 'string') {\r\n throw 'its type must be defined';\r\n }\r\n\r\n options.transform = {dataProjection: proj4326, featureProjection: proj3857};\r\n\r\n let addToLegend = '';\r\n\r\n // define a style with the helper function if it is not explicitly defined\r\n if (typeof options.style == 'undefined') {\r\n options.style = defineStyle(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n addToLegend = defineLegend(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n }\r\n\r\n options.params = typeof options.params == 'object' ? options.params : {};\r\n $.extend(options.params, {format: 'JSON', resource: options.itsType});\r\n\r\n super('https://transportal.cee.wisc.edu/its/inventory/', options);\r\n\r\n //add any additional content to the legend\r\n this.addLegendContent(addToLegend);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : true;\r\n\r\n if (options.addPopup) {\r\n mapPopup.addVectorPopup(this, function (props: { featureGuid: string }) {\r\n return `<iframe src=\"https://transportal.cee.wisc.edu/its/inventory/?feature=${props.featureGuid}\" ` +\r\n `height=\"250\" width=\"350\"></iframe>`;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @callback makeGetParams\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: { minX: number, minY: number, maxX: number, maxY: number }, zoomLevel: number) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n let lowerLeft = new ol.geom.Point([extent.minX, extent.minY]);\r\n lowerLeft.transform(this.mapProj, this._projection4326);\r\n let lowerLeftCoordinates = lowerLeft.getCoordinates();\r\n let upperRight = new ol.geom.Point([extent.maxX, extent.maxY]);\r\n upperRight.transform(this.mapProj, this._projection4326);\r\n let upperRightCoordinates = upperRight.getCoordinates();\r\n\r\n $.extend(this.mapMoveParams,\r\n {\r\n L: lowerLeftCoordinates[0],\r\n R: upperRightCoordinates[0],\r\n B: lowerLeftCoordinates[1],\r\n T: upperRightCoordinates[1]\r\n });\r\n }\r\n}\r\n\r\nnm.LayerItsInventory = LayerItsInventory;\r\nexport default LayerItsInventory;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerItsInventory.js","sourceRoot":"","sources":["../../src/layers/LayerItsInventory.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,mEAA+F;AAC/F,kDAA6C;AAC7C,2CAAsC;AACtC,0BAA6B;AAC7B,wDAA4D;AAC5D,wCAAmC;AACnC,sCAAiC;AACjC,0CAAqC;AAGrC,uCAAkC;AAIlC,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAoC3B,0BAA0B,OAAe,EAAE,YAAwB,EAAE,aAA0B,EAAE,aAA0B;IACvH,YAAY,CAAC;IAEb,sDAAsD;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAE;QAC5B,WAAW,EAAE,CAAC;KACjB;IAED,IAAI,OAAO,YAAY,IAAI,QAAQ,EAAE;QACjC,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC,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/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\n\r\nimport {LayerBaseVectorGeoJson, LayerBaseVectorGeoJsonOptions} from './LayerBaseVectorGeoJson';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport $ = require('jquery');\r\nimport {proj4326, proj3857} from '../olHelpers/projections';\r\nimport Style from 'ol/style/Style';\r\nimport Icon from 'ol/style/Icon';\r\nimport Stroke from 'ol/style/Stroke';\r\nimport Fill from 'ol/style/Fill';\r\nimport Feature from 'ol/Feature';\r\nimport Point from 'ol/geom/Point';\r\nimport {iStyleFunc} from \"../olHelpers/esriToOlStyle\";\r\n\r\n\r\nlet nm = provide('layers');\r\n\r\n\r\nexport interface iLineStyle {\r\n color: string;\r\n width?: number\r\n}\r\n\r\nexport interface iMultiConfig {\r\n prop: string;\r\n defaultName: string;\r\n}\r\n\r\nexport interface iIconConfig extends iMultiConfig {\r\n defaultIcon: string;\r\n iconArray: string[][]\r\n}\r\n\r\nexport interface iLineConfig extends iMultiConfig {\r\n defaultColor: string;\r\n defaultWidth?: number;\r\n lineArray: any[][]\r\n}\r\n\r\nexport interface iLayerItsInventory extends LayerBaseVectorGeoJsonOptions {\r\n itsType: string;\r\n addPopup?: boolean;\r\n itsIcon?: string;\r\n itsLineStyle?: iLineStyle;\r\n itsIconConfig?: iIconConfig;\r\n itsLineConfig?: iLineConfig\r\n}\r\n\r\n\r\n\r\n\r\nfunction checkStyleNumber(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig) {\r\n \"use strict\";\r\n\r\n //make sure one and only one configuration is defined;\r\n let configCount = 0;\r\n if (typeof itsIcon == 'string') {\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineStyle == 'object') {\r\n itsLineStyle.width = typeof itsLineStyle.width == 'number' ? itsLineStyle.width : 5;\r\n itsLineStyle.color = typeof itsLineStyle.color == 'string' ? itsLineStyle.color : 'red';\r\n configCount++;\r\n }\r\n\r\n if (typeof itsIconConfig == 'object') {\r\n itsIconConfig.defaultName = itsIconConfig.defaultName || 'Other';\r\n\r\n if (typeof itsIconConfig.iconArray == 'undefined') {\r\n itsIconConfig.iconArray = [];\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineConfig == 'object') {\r\n itsLineConfig.defaultName = itsLineConfig.defaultName || 'Other';\r\n itsLineConfig.defaultWidth = itsLineConfig.defaultWidth || 5;\r\n itsLineConfig.defaultColor = itsLineConfig.defaultColor || 'red';\r\n\r\n\r\n if (typeof itsLineConfig.lineArray == 'undefined') {\r\n itsLineConfig.lineArray = [];\r\n }\r\n\r\n // set the width if not defined\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n if (itsLineConfig.lineArray[i].length == 3) {\r\n itsLineConfig.lineArray[i].push(5);\r\n }\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (configCount > 1) {\r\n throw 'Only one style config can be defined';\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {*} undefined, style, or style function\r\n */\r\nfunction defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig): Style |Style[]|iStyleFunc {\r\n \"use strict\";\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return new Style({\r\n image: new Icon(\r\n {\r\n src: _iconUrlRoot + itsIcon,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n });\r\n } else if (itsLineStyle) {\r\n return new Style({\r\n stroke: new Stroke({\r\n color: itsLineStyle.color,\r\n width: itsLineStyle.width\r\n })\r\n });\r\n } else if (itsIconConfig) {\r\n return function (feature: Feature) {\r\n let symbolProp = feature.getProperties()[itsIconConfig.prop];\r\n let iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon;\r\n\r\n for (let i = 0; i < itsIconConfig.iconArray.length; i++) {\r\n let thisProp = itsIconConfig.iconArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n iconUrl = _iconUrlRoot + thisProp[2];\r\n break;\r\n }\r\n }\r\n\r\n return [new Style({\r\n image: new Icon(\r\n {\r\n src: iconUrl,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n })];\r\n };\r\n } else if (itsLineConfig) {\r\n return function (feature: Feature) {\r\n let symbolProp = feature.getProperties()[itsLineConfig.prop];\r\n let colr = itsLineConfig.defaultColor || 'red';\r\n let width = itsLineConfig.defaultWidth || 5;\r\n\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n let thisProp = itsLineConfig.lineArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n colr = thisProp[2];\r\n width = thisProp[3];\r\n break;\r\n }\r\n }\r\n\r\n return [new Style({\r\n stroke: new Stroke({\r\n color: colr,\r\n width: width\r\n })\r\n })];\r\n };\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction defineLegend(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig) {\r\n \"use strict\";\r\n\r\n let iconHeight = 17;\r\n\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return `<img src=\"${_iconUrlRoot + itsIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n } else if (itsLineStyle) {\r\n return `<hr style=\"height: ${itsLineStyle.width}px; background-color: ${itsLineStyle.color}\">`;\r\n } else if (itsIconConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n\r\n for (let a of itsIconConfig.iconArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${a[1]}</span><img src=\"${_iconUrlRoot + a[2]}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n }\r\n\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsIconConfig.defaultName}</span>` +\r\n `<img src=\"${_iconUrlRoot + itsIconConfig.defaultIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\"></li>`;\r\n\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else if (itsLineConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n for (let ls of itsLineConfig.lineArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${ls[1]}</span>` +\r\n `<hr style=\"height: ${ls[3]}px; background-color: ${ls[2]}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsLineConfig.defaultName}</span>` +\r\n `<hr style=\"height: ${itsLineConfig.defaultWidth}px; background-color: ${itsLineConfig.defaultColor}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else {\r\n return '';\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Its Layer class\r\n * @augments LayerBaseVectorGeoJson\r\n */\r\nexport class LayerItsInventory extends LayerBaseVectorGeoJson {\r\n\r\n /**\r\n * ITS device layer, types available at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} options.itsType the ITS device type, use the url flag at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {boolean} [options.addPopup=true] if the popup should be added automatically\r\n *\r\n * @param {string} [options.itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [options.itsLineStyle=undefined] A single line style\r\n * @param {string} options.itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [options.itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches\r\n * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5]\r\n */\r\n constructor(options: iLayerItsInventory) {\r\n if (typeof options.itsType !== 'string') {\r\n throw 'its type must be defined';\r\n }\r\n\r\n options.transform = {dataProjection: proj4326, featureProjection: proj3857};\r\n\r\n let addToLegend = '';\r\n\r\n // define a style with the helper function if it is not explicitly defined\r\n if (typeof options.style == 'undefined') {\r\n options.style = defineStyle(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n addToLegend = defineLegend(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n }\r\n\r\n options.params = typeof options.params == 'object' ? options.params : {};\r\n $.extend(options.params, {format: 'JSON', resource: options.itsType});\r\n\r\n super('https://transportal.cee.wisc.edu/its/inventory/', options);\r\n\r\n //add any additional content to the legend\r\n this.addLegendContent(addToLegend);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : true;\r\n\r\n if (options.addPopup) {\r\n mapPopup.addVectorPopup(this, function (props: { featureGuid: string }) {\r\n return `<iframe src=\"https://transportal.cee.wisc.edu/its/inventory/?feature=${props.featureGuid}\" ` +\r\n `height=\"250\" width=\"350\"></iframe>`;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @callback makeGetParams\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent: { minX: number, minY: number, maxX: number, maxY: number }, zoomLevel: number) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n let lowerLeft = new Point([extent.minX, extent.minY]);\r\n lowerLeft.transform(this.mapProj, this._projection4326);\r\n let lowerLeftCoordinates = lowerLeft.getCoordinates();\r\n let upperRight = new Point([extent.maxX, extent.maxY]);\r\n upperRight.transform(this.mapProj, this._projection4326);\r\n let upperRightCoordinates = upperRight.getCoordinates();\r\n\r\n $.extend(this.mapMoveParams,\r\n {\r\n L: lowerLeftCoordinates[0],\r\n R: upperRightCoordinates[0],\r\n B: lowerLeftCoordinates[1],\r\n T: upperRightCoordinates[1]\r\n });\r\n }\r\n}\r\n\r\nnm.LayerItsInventory = LayerItsInventory;\r\nexport default LayerItsInventory;\r\n"]} \ No newline at end of file diff --git a/dist/layers/LayerRealEarthTile.js.map b/dist/layers/LayerRealEarthTile.js.map index 85c741e..9594f4d 100644 --- a/dist/layers/LayerRealEarthTile.js.map +++ b/dist/layers/LayerRealEarthTile.js.map @@ -1 +1 @@ -{"version":3,"file":"LayerRealEarthTile.js","sourceRoot":"","sources":["../../src/layers/LayerRealEarthTile.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,uDAAoD;AAEpD,sEAAiE;AACjE,2CAAsC;AAEtC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAS7B;;;GAGG;AACH;IAAwC,sCAAgB;IAIpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,4BAAY,OAAkC;QAA9C,iBAWC;QAVG,OAAO,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAChF,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,QAAA,kBAAM,EAAE,EAAE,OAAO,CAAC,SAAC;YACnB,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,KAAI,CAAC,QAAQ,GAAG,IAAI,8BAAoB,CAAC,KAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;YACzE,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;SAC5B;aAAM;YACH,QAAA,kBAAM,uDAAqD,OAAO,CAAC,QAAQ,uBAAoB,EAAE,OAAO,CAAC,SAAC;YAC1G,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;SACrC;;IACL,CAAC;IAED,yCAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9C;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAED,kCAAK,GAAL;QACI,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,iBAAM,KAAK,WAAE,CAAC;IACzB,CAAC;IACL,yBAAC;AAAD,CAAC,AAnDD,CAAwC,mCAAgB,GAmDvD;AAnDY,gDAAkB;AAqD/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/4/2015.\r\n */\r\n\r\nimport {LayerBaseXyzTile} from './LayerBaseXyzTile';\r\nimport {LayerBaseOptions} from './LayerBase';\r\nimport RealEarthAnimateTile from '../mixin/RealEarthAnimateTile';\r\nimport provide from '../util/provide';\r\nimport {IRealEarthAnimate, timesLoadedCallback} from \"../mixin/RealEarthAnimate\";\r\nconst nm = provide('layers');\r\n\r\nexport interface LayerRealEarthTileOptions extends LayerBaseOptions {\r\n products: string;\r\n animate?: boolean;\r\n timeLoadCallback?: timesLoadedCallback;\r\n}\r\n\r\n\r\n/**\r\n * Real earth tile\r\n * @augments LayerBaseXyzTile\r\n */\r\nexport class LayerRealEarthTile extends LayerBaseXyzTile implements IRealEarthAnimate {\r\n _products: string;\r\n animator: RealEarthAnimateTile;\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {string} options.products - the products to request\r\n * @param {boolean} [options.hasTimes=false] If the layer is time dependent, fixed set of dates\r\n * @param {boolean} [options.animate=false] if the layer should be animated\r\n */\r\n constructor(options: LayerRealEarthTileOptions) {\r\n options.animate = typeof options.animate == 'boolean' ? options.animate : false;\r\n if (options.animate) {\r\n super('', options);\r\n this._products = options.products;\r\n this.animator = new RealEarthAnimateTile(this, options.timeLoadCallback);\r\n this.animator.timeInit();\r\n } else {\r\n super(`http://realearth.ssec.wisc.edu/api/image?products=${options.products}&x={x}&y={y}&z={z}`, options);\r\n this._products = options.products;\r\n }\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (this.animator) {\r\n return this.animator.setLayerTime(theTime);\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n _load(): boolean {\r\n if (this.animator) {\r\n return false;\r\n }\r\n return super._load();\r\n }\r\n}\r\n\r\nnm.LayerRealEarthTile = LayerRealEarthTile;\r\nexport default LayerRealEarthTile;\r\n"]} \ No newline at end of file +{"version":3,"file":"LayerRealEarthTile.js","sourceRoot":"","sources":["../../src/layers/LayerRealEarthTile.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,uDAAoD;AAEpD,sEAAiE;AACjE,2CAAsC;AAEtC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAU7B;;;GAGG;AACH;IAAwC,sCAAgB;IAIpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,4BAAY,OAAkC;QAA9C,iBAWC;QAVG,OAAO,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAChF,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,QAAA,kBAAM,EAAE,EAAE,OAAO,CAAC,SAAC;YACnB,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,KAAI,CAAC,QAAQ,GAAG,IAAI,8BAAoB,CAAC,KAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;YACzE,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;SAC5B;aAAM;YACH,QAAA,kBAAM,uDAAqD,OAAO,CAAC,QAAQ,uBAAoB,EAAE,OAAO,CAAC,SAAC;YAC1G,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;SACrC;;IACL,CAAC;IAED,yCAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9C;aAAM;YACH,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAED,kCAAK,GAAL;QACI,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,iBAAM,KAAK,WAAE,CAAC;IACzB,CAAC;IACL,yBAAC;AAAD,CAAC,AAnDD,CAAwC,mCAAgB,GAmDvD;AAnDY,gDAAkB;AAqD/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/4/2015.\r\n */\r\n\r\nimport {LayerBaseXyzTile} from './LayerBaseXyzTile';\r\nimport {LayerBaseOptions} from './LayerBase';\r\nimport RealEarthAnimateTile from '../mixin/RealEarthAnimateTile';\r\nimport provide from '../util/provide';\r\nimport {IRealEarthAnimate, timesLoadedCallback} from \"../mixin/RealEarthAnimate\";\r\nconst nm = provide('layers');\r\n\r\nexport interface LayerRealEarthTileOptions extends LayerBaseOptions {\r\n products: string;\r\n animate?: boolean;\r\n timeLoadCallback?: timesLoadedCallback;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Real earth tile\r\n * @augments LayerBaseXyzTile\r\n */\r\nexport class LayerRealEarthTile extends LayerBaseXyzTile implements IRealEarthAnimate {\r\n _products: string;\r\n animator: RealEarthAnimateTile;\r\n\r\n /**\r\n * The base layer for all others\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {string} options.products - the products to request\r\n * @param {boolean} [options.hasTimes=false] If the layer is time dependent, fixed set of dates\r\n * @param {boolean} [options.animate=false] if the layer should be animated\r\n */\r\n constructor(options: LayerRealEarthTileOptions) {\r\n options.animate = typeof options.animate == 'boolean' ? options.animate : false;\r\n if (options.animate) {\r\n super('', options);\r\n this._products = options.products;\r\n this.animator = new RealEarthAnimateTile(this, options.timeLoadCallback);\r\n this.animator.timeInit();\r\n } else {\r\n super(`http://realearth.ssec.wisc.edu/api/image?products=${options.products}&x={x}&y={y}&z={z}`, options);\r\n this._products = options.products;\r\n }\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (this.animator) {\r\n return this.animator.setLayerTime(theTime);\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n _load(): boolean {\r\n if (this.animator) {\r\n return false;\r\n }\r\n return super._load();\r\n }\r\n}\r\n\r\nnm.LayerRealEarthTile = LayerRealEarthTile;\r\nexport default LayerRealEarthTile;\r\n"]} \ No newline at end of file diff --git a/dist/mixin/RealEarthAnimateTile.d.ts b/dist/mixin/RealEarthAnimateTile.d.ts index 721fff8..b73f729 100644 --- a/dist/mixin/RealEarthAnimateTile.d.ts +++ b/dist/mixin/RealEarthAnimateTile.d.ts @@ -2,16 +2,17 @@ * Created by gavorhes on 12/4/2015. */ import RealEarthAnimate from './RealEarthAnimate'; -import ol = require('custom-ol'); import LayerRealEarthTile from "../layers/LayerRealEarthTile"; +import XYZ from 'ol/source/XYZ'; +import Tile from 'ol/layer/Tile'; /** * Animate real earth tile * @augments RealEarthAnimate */ declare class RealEarthAnimateTile extends RealEarthAnimate { _sourceUrls: string[]; - _source: ol.source.XYZ; - _olLayer: ol.layer.Tile; + _source: XYZ; + _olLayer: Tile; constructor(layer: LayerRealEarthTile, loadCallback?: (lyr: LayerRealEarthTile) => void); timeInit(): void; _loadDates(inString: string): string; diff --git a/dist/mixin/RealEarthAnimateTile.js.map b/dist/mixin/RealEarthAnimateTile.js.map index 5c24d32..ad87fd0 100644 --- a/dist/mixin/RealEarthAnimateTile.js.map +++ b/dist/mixin/RealEarthAnimateTile.js.map @@ -1 +1 @@ -{"version":3,"file":"RealEarthAnimateTile.js","sourceRoot":"","sources":["../../src/mixin/RealEarthAnimateTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,uDAAkD;AAClD,2CAAsC;AAGtC,IAAM,EAAE,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAC;AAE5B;;;GAGG;AACH;IAAmC,wCAAgB;IAK/C,8BAAY,KAAyB,EAAE,YAAgD;QAAvF,YACI,kBAAM,KAAK,EAAE,YAAY,CAAC,SAG7B;QAFG,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;;IAClC,CAAC;IAID,uCAAQ,GAAR;QACI,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,yCAAU,GAAV,UAAW,QAAgB;QACvB,IAAI,MAAM,GAAG,iBAAM,UAAU,YAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,aAAa,GACb,uDAAqD,IAAI,CAAC,SAAS,SAAI,MAAM,uBAAoB,CAAC;QACtG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;OAEG;IACH,0CAAW,GAAX;QACI,IAAI,iBAAM,WAAW,WAAE,EAAC;YACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SACtE;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2CAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,iBAAM,YAAY,YAAC,OAAO,CAAC,EAAE;YAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,EAAC;gBAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAC9B;YACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;SAC7D;aAAM;YACH,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,2BAAC;AAAD,CAAC,AA/CD,CAAmC,0BAAgB,GA+ClD;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAC/C,kBAAe,oBAAoB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport RealEarthAnimate from './RealEarthAnimate';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport LayerRealEarthTile from \"../layers/LayerRealEarthTile\";\r\nconst nm = provide('mixin');\r\n\r\n/**\r\n * Animate real earth tile\r\n * @augments RealEarthAnimate\r\n */\r\nclass RealEarthAnimateTile extends RealEarthAnimate {\r\n _sourceUrls: string[];\r\n _source: ol.source.XYZ;\r\n _olLayer: ol.layer.Tile;\r\n\r\n constructor(layer: LayerRealEarthTile, loadCallback?: (lyr: LayerRealEarthTile) => void){\r\n super(layer, loadCallback);\r\n this._source = layer.source;\r\n this._olLayer = layer.olLayer;\r\n }\r\n\r\n\r\n\r\n timeInit() {\r\n super.timeInit();\r\n this._sourceUrls = [];\r\n }\r\n\r\n _loadDates(inString: string): string {\r\n let rawDte = super._loadDates(inString);\r\n let dteProductUrl =\r\n `http://realearth.ssec.wisc.edu/api/image?products=${this._products}_${rawDte}&x={x}&y={y}&z={z}`;\r\n this._sourceUrls.push(dteProductUrl);\r\n return '';\r\n }\r\n\r\n /**\r\n * @protected\r\n */\r\n _loadLatest(): boolean {\r\n if (super._loadLatest()){\r\n this._source.setUrl(this._sourceUrls[this._sourceUrls.length - 1]);\r\n }\r\n return true;\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (super.setLayerTime(theTime)) {\r\n if (this._olLayer.getZIndex() < 0){\r\n this._olLayer.setZIndex(0);\r\n }\r\n this._source.setUrl(this._sourceUrls[this._currentIndex]);\r\n } else {\r\n this._olLayer.setZIndex(-1);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nnm.RealEarthAnimateTile = RealEarthAnimateTile;\r\nexport default RealEarthAnimateTile;\r\n"]} \ No newline at end of file +{"version":3,"file":"RealEarthAnimateTile.js","sourceRoot":"","sources":["../../src/mixin/RealEarthAnimateTile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,uDAAkD;AAClD,2CAAsC;AAEtC,IAAM,EAAE,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAC;AAI5B;;;GAGG;AACH;IAAmC,wCAAgB;IAK/C,8BAAY,KAAyB,EAAE,YAAgD;QAAvF,YACI,kBAAM,KAAK,EAAE,YAAY,CAAC,SAG7B;QAFG,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;;IAClC,CAAC;IAID,uCAAQ,GAAR;QACI,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,yCAAU,GAAV,UAAW,QAAgB;QACvB,IAAI,MAAM,GAAG,iBAAM,UAAU,YAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,aAAa,GACb,uDAAqD,IAAI,CAAC,SAAS,SAAI,MAAM,uBAAoB,CAAC;QACtG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;OAEG;IACH,0CAAW,GAAX;QACI,IAAI,iBAAM,WAAW,WAAE,EAAC;YACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SACtE;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2CAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,iBAAM,YAAY,YAAC,OAAO,CAAC,EAAE;YAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,EAAC;gBAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAC9B;YACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;SAC7D;aAAM;YACH,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,2BAAC;AAAD,CAAC,AA/CD,CAAmC,0BAAgB,GA+ClD;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAC/C,kBAAe,oBAAoB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport RealEarthAnimate from './RealEarthAnimate';\r\nimport provide from '../util/provide';\r\nimport LayerRealEarthTile from \"../layers/LayerRealEarthTile\";\r\nconst nm = provide('mixin');\r\nimport XYZ from 'ol/source/XYZ';\r\nimport Tile from 'ol/layer/Tile';\r\n\r\n/**\r\n * Animate real earth tile\r\n * @augments RealEarthAnimate\r\n */\r\nclass RealEarthAnimateTile extends RealEarthAnimate {\r\n _sourceUrls: string[];\r\n _source: XYZ;\r\n _olLayer: Tile;\r\n\r\n constructor(layer: LayerRealEarthTile, loadCallback?: (lyr: LayerRealEarthTile) => void){\r\n super(layer, loadCallback);\r\n this._source = layer.source;\r\n this._olLayer = layer.olLayer;\r\n }\r\n\r\n\r\n\r\n timeInit() {\r\n super.timeInit();\r\n this._sourceUrls = [];\r\n }\r\n\r\n _loadDates(inString: string): string {\r\n let rawDte = super._loadDates(inString);\r\n let dteProductUrl =\r\n `http://realearth.ssec.wisc.edu/api/image?products=${this._products}_${rawDte}&x={x}&y={y}&z={z}`;\r\n this._sourceUrls.push(dteProductUrl);\r\n return '';\r\n }\r\n\r\n /**\r\n * @protected\r\n */\r\n _loadLatest(): boolean {\r\n if (super._loadLatest()){\r\n this._source.setUrl(this._sourceUrls[this._sourceUrls.length - 1]);\r\n }\r\n return true;\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (super.setLayerTime(theTime)) {\r\n if (this._olLayer.getZIndex() < 0){\r\n this._olLayer.setZIndex(0);\r\n }\r\n this._source.setUrl(this._sourceUrls[this._currentIndex]);\r\n } else {\r\n this._olLayer.setZIndex(-1);\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nnm.RealEarthAnimateTile = RealEarthAnimateTile;\r\nexport default RealEarthAnimateTile;\r\n"]} \ No newline at end of file diff --git a/dist/mixin/RealEarthAnimateVector.d.ts b/dist/mixin/RealEarthAnimateVector.d.ts index de1e9ab..bcc1641 100644 --- a/dist/mixin/RealEarthAnimateVector.d.ts +++ b/dist/mixin/RealEarthAnimateVector.d.ts @@ -2,20 +2,21 @@ * Created by gavorhes on 12/4/2015. */ import RealEarthAnimate from './RealEarthAnimate'; -import ol = require('custom-ol'); import { LayerVectorRealEarth } from "../layers/LayerRealEarthVector"; +import VectorSource from 'ol/source/Vector'; +import VectorLayer from 'ol/layer/Vector'; /** * class mixin to animate RealEarth vector layers * @augments RealEarthAnimate */ declare class RealEarthAnimateVector extends RealEarthAnimate { _dataCache: Array<Array<Object> | Object>; - _source: ol.source.Vector; + _source: VectorSource; _rawTimesLookup: { [s: string]: any; }; _currentIndex: number; - _olLayer: ol.layer.Vector; + _olLayer: VectorLayer; _lyr: LayerVectorRealEarth; constructor(layer: LayerVectorRealEarth, loadCallback?: (lyr: LayerVectorRealEarth) => void); /** diff --git a/dist/mixin/RealEarthAnimateVector.js.map b/dist/mixin/RealEarthAnimateVector.js.map index c90fbd9..d7feeb5 100644 --- a/dist/mixin/RealEarthAnimateVector.js.map +++ b/dist/mixin/RealEarthAnimateVector.js.map @@ -1 +1 @@ -{"version":3,"file":"RealEarthAnimateVector.js","sourceRoot":"","sources":["../../src/mixin/RealEarthAnimateVector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,uDAAkD;AAClD,2CAAsC;AAGtC,0BAA6B;AAC7B,IAAM,EAAE,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAC;AAG5B;;;GAGG;AACH;IAAqC,0CAAgB;IAQjD,gCAAY,KAA2B,EAAE,YAAkD;QAA3F,YACI,kBAAM,KAAK,EAAE,YAAY,CAAC,SAI7B;QAHG,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,KAAI,CAAC,IAAI,GAAG,KAAK,CAAC;;IACtB,CAAC;IAGD;;OAEG;IACH,yCAAQ,GAAR;QACI,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,2CAAU,GAAV,UAAW,QAAgB;QACvB,IAAI,MAAM,GAAG,iBAAM,UAAU,YAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;OAEG;IACH,4CAAW,G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b,UAAc,OAAe;QACzB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,EAClE,EAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAC,CAAC,CAAC,CAAC;IAC3H,CAAC;IAED,6CAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,iBAAM,YAAY,YAAC,OAAO,CAAC,EAAE;YAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC7C;aAAM;YACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SACxB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,6BAAC;AAAD,CAAC,AAlGD,CAAqC,0BAAgB,GAkGpD;AAED,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACnD,kBAAe,sBAAsB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport RealEarthAnimate from './RealEarthAnimate';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport {LayerVectorRealEarth} from \"../layers/LayerRealEarthVector\";\r\nimport $ = require('jquery');\r\nconst nm = provide('mixin');\r\n\r\n\r\n/**\r\n * class mixin to animate RealEarth vector layers\r\n * @augments RealEarthAnimate\r\n */\r\nclass RealEarthAnimateVector extends RealEarthAnimate {\r\n _dataCache: Array<Array<Object>|Object>;\r\n _source: ol.source.Vector;\r\n _rawTimesLookup: {[s: string]: any};\r\n _currentIndex: number;\r\n _olLayer: ol.layer.Vector;\r\n _lyr: LayerVectorRealEarth;\r\n\r\n constructor(layer: LayerVectorRealEarth, loadCallback?: (lyr: LayerVectorRealEarth) => void){\r\n super(layer, loadCallback);\r\n this._source = layer.source;\r\n this._olLayer = layer.olLayer;\r\n this._lyr = layer;\r\n }\r\n\r\n\r\n /**\r\n * Call this after the mixin has been applied\r\n */\r\n timeInit() {\r\n super.timeInit();\r\n this._rawTimesLookup = {};\r\n this._dataCache = [];\r\n }\r\n\r\n /**\r\n * Given the raw time string, add to the arrays to keep track of dates and cache\r\n * @param {string} inString - input date string\r\n * @protected\r\n */\r\n _loadDates(inString: string): string {\r\n let rawDte = super._loadDates(inString);\r\n this._dataCache.push(null);\r\n this._rawTimesLookup[rawDte] = null;\r\n return '';\r\n }\r\n\r\n /**\r\n * @protected\r\n */\r\n _loadLatest(): boolean {\r\n if (super._loadLatest()) {\r\n this._loadAtTimeIndex.call(this, this._currentIndex);\r\n }\r\n return true;\r\n }\r\n\r\n //\r\n //http://realearth.ssec.wisc.edu/api/image?products=nexrhres_20160108_212500&x=1&y=5&z=4\r\n //\r\n // 20160108.205500\r\n // http://realearth.ssec.wisc.edu/api/image?products=nexrhres_20160108_205500&x=34&y=46&z=7\r\n\r\n /**\r\n * Load the features at the date index specified\r\n * @param {number} i the index of the features to be loaded by date\r\n * @param {boolean} [setAsSource=true] set to false to trigger cache load only\r\n * @private\r\n */\r\n _loadAtTimeIndex(i: number, setAsSource = true) {\r\n setAsSource = typeof setAsSource == 'boolean' ? setAsSource : true;\r\n if (this._dataCache[i] != null) {\r\n this._source.clear();\r\n this._loadFeatures(this._dataCache[i]);\r\n } else {\r\n let __this = this;\r\n $.get('http://realearth.ssec.wisc.edu:80/api/shapes',\r\n {products: `${this._products}_${this._rawDateStrings[i]}`},\r\n function (d) {\r\n __this._dataCache[i] = d;\r\n __this._rawTimesLookup[__this._rawDateStrings[i]] = d;\r\n if (setAsSource) {\r\n __this._source.clear();\r\n __this._loadFeatures.call(__this, __this._dataCache[i]);\r\n }\r\n }, 'json'\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * helper to load the features at the index specified\r\n * @param {object} geojObj - the geojson object\r\n * @private\r\n */\r\n _loadFeatures(geojObj: Object) {\r\n this._source.addFeatures(this._lyr._geoJsonFormat.readFeatures(geojObj,\r\n {featureProjection: this._lyr._transform.featureProjection, dataProjection: this._lyr._transform.dataProjection}));\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (super.setLayerTime(theTime)) {\r\n this._loadAtTimeIndex(this._currentIndex);\r\n } else {\r\n this._source.clear();\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nnm.RealEarthAnimateVector = RealEarthAnimateVector;\r\nexport default RealEarthAnimateVector;\r\n"]} \ No newline at end of file +{"version":3,"file":"RealEarthAnimateVector.js","sourceRoot":"","sources":["../../src/mixin/RealEarthAnimateVector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,uDAAkD;AAClD,2CAAsC;AAEtC,0BAA6B;AAC7B,IAAM,EAAE,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAC;AAK5B;;;GAGG;AACH;IAAqC,0CAAgB;IAQjD,gCAAY,KAA2B,EAAE,YAAkD;QAA3F,YACI,kBAAM,KAAK,EAAE,YAAY,CAAC,SAI7B;QAHG,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,KAAI,CAAC,IAAI,GAAG,KAAK,CAAC;;IACtB,CAAC;IAGD;;OAEG;IACH,yCAAQ,GAAR;QACI,iBAAM,QAAQ,WAAE,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,2CAAU,GAAV,UAAW,QAAgB;QACvB,IAAI,MAAM,GAAG,iBAAM,UAAU,YAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;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IG;IACH,8CAAa,GAAb,UAAc,OAAe;QACzB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,EAClE,EAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAC,CAAC,CAAC,CAAC;IAC3H,CAAC;IAED,6CAAY,GAAZ,UAAa,OAAe;QACxB,IAAI,iBAAM,YAAY,YAAC,OAAO,CAAC,EAAE;YAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC7C;aAAM;YACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SACxB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,6BAAC;AAAD,CAAC,AAlGD,CAAqC,0BAAgB,GAkGpD;AAED,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACnD,kBAAe,sBAAsB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/4/2015.\r\n */\r\nimport RealEarthAnimate from './RealEarthAnimate';\r\nimport provide from '../util/provide';\r\nimport {LayerVectorRealEarth} from \"../layers/LayerRealEarthVector\";\r\nimport $ = require('jquery');\r\nconst nm = provide('mixin');\r\nimport VectorSource from 'ol/source/Vector';\r\nimport VectorLayer from 'ol/layer/Vector';\r\n\r\n\r\n/**\r\n * class mixin to animate RealEarth vector layers\r\n * @augments RealEarthAnimate\r\n */\r\nclass RealEarthAnimateVector extends RealEarthAnimate {\r\n _dataCache: Array<Array<Object>|Object>;\r\n _source: VectorSource;\r\n _rawTimesLookup: {[s: string]: any};\r\n _currentIndex: number;\r\n _olLayer: VectorLayer;\r\n _lyr: LayerVectorRealEarth;\r\n\r\n constructor(layer: LayerVectorRealEarth, loadCallback?: (lyr: LayerVectorRealEarth) => void){\r\n super(layer, loadCallback);\r\n this._source = layer.source;\r\n this._olLayer = layer.olLayer;\r\n this._lyr = layer;\r\n }\r\n\r\n\r\n /**\r\n * Call this after the mixin has been applied\r\n */\r\n timeInit() {\r\n super.timeInit();\r\n this._rawTimesLookup = {};\r\n this._dataCache = [];\r\n }\r\n\r\n /**\r\n * Given the raw time string, add to the arrays to keep track of dates and cache\r\n * @param {string} inString - input date string\r\n * @protected\r\n */\r\n _loadDates(inString: string): string {\r\n let rawDte = super._loadDates(inString);\r\n this._dataCache.push(null);\r\n this._rawTimesLookup[rawDte] = null;\r\n return '';\r\n }\r\n\r\n /**\r\n * @protected\r\n */\r\n _loadLatest(): boolean {\r\n if (super._loadLatest()) {\r\n this._loadAtTimeIndex.call(this, this._currentIndex);\r\n }\r\n return true;\r\n }\r\n\r\n //\r\n //http://realearth.ssec.wisc.edu/api/image?products=nexrhres_20160108_212500&x=1&y=5&z=4\r\n //\r\n // 20160108.205500\r\n // http://realearth.ssec.wisc.edu/api/image?products=nexrhres_20160108_205500&x=34&y=46&z=7\r\n\r\n /**\r\n * Load the features at the date index specified\r\n * @param {number} i the index of the features to be loaded by date\r\n * @param {boolean} [setAsSource=true] set to false to trigger cache load only\r\n * @private\r\n */\r\n _loadAtTimeIndex(i: number, setAsSource = true) {\r\n setAsSource = typeof setAsSource == 'boolean' ? setAsSource : true;\r\n if (this._dataCache[i] != null) {\r\n this._source.clear();\r\n this._loadFeatures(this._dataCache[i]);\r\n } else {\r\n let __this = this;\r\n $.get('http://realearth.ssec.wisc.edu:80/api/shapes',\r\n {products: `${this._products}_${this._rawDateStrings[i]}`},\r\n function (d) {\r\n __this._dataCache[i] = d;\r\n __this._rawTimesLookup[__this._rawDateStrings[i]] = d;\r\n if (setAsSource) {\r\n __this._source.clear();\r\n __this._loadFeatures.call(__this, __this._dataCache[i]);\r\n }\r\n }, 'json'\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * helper to load the features at the index specified\r\n * @param {object} geojObj - the geojson object\r\n * @private\r\n */\r\n _loadFeatures(geojObj: Object) {\r\n this._source.addFeatures(this._lyr._geoJsonFormat.readFeatures(geojObj,\r\n {featureProjection: this._lyr._transform.featureProjection, dataProjection: this._lyr._transform.dataProjection}));\r\n }\r\n\r\n setLayerTime(theTime: number): boolean {\r\n if (super.setLayerTime(theTime)) {\r\n this._loadAtTimeIndex(this._currentIndex);\r\n } else {\r\n this._source.clear();\r\n }\r\n return true;\r\n }\r\n}\r\n\r\nnm.RealEarthAnimateVector = RealEarthAnimateVector;\r\nexport default RealEarthAnimateVector;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/SortedFeatures.d.ts b/dist/olHelpers/SortedFeatures.d.ts index 8a2e8cc..7952610 100644 --- a/dist/olHelpers/SortedFeatures.d.ts +++ b/dist/olHelpers/SortedFeatures.d.ts @@ -1,24 +1,24 @@ -import ol = require('custom-ol'); +import Feature from 'ol/Feature'; /** * take an array of features and sort by a given property name */ export declare class SortedFeatures { - sortedFeatures: Array<ol.Feature>; + sortedFeatures: Array<Feature>; propertyName: string; _propertyType: string; /** * - * @param {Array<ol.Feature>} features array of ol features + * @param {Array<Feature>} features array of ol features * @param {string} propertyName - the property name to use for lookup */ - constructor(features: ol.Feature[], propertyName: string); + constructor(features: Feature[], propertyName: string); /** * recursive search to find the value * @param {number|string} propertyValue - the property value to search for * @param {boolean} [exactMatch=false] if only an exact match should be returned * @param {Array} [sortedFeatures=this.sortedFeatures] - the candidate features - * @returns {ol.Feature|undefined} the feature matching the lookup + * @returns {Feature|undefined} the feature matching the lookup */ - getFeature(propertyValue: number | string, exactMatch?: boolean, sortedFeatures?: Array<ol.Feature>): ol.Feature; + getFeature(propertyValue: number | string, exactMatch?: boolean, sortedFeatures?: Array<Feature>): Feature; } export default SortedFeatures; diff --git a/dist/olHelpers/SortedFeatures.js b/dist/olHelpers/SortedFeatures.js index 4994e6f..f78be25 100644 --- a/dist/olHelpers/SortedFeatures.js +++ b/dist/olHelpers/SortedFeatures.js @@ -11,7 +11,7 @@ var nm = provide_1.default('olHelpers'); var SortedFeatures = /** @class */ (function () { /** * - * @param {Array<ol.Feature>} features array of ol features + * @param {Array<Feature>} features array of ol features * @param {string} propertyName - the property name to use for lookup */ function SortedFeatures(features, propertyName) { @@ -50,7 +50,7 @@ var SortedFeatures = /** @class */ (function () { * @param {number|string} propertyValue - the property value to search for * @param {boolean} [exactMatch=false] if only an exact match should be returned * @param {Array} [sortedFeatures=this.sortedFeatures] - the candidate features - * @returns {ol.Feature|undefined} the feature matching the lookup + * @returns {Feature|undefined} the feature matching the lookup */ SortedFeatures.prototype.getFeature = function (propertyValue, exactMatch, sortedFeatures) { if (exactMatch === void 0) { exactMatch = false; } diff --git a/dist/olHelpers/SortedFeatures.js.map b/dist/olHelpers/SortedFeatures.js.map index 4d40b1d..141cfd8 100644 --- a/dist/olHelpers/SortedFeatures.js.map +++ b/dist/olHelpers/SortedFeatures.js.map @@ -1 +1 @@ -{"version":3,"file":"SortedFeatures.js","sourceRoot":"","sources":["../../src/olHelpers/SortedFeatures.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AAEtC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAE9B;;GAEG;AACH;IAKI;;;;OAIG;IACH,wBAAY,QAAsB,EAAE,YAAoB;QACpD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,IAAI,CAAC,aAAa,GAAG,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAEtF,IAAI,QAAM,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;gBACnC,IAAI,QAAM,CAAC,aAAa,IAAI,QAAQ,EAAC;oBACjC,IAA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G,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1C,IAAI,WAAW,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEhE,IAAI,WAAW,KAAM,aAAa,EAAC;YAC/B,OAAO,UAAU,CAAC;SACrB;QAED,IAAI,aAAa,GAAG,WAAW,EAAC;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;SACxF;aAAM;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;SACrF;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA1GD,IA0GC;AA1GY,wCAAc;AA4G3B,EAAE,CAAC,cAAc,GAAG,cAAc,CAAC;AACnC,kBAAe,cAAc,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/23/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nlet nm = provide('olHelpers');\r\n\r\n/**\r\n * take an array of features and sort by a given property name\r\n */\r\nexport class SortedFeatures {\r\n sortedFeatures: Array<ol.Feature>;\r\n propertyName: string;\r\n _propertyType: string;\r\n\r\n /**\r\n *\r\n * @param {Array<ol.Feature>} features array of ol features\r\n * @param {string} propertyName - the property name to use for lookup\r\n */\r\n constructor(features: ol.Feature[], propertyName: string) {\r\n this.sortedFeatures = features;\r\n this.propertyName = propertyName;\r\n\r\n if (this.sortedFeatures.length > 0) {\r\n this._propertyType = typeof this.sortedFeatures[0].getProperties()[this.propertyName];\r\n\r\n let __this = this;\r\n this.sortedFeatures.sort(function (a, b) : number {\r\n if (__this._propertyType == 'number'){\r\n let aMinusB = a['getProperties']()[__this.propertyName] - b['getProperties']()[__this.propertyName];\r\n if (aMinusB == 0){\r\n return 0;\r\n } else {\r\n return aMinusB > 0 ? 1 : -1;\r\n }\r\n } else if (__this._propertyType == 'string'){\r\n let propA = a['getProperties']()[__this.propertyName] || '';\r\n let propB = b['getProperties']()[__this.propertyName] || '';\r\n propA = propA.toString().trim();\r\n propB = propB.toString().trim();\r\n\r\n if (propA == propB){\r\n return 0;\r\n } else {\r\n return propA > propB ? 1 : 0;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * recursive search to find the value\r\n * @param {number|string} propertyValue - the property value to search for\r\n * @param {boolean} [exactMatch=false] if only an exact match should be returned\r\n * @param {Array} [sortedFeatures=this.sortedFeatures] - the candidate features\r\n * @returns {ol.Feature|undefined} the feature matching the lookup\r\n */\r\n getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<ol.Feature>): ol.Feature {\r\n if (typeof sortedFeatures == 'undefined'){\r\n sortedFeatures = this.sortedFeatures;\r\n }\r\n\r\n\r\n if (sortedFeatures.length == 0){\r\n return undefined;\r\n }\r\n\r\n if (sortedFeatures.length == 1){\r\n if (exactMatch){\r\n if (sortedFeatures[0].getProperties()[this.propertyName] == propertyValue){\r\n return sortedFeatures[0];\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return sortedFeatures[0];\r\n }\r\n }\r\n\r\n let lowProp = sortedFeatures[0].getProperties()[this.propertyName];\r\n let highProp = sortedFeatures[sortedFeatures.length - 1].getProperties()[this.propertyName];\r\n\r\n if (exactMatch){\r\n if (lowProp == propertyValue){\r\n return sortedFeatures[0];\r\n } else if (propertyValue < lowProp){\r\n return undefined;\r\n } else if (highProp == propertyValue){\r\n return sortedFeatures[sortedFeatures.length - 1];\r\n } else if (propertyValue > highProp){\r\n return undefined;\r\n }\r\n } else {\r\n if (propertyValue <= lowProp){\r\n return sortedFeatures[0];\r\n } else if (propertyValue >= highProp){\r\n return sortedFeatures[sortedFeatures.length - 1];\r\n }\r\n }\r\n\r\n let midIndex = Math.floor(sortedFeatures.length / 2);\r\n let midFeature = sortedFeatures[midIndex];\r\n let midProperty = midFeature.getProperties()[this.propertyName];\r\n\r\n if (midProperty === propertyValue){\r\n return midFeature;\r\n }\r\n\r\n if (propertyValue < midProperty){\r\n return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(0, midIndex));\r\n } else {\r\n return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(midIndex));\r\n }\r\n }\r\n}\r\n\r\nnm.SortedFeatures = SortedFeatures;\r\nexport default SortedFeatures;\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"SortedFeatures.js","sourceRoot":"","sources":["../../src/olHelpers/SortedFeatures.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AAEtC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAE9B;;GAEG;AACH;IAKI;;;;OAIG;IACH,wBAAY,QAAmB,EAAE,YAAoB;QACjD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,IAAI,CAAC,aAAa,GAAG,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAEtF,IAAI,QAAM,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;gBACnC,IAAI,QAAM,CAAC,aAAa,IAAI,QAAQ,EAAC;oBACjC,IAAI,OAAO,GAAG,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,QAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,QAAM,CAAC,YAAY,CAAC,CAAC;oBACpG,IAAI,OAAO,IAAI,CAAC,EAAC;wBACb,OAAO,CAAC,CAAC;qBACZ;yBAAM;wBACH,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC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a,EAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;SACxF;aAAM;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;SACrF;IACL,CAAC;IACL,qBAAC;AAAD,CAAC,AA1GD,IA0GC;AA1GY,wCAAc;AA4G3B,EAAE,CAAC,cAAc,GAAG,cAAc,CAAC;AACnC,kBAAe,cAAc,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/23/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport Feature from 'ol/Feature';\r\nlet nm = provide('olHelpers');\r\n\r\n/**\r\n * take an array of features and sort by a given property name\r\n */\r\nexport class SortedFeatures {\r\n sortedFeatures: Array<Feature>;\r\n propertyName: string;\r\n _propertyType: string;\r\n\r\n /**\r\n *\r\n * @param {Array<Feature>} features array of ol features\r\n * @param {string} propertyName - the property name to use for lookup\r\n */\r\n constructor(features: Feature[], propertyName: string) {\r\n this.sortedFeatures = features;\r\n this.propertyName = propertyName;\r\n\r\n if (this.sortedFeatures.length > 0) {\r\n this._propertyType = typeof this.sortedFeatures[0].getProperties()[this.propertyName];\r\n\r\n let __this = this;\r\n this.sortedFeatures.sort(function (a, b) : number {\r\n if (__this._propertyType == 'number'){\r\n let aMinusB = a['getProperties']()[__this.propertyName] - b['getProperties']()[__this.propertyName];\r\n if (aMinusB == 0){\r\n return 0;\r\n } else {\r\n return aMinusB > 0 ? 1 : -1;\r\n }\r\n } else if (__this._propertyType == 'string'){\r\n let propA = a['getProperties']()[__this.propertyName] || '';\r\n let propB = b['getProperties']()[__this.propertyName] || '';\r\n propA = propA.toString().trim();\r\n propB = propB.toString().trim();\r\n\r\n if (propA == propB){\r\n return 0;\r\n } else {\r\n return propA > propB ? 1 : 0;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * recursive search to find the value\r\n * @param {number|string} propertyValue - the property value to search for\r\n * @param {boolean} [exactMatch=false] if only an exact match should be returned\r\n * @param {Array} [sortedFeatures=this.sortedFeatures] - the candidate features\r\n * @returns {Feature|undefined} the feature matching the lookup\r\n */\r\n getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<Feature>): Feature {\r\n if (typeof sortedFeatures == 'undefined'){\r\n sortedFeatures = this.sortedFeatures;\r\n }\r\n\r\n\r\n if (sortedFeatures.length == 0){\r\n return undefined;\r\n }\r\n\r\n if (sortedFeatures.length == 1){\r\n if (exactMatch){\r\n if (sortedFeatures[0].getProperties()[this.propertyName] == propertyValue){\r\n return sortedFeatures[0];\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return sortedFeatures[0];\r\n }\r\n }\r\n\r\n let lowProp = sortedFeatures[0].getProperties()[this.propertyName];\r\n let highProp = sortedFeatures[sortedFeatures.length - 1].getProperties()[this.propertyName];\r\n\r\n if (exactMatch){\r\n if (lowProp == propertyValue){\r\n return sortedFeatures[0];\r\n } else if (propertyValue < lowProp){\r\n return undefined;\r\n } else if (highProp == propertyValue){\r\n return sortedFeatures[sortedFeatures.length - 1];\r\n } else if (propertyValue > highProp){\r\n return undefined;\r\n }\r\n } else {\r\n if (propertyValue <= lowProp){\r\n return sortedFeatures[0];\r\n } else if (propertyValue >= highProp){\r\n return sortedFeatures[sortedFeatures.length - 1];\r\n }\r\n }\r\n\r\n let midIndex = Math.floor(sortedFeatures.length / 2);\r\n let midFeature = sortedFeatures[midIndex];\r\n let midProperty = midFeature.getProperties()[this.propertyName];\r\n\r\n if (midProperty === propertyValue){\r\n return midFeature;\r\n }\r\n\r\n if (propertyValue < midProperty){\r\n return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(0, midIndex));\r\n } else {\r\n return this.getFeature(propertyValue, exactMatch, sortedFeatures.slice(midIndex));\r\n }\r\n }\r\n}\r\n\r\nnm.SortedFeatures = SortedFeatures;\r\nexport default SortedFeatures;\r\n\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/esriToOlStyle.d.ts b/dist/olHelpers/esriToOlStyle.d.ts index 709061b..88dab0e 100644 --- a/dist/olHelpers/esriToOlStyle.d.ts +++ b/dist/olHelpers/esriToOlStyle.d.ts @@ -1,4 +1,5 @@ -import ol = require('custom-ol'); +import Style from 'ol/style/Style'; +import Feature from 'ol/Feature'; export interface iEsriResponse { drawingInfo: { renderer: iEsriRenderer; @@ -30,10 +31,10 @@ export interface iEsriSymbol { imageData: string; } export interface iStyleFunc { - (f: ol.Feature): ol.style.Style | ol.style.Style[]; + (f: Feature): Style | Style[]; } export declare function makeFeatureServiceLegendAndSymbol(esriResponse: iEsriResponse): { - style: iStyleFunc | ol.style.Style; + style: iStyleFunc | Style; legend: string; }; export interface iMapServiceLegend { diff --git a/dist/olHelpers/esriToOlStyle.js b/dist/olHelpers/esriToOlStyle.js index 1a47f61..6ef31c8 100644 --- a/dist/olHelpers/esriToOlStyle.js +++ b/dist/olHelpers/esriToOlStyle.js @@ -14,7 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); * Created by gavorhes on 1/4/2016. */ var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); +var Style_1 = require("ol/style/Style"); +var Circle_1 = require("ol/style/Circle"); +var Stroke_1 = require("ol/style/Stroke"); +var Fill_1 = require("ol/style/Fill"); +var Icon_1 = require("ol/style/Icon"); var nm = provide_1.default('olHelpers.esriToOlStyle'); /** * @@ -65,20 +69,20 @@ var PointSymbol = /** @class */ (function (_super) { var outerColor = _colorArrayToRgba(_this.symbolObj.outline.color, _this.opacity); var outlineWidth = _this.symbolObj.outline.width; var radius = _this.symbolObj.size; - _this.olStyle = new ol.style.Style({ - image: new ol.style.Circle({ + _this.olStyle = new Style_1.default({ + image: new Circle_1.default({ radius: radius, - fill: new ol.style.Fill({ + fill: new Fill_1.default({ color: innerColor }), - stroke: new ol.style.Stroke({ color: outerColor, width: outlineWidth }) + stroke: new Stroke_1.default({ color: outerColor, width: outlineWidth }) }) }); _this.legendHtml = "<span class=\"legend-layer-icon\" style=\"color: " + innerColor + "\">●</span>"; break; case 'esriPMS': - _this.olStyle = new ol.style.Style({ - image: new ol.style.Icon({ src: "data:image/png;base64," + _this.symbolObj['imageData'] }) + _this.olStyle = new Style_1.default({ + image: new Icon_1.default({ src: "data:image/png;base64," + _this.symbolObj['imageData'] }) }); _this.legendHtml = "<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64," + _this.symbolObj['imageData'] + "\">"; break; @@ -98,8 +102,8 @@ var LineSymbol = /** @class */ (function (_super) { case 'esriSLS': var innerColor = _colorArrayToRgba(_this.symbolObj.color, _this.opacity); var lineWidth = _this.symbolObj.width; - _this.olStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + _this.olStyle = new Style_1.default({ + stroke: new Stroke_1.default({ color: innerColor, //lineDash: [4], width: lineWidth @@ -132,13 +136,13 @@ var PolygonSymbol = /** @class */ (function (_super) { var innerColor = _colorArrayToRgba(_this.symbolObj.color, _this.opacity); var outerColor = _colorArrayToRgba(_this.symbolObj.outline.color, _this.opacity); var outlineWidth = _this.symbolObj.outline.width; - _this.olStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + _this.olStyle = new Style_1.default({ + stroke: new Stroke_1.default({ color: outerColor, //lineDash: [4], width: outlineWidth }), - fill: new ol.style.Fill({ + fill: new Fill_1.default({ color: innerColor }) }); diff --git a/dist/olHelpers/esriToOlStyle.js.map b/dist/olHelpers/esriToOlStyle.js.map index 10bc68c..1f5413d 100644 --- a/dist/olHelpers/esriToOlStyle.js.map +++ b/dist/olHelpers/esriToOlStyle.js.map @@ -1 +1 @@ -{"version":3,"file":"esriToOlStyle.js","sourceRoot":"","sources":["../../src/olHelpers/esriToOlStyle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAsC;AACtC,8BAAiC;AACjC,IAAM,EAAE,GAAG,iBAAO,CAAC,yBAAyB,CAAC,CAAC;AAG9C;;;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iE,2BAAA,EAAA,eAAyB;IAGvG,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,IAAI,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEpC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;QACpB,aAAa,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KAC1D;SAAM;QACH,aAAa,IAAI,MAAM,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAC;gBACnD,SAAS;aACZ;YACD,aAAa,IAAI,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;SACvE;QACD,aAAa,IAAI,OAAO,CAAC;KAC5B;IAED,OAAO,aAAa,CAAC;AACzB,CAAC;AArBD,oDAqBC;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 1/4/2016.\r\n */\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nconst nm = provide('olHelpers.esriToOlStyle');\r\n\r\n\r\n/**\r\n *\r\n * @param {Array<number>} colorArray - input color array\r\n * @param {number} opacity - the opacity 0 to 1\r\n * @returns {string} rgba string\r\n * @private\r\n */\r\nfunction _colorArrayToRgba(colorArray: [number, number, number], opacity: number): string {\r\n \"use strict\";\r\n\r\n return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${opacity})`;\r\n}\r\n\r\n/**\r\n * escape html charcters\r\n * @param {string} str - input string\r\n * @returns {string} escaped string\r\n */\r\nfunction htmlEscape(str: string): string {\r\n return String(str)\r\n .replace(/&/g, '&')\r\n .replace(/\"/g, '"')\r\n .replace(/'/g, ''')\r\n .replace(/</g, '<')\r\n .replace(/>/g, '>');\r\n}\r\n\r\nnm.htmlEscape = htmlEscape;\r\n\r\n\r\nexport interface iEsriResponse{\r\n drawingInfo: {\r\n renderer: iEsriRenderer;\r\n transparency: number\r\n },\r\n geometryType: string\r\n}\r\n\r\n\r\nexport interface iEsriRenderer{\r\n type: string;\r\n symbol: iEsriSymbol;\r\n uniqueValueInfos: Array<{label: string, value: any, symbol: iEsriSymbol}>;\r\n field1: string;\r\n defaultSymbol: iEsriSymbol;\r\n defaultLabel: string;\r\n}\r\n\r\nexport interface iEsriSymbol{\r\n size: number;\r\n type: string;\r\n outline:{\r\n color: [number, number, number];\r\n width: number;\r\n },\r\n color: [number, number, number];\r\n width: number;\r\n imageData: string\r\n}\r\n\r\n\r\nclass CommonSymbol {\r\n legendHtml: string;\r\n opacity: number;\r\n symbolObj: iEsriSymbol;\r\n olStyle: ol.style.Style;\r\n\r\n /**\r\n *\r\n * @param symbolObj\r\n * @param {number} opacity\r\n */\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n this.symbolObj = symbolObj;\r\n this.opacity = opacity;\r\n this.olStyle = undefined;\r\n this.legendHtml = '';\r\n }\r\n}\r\n\r\ninterface ICommonSymbol{\r\n new (symbolObj: iEsriSymbol, opacity: number): CommonSymbol\r\n}\r\n\r\n\r\nclass PointSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj.type) {\r\n case 'esriSMS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity);\r\n let outlineWidth = this.symbolObj.outline.width;\r\n let radius = this.symbolObj.size;\r\n\r\n\r\n this.olStyle = new ol.style.Style({\r\n image: new ol.style.Circle({\r\n radius: radius,\r\n fill: new ol.style.Fill({\r\n color: innerColor\r\n }),\r\n stroke: new ol.style.Stroke({color: outerColor, width: outlineWidth})\r\n })\r\n });\r\n this.legendHtml = `<span class=\"legend-layer-icon\" style=\"color: ${innerColor}\">●</span>`;\r\n break;\r\n case 'esriPMS':\r\n this.olStyle = new ol.style.Style({\r\n image: new ol.style.Icon({src: `data:image/png;base64,${this.symbolObj['imageData']}`})\r\n });\r\n this.legendHtml = `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${this.symbolObj['imageData']}\">`;\r\n break;\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Point symbol does not handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nclass LineSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj.type) {\r\n case 'esriSLS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let lineWidth = this.symbolObj.width;\r\n\r\n this.olStyle = new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: innerColor,\r\n //lineDash: [4],\r\n width: lineWidth\r\n })\r\n });\r\n\r\n this.legendHtml = `<span class=\"legend-layer-icon\" `;\r\n this.legendHtml += `style=\"`;\r\n this.legendHtml += `background-color: ${innerColor};`;\r\n this.legendHtml += `width: 40px;`;\r\n this.legendHtml += `height: 4px;`;\r\n this.legendHtml += `position: relative;`;\r\n this.legendHtml += `display: inline-block;`;\r\n this.legendHtml += `top: -1px;`;\r\n this.legendHtml += `\"></span>`;\r\n break;\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Line symbol does not handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nclass PolygonSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj['type']) {\r\n case 'esriSFS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity);\r\n let outlineWidth = this.symbolObj.outline.width;\r\n\r\n this.olStyle = new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: outerColor,\r\n //lineDash: [4],\r\n width: outlineWidth\r\n }),\r\n fill: new ol.style.Fill({\r\n color: innerColor\r\n })\r\n });\r\n\r\n this.legendHtml = `<span class=\"legend-layer-icon\" `;\r\n this.legendHtml += `style=\"`;\r\n this.legendHtml += `background-color: ${innerColor};`;\r\n this.legendHtml += `border: solid ${outerColor} 1px;`;\r\n this.legendHtml += `width: 40px;`;\r\n this.legendHtml += `height: 9px;`;\r\n this.legendHtml += `position: relative;`;\r\n this.legendHtml += `display: inline-block;`;\r\n this.legendHtml += `top: 2px;`;\r\n this.legendHtml += `\"></span>`;\r\n break;\r\n\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Polygon symbol does handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nexport interface iStyleFunc{\r\n (f: ol.Feature): ol.style.Style| ol.style.Style[]\r\n}\r\n\r\nclass SymbolGenerator {\r\n opacity: number;\r\n renderer: iEsriRenderer;\r\n legendHtml: string;\r\n olStyle: iStyleFunc | ol.style.Style;\r\n\r\n constructor(esriResponse: iEsriResponse) {\r\n this.opacity = (100 - (esriResponse['drawingInfo']['transparency'] || 0)) / 100;\r\n this.renderer = esriResponse.drawingInfo.renderer;\r\n this.olStyle = undefined;\r\n this.legendHtml = '';\r\n }\r\n}\r\n\r\nclass SingleSymbol extends SymbolGenerator {\r\n symbol: iEsriSymbol;\r\n /**\r\n *\r\n * @param {object} esriResponse - layer info\r\n * @param SymbolClass - the symbol class to use\r\n */\r\n constructor(esriResponse: iEsriResponse, SymbolClass: ICommonSymbol) {\r\n super(esriResponse);\r\n this.symbol = this.renderer.symbol;\r\n let symbolObj = new SymbolClass(this.symbol, this.opacity);\r\n this.olStyle = symbolObj.olStyle;\r\n this.legendHtml = symbolObj.legendHtml;\r\n }\r\n}\r\n\r\nclass UniqueValueSymbol extends SymbolGenerator {\r\n\r\n propertyName: string;\r\n defaultSymbol: iEsriSymbol;\r\n defaultStyle: ol.style.Style;\r\n defaultLabelHtml: string;\r\n labelArray: Array<string>;\r\n legendArray: Array<string>;\r\n propertyStyleLookup: {[s: string]: ol.style.Style};\r\n valueArray: Array<any>;\r\n uniqueValueInfos: Array<{label: string, value: any, symbol: iEsriSymbol}>;\r\n\r\n /**\r\n *\r\n * @param {object} esriResponse - layer info\r\n * @param SymbolClass - the Symbol class definition\r\n */\r\n constructor(esriResponse: iEsriResponse, SymbolClass: ICommonSymbol) {\r\n super(esriResponse);\r\n this.uniqueValueInfos = this.renderer.uniqueValueInfos;\r\n this.propertyName = this.renderer.field1;\r\n this.defaultSymbol = this.renderer.defaultSymbol;\r\n\r\n\r\n if (this.defaultSymbol) {\r\n let symbolObj = new SymbolClass(this.defaultSymbol, this.opacity);\r\n this.defaultStyle = symbolObj.olStyle;\r\n this.defaultLabelHtml = `<span class=\"legend-layer-subitem\">${htmlEscape(this.renderer['defaultLabel'])}</span>` + symbolObj.legendHtml;\r\n } else {\r\n this.defaultStyle = undefined;\r\n this.defaultLabelHtml = 'other';\r\n }\r\n\r\n this.valueArray = [];\r\n this.labelArray = [];\r\n this.legendArray = [];\r\n this.propertyStyleLookup = {};\r\n\r\n for (let uniqueVal of this.uniqueValueInfos) {\r\n this.labelArray.push(uniqueVal['label']);\r\n this.valueArray.push(uniqueVal['value']);\r\n let uniqueSym = new SymbolClass(uniqueVal.symbol, this.opacity);\r\n this.legendArray.push(`<span class=\"legend-layer-subitem\">${htmlEscape(uniqueVal['label'])}</span>` + uniqueSym.legendHtml);\r\n this.propertyStyleLookup[uniqueVal['value']] = uniqueSym.olStyle;\r\n }\r\n\r\n this.olStyle = (feature: ol.Feature): ol.style.Style[] => {\r\n let checkProperties = feature.getProperties();\r\n let checkProperty = checkProperties[this.propertyName];\r\n\r\n if (this.propertyStyleLookup[checkProperty] !== undefined) {\r\n return [this.propertyStyleLookup[checkProperty]];\r\n } else {\r\n return [this.defaultStyle];\r\n }\r\n };\r\n\r\n if (this.defaultLabelHtml !== null) {\r\n this.legendArray.push(this.defaultLabelHtml);\r\n }\r\n\r\n this.legendHtml = '<ul>';\r\n for (let h of this.legendArray) {\r\n this.legendHtml += `<li>${h}</li>`;\r\n }\r\n this.legendHtml += '</ul>';\r\n }\r\n}\r\n\r\nexport function makeFeatureServiceLegendAndSymbol(esriResponse: iEsriResponse): {style: iStyleFunc | ol.style.Style, legend: string} {\r\n \"use strict\";\r\n let renderer = esriResponse.drawingInfo.renderer;\r\n let symbolLegendOut: SymbolGenerator = null;\r\n\r\n switch (renderer.type) {\r\n case 'simple':\r\n switch (esriResponse.geometryType) {\r\n case 'esriGeometryPoint':\r\n symbolLegendOut = new SingleSymbol(esriResponse, PointSymbol);\r\n break;\r\n case 'esriGeometryPolyline':\r\n symbolLegendOut = new SingleSymbol(esriResponse, LineSymbol);\r\n break;\r\n case 'esriGeometryPolygon':\r\n symbolLegendOut = new SingleSymbol(esriResponse, PolygonSymbol);\r\n break;\r\n default:\r\n console.log(esriResponse);\r\n alert(esriResponse.geometryType + ' not handled');\r\n }\r\n break;\r\n case 'uniqueValue':\r\n switch (esriResponse.geometryType) {\r\n case 'esriGeometryPoint':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, PointSymbol);\r\n break;\r\n case 'esriGeometryPolyline':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, LineSymbol);\r\n break;\r\n case 'esriGeometryPolygon':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, PolygonSymbol);\r\n break;\r\n default:\r\n console.log(esriResponse);\r\n alert(esriResponse['geometryType'] + ' not handled');\r\n }\r\n break;\r\n default:\r\n alert('not handled renderer type: ' + renderer['type']);\r\n }\r\n\r\n if (symbolLegendOut == null) {\r\n return {style: undefined, legend: ''};\r\n } else {\r\n return {style: symbolLegendOut.olStyle, legend: symbolLegendOut.legendHtml};\r\n }\r\n}\r\n\r\nnm.makeFeatureServiceLegendAndSymbol = makeFeatureServiceLegendAndSymbol;\r\n\r\n\r\nexport interface iMapServiceLegend{\r\n layerName: string;\r\n legend: {label: string, imageData: string}[]\r\n}\r\n\r\n/**\r\n *\r\n * @param {object} lyrObject - the layer as defined in the response\r\n * @param {boolean} [skipLayerNameAndExpander=false] use only icons\r\n * @returns {string} legend html\r\n */\r\nfunction mapServiceLegendItem(lyrObject: iMapServiceLegend, skipLayerNameAndExpander: boolean = false) {\r\n\r\n\r\n skipLayerNameAndExpander = typeof skipLayerNameAndExpander == 'boolean' ? skipLayerNameAndExpander : false;\r\n let layerName = lyrObject['layerName'];\r\n let legendItems = lyrObject['legend'];\r\n let legendHtml = '';\r\n\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml += `<span class=\"legend-layer-subitem\">${layerName}</span>`;\r\n }\r\n\r\n if (legendItems.length == 1) {\r\n legendHtml = `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${legendItems[0]['imageData']}\">`;\r\n } else {\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml += '<span class=\"legend-items-expander\" title=\"Expand/Collapse\">▼</span>';\r\n }\r\n legendHtml += '<ul>';\r\n for (let i = 0; i < legendItems.length; i++) {\r\n legendHtml += `<li>`;\r\n legendHtml += `<span class=\"legend-layer-subitem\">${htmlEscape(legendItems[i]['label'])}</span>`;\r\n legendHtml += `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${legendItems[i]['imageData']}\">`;\r\n legendHtml += `</li>`;\r\n }\r\n legendHtml += '</ul>';\r\n }\r\n\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml = `<span class=\"legend-layer-subitem\">${layerName}</span>` + legendHtml;\r\n }\r\n\r\n return legendHtml;\r\n}\r\n\r\n/**\r\n * make map service legent\r\n * @param {object} esriResponse - layer info\r\n * @param showLayers - limited number of layers to show in map service\r\n * @returns {string} legend content\r\n */\r\nexport function makeMapServiceLegend(esriResponse: {layers: iMapServiceLegend[]}, showLayers: number[] = []) {\r\n \"use strict\";\r\n\r\n let newLegendHtml = '';\r\n\r\n let layers = esriResponse['layers'];\r\n\r\n if (layers.length == 1) {\r\n newLegendHtml += mapServiceLegendItem(layers[0], true);\r\n } else {\r\n newLegendHtml += '<ul>';\r\n for (let i = 0; i < layers.length; i++) {\r\n if (showLayers.length > 0 && showLayers.indexOf(i) < 0){\r\n continue;\r\n }\r\n newLegendHtml += '<li>' + mapServiceLegendItem(layers[i]) + '</li>';\r\n }\r\n newLegendHtml += '</ul>';\r\n }\r\n\r\n return newLegendHtml;\r\n}\r\n\r\nnm.makeMapServiceLegend = makeMapServiceLegend;\r\n"]} \ No newline at end of file +{"version":3,"file":"esriToOlStyle.js","sourceRoot":"","sources":["../../src/olHelpers/esriToOlStyle.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAsC;AACtC,wCAAmC;AACnC,0CAAqC;AACrC,0CAAqC;AACrC,sCAAiC;AACjC,sCAAiC;AAEjC,IAAM,EAAE,GAAG,iBAAO,CAAC,yBAAyB,CAAC,CAAC;AAI9C;;;;;;GAMG;AACH,2BAA2B,UAAoC,EAAE,OAAe;IAC5E,YAAY,CAAC;IAEb,OAAO,UAAQ,UAAU,CAAC,CAAC,CAAC,SAAI,UAAU,CAAC,CAAC,CAAC,SAAI,UAAU,CAAC,CAAC,CAAC,SAAI,OAAO,MAAG,CAAC;AACjF,CAAC;AAED;;;;GAIG;AACH,oBAAoB,GAAW;IAC3B,OAAO,MAAM,CAAC,GAAG,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAkC3B;IAMI;;;;OAIG;IACH,s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,CAAC,OAAO,CAAC,CAAC,YAAS,CAAC;YACjG,UAAU,IAAI,gFAAyE,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAI,CAAC;YACvH,UAAU,IAAI,OAAO,CAAC;SACzB;QACD,UAAU,IAAI,OAAO,CAAC;KACzB;IAED,IAAI,CAAC,wBAAwB,EAAE;QAC3B,UAAU,GAAG,0CAAsC,SAAS,YAAS,GAAG,UAAU,CAAC;KACtF;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;GAKG;AACH,8BAAqC,YAA2C,EAAE,UAAyB;IACvG,YAAY,CAAC;IADiE,2BAAA,EAAA,eAAyB;IAGvG,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,IAAI,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEpC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;QACpB,aAAa,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KAC1D;SAAM;QACH,aAAa,IAAI,MAAM,CAAC;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAC;gBACnD,SAAS;aACZ;YACD,aAAa,IAAI,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;SACvE;QACD,aAAa,IAAI,OAAO,CAAC;KAC5B;IAED,OAAO,aAAa,CAAC;AACzB,CAAC;AArBD,oDAqBC;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 1/4/2016.\r\n */\r\nimport provide from '../util/provide';\r\nimport Style from 'ol/style/Style';\r\nimport Circle from 'ol/style/Circle';\r\nimport Stroke from 'ol/style/Stroke';\r\nimport Fill from 'ol/style/Fill';\r\nimport Icon from \"ol/style/Icon\";\r\nimport Feature from 'ol/Feature'\r\nconst nm = provide('olHelpers.esriToOlStyle');\r\n\r\n\r\n\r\n/**\r\n *\r\n * @param {Array<number>} colorArray - input color array\r\n * @param {number} opacity - the opacity 0 to 1\r\n * @returns {string} rgba string\r\n * @private\r\n */\r\nfunction _colorArrayToRgba(colorArray: [number, number, number], opacity: number): string {\r\n \"use strict\";\r\n\r\n return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${opacity})`;\r\n}\r\n\r\n/**\r\n * escape html charcters\r\n * @param {string} str - input string\r\n * @returns {string} escaped string\r\n */\r\nfunction htmlEscape(str: string): string {\r\n return String(str)\r\n .replace(/&/g, '&')\r\n .replace(/\"/g, '"')\r\n .replace(/'/g, ''')\r\n .replace(/</g, '<')\r\n .replace(/>/g, '>');\r\n}\r\n\r\nnm.htmlEscape = htmlEscape;\r\n\r\n\r\nexport interface iEsriResponse{\r\n drawingInfo: {\r\n renderer: iEsriRenderer;\r\n transparency: number\r\n },\r\n geometryType: string\r\n}\r\n\r\n\r\nexport interface iEsriRenderer{\r\n type: string;\r\n symbol: iEsriSymbol;\r\n uniqueValueInfos: Array<{label: string, value: any, symbol: iEsriSymbol}>;\r\n field1: string;\r\n defaultSymbol: iEsriSymbol;\r\n defaultLabel: string;\r\n}\r\n\r\nexport interface iEsriSymbol{\r\n size: number;\r\n type: string;\r\n outline:{\r\n color: [number, number, number];\r\n width: number;\r\n },\r\n color: [number, number, number];\r\n width: number;\r\n imageData: string\r\n}\r\n\r\n\r\nclass CommonSymbol {\r\n legendHtml: string;\r\n opacity: number;\r\n symbolObj: iEsriSymbol;\r\n olStyle: Style;\r\n\r\n /**\r\n *\r\n * @param symbolObj\r\n * @param {number} opacity\r\n */\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n this.symbolObj = symbolObj;\r\n this.opacity = opacity;\r\n this.olStyle = undefined;\r\n this.legendHtml = '';\r\n }\r\n}\r\n\r\ninterface ICommonSymbol{\r\n new (symbolObj: iEsriSymbol, opacity: number): CommonSymbol\r\n}\r\n\r\n\r\nclass PointSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj.type) {\r\n case 'esriSMS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity);\r\n let outlineWidth = this.symbolObj.outline.width;\r\n let radius = this.symbolObj.size;\r\n\r\n\r\n this.olStyle = new Style({\r\n image: new Circle({\r\n radius: radius,\r\n fill: new Fill({\r\n color: innerColor\r\n }),\r\n stroke: new Stroke({color: outerColor, width: outlineWidth})\r\n })\r\n });\r\n this.legendHtml = `<span class=\"legend-layer-icon\" style=\"color: ${innerColor}\">●</span>`;\r\n break;\r\n case 'esriPMS':\r\n this.olStyle = new Style({\r\n image: new Icon({src: `data:image/png;base64,${this.symbolObj['imageData']}`})\r\n });\r\n this.legendHtml = `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${this.symbolObj['imageData']}\">`;\r\n break;\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Point symbol does not handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nclass LineSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj.type) {\r\n case 'esriSLS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let lineWidth = this.symbolObj.width;\r\n\r\n this.olStyle = new Style({\r\n stroke: new Stroke({\r\n color: innerColor,\r\n //lineDash: [4],\r\n width: lineWidth\r\n })\r\n });\r\n\r\n this.legendHtml = `<span class=\"legend-layer-icon\" `;\r\n this.legendHtml += `style=\"`;\r\n this.legendHtml += `background-color: ${innerColor};`;\r\n this.legendHtml += `width: 40px;`;\r\n this.legendHtml += `height: 4px;`;\r\n this.legendHtml += `position: relative;`;\r\n this.legendHtml += `display: inline-block;`;\r\n this.legendHtml += `top: -1px;`;\r\n this.legendHtml += `\"></span>`;\r\n break;\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Line symbol does not handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nclass PolygonSymbol extends CommonSymbol {\r\n constructor(symbolObj: iEsriSymbol, opacity: number) {\r\n super(symbolObj, opacity);\r\n switch (this.symbolObj['type']) {\r\n case 'esriSFS':\r\n let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity);\r\n let outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity);\r\n let outlineWidth = this.symbolObj.outline.width;\r\n\r\n this.olStyle = new Style({\r\n stroke: new Stroke({\r\n color: outerColor,\r\n //lineDash: [4],\r\n width: outlineWidth\r\n }),\r\n fill: new Fill({\r\n color: innerColor\r\n })\r\n });\r\n\r\n this.legendHtml = `<span class=\"legend-layer-icon\" `;\r\n this.legendHtml += `style=\"`;\r\n this.legendHtml += `background-color: ${innerColor};`;\r\n this.legendHtml += `border: solid ${outerColor} 1px;`;\r\n this.legendHtml += `width: 40px;`;\r\n this.legendHtml += `height: 9px;`;\r\n this.legendHtml += `position: relative;`;\r\n this.legendHtml += `display: inline-block;`;\r\n this.legendHtml += `top: 2px;`;\r\n this.legendHtml += `\"></span>`;\r\n break;\r\n\r\n default:\r\n console.log(this.symbolObj);\r\n alert('Polygon symbol does handle symbol type: ' + this.symbolObj['type']);\r\n }\r\n }\r\n}\r\n\r\nexport interface iStyleFunc{\r\n (f: Feature): Style| Style[]\r\n}\r\n\r\nclass SymbolGenerator {\r\n opacity: number;\r\n renderer: iEsriRenderer;\r\n legendHtml: string;\r\n olStyle: iStyleFunc | Style;\r\n\r\n constructor(esriResponse: iEsriResponse) {\r\n this.opacity = (100 - (esriResponse['drawingInfo']['transparency'] || 0)) / 100;\r\n this.renderer = esriResponse.drawingInfo.renderer;\r\n this.olStyle = undefined;\r\n this.legendHtml = '';\r\n }\r\n}\r\n\r\nclass SingleSymbol extends SymbolGenerator {\r\n symbol: iEsriSymbol;\r\n /**\r\n *\r\n * @param {object} esriResponse - layer info\r\n * @param SymbolClass - the symbol class to use\r\n */\r\n constructor(esriResponse: iEsriResponse, SymbolClass: ICommonSymbol) {\r\n super(esriResponse);\r\n this.symbol = this.renderer.symbol;\r\n let symbolObj = new SymbolClass(this.symbol, this.opacity);\r\n this.olStyle = symbolObj.olStyle;\r\n this.legendHtml = symbolObj.legendHtml;\r\n }\r\n}\r\n\r\nclass UniqueValueSymbol extends SymbolGenerator {\r\n\r\n propertyName: string;\r\n defaultSymbol: iEsriSymbol;\r\n defaultStyle: Style;\r\n defaultLabelHtml: string;\r\n labelArray: Array<string>;\r\n legendArray: Array<string>;\r\n propertyStyleLookup: {[s: string]: Style};\r\n valueArray: Array<any>;\r\n uniqueValueInfos: Array<{label: string, value: any, symbol: iEsriSymbol}>;\r\n\r\n /**\r\n *\r\n * @param {object} esriResponse - layer info\r\n * @param SymbolClass - the Symbol class definition\r\n */\r\n constructor(esriResponse: iEsriResponse, SymbolClass: ICommonSymbol) {\r\n super(esriResponse);\r\n this.uniqueValueInfos = this.renderer.uniqueValueInfos;\r\n this.propertyName = this.renderer.field1;\r\n this.defaultSymbol = this.renderer.defaultSymbol;\r\n\r\n\r\n if (this.defaultSymbol) {\r\n let symbolObj = new SymbolClass(this.defaultSymbol, this.opacity);\r\n this.defaultStyle = symbolObj.olStyle;\r\n this.defaultLabelHtml = `<span class=\"legend-layer-subitem\">${htmlEscape(this.renderer['defaultLabel'])}</span>` + symbolObj.legendHtml;\r\n } else {\r\n this.defaultStyle = undefined;\r\n this.defaultLabelHtml = 'other';\r\n }\r\n\r\n this.valueArray = [];\r\n this.labelArray = [];\r\n this.legendArray = [];\r\n this.propertyStyleLookup = {};\r\n\r\n for (let uniqueVal of this.uniqueValueInfos) {\r\n this.labelArray.push(uniqueVal['label']);\r\n this.valueArray.push(uniqueVal['value']);\r\n let uniqueSym = new SymbolClass(uniqueVal.symbol, this.opacity);\r\n this.legendArray.push(`<span class=\"legend-layer-subitem\">${htmlEscape(uniqueVal['label'])}</span>` + uniqueSym.legendHtml);\r\n this.propertyStyleLookup[uniqueVal['value']] = uniqueSym.olStyle;\r\n }\r\n\r\n this.olStyle = (feature: Feature): Style[] => {\r\n let checkProperties = feature.getProperties();\r\n let checkProperty = checkProperties[this.propertyName];\r\n\r\n if (this.propertyStyleLookup[checkProperty] !== undefined) {\r\n return [this.propertyStyleLookup[checkProperty]];\r\n } else {\r\n return [this.defaultStyle];\r\n }\r\n };\r\n\r\n if (this.defaultLabelHtml !== null) {\r\n this.legendArray.push(this.defaultLabelHtml);\r\n }\r\n\r\n this.legendHtml = '<ul>';\r\n for (let h of this.legendArray) {\r\n this.legendHtml += `<li>${h}</li>`;\r\n }\r\n this.legendHtml += '</ul>';\r\n }\r\n}\r\n\r\nexport function makeFeatureServiceLegendAndSymbol(esriResponse: iEsriResponse): {style: iStyleFunc | Style, legend: string} {\r\n \"use strict\";\r\n let renderer = esriResponse.drawingInfo.renderer;\r\n let symbolLegendOut: SymbolGenerator = null;\r\n\r\n switch (renderer.type) {\r\n case 'simple':\r\n switch (esriResponse.geometryType) {\r\n case 'esriGeometryPoint':\r\n symbolLegendOut = new SingleSymbol(esriResponse, PointSymbol);\r\n break;\r\n case 'esriGeometryPolyline':\r\n symbolLegendOut = new SingleSymbol(esriResponse, LineSymbol);\r\n break;\r\n case 'esriGeometryPolygon':\r\n symbolLegendOut = new SingleSymbol(esriResponse, PolygonSymbol);\r\n break;\r\n default:\r\n console.log(esriResponse);\r\n alert(esriResponse.geometryType + ' not handled');\r\n }\r\n break;\r\n case 'uniqueValue':\r\n switch (esriResponse.geometryType) {\r\n case 'esriGeometryPoint':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, PointSymbol);\r\n break;\r\n case 'esriGeometryPolyline':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, LineSymbol);\r\n break;\r\n case 'esriGeometryPolygon':\r\n symbolLegendOut = new UniqueValueSymbol(esriResponse, PolygonSymbol);\r\n break;\r\n default:\r\n console.log(esriResponse);\r\n alert(esriResponse['geometryType'] + ' not handled');\r\n }\r\n break;\r\n default:\r\n alert('not handled renderer type: ' + renderer['type']);\r\n }\r\n\r\n if (symbolLegendOut == null) {\r\n return {style: undefined, legend: ''};\r\n } else {\r\n return {style: symbolLegendOut.olStyle, legend: symbolLegendOut.legendHtml};\r\n }\r\n}\r\n\r\nnm.makeFeatureServiceLegendAndSymbol = makeFeatureServiceLegendAndSymbol;\r\n\r\n\r\nexport interface iMapServiceLegend{\r\n layerName: string;\r\n legend: {label: string, imageData: string}[]\r\n}\r\n\r\n/**\r\n *\r\n * @param {object} lyrObject - the layer as defined in the response\r\n * @param {boolean} [skipLayerNameAndExpander=false] use only icons\r\n * @returns {string} legend html\r\n */\r\nfunction mapServiceLegendItem(lyrObject: iMapServiceLegend, skipLayerNameAndExpander: boolean = false) {\r\n\r\n\r\n skipLayerNameAndExpander = typeof skipLayerNameAndExpander == 'boolean' ? skipLayerNameAndExpander : false;\r\n let layerName = lyrObject['layerName'];\r\n let legendItems = lyrObject['legend'];\r\n let legendHtml = '';\r\n\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml += `<span class=\"legend-layer-subitem\">${layerName}</span>`;\r\n }\r\n\r\n if (legendItems.length == 1) {\r\n legendHtml = `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${legendItems[0]['imageData']}\">`;\r\n } else {\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml += '<span class=\"legend-items-expander\" title=\"Expand/Collapse\">▼</span>';\r\n }\r\n legendHtml += '<ul>';\r\n for (let i = 0; i < legendItems.length; i++) {\r\n legendHtml += `<li>`;\r\n legendHtml += `<span class=\"legend-layer-subitem\">${htmlEscape(legendItems[i]['label'])}</span>`;\r\n legendHtml += `<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64,${legendItems[i]['imageData']}\">`;\r\n legendHtml += `</li>`;\r\n }\r\n legendHtml += '</ul>';\r\n }\r\n\r\n if (!skipLayerNameAndExpander) {\r\n legendHtml = `<span class=\"legend-layer-subitem\">${layerName}</span>` + legendHtml;\r\n }\r\n\r\n return legendHtml;\r\n}\r\n\r\n/**\r\n * make map service legent\r\n * @param {object} esriResponse - layer info\r\n * @param showLayers - limited number of layers to show in map service\r\n * @returns {string} legend content\r\n */\r\nexport function makeMapServiceLegend(esriResponse: {layers: iMapServiceLegend[]}, showLayers: number[] = []) {\r\n \"use strict\";\r\n\r\n let newLegendHtml = '';\r\n\r\n let layers = esriResponse['layers'];\r\n\r\n if (layers.length == 1) {\r\n newLegendHtml += mapServiceLegendItem(layers[0], true);\r\n } else {\r\n newLegendHtml += '<ul>';\r\n for (let i = 0; i < layers.length; i++) {\r\n if (showLayers.length > 0 && showLayers.indexOf(i) < 0){\r\n continue;\r\n }\r\n newLegendHtml += '<li>' + mapServiceLegendItem(layers[i]) + '</li>';\r\n }\r\n newLegendHtml += '</ul>';\r\n }\r\n\r\n return newLegendHtml;\r\n}\r\n\r\nnm.makeMapServiceLegend = makeMapServiceLegend;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/extentUtil.d.ts b/dist/olHelpers/extentUtil.d.ts index cf9fda7..bf5ffb8 100644 --- a/dist/olHelpers/extentUtil.d.ts +++ b/dist/olHelpers/extentUtil.d.ts @@ -1,15 +1,11 @@ -import ol = require('custom-ol'); -import { LayerBaseVector } from "../layers/LayerBaseVector"; -/** - * - * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector|*} layers - array of layers or single - * @returns {ol.Extent|Array<number>|*} - collective extent - */ -export declare function calculateExtent(layers: ol.layer.Vector[] | LayerBaseVector[]): ol.Extent | Array<number> | ol.Extent | number[]; +import { LayerBaseVector } from "../layers"; +import Vector from 'ol/layer/Vector'; +import Map from 'ol/Map'; +export declare function calculateExtent(layers: Vector[] | LayerBaseVector[]): number[]; /** * given one or an array of layers, fit to the map * @param layers - array of layers or single * @param mp - the map to fit * @param [zoomOut=undefined] - levels to zoom out after fit */ -export declare function fitToMap(layers: ol.layer.Vector[] | LayerBaseVector[], mp: ol.Map, zoomOut?: number): void; +export declare function fitToMap(layers: Vector[] | LayerBaseVector[], mp: Map, zoomOut?: number): void; diff --git a/dist/olHelpers/extentUtil.js b/dist/olHelpers/extentUtil.js index 3a5eb61..f84d838 100644 --- a/dist/olHelpers/extentUtil.js +++ b/dist/olHelpers/extentUtil.js @@ -5,11 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); */ var provide_1 = require("../util/provide"); var nm = provide_1.default('util'); -/** - * - * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector|*} layers - array of layers or single - * @returns {ol.Extent|Array<number>|*} - collective extent - */ function calculateExtent(layers) { "use strict"; var hasExtent = false; diff --git a/dist/olHelpers/extentUtil.js.map b/dist/olHelpers/extentUtil.js.map index c3095e4..e5a7112 100644 --- a/dist/olHelpers/extentUtil.js.map +++ b/dist/olHelpers/extentUtil.js.map @@ -1 +1 @@ -{"version":3,"file":"extentUtil.js","sourceRoot":"","sources":["../../src/olHelpers/extentUtil.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AAKtC,IAAM,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;AAE3B;;;;GAIG;AACH,yBAAgC,MAA2C;IACvE,YAAY,CAAC;IAEb,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC;IACnB,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC;IAEnB,KAAgB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,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AC,GAAG,CAAC,GAAgB,EAAE,EAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,EAAC,CAAC,CAAC;IAEzD,IAAI,OAAO,OAAO,IAAI,QAAQ,EAAC;QAC3B,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;KAC1D;AACL,CAAC;AAdD,4BAcC;AAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 7/18/2016.\r\n */\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport {LayerBaseVector} from \"../layers/LayerBaseVector\";\r\n\r\n\r\nconst nm = provide('util');\r\n\r\n/**\r\n *\r\n * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector|*} layers - array of layers or single\r\n * @returns {ol.Extent|Array<number>|*} - collective extent\r\n */\r\nexport function calculateExtent(layers: ol.layer.Vector[]|LayerBaseVector[]): ol.Extent|Array<number>| ol.Extent| number[] {\r\n \"use strict\";\r\n\r\n let hasExtent = false;\r\n\r\n let minX = 10E100;\r\n let minY = 10E100;\r\n let maxX = -10E100;\r\n let maxY = -10E100;\r\n\r\n for (let lyr of layers) {\r\n\r\n let olLayer: ol.layer.Vector = (lyr as LayerBaseVector).olLayer || lyr as ol.layer.Vector;\r\n \r\n \r\n if (olLayer.getSource().getFeatures().length > 0) {\r\n hasExtent = true;\r\n let ext = olLayer.getSource().getExtent();\r\n minX = ext[0] < minX ? ext[0] : minX;\r\n minY = ext[1] < minY ? ext[1] : minY;\r\n maxX = ext[2] > maxX ? ext[2] : maxX;\r\n maxY = ext[3] > maxY ? ext[3] : maxY;\r\n }\r\n }\r\n\r\n if (hasExtent) {\r\n return [minX, minY, maxX, maxY];\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\nnm.calculateExtent = calculateExtent;\r\n \r\n\r\n/**\r\n * given one or an array of layers, fit to the map\r\n * @param layers - array of layers or single\r\n * @param mp - the map to fit\r\n * @param [zoomOut=undefined] - levels to zoom out after fit\r\n */\r\nexport function fitToMap(layers: ol.layer.Vector[]|LayerBaseVector[], mp: ol.Map, zoomOut?: number){\r\n \"use strict\";\r\n\r\n let ext = calculateExtent(layers);\r\n \r\n if (typeof ext == 'undefined'){\r\n return;\r\n }\r\n \r\n mp.getView().fit(ext as ol.Extent, {size: mp.getSize()});\r\n \r\n if (typeof zoomOut == 'number'){\r\n mp.getView().setZoom(mp.getView().getZoom() - zoomOut);\r\n }\r\n}\r\n\r\nnm.calculateExtent = calculateExtent;\r\n"]} \ No newline at end of file +{"version":3,"file":"extentUtil.js","sourceRoot":"","sources":["../../src/olHelpers/extentUtil.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AAMtC,IAAM,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;AAE3B,yBAAgC,MAAkC;IAC9D,YAAY,CAAC;IAEb,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC;IACnB,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC;IAEnB,KAAgB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;QAAnB,IAAI,GAAG,eAAA;QAER,IAAI,OAAO,GAAY,GAAuB,CAAC,OAAO,IAAI,GAAa,CAAC;QAGxE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9C,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,CAAC;YAC1C,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,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016.\r\n */\r\nimport provide from '../util/provide';\r\nimport {LayerBaseVector} from \"../layers\";\r\nimport Vector from 'ol/layer/Vector';\r\nimport Map from 'ol/Map';\r\n\r\n\r\nconst nm = provide('util');\r\n\r\nexport function calculateExtent(layers: Vector[]|LayerBaseVector[]): number[] {\r\n \"use strict\";\r\n\r\n let hasExtent = false;\r\n\r\n let minX = 10E100;\r\n let minY = 10E100;\r\n let maxX = -10E100;\r\n let maxY = -10E100;\r\n\r\n for (let lyr of layers) {\r\n\r\n let olLayer: Vector = (lyr as LayerBaseVector).olLayer || lyr as Vector;\r\n \r\n \r\n if (olLayer.getSource().getFeatures().length > 0) {\r\n hasExtent = true;\r\n let ext = olLayer.getSource().getExtent();\r\n minX = ext[0] < minX ? ext[0] : minX;\r\n minY = ext[1] < minY ? ext[1] : minY;\r\n maxX = ext[2] > maxX ? ext[2] : maxX;\r\n maxY = ext[3] > maxY ? ext[3] : maxY;\r\n }\r\n }\r\n\r\n if (hasExtent) {\r\n return [minX, minY, maxX, maxY];\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\nnm.calculateExtent = calculateExtent;\r\n \r\n\r\n/**\r\n * given one or an array of layers, fit to the map\r\n * @param layers - array of layers or single\r\n * @param mp - the map to fit\r\n * @param [zoomOut=undefined] - levels to zoom out after fit\r\n */\r\nexport function fitToMap(layers: Vector[]|LayerBaseVector[], mp: Map, zoomOut?: number){\r\n \"use strict\";\r\n\r\n let ext = calculateExtent(layers);\r\n \r\n if (typeof ext == 'undefined'){\r\n return;\r\n }\r\n \r\n mp.getView().fit(ext as [number, number, number, number], {size: mp.getSize()});\r\n \r\n if (typeof zoomOut == 'number'){\r\n mp.getView().setZoom(mp.getView().getZoom() - zoomOut);\r\n }\r\n}\r\n\r\nnm.calculateExtent = calculateExtent;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/geocode.d.ts b/dist/olHelpers/geocode.d.ts index 3b8a17b..a58e26b 100644 --- a/dist/olHelpers/geocode.d.ts +++ b/dist/olHelpers/geocode.d.ts @@ -1,9 +1,9 @@ -import ol = require('custom-ol'); +import Map from 'ol/Map'; export declare class Geocode { private theButton; private theInput; private map; private indicationLayer; - constructor(mapDiv: HTMLDivElement, map: ol.Map); + constructor(mapDiv: HTMLDivElement, map: Map); private reset; } diff --git a/dist/olHelpers/geocode.js b/dist/olHelpers/geocode.js index dcd8188..6a0bdc6 100644 --- a/dist/olHelpers/geocode.js +++ b/dist/olHelpers/geocode.js @@ -2,10 +2,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); var $ = require("jquery"); var makeGuid_1 = require("../util/makeGuid"); -var ol = require("custom-ol"); var projections_1 = require("./projections"); +var Vector_1 = require("ol/layer/Vector"); +var Vector_2 = require("ol/source/Vector"); +var Circle_1 = require("ol/style/Circle"); +var Fill_1 = require("ol/style/Fill"); +var Stroke_1 = require("ol/style/Stroke"); +var Point_1 = require("ol/geom/Point"); +var Feature_1 = require("ol/Feature"); var invalidClass = 'geocoder-invalid'; var geocoderLoadingClass = 'geocoder-loading'; +var Style_1 = require("ol/style/Style"); // let testAddress = '65 7th Street, Prairie du Sac, WI'; var Geocode = /** @class */ (function () { function Geocode(mapDiv, map) { @@ -13,13 +20,13 @@ var Geocode = /** @class */ (function () { var inputGuid = makeGuid_1.makeGuid(); var buttonGuid = makeGuid_1.makeGuid(); this.map = map; - this.indicationLayer = new ol.layer.Vector({ - source: new ol.source.Vector(), - style: new ol.style.Style({ - image: new ol.style.Circle({ + this.indicationLayer = new Vector_1.default({ + source: new Vector_2.default(), + style: new Style_1.default({ + image: new Circle_1.default({ radius: 12, - fill: new ol.style.Fill({ color: 'rgba(255,0,0,0.5)' }), - stroke: new ol.style.Stroke({ color: 'red', width: 1 }) + fill: new Fill_1.default({ color: 'rgba(255,0,0,0.5)' }), + stroke: new Stroke_1.default({ color: 'red', width: 1 }) }) }) }); @@ -48,8 +55,8 @@ var Geocode = /** @class */ (function () { } else { var v = _this.map.getView(); - var p = new ol.geom.Point([lon, lat]); - var feat = new ol.Feature(p); + var p = new Point_1.default([lon, lat]); + var feat = new Feature_1.default(p); _this.indicationLayer.getSource().addFeature(feat); p.transform(projections_1.proj4326, projections_1.proj3857); v.setCenter(p.getCoordinates()); diff --git a/dist/olHelpers/geocode.js.map b/dist/olHelpers/geocode.js.map index 3600512..0978b6c 100644 --- a/dist/olHelpers/geocode.js.map +++ b/dist/olHelpers/geocode.js.map @@ -1 +1 @@ -{"version":3,"file":"geocode.js","sourceRoot":"","sources":["../../src/olHelpers/geocode.ts"],"names":[],"mappings":";;AAAA,0BAA4B;AAC5B,6CAA0C;AAC1C,8BAAiC;AACjC,6CAAiD;AAGjD,IAAI,YAAY,GAAG,kBAAkB,CAAC;AACtC,IAAI,oBAAoB,GAAG,kBAAkB,CAAC;AAE9C,yDAAyD;AAGzD;IAMI,iBAAY,MAAsB,EAAE,GAAW;QAA/C,iBA8EC;QA7EG,IAAI,SAAS,GAAG,mBAAQ,EAAE,CAAC;QAC3B,IAAI,UAAU,GAAG,mBAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,eAAe,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YACvC,MAAM,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;YAC9B,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtB,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;oBACvB,MAAM,EAAE,EAAE;oBACV,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,mBAAmB,EAAC,CAAC;oBACrD,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;iBACxD,CAAC;aACL,CAAC;SACL,CAAC,CAAC;QACH,IAAI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O,IAAI,EAAE,EAAE;gBAC/C,UAAU,CAAC,KAAK,EAAE,CAAC;aACtB;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAEO,uBAAK,GAAb;QACI,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;IAC7B,CAAC;IAQL,cAAC;AAAD,CAAC,AAjGD,IAiGC;AAjGY,0BAAO","sourcesContent":["import $ = require('jquery')\r\nimport {makeGuid} from '../util/makeGuid';\r\nimport ol = require('custom-ol');\r\nimport {proj3857, proj4326} from './projections';\r\n\r\n\r\nlet invalidClass = 'geocoder-invalid';\r\nlet geocoderLoadingClass = 'geocoder-loading';\r\n\r\n// let testAddress = '65 7th Street, Prairie du Sac, WI';\r\n\r\n\r\nexport class Geocode {\r\n private theButton: HTMLButtonElement;\r\n private theInput: HTMLInputElement;\r\n private map: ol.Map;\r\n private indicationLayer;\r\n\r\n constructor(mapDiv: HTMLDivElement, map: ol.Map) {\r\n let inputGuid = makeGuid();\r\n let buttonGuid = makeGuid();\r\n\r\n this.map = map;\r\n this.indicationLayer = new ol.layer.Vector({\r\n source: new ol.source.Vector(),\r\n style: new ol.style.Style({\r\n image: new ol.style.Circle({\r\n radius: 12,\r\n fill: new ol.style.Fill({color: 'rgba(255,0,0,0.5)'}),\r\n stroke: new ol.style.Stroke({color: 'red', width: 1})\r\n })\r\n })\r\n });\r\n this.map.addLayer(this.indicationLayer);\r\n\r\n $(mapDiv).append('<div class=\"geocoder-el\">' +\r\n `<input type=\"text\" id=\"${inputGuid}\">` +\r\n `<button id=\"${buttonGuid}\">Search</button>` +\r\n '</div>');\r\n\r\n this.theButton = document.getElementById(buttonGuid) as HTMLButtonElement;\r\n this.theInput = document.getElementById(inputGuid) as HTMLInputElement;\r\n\r\n this.reset();\r\n\r\n let $theButton = $(this.theButton);\r\n let $theInput = $(this.theInput);\r\n\r\n $theButton.click((evt) => {\r\n\r\n evt.preventDefault();\r\n\r\n $theButton.addClass(geocoderLoadingClass);\r\n this.theButton.disabled = true;\r\n this.indicationLayer.getSource().clear();\r\n\r\n $.get(\r\n `https://geocode.xyz/${this.theInput.value}?geoit=json`,\r\n {},\r\n (d) => {\r\n let lat = parseFloat(d['latt']);\r\n let lon = parseFloat(d['longt']);\r\n\r\n if ((lat == 0 && lon == 0) || d['error']) {\r\n $theInput.addClass(invalidClass);\r\n this.theInput.title = 'Specified Location Invalid';\r\n this.theButton.title = 'Specified Location Invalid';\r\n\r\n } else {\r\n let v = this.map.getView();\r\n let p = new ol.geom.Point([lon, lat]);\r\n let feat = new ol.Feature(p);\r\n this.indicationLayer.getSource().addFeature(feat);\r\n p.transform(proj4326, proj3857);\r\n\r\n v.setCenter(p.getCoordinates());\r\n v.setZoom(13);\r\n }\r\n\r\n $theButton.removeClass(geocoderLoadingClass);\r\n this.theButton.disabled = false;\r\n },\r\n 'json');\r\n });\r\n\r\n $(this.theInput).keyup((evt) => {\r\n evt.preventDefault();\r\n this.theButton.disabled = this.theInput.value.length == 0;\r\n $theInput.removeClass(invalidClass);\r\n this.theInput.title = '';\r\n this.theButton.title = '';\r\n\r\n if (!this.theButton.disabled && evt.keyCode == 13) {\r\n $theButton.click();\r\n }\r\n })\r\n }\r\n\r\n private reset() {\r\n this.theButton.disabled = true;\r\n this.theInput.value = '';\r\n }\r\n\r\n\r\n// https://geocode.xyz/65%2075h%20street%20prairie%20du%20sac%20wi?geoit=json\r\n\r\n// error\r\n// geocoder-invalid\r\n\r\n}\r\n\r\n\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"geocode.js","sourceRoot":"","sources":["../../src/olHelpers/geocode.ts"],"names":[],"mappings":";;AAAA,0BAA4B;AAC5B,6CAA0C;AAC1C,6CAAiD;AACjD,0CAAqC;AACrC,2CAA4C;AAC5C,0CAAqC;AACrC,sCAAiC;AACjC,0CAAqC;AACrC,uCAAkC;AAClC,sCAAiC;AAIjC,IAAI,YAAY,GAAG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,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;iBACjB;gBAED,UAAU,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;gBAC7C,KAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;YACpC,CAAC,EACD,MAAM,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,UAAC,GAAG;YACvB,GAAG,CAAC,cAAc,EAAE,CAAC;YACrB,KAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;YAC1D,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YACpC,KAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;YACzB,KAAI,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC;YAE1B,IAAI,CAAC,KAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE;gBAC/C,UAAU,CAAC,KAAK,EAAE,CAAC;aACtB;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAEO,uBAAK,GAAb;QACI,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;IAC7B,CAAC;IAQL,cAAC;AAAD,CAAC,AAjGD,IAiGC;AAjGY,0BAAO","sourcesContent":["import $ = require('jquery')\r\nimport {makeGuid} from '../util/makeGuid';\r\nimport {proj3857, proj4326} from './projections';\r\nimport Vector from 'ol/layer/Vector';\r\nimport VectorSource from 'ol/source/Vector';\r\nimport Circle from 'ol/style/Circle';\r\nimport Fill from 'ol/style/Fill';\r\nimport Stroke from 'ol/style/Stroke';\r\nimport Point from 'ol/geom/Point';\r\nimport Feature from 'ol/Feature';\r\n\r\n\r\n\r\nlet invalidClass = 'geocoder-invalid';\r\nlet geocoderLoadingClass = 'geocoder-loading';\r\nimport Map from 'ol/Map';\r\nimport Style from \"ol/style/Style\";\r\n\r\n// let testAddress = '65 7th Street, Prairie du Sac, WI';\r\n\r\n\r\nexport class Geocode {\r\n private theButton: HTMLButtonElement;\r\n private theInput: HTMLInputElement;\r\n private map: Map;\r\n private indicationLayer;\r\n\r\n constructor(mapDiv: HTMLDivElement, map: Map) {\r\n let inputGuid = makeGuid();\r\n let buttonGuid = makeGuid();\r\n\r\n this.map = map;\r\n this.indicationLayer = new Vector({\r\n source: new VectorSource(),\r\n style: new Style({\r\n image: new Circle({\r\n radius: 12,\r\n fill: new Fill({color: 'rgba(255,0,0,0.5)'}),\r\n stroke: new Stroke({color: 'red', width: 1})\r\n })\r\n })\r\n });\r\n this.map.addLayer(this.indicationLayer);\r\n\r\n $(mapDiv).append('<div class=\"geocoder-el\">' +\r\n `<input type=\"text\" id=\"${inputGuid}\">` +\r\n `<button id=\"${buttonGuid}\">Search</button>` +\r\n '</div>');\r\n\r\n this.theButton = document.getElementById(buttonGuid) as HTMLButtonElement;\r\n this.theInput = document.getElementById(inputGuid) as HTMLInputElement;\r\n\r\n this.reset();\r\n\r\n let $theButton = $(this.theButton);\r\n let $theInput = $(this.theInput);\r\n\r\n $theButton.click((evt) => {\r\n\r\n evt.preventDefault();\r\n\r\n $theButton.addClass(geocoderLoadingClass);\r\n this.theButton.disabled = true;\r\n this.indicationLayer.getSource().clear();\r\n\r\n $.get(\r\n `https://geocode.xyz/${this.theInput.value}?geoit=json`,\r\n {},\r\n (d) => {\r\n let lat = parseFloat(d['latt']);\r\n let lon = parseFloat(d['longt']);\r\n\r\n if ((lat == 0 && lon == 0) || d['error']) {\r\n $theInput.addClass(invalidClass);\r\n this.theInput.title = 'Specified Location Invalid';\r\n this.theButton.title = 'Specified Location Invalid';\r\n\r\n } else {\r\n let v = this.map.getView();\r\n let p = new Point([lon, lat]);\r\n let feat = new Feature(p);\r\n this.indicationLayer.getSource().addFeature(feat);\r\n p.transform(proj4326, proj3857);\r\n\r\n v.setCenter(p.getCoordinates());\r\n v.setZoom(13);\r\n }\r\n\r\n $theButton.removeClass(geocoderLoadingClass);\r\n this.theButton.disabled = false;\r\n },\r\n 'json');\r\n });\r\n\r\n $(this.theInput).keyup((evt) => {\r\n evt.preventDefault();\r\n this.theButton.disabled = this.theInput.value.length == 0;\r\n $theInput.removeClass(invalidClass);\r\n this.theInput.title = '';\r\n this.theButton.title = '';\r\n\r\n if (!this.theButton.disabled && evt.keyCode == 13) {\r\n $theButton.click();\r\n }\r\n })\r\n }\r\n\r\n private reset() {\r\n this.theButton.disabled = true;\r\n this.theInput.value = '';\r\n }\r\n\r\n\r\n// https://geocode.xyz/65%2075h%20street%20prairie%20du%20sac%20wi?geoit=json\r\n\r\n// error\r\n// geocoder-invalid\r\n\r\n}\r\n\r\n\r\n\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/layerSwipe.d.ts b/dist/olHelpers/layerSwipe.d.ts index ab7c87b..c453136 100644 --- a/dist/olHelpers/layerSwipe.d.ts +++ b/dist/olHelpers/layerSwipe.d.ts @@ -3,8 +3,7 @@ */ /// <reference types="jquery" /> /// <reference types="jqueryui" /> -import { LayerBase } from "../layers/LayerBase"; -import ol = require('custom-ol'); +import { LayerBase } from "../layers"; declare class LayerSwipe { leftLayers: Array<LayerBase>; rightLayers: Array<LayerBase>; diff --git a/dist/olHelpers/layerSwipe.js.map b/dist/olHelpers/layerSwipe.js.map index 436374b..7c2adad 100644 --- a/dist/olHelpers/layerSwipe.js.map +++ b/dist/olHelpers/layerSwipe.js.map @@ -1 +1 @@ -{"version":3,"file":"layerSwipe.js","sourceRoot":"","sources":["../../src/olHelpers/layerSwipe.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,2CAAsC;AAGtC,0BAA6B;AAE7B,IAAI,EAAE,GAAG,iBAAO,CAAC,wBAAwB,CAAC,CAAC;AAG3C;IASI;;;;OAIG;IACH,oBAAY,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AAC;YAE3F,IAAI,OAAO,GAAG,CAAC,EAAE;gBACb,OAAO;aACV;iBAAM,IAAI,KAAK,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE;gBAC7C,OAAO;aACV;YAED,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAK,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,MAAG,CAAC,CAAC;YAC9D,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;;;OAdA;IAeL,iBAAC;AAAD,CAAC,AA/ID,IA+IC;AAED,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAC3B,kBAAe,UAAU,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 6/1/2016.\r\n */\r\n\r\n\r\nimport provide from '../util/provide';\r\nimport {LayerBase} from \"../layers/LayerBase\";\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\n\r\nlet nm = provide('collections.layerSwipe');\r\n\r\n\r\nclass LayerSwipe {\r\n leftLayers: Array<LayerBase>;\r\n rightLayers: Array<LayerBase>;\r\n _percentRight: number;\r\n _map: ol.Map;\r\n $mapElement: JQuery;\r\n $swiper: JQuery;\r\n dragging: boolean;\r\n offset: number;\r\n /**\r\n *\r\n * @param {ol.Map} map - the map\r\n * @param {string} [sliderContent=''] - additional html to be added inside the slider div\r\n */\r\n constructor(map: ol.Map, sliderContent: string = '') {\r\n\r\n sliderContent = sliderContent || '';\r\n /**\r\n *\r\n * @type {Array<LayerBase>}\r\n */\r\n this.leftLayers = [];\r\n\r\n /**\r\n *\r\n * @type {Array<LayerBase>}\r\n */\r\n this.rightLayers = [];\r\n\r\n this._percentRight = 50;\r\n this.offset = null;\r\n\r\n this._map = map;\r\n this.$mapElement = $(map.getTargetElement());\r\n this.$mapElement.append(`<div class=\"layer-swiper\">${sliderContent}</div>`);\r\n\r\n\r\n this.$swiper = this.$mapElement.find('.layer-swiper');\r\n this.percentRight = this.percentRight;\r\n\r\n this.dragging = false;\r\n\r\n this.$mapElement.mouseleave(() => {\r\n this.dragging = false;\r\n });\r\n\r\n this.$swiper.bind('mousewheel DOMMouseScroll', function(evt){\r\n evt.preventDefault();\r\n });\r\n\r\n this.$swiper.mousedown((evt) => {\r\n this.dragging = true;\r\n this.offset = evt.offsetX;\r\n });\r\n\r\n $(window).mouseup(() => {\r\n this.dragging = false;\r\n });\r\n\r\n this.$mapElement.mousemove((evt) => {\r\n if (this.dragging) {\r\n let mapLeft = this.$mapElement.position().left;\r\n let mapWidth = this.$mapElement.width();\r\n\r\n this.percentRight = 100 * (evt.pageX - this.offset - mapLeft) / mapWidth;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - layer to be added to left side\r\n */\r\n addLeftLayer(lyr: LayerBase) {\r\n\r\n if (this.leftLayers.indexOf(lyr) != -1){\r\n return;\r\n }\r\n\r\n lyr.olLayer.on('precompose', (event: {context: CanvasRenderingContext2D}) => {\r\n let ctx = event['context'];\r\n let width = ctx.canvas.width * (this.percentRight / 100);\r\n\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.rect(0, 0, width, ctx.canvas.height);\r\n ctx.clip();\r\n });\r\n\r\n lyr.olLayer.on('postcompose', function (event: {context: CanvasRenderingContext2D}) {\r\n let ctx = event['context'];\r\n ctx.restore();\r\n });\r\n\r\n\r\n this.leftLayers.push(lyr);\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - layer to be added to right side\r\n */\r\n addRightLayer(lyr: LayerBase) {\r\n\r\n if (this.rightLayers.indexOf(lyr) != -1){\r\n return;\r\n }\r\n\r\n lyr.olLayer.on('precompose', (event: {context: CanvasRenderingContext2D}) => {\r\n let ctx = event['context'];\r\n let width = ctx.canvas.width * (this.percentRight / 100);\r\n\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);\r\n ctx.clip();\r\n });\r\n\r\n lyr.olLayer.on('postcompose', function (event: {context: CanvasRenderingContext2D}) {\r\n let ctx = event['context'];\r\n ctx.restore();\r\n });\r\n\r\n this.rightLayers.push(lyr);\r\n }\r\n\r\n get percentRight() : number{\r\n return this._percentRight;\r\n }\r\n\r\n set percentRight(percent: number) {\r\n let maxed = this.$swiper.position().left + this.$swiper.width() > this.$mapElement.width();\r\n\r\n if (percent < 0) {\r\n return;\r\n } else if (maxed && percent > this.percentRight) {\r\n return;\r\n }\r\n\r\n this._percentRight = percent;\r\n this.$swiper.css('left', `${this._percentRight.toFixed(2)}%`);\r\n this._map.render();\r\n }\r\n}\r\n\r\nnm.LayerSwipe = LayerSwipe;\r\nexport default LayerSwipe;\r\n"]} \ No newline at end of file +{"version":3,"file":"layerSwipe.js","sourceRoot":"","sources":["../../src/olHelpers/layerSwipe.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,2CAAsC;AAEtC,0BAA6B;AAE7B,IAAI,EAAE,GAAG,iBAAO,CAAC,wBAAwB,CAAC,CAAC;AAG3C;IASI;;;;OAIG;IACH,oBAAY,GAAW,EAAE,aAA0B;QAA1B,8BAAA,EAAA,kBAA0B;QAAnD,iBAqDC;QAnDG,aAAa,GAAG,aAAa,IAAI,EAAE,CAAC;QACpC;;;WAGG;QACH,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB;;;WAGG;QACH,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,iCAA6B,aAAa,WAAQ,CAAC,CAAC;QAG5E,IAAI,CAAC,OAAO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\r\nimport provide from '../util/provide';\r\nimport {LayerBase} from \"../layers\";\r\nimport $ = require('jquery');\r\n\r\nlet nm = provide('collections.layerSwipe');\r\n\r\n\r\nclass LayerSwipe {\r\n leftLayers: Array<LayerBase>;\r\n rightLayers: Array<LayerBase>;\r\n _percentRight: number;\r\n _map: ol.Map;\r\n $mapElement: JQuery;\r\n $swiper: JQuery;\r\n dragging: boolean;\r\n offset: number;\r\n /**\r\n *\r\n * @param {ol.Map} map - the map\r\n * @param {string} [sliderContent=''] - additional html to be added inside the slider div\r\n */\r\n constructor(map: ol.Map, sliderContent: string = '') {\r\n\r\n sliderContent = sliderContent || '';\r\n /**\r\n *\r\n * @type {Array<LayerBase>}\r\n */\r\n this.leftLayers = [];\r\n\r\n /**\r\n *\r\n * @type {Array<LayerBase>}\r\n */\r\n this.rightLayers = [];\r\n\r\n this._percentRight = 50;\r\n this.offset = null;\r\n\r\n this._map = map;\r\n this.$mapElement = $(map.getTargetElement());\r\n this.$mapElement.append(`<div class=\"layer-swiper\">${sliderContent}</div>`);\r\n\r\n\r\n this.$swiper = this.$mapElement.find('.layer-swiper');\r\n this.percentRight = this.percentRight;\r\n\r\n this.dragging = false;\r\n\r\n this.$mapElement.mouseleave(() => {\r\n this.dragging = false;\r\n });\r\n\r\n this.$swiper.bind('mousewheel DOMMouseScroll', function(evt){\r\n evt.preventDefault();\r\n });\r\n\r\n this.$swiper.mousedown((evt) => {\r\n this.dragging = true;\r\n this.offset = evt.offsetX;\r\n });\r\n\r\n $(window).mouseup(() => {\r\n this.dragging = false;\r\n });\r\n\r\n this.$mapElement.mousemove((evt) => {\r\n if (this.dragging) {\r\n let mapLeft = this.$mapElement.position().left;\r\n let mapWidth = this.$mapElement.width();\r\n\r\n this.percentRight = 100 * (evt.pageX - this.offset - mapLeft) / mapWidth;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - layer to be added to left side\r\n */\r\n addLeftLayer(lyr: LayerBase) {\r\n\r\n if (this.leftLayers.indexOf(lyr) != -1){\r\n return;\r\n }\r\n\r\n lyr.olLayer.on('precompose', (event) => {\r\n let ctx = event['context'] as CanvasRenderingContext2D;\r\n let width = ctx.canvas.width * (this.percentRight / 100);\r\n\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.rect(0, 0, width, ctx.canvas.height);\r\n ctx.clip();\r\n });\r\n\r\n lyr.olLayer.on('postcompose', function (event) {\r\n let ctx = event['context'] as CanvasRenderingContext2D;\r\n ctx.restore();\r\n });\r\n\r\n\r\n this.leftLayers.push(lyr);\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - layer to be added to right side\r\n */\r\n addRightLayer(lyr: LayerBase) {\r\n\r\n if (this.rightLayers.indexOf(lyr) != -1){\r\n return;\r\n }\r\n\r\n lyr.olLayer.on('precompose', (event) => {\r\n let ctx = event['context'] as CanvasRenderingContext2D;\r\n let width = ctx.canvas.width * (this.percentRight / 100);\r\n\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);\r\n ctx.clip();\r\n });\r\n\r\n lyr.olLayer.on('postcompose', function (event) {\r\n let ctx = event['context'] as CanvasRenderingContext2D;\r\n ctx.restore();\r\n });\r\n\r\n this.rightLayers.push(lyr);\r\n }\r\n\r\n get percentRight() : number{\r\n return this._percentRight;\r\n }\r\n\r\n set percentRight(percent: number) {\r\n let maxed = this.$swiper.position().left + this.$swiper.width() > this.$mapElement.width();\r\n\r\n if (percent < 0) {\r\n return;\r\n } else if (maxed && percent > this.percentRight) {\r\n return;\r\n }\r\n\r\n this._percentRight = percent;\r\n this.$swiper.css('left', `${this._percentRight.toFixed(2)}%`);\r\n this._map.render();\r\n }\r\n}\r\n\r\nnm.LayerSwipe = LayerSwipe;\r\nexport default LayerSwipe;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/mapInteractionBase.d.ts b/dist/olHelpers/mapInteractionBase.d.ts index 8dc3285..6462737 100644 --- a/dist/olHelpers/mapInteractionBase.d.ts +++ b/dist/olHelpers/mapInteractionBase.d.ts @@ -1,9 +1,9 @@ -import ol = require('custom-ol'); +import Map from 'ol/Map'; /** * base interaction */ export declare class MapInteractionBase { - _map: ol.Map; + _map: Map; _initialized: boolean; _subtype: string; /** @@ -16,12 +16,12 @@ export declare class MapInteractionBase { * @param theMap - the ol Map * @returns true for already initialized */ - init(theMap: ol.Map): void; + init(theMap: Map): void; /** * get reference to the ol map object * @returns {ol.Map} the map object */ - readonly map: ol.Map; + readonly map: Map; /** * get if is initialized * @returns {boolean} is initialized diff --git a/dist/olHelpers/mapInteractionBase.js b/dist/olHelpers/mapInteractionBase.js index 6fbc0df..ce038c2 100644 --- a/dist/olHelpers/mapInteractionBase.js +++ b/dist/olHelpers/mapInteractionBase.js @@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); * Created by gavorhes on 12/8/2015. */ var provide_1 = require("../util/provide"); +// import ol = require('custom-ol'); var nm = provide_1.default('olHelpers'); /** * base interaction diff --git a/dist/olHelpers/mapInteractionBase.js.map b/dist/olHelpers/mapInteractionBase.js.map index 5b24fed..ba6472e 100644 --- a/dist/olHelpers/mapInteractionBase.js.map +++ b/dist/olHelpers/mapInteractionBase.js.map @@ -1 +1 @@ -{"version":3,"file":"mapInteractionBase.js","sourceRoot":"","sources":["../../src/olHelpers/mapInteractionBase.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AAEtC,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAIhC;;GAEG;AACH;IAKI;;;OAGG;IACH,4BAAY,OAAe;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,iCAAI,GAAJ,UAAK,MAAc;QACf,IAAI,CAAC,IAAI,CAAC,YAAY,EAAC;YACnB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;IACL,CAAC;IAMD,sBAAI,mCAAG;QAJP;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;;;OAAA;IAMD,sBAAI,2CAAW;QAJf;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,YAAY,CAAC;QAC7B,CAAC;;;OAAA;IAED;;;OAGG;IACH,uCAAU,GAAV;QACI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,IAAI,GAAG,GAAM,IAAI,CAAC,QAAQ,4BAAyB,CAAC;YACpD,KAAK,CAAC,GAAG,CAAC,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,MAAM,GAAG,CAAC;SACb;IACL,CAAC;IAED;;OAEG;IACH,sCAAS,GAAT;QACI,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IACL,yBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,gDAAkB;AAgE/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nconst nm = provide('olHelpers');\r\n\r\n\r\n\r\n/**\r\n * base interaction\r\n */\r\nexport class MapInteractionBase {\r\n _map: ol.Map;\r\n _initialized: boolean;\r\n _subtype: string;\r\n\r\n /**\r\n * map interaction base\r\n * @param subtype - the interaction subtype\r\n */\r\n constructor(subtype: string) {\r\n this._map = null;\r\n this._initialized = false;\r\n this._subtype = subtype;\r\n }\r\n\r\n /**\r\n * base initializer, returns true for already initialized\r\n * @param theMap - the ol Map\r\n * @returns true for already initialized\r\n */\r\n init(theMap: ol.Map){\r\n if (!this._initialized){\r\n this._map = theMap;\r\n this._initialized = true;\r\n }\r\n }\r\n\r\n /**\r\n * get reference to the ol map object\r\n * @returns {ol.Map} the map object\r\n */\r\n get map() {\r\n return this._map;\r\n }\r\n\r\n /**\r\n * get if is initialized\r\n * @returns {boolean} is initialized\r\n */\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n /**\r\n * Check the initialization status and throw exception if not valid yet\r\n * @protected\r\n */\r\n _checkInit() {\r\n if (!this.initialized) {\r\n let msg = `${this._subtype} object not initialized`;\r\n alert(msg);\r\n console.log(msg);\r\n throw msg;\r\n }\r\n }\r\n\r\n /**\r\n * Check the initialization status and throw exception if not valid yet\r\n */\r\n checkInit(){\r\n this._checkInit();\r\n }\r\n}\r\n\r\nnm.MapInteractionBase = MapInteractionBase;\r\nexport default MapInteractionBase;\r\n"]} \ No newline at end of file +{"version":3,"file":"mapInteractionBase.js","sourceRoot":"","sources":["../../src/olHelpers/mapInteractionBase.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,2CAAsC;AACtC,oCAAoC;AACpC,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAMhC;;GAEG;AACH;IAKI;;;OAGG;IACH,4BAAY,OAAe;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,iCAAI,GAAJ,UAAK,MAAW;QACZ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAC;YACnB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;IACL,CAAC;IAMD,sBAAI,mCAAG;QAJP;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;;;OAAA;IAMD,sBAAI,2CAAW;QAJf;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,YAAY,CAAC;QAC7B,CAAC;;;OAAA;IAED;;;OAGG;IACH,uCAAU,GAAV;QACI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,IAAI,GAAG,GAAM,IAAI,CAAC,QAAQ,4BAAyB,CAAC;YACpD,KAAK,CAAC,GAAG,CAAC,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,MAAM,GAAG,CAAC;SACb;IACL,CAAC;IAED;;OAEG;IACH,sCAAS,GAAT;QACI,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IACL,yBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,gDAAkB;AAgE/B,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C,kBAAe,kBAAkB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\nimport provide from '../util/provide';\r\n// import ol = require('custom-ol');\r\nconst nm = provide('olHelpers');\r\n\r\nimport Map from 'ol/Map'\r\n\r\n\r\n\r\n/**\r\n * base interaction\r\n */\r\nexport class MapInteractionBase {\r\n _map: Map;\r\n _initialized: boolean;\r\n _subtype: string;\r\n\r\n /**\r\n * map interaction base\r\n * @param subtype - the interaction subtype\r\n */\r\n constructor(subtype: string) {\r\n this._map = null;\r\n this._initialized = false;\r\n this._subtype = subtype;\r\n }\r\n\r\n /**\r\n * base initializer, returns true for already initialized\r\n * @param theMap - the ol Map\r\n * @returns true for already initialized\r\n */\r\n init(theMap: Map){\r\n if (!this._initialized){\r\n this._map = theMap;\r\n this._initialized = true;\r\n }\r\n }\r\n\r\n /**\r\n * get reference to the ol map object\r\n * @returns {ol.Map} the map object\r\n */\r\n get map() {\r\n return this._map;\r\n }\r\n\r\n /**\r\n * get if is initialized\r\n * @returns {boolean} is initialized\r\n */\r\n get initialized() {\r\n return this._initialized;\r\n }\r\n\r\n /**\r\n * Check the initialization status and throw exception if not valid yet\r\n * @protected\r\n */\r\n _checkInit() {\r\n if (!this.initialized) {\r\n let msg = `${this._subtype} object not initialized`;\r\n alert(msg);\r\n console.log(msg);\r\n throw msg;\r\n }\r\n }\r\n\r\n /**\r\n * Check the initialization status and throw exception if not valid yet\r\n */\r\n checkInit(){\r\n this._checkInit();\r\n }\r\n}\r\n\r\nnm.MapInteractionBase = MapInteractionBase;\r\nexport default MapInteractionBase;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/mapMoveCls.d.ts b/dist/olHelpers/mapMoveCls.d.ts index 5bdc0bc..aa11e78 100644 --- a/dist/olHelpers/mapMoveCls.d.ts +++ b/dist/olHelpers/mapMoveCls.d.ts @@ -1,6 +1,6 @@ import LayerBaseVector from "../layers/LayerBaseVector"; import MapInteractionBase from './mapInteractionBase'; -import ol = require('custom-ol'); +import Map from 'ol/Map'; export interface extentObject { minX: number; minY: number; @@ -44,7 +44,7 @@ export declare class MapMoveCls extends MapInteractionBase { * initialize the map move object * @param theMap - the ol map */ - init(theMap: ol.Map): void; + init(theMap: Map): void; _updateMapExtent(): void; /** * return the map extent diff --git a/dist/olHelpers/mapMoveCls.js.map b/dist/olHelpers/mapMoveCls.js.map index 5e8268d..fbe1905 100644 --- a/dist/olHelpers/mapMoveCls.js.map +++ b/dist/olHelpers/mapMoveCls.js.map @@ -1 +1 @@ -{"version":3,"file":"mapMoveCls.js","sourceRoot":"","sources":["../../src/olHelpers/mapMoveCls.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAsD;AACtD,mDAAqD;AACrD,2CAAsC;AACtC,6CAAwC;AAExC,0BAA6B;AAC7B,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAqBhC;;;GAGG;AACH;IAAgC,8BAAkB;IAa9C;;OAEG;IACH;QAAA,YACI,kBAAM,UAAU,CAAC,SAepB;QAdG,KAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,KAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,KAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAI,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C,CAAC,CAAC;SAC/D;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAlQD,CAAgC,4BAAkB,GAkQjD;AAlQY,gCAAU;AAoQvB,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAC3B,kBAAe,UAAU,CAAC","sourcesContent":["import LayerBaseVector from \"../layers/LayerBaseVector\";\r\nimport MapInteractionBase from './mapInteractionBase';\r\nimport * as checkDefined from '../util/checkDefined';\r\nimport provide from '../util/provide';\r\nimport makeGuid from '../util/makeGuid';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nconst nm = provide('olHelpers');\r\n\r\n\r\nexport interface extentObject{\r\n minX: number;\r\n minY: number;\r\n maxX: number;\r\n maxY: number;\r\n}\r\n\r\nexport interface mapMoveCallbackFunction{\r\n /**\r\n *\r\n * @param extent extent as predefined object minX, minX, maxX, maxY\r\n * @param zoomLevel current zoom level\r\n * @param evtType the event type 'change:center', 'change:resolution'\r\n */\r\n (extent: extentObject, zoomLevel: number, evtType?: string): any\r\n}\r\n\r\n\r\n/**\r\n * assists with map move interactions, trigger callback functions\r\n * @augments MapInteractionBase\r\n */\r\nexport class MapMoveCls extends MapInteractionBase {\r\n _mapExtent: extentObject;\r\n _zoomLevel: number;\r\n _lookupLayer: {[s: string]: LayerBaseVector};\r\n _arrLayer: Array<LayerBaseVector>;\r\n _arrLyrTimeout: Array<number>;\r\n _mapMoveCallbackTimeout: Array<number>;\r\n _mapMoveCallbackDelays: Array<number>;\r\n _mapMoveCallbacksLookup: {[s: string]: mapMoveCallbackFunction};\r\n _mapMoveCallbackContext: Array<Object>;\r\n _mapMoveCallbacks: Array<mapMoveCallbackFunction>;\r\n _arrLyrRequest: Array<any>;\r\n\r\n /**\r\n * constructor called implicitly\r\n */\r\n constructor() {\r\n super('map move');\r\n this._arrLyrRequest = [];\r\n this._arrLyrTimeout = [];\r\n this._arrLayer = [];\r\n this._lookupLayer = {};\r\n\r\n this._mapMoveCallbacks = [];\r\n this._mapMoveCallbacksLookup = {};\r\n this._mapMoveCallbackDelays = [];\r\n this._mapMoveCallbackContext = [];\r\n this._mapMoveCallbackTimeout = [];\r\n\r\n this._mapExtent = undefined;\r\n this._zoomLevel = undefined;\r\n\r\n }\r\n\r\n /**\r\n * initialize the map move object\r\n * @param theMap - the ol map\r\n */\r\n init(theMap: ol.Map){\r\n super.init(theMap);\r\n\r\n this.map.getView().on(['change:center', 'change:resolution'], (e: {type: string}) =>{\r\n\r\n this._updateMapExtent();\r\n\r\n // trigger the layer updates\r\n for (let i = 0; i < this._arrLayer.length; i++) {\r\n this.triggerLyrLoad(this._arrLayer[i], i, e.type);\r\n }\r\n\r\n // trigger the map callbacks\r\n for (let i = 0; i < this._mapMoveCallbacks.length; i++) {\r\n this.triggerMoveCallback(i, e.type);\r\n }\r\n });\r\n }\r\n\r\n _updateMapExtent() {\r\n let theView = this.map.getView();\r\n this._zoomLevel = theView.getZoom();\r\n\r\n let extentArray = theView.calculateExtent(this.map.getSize());\r\n\r\n this._mapExtent = {\r\n minX: extentArray[0],\r\n minY: extentArray[1],\r\n maxX: extentArray[2],\r\n maxY: extentArray[3]\r\n };\r\n }\r\n\r\n /**\r\n * return the map extent\r\n */\r\n get mapExtent() {\r\n if (!this._mapExtent) {\r\n this._updateMapExtent();\r\n }\r\n\r\n return this._mapExtent;\r\n }\r\n\r\n /**\r\n * Trigger the layer load\r\n * @param lyr the layer being acted on\r\n * @param index index of the layer\r\n * @param eventType the event triggering the load, as 'change:center' or 'change:resolution'\r\n */\r\n triggerLyrLoad(lyr: LayerBaseVector, index?: number, eventType?: string) {\r\n\r\n if (checkDefined.undefinedOrNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n throw 'need to define lyr or index';\r\n } else if (checkDefined.definedAndNotNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n index = this._arrLayer.indexOf(lyr);\r\n } else if (checkDefined.undefinedOrNull(lyr) && checkDefined.definedAndNotNull(index)) {\r\n lyr = this._arrLayer[index];\r\n }\r\n\r\n // clear the timeout\r\n if (this._arrLyrTimeout[index] != null) {\r\n clearTimeout(this._arrLyrTimeout[index]);\r\n this._arrLyrTimeout[index] = null;\r\n }\r\n\r\n // abort if necessary and clear the request\r\n if (this._arrLyrRequest[index] != null && this._arrLyrRequest[index] != 4) {\r\n this._arrLyrRequest[index].abort();\r\n this._arrLyrRequest[index] = null;\r\n }\r\n\r\n // dummy callback used if before load returns false\r\n let callbackFunc = function () {};\r\n\r\n if (lyr.mapMoveBefore(this._zoomLevel, eventType)) {\r\n lyr.mapMoveMakeGetParams(this._mapExtent, this._zoomLevel);\r\n\r\n let __this = this;\r\n\r\n callbackFunc = function () {\r\n function innerFunction(theLayer: LayerBaseVector, theIndex: number) {\r\n let _innerThis = this;\r\n this._arrLyrRequest[theIndex] = $.get(\r\n theLayer.url,\r\n theLayer.mapMoveParams,\r\n function (d) {\r\n /**\r\n * @type {LayerBaseVector}\r\n */\r\n theLayer.mapMoveCallback(d);\r\n theLayer.loadCallback();\r\n }, 'json').fail(\r\n function (jqXHR) {\r\n if (jqXHR.statusText != 'abort') {\r\n console.log('failed');\r\n console.log(theLayer.url);\r\n console.log(theLayer.mapMoveParams);\r\n }\r\n }).always(\r\n function () {\r\n _innerThis._arrLyrTimeout[theIndex] = null;\r\n _innerThis._arrLyrRequest[theIndex] = null;\r\n });\r\n }\r\n innerFunction.call(__this, lyr, index);\r\n };\r\n } else {\r\n lyr.clear();\r\n }\r\n this._arrLyrTimeout[index] = setTimeout(callbackFunc, lyr.onDemandDelay);\r\n }\r\n\r\n /**\r\n * trigger the map move call back at the given index\r\n * @param ind - the index of the layer\r\n * @param eventType=undefined the event triggering the load as 'change:center' or 'change:resolution'\r\n * @param functionId=undefined the function id used to reference the added callback function\r\n */\r\n triggerMoveCallback(ind: number, eventType?: string, functionId?: string) {\r\n\r\n if (typeof ind == 'undefined' && typeof functionId == 'undefined'){\r\n throw 'either the function index or the id must be defined';\r\n }\r\n\r\n if (typeof ind !== 'number'){\r\n ind = this._mapMoveCallbacks.indexOf(this._mapMoveCallbacksLookup[functionId]);\r\n }\r\n\r\n if (ind < 0){\r\n console.log('function not found');\r\n\r\n return;\r\n }\r\n\r\n // clear the timeout\r\n if (this._mapMoveCallbackTimeout[ind] != null) {\r\n clearTimeout(this._mapMoveCallbackTimeout[ind]);\r\n this._mapMoveCallbackTimeout[ind] = null;\r\n }\r\n\r\n let ctx = this._mapMoveCallbackContext[ind];\r\n let theFunc = this._mapMoveCallbacks[ind];\r\n\r\n let __this = this;\r\n\r\n let f = function () {\r\n if (ctx !== null) {\r\n theFunc.call(ctx, __this._mapExtent, __this._zoomLevel, eventType);\r\n } else {\r\n theFunc(__this._mapExtent, __this._zoomLevel, eventType);\r\n }\r\n };\r\n\r\n this._mapMoveCallbackTimeout[ind] = setTimeout(f, this._mapMoveCallbackDelays[ind]);\r\n }\r\n\r\n /**\r\n * Add a layer to the interaction\r\n * @param lyr - layer to add\r\n * @param triggerOnAdd - if the layer should be loaded on add\r\n */\r\n addVectorLayer(lyr: LayerBaseVector, triggerOnAdd: boolean = true) {\r\n if (this._arrLayer.indexOf(lyr) > -1) {\r\n console.log('already added ' + lyr.name + ' to map move');\r\n\r\n return;\r\n }\r\n this._checkInit();\r\n\r\n this._arrLyrRequest.push(null);\r\n this._arrLyrTimeout.push(null);\r\n this._arrLayer.push(lyr);\r\n this._lookupLayer[lyr.id] = lyr;\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerLyrLoad(lyr, this._arrLayer.length - 1);\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add a callback to the map move event\r\n * @param func - callback function\r\n * @param context - the context to use for this function\r\n * @param delay=50 the delay before call load\r\n * @param triggerOnAdd if the layer should be loaded on add to mapMove\r\n * @param functionId optional id to reference the function later for outside triggering\r\n */\r\n addCallback(func: mapMoveCallbackFunction, context?: any, delay?: number, triggerOnAdd? : boolean, functionId?: string) {\r\n\r\n if (this._mapMoveCallbacks.indexOf(func) > -1) {\r\n console.log('this function already added to map move');\r\n return;\r\n }\r\n this._checkInit();\r\n if (!functionId){\r\n functionId = makeGuid();\r\n }\r\n\r\n this._mapMoveCallbacks.push(func);\r\n this._mapMoveCallbacksLookup[functionId] = func;\r\n this._mapMoveCallbackDelays.push(typeof delay == 'number' ? delay : 50);\r\n this._mapMoveCallbackContext.push(checkDefined.definedAndNotNull(context) ? context : null);\r\n this._mapMoveCallbackTimeout.push(null);\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerMoveCallback(this._mapMoveCallbacks.length - 1);\r\n }\r\n }\r\n}\r\n\r\nnm.MapMoveCls = MapMoveCls;\r\nexport default MapMoveCls;\r\n"]} \ No newline at end of file +{"version":3,"file":"mapMoveCls.js","sourceRoot":"","sources":["../../src/olHelpers/mapMoveCls.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAsD;AACtD,mDAAqD;AACrD,2CAAsC;AACtC,6CAAwC;AAExC,0BAA6B;AAE7B,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAqBhC;;;GAGG;AACH;IAAgC,8BAAkB;IAa9C;;OAEG;IACH;QAAA,YACI,kBAAM,UAAU,CAAC,SAepB;QAdG,KAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,KAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,KAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,KAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,KAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,KAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;QACjC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C","sourcesContent":["import LayerBaseVector from \"../layers/LayerBaseVector\";\r\nimport MapInteractionBase from './mapInteractionBase';\r\nimport * as checkDefined from '../util/checkDefined';\r\nimport provide from '../util/provide';\r\nimport makeGuid from '../util/makeGuid';\r\nimport {} from 'ol/coordinate';\r\nimport $ = require('jquery');\r\nimport Map from 'ol/Map';\r\nconst nm = provide('olHelpers');\r\n\r\n\r\nexport interface extentObject{\r\n minX: number;\r\n minY: number;\r\n maxX: number;\r\n maxY: number;\r\n}\r\n\r\nexport interface mapMoveCallbackFunction{\r\n /**\r\n *\r\n * @param extent extent as predefined object minX, minX, maxX, maxY\r\n * @param zoomLevel current zoom level\r\n * @param evtType the event type 'change:center', 'change:resolution'\r\n */\r\n (extent: extentObject, zoomLevel: number, evtType?: string): any\r\n}\r\n\r\n\r\n/**\r\n * assists with map move interactions, trigger callback functions\r\n * @augments MapInteractionBase\r\n */\r\nexport class MapMoveCls extends MapInteractionBase {\r\n _mapExtent: extentObject;\r\n _zoomLevel: number;\r\n _lookupLayer: {[s: string]: LayerBaseVector};\r\n _arrLayer: Array<LayerBaseVector>;\r\n _arrLyrTimeout: Array<number>;\r\n _mapMoveCallbackTimeout: Array<number>;\r\n _mapMoveCallbackDelays: Array<number>;\r\n _mapMoveCallbacksLookup: {[s: string]: mapMoveCallbackFunction};\r\n _mapMoveCallbackContext: Array<Object>;\r\n _mapMoveCallbacks: Array<mapMoveCallbackFunction>;\r\n _arrLyrRequest: Array<any>;\r\n\r\n /**\r\n * constructor called implicitly\r\n */\r\n constructor() {\r\n super('map move');\r\n this._arrLyrRequest = [];\r\n this._arrLyrTimeout = [];\r\n this._arrLayer = [];\r\n this._lookupLayer = {};\r\n\r\n this._mapMoveCallbacks = [];\r\n this._mapMoveCallbacksLookup = {};\r\n this._mapMoveCallbackDelays = [];\r\n this._mapMoveCallbackContext = [];\r\n this._mapMoveCallbackTimeout = [];\r\n\r\n this._mapExtent = undefined;\r\n this._zoomLevel = undefined;\r\n\r\n }\r\n\r\n /**\r\n * initialize the map move object\r\n * @param theMap - the ol map\r\n */\r\n init(theMap: Map){\r\n super.init(theMap);\r\n\r\n this.map.getView().on(['change:center', 'change:resolution'], (e: {type: string}) =>{\r\n\r\n this._updateMapExtent();\r\n\r\n // trigger the layer updates\r\n for (let i = 0; i < this._arrLayer.length; i++) {\r\n this.triggerLyrLoad(this._arrLayer[i], i, e.type);\r\n }\r\n\r\n // trigger the map callbacks\r\n for (let i = 0; i < this._mapMoveCallbacks.length; i++) {\r\n this.triggerMoveCallback(i, e.type);\r\n }\r\n });\r\n }\r\n\r\n _updateMapExtent() {\r\n let theView = this.map.getView();\r\n this._zoomLevel = theView.getZoom();\r\n\r\n let extentArray = theView.calculateExtent(this.map.getSize());\r\n\r\n this._mapExtent = {\r\n minX: extentArray[0],\r\n minY: extentArray[1],\r\n maxX: extentArray[2],\r\n maxY: extentArray[3]\r\n };\r\n }\r\n\r\n /**\r\n * return the map extent\r\n */\r\n get mapExtent() {\r\n if (!this._mapExtent) {\r\n this._updateMapExtent();\r\n }\r\n\r\n return this._mapExtent;\r\n }\r\n\r\n /**\r\n * Trigger the layer load\r\n * @param lyr the layer being acted on\r\n * @param index index of the layer\r\n * @param eventType the event triggering the load, as 'change:center' or 'change:resolution'\r\n */\r\n triggerLyrLoad(lyr: LayerBaseVector, index?: number, eventType?: string) {\r\n\r\n if (checkDefined.undefinedOrNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n throw 'need to define lyr or index';\r\n } else if (checkDefined.definedAndNotNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n index = this._arrLayer.indexOf(lyr);\r\n } else if (checkDefined.undefinedOrNull(lyr) && checkDefined.definedAndNotNull(index)) {\r\n lyr = this._arrLayer[index];\r\n }\r\n\r\n // clear the timeout\r\n if (this._arrLyrTimeout[index] != null) {\r\n clearTimeout(this._arrLyrTimeout[index]);\r\n this._arrLyrTimeout[index] = null;\r\n }\r\n\r\n // abort if necessary and clear the request\r\n if (this._arrLyrRequest[index] != null && this._arrLyrRequest[index] != 4) {\r\n this._arrLyrRequest[index].abort();\r\n this._arrLyrRequest[index] = null;\r\n }\r\n\r\n // dummy callback used if before load returns false\r\n let callbackFunc = function () {};\r\n\r\n if (lyr.mapMoveBefore(this._zoomLevel, eventType)) {\r\n lyr.mapMoveMakeGetParams(this._mapExtent, this._zoomLevel);\r\n\r\n let __this = this;\r\n\r\n callbackFunc = function () {\r\n function innerFunction(theLayer: LayerBaseVector, theIndex: number) {\r\n let _innerThis = this;\r\n this._arrLyrRequest[theIndex] = $.get(\r\n theLayer.url,\r\n theLayer.mapMoveParams,\r\n function (d) {\r\n /**\r\n * @type {LayerBaseVector}\r\n */\r\n theLayer.mapMoveCallback(d);\r\n theLayer.loadCallback();\r\n }, 'json').fail(\r\n function (jqXHR) {\r\n if (jqXHR.statusText != 'abort') {\r\n console.log('failed');\r\n console.log(theLayer.url);\r\n console.log(theLayer.mapMoveParams);\r\n }\r\n }).always(\r\n function () {\r\n _innerThis._arrLyrTimeout[theIndex] = null;\r\n _innerThis._arrLyrRequest[theIndex] = null;\r\n });\r\n }\r\n innerFunction.call(__this, lyr, index);\r\n };\r\n } else {\r\n lyr.clear();\r\n }\r\n this._arrLyrTimeout[index] = setTimeout(callbackFunc, lyr.onDemandDelay);\r\n }\r\n\r\n /**\r\n * trigger the map move call back at the given index\r\n * @param ind - the index of the layer\r\n * @param eventType=undefined the event triggering the load as 'change:center' or 'change:resolution'\r\n * @param functionId=undefined the function id used to reference the added callback function\r\n */\r\n triggerMoveCallback(ind: number, eventType?: string, functionId?: string) {\r\n\r\n if (typeof ind == 'undefined' && typeof functionId == 'undefined'){\r\n throw 'either the function index or the id must be defined';\r\n }\r\n\r\n if (typeof ind !== 'number'){\r\n ind = this._mapMoveCallbacks.indexOf(this._mapMoveCallbacksLookup[functionId]);\r\n }\r\n\r\n if (ind < 0){\r\n console.log('function not found');\r\n\r\n return;\r\n }\r\n\r\n // clear the timeout\r\n if (this._mapMoveCallbackTimeout[ind] != null) {\r\n clearTimeout(this._mapMoveCallbackTimeout[ind]);\r\n this._mapMoveCallbackTimeout[ind] = null;\r\n }\r\n\r\n let ctx = this._mapMoveCallbackContext[ind];\r\n let theFunc = this._mapMoveCallbacks[ind];\r\n\r\n let __this = this;\r\n\r\n let f = function () {\r\n if (ctx !== null) {\r\n theFunc.call(ctx, __this._mapExtent, __this._zoomLevel, eventType);\r\n } else {\r\n theFunc(__this._mapExtent, __this._zoomLevel, eventType);\r\n }\r\n };\r\n\r\n this._mapMoveCallbackTimeout[ind] = setTimeout(f, this._mapMoveCallbackDelays[ind]);\r\n }\r\n\r\n /**\r\n * Add a layer to the interaction\r\n * @param lyr - layer to add\r\n * @param triggerOnAdd - if the layer should be loaded on add\r\n */\r\n addVectorLayer(lyr: LayerBaseVector, triggerOnAdd: boolean = true) {\r\n if (this._arrLayer.indexOf(lyr) > -1) {\r\n console.log('already added ' + lyr.name + ' to map move');\r\n\r\n return;\r\n }\r\n this._checkInit();\r\n\r\n this._arrLyrRequest.push(null);\r\n this._arrLyrTimeout.push(null);\r\n this._arrLayer.push(lyr);\r\n this._lookupLayer[lyr.id] = lyr;\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerLyrLoad(lyr, this._arrLayer.length - 1);\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add a callback to the map move event\r\n * @param func - callback function\r\n * @param context - the context to use for this function\r\n * @param delay=50 the delay before call load\r\n * @param triggerOnAdd if the layer should be loaded on add to mapMove\r\n * @param functionId optional id to reference the function later for outside triggering\r\n */\r\n addCallback(func: mapMoveCallbackFunction, context?: any, delay?: number, triggerOnAdd? : boolean, functionId?: string) {\r\n\r\n if (this._mapMoveCallbacks.indexOf(func) > -1) {\r\n console.log('this function already added to map move');\r\n return;\r\n }\r\n this._checkInit();\r\n if (!functionId){\r\n functionId = makeGuid();\r\n }\r\n\r\n this._mapMoveCallbacks.push(func);\r\n this._mapMoveCallbacksLookup[functionId] = func;\r\n this._mapMoveCallbackDelays.push(typeof delay == 'number' ? delay : 50);\r\n this._mapMoveCallbackContext.push(checkDefined.definedAndNotNull(context) ? context : null);\r\n this._mapMoveCallbackTimeout.push(null);\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerMoveCallback(this._mapMoveCallbacks.length - 1);\r\n }\r\n }\r\n}\r\n\r\nnm.MapMoveCls = MapMoveCls;\r\nexport default MapMoveCls;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/mapPopupCls.d.ts b/dist/olHelpers/mapPopupCls.d.ts index 15d654b..4c6f8c6 100644 --- a/dist/olHelpers/mapPopupCls.d.ts +++ b/dist/olHelpers/mapPopupCls.d.ts @@ -4,9 +4,12 @@ /// <reference types="jquery" /> /// <reference types="jqueryui" /> import MapInteractionBase from './mapInteractionBase'; -import ol = require('custom-ol'); import { LayerBaseVector } from "../layers/LayerBaseVector"; import LayerEsriMapServer from "../layers/LayerEsriMapServer"; +import Map from 'ol/Map'; +import Vector from 'ol/layer/Vector'; +import Feature from 'ol/Feature'; +import { Style } from 'ol/style'; export interface popupChangedFunction { ($popContent: JQuery): any; } @@ -22,10 +25,10 @@ export interface popupCallback { (featureProperties: Object, jqRef?: JQuery): string | boolean; } export declare class FeatureLayerProperties { - feature: ol.Feature; + feature: Feature; layer: LayerBaseVector | LayerEsriMapServer; layerIndex: number; - selectionLayer: ol.layer.Vector; + selectionLayer: Vector; popupContent: string; esriLayerName: string; /** @@ -36,7 +39,7 @@ export declare class FeatureLayerProperties { * @param selectionLayer - the ol selection layer * @param [esriLayerName=undefined] - esri layer name */ - constructor(feature: ol.Feature, layer: LayerBaseVector | LayerEsriMapServer, layerIndex: number, selectionLayer: ol.layer.Vector, esriLayerName?: string); + constructor(feature: Feature, layer: LayerBaseVector | LayerEsriMapServer, layerIndex: number, selectionLayer: Vector, esriLayerName?: string); readonly layerName: string; } /** @@ -73,9 +76,9 @@ export declare class MapPopupCls extends MapInteractionBase { constructor(); /** * map popup initialization - * @param {ol.Map} theMap - the ol map + * @param theMap - the ol map */ - init(theMap: ol.Map): void; + init(theMap: Map): void; /** * helper to select features * @private @@ -88,14 +91,14 @@ export declare class MapPopupCls extends MapInteractionBase { * @param {string} popupContent - popup content * @param {string} esriName - esri layer name */ - addMapServicePopupContent(feature: ol.Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string): void; + addMapServicePopupContent(feature: Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string): void; /** * * @param pixel - the ol pixel * @returns feature layer properties * @private */ - _featuresAtPixel(pixel: ol.Pixel): Array<FeatureLayerProperties>; + _featuresAtPixel(pixel: [number, number]): Array<FeatureLayerProperties>; closePopup(): boolean; /** * @@ -115,8 +118,8 @@ export declare class MapPopupCls extends MapInteractionBase { _addPopupLayer(lyr: LayerBaseVector | LayerEsriMapServer, selectionStyle: { color?: string; width?: number; - olStyle?: ol.style.Style; - }): ol.layer.Vector; + olStyle?: Style; + }): Vector; /** * Add popup to the map * @param {LayerBase|*} lyr The layer that the popup with act on @@ -130,8 +133,8 @@ export declare class MapPopupCls extends MapInteractionBase { addVectorPopup(lyr: LayerBaseVector, popupContentFunction: popupCallback, selectionStyle?: { color?: string; width?: number; - olStyle?: ol.style.Style; - }): ol.layer.Vector; + olStyle?: Style; + }): Vector; /** * * @param {LayerBase} lyr - layer @@ -146,7 +149,7 @@ export declare class MapPopupCls extends MapInteractionBase { * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function * @returns {object} a reference to the ol selection layer */ - addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: ol.style.Style | ol.style.Style[]): ol.layer.Vector; + addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: Style | Style[]): Vector; clearSelection(): void; /** * Add a function to be called when the map is clicked but before any popups are implemented diff --git a/dist/olHelpers/mapPopupCls.js b/dist/olHelpers/mapPopupCls.js index 47a1812..0cb9089 100644 --- a/dist/olHelpers/mapPopupCls.js +++ b/dist/olHelpers/mapPopupCls.js @@ -15,8 +15,13 @@ var __extends = (this && this.__extends) || (function () { Object.defineProperty(exports, "__esModule", { value: true }); var mapInteractionBase_1 = require("./mapInteractionBase"); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); var $ = require("jquery"); +// import * as ol from "custom-ol"; +var Vector_1 = require("ol/layer/Vector"); +var Vector_2 = require("ol/source/Vector"); +var Overlay_1 = require("ol/Overlay"); +var easing = require("ol/easing"); +var style_1 = require("ol/style"); var nm = provide_1.default('olHelpers'); var FeatureLayerProperties = /** @class */ (function () { /** @@ -91,7 +96,7 @@ var MapPopupCls = /** @class */ (function (_super) { } /** * map popup initialization - * @param {ol.Map} theMap - the ol map + * @param theMap - the ol map */ MapPopupCls.prototype.init = function (theMap) { var _this = this; @@ -112,9 +117,9 @@ var MapPopupCls = /** @class */ (function (_super) { this._$popupContent = $map.find('.popup-content'); this._$popupCloser = $map.find('.ol-popup-closer'); var _ease = function (n) { - return ol.easing.inAndOut(n); + return easing['inAndOut'](n); }; - this._popupOverlay = new ol.Overlay({ + this._popupOverlay = new Overlay_1.default({ element: this._$popupContainer[0], autoPan: true, autoPanAnimation: { @@ -339,23 +344,23 @@ var MapPopupCls = /** @class */ (function (_super) { theStyle = selectionStyle.olStyle; } else { - theStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + theStyle = new style_1.Style({ + stroke: new style_1.Stroke({ color: selectionStyle.color, width: selectionStyle.width }), - image: new ol.style.Circle({ + image: new style_1.Circle({ radius: 7, - fill: new ol.style.Fill({ color: selectionStyle.color }), - stroke: new ol.style.Stroke({ color: selectionStyle.color, width: 1 }) + fill: new style_1.Fill({ color: selectionStyle.color }), + stroke: new style_1.Stroke({ color: selectionStyle.color, width: 1 }) }), - fill: new ol.style.Fill({ + fill: style_1.Fill({ color: selectionStyle.color }) }); } - var selectionLayer = new ol.layer.Vector({ - source: new ol.source.Vector(), + var selectionLayer = new Vector_1.default({ + source: new Vector_2.default(), style: theStyle }); selectionLayer.setZIndex(100); diff --git a/dist/olHelpers/mapPopupCls.js.map b/dist/olHelpers/mapPopupCls.js.map index 963963c..a737cda 100644 --- a/dist/olHelpers/mapPopupCls.js.map +++ b/dist/olHelpers/mapPopupCls.js.map @@ -1 +1 @@ -{"version":3,"file":"mapPopupCls.js","sourceRoot":"","sources":["../../src/olHelpers/mapPopupCls.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,2DAAsD;AAEtD,2CAAsC;AACtC,8BAAiC;AAIjC,0BAA6B;AAE7B,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AA0BhC;IASI;;;;;;;OAOG;IACH,gCAAY,OAAmB,EAAE,KAAyC,EAAE,UAAkB,EAAE,cAA+B,EAAE,aAAsB;QACnJ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,OAAO,aAAa,IAAI,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,CAAC;IAED,sBAAI,6CAAS;aAAb;YACI,IAAI,OAAO,IAAI,CAAC,aAAa,IAAI,QAAQ,EAAE;gBACvC,OAAO,IAAI,CAAC,aAAa,CAAC;aAC7B;iBAAM;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B;QACL,CAAC;;;OAAA;IACL,6BAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,wDAAsB;AAmCnC;;;GA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C;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,wCAAkB,GAAlB,UAAmB,GAAuB,EAAE,cAAgD;QACxF,IAAI,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,EAAC,OAAO,EAAG,cAAiC,EAAC,CAAC,CAAC;QAC7F,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAGD,oCAAc,GAAd;QACI,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnD,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC;SAChD;QACD,KAAc,UAAuB,EAAvB,KAAA,IAAI,CAAC,kBAAkB,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;YAAlC,IAAI,CAAC,SAAA;YACN,CAAC,EAAE,CAAC;SACP;IACL,CAAC;IAAA,CAAC;IAEF;;;OAGG;IACH,yCAAmB,GAAnB,UAAoB,IAAc;QAC9B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACL,kBAAC;AAAD,CAAC,AAxdD,CAAiC,4BAAkB,GAwdlD;AAxdY,kCAAW;AAydxB,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC;AAC7B,kBAAe,WAAW,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/3/2015.\r\n */\r\n\r\nimport MapInteractionBase from './mapInteractionBase';\r\nimport propertiesZoomStyle from '../olHelpers/propertiesZoomStyle';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport {LayerBaseVector} from \"../layers/LayerBaseVector\";\r\nimport {LayerBase} from \"../layers/LayerBase\";\r\nimport LayerEsriMapServer from \"../layers/LayerEsriMapServer\";\r\nimport $ = require('jquery');\r\n\r\nconst nm = provide('olHelpers');\r\n\r\nexport interface popupChangedFunction {\r\n ($popContent: JQuery): any;\r\n}\r\n\r\n/**\r\n *\r\n */\r\nexport interface popupCallback {\r\n /**\r\n * Callback function for the popup\r\n * @param featureProperties\r\n * @param jqRef\r\n */\r\n (featureProperties: Object, jqRef?: JQuery): string | boolean;\r\n}\r\n\r\ninterface mapEvent {\r\n coordinate: ol.Coordinate;\r\n pixel: ol.Pixel;\r\n dragging: boolean|any;\r\n originalEvent: Event;\r\n}\r\n\r\n\r\nexport class FeatureLayerProperties {\r\n\r\n feature: ol.Feature;\r\n layer: LayerBaseVector|LayerEsriMapServer;\r\n layerIndex: number;\r\n selectionLayer: ol.layer.Vector;\r\n popupContent: string;\r\n esriLayerName: string;\r\n\r\n /**\r\n *\r\n * @param feature the feature\r\n * @param layer - the layer in the popup\r\n * @param layerIndex - index of the layer\r\n * @param selectionLayer - the ol selection layer\r\n * @param [esriLayerName=undefined] - esri layer name\r\n */\r\n constructor(feature: ol.Feature, layer: LayerBaseVector|LayerEsriMapServer, layerIndex: number, selectionLayer: ol.layer.Vector, esriLayerName?: string) {\r\n this.feature = feature;\r\n this.layer = layer;\r\n this.layerIndex = layerIndex;\r\n this.selectionLayer = selectionLayer;\r\n this.popupContent = '';\r\n this.esriLayerName = typeof esriLayerName == 'string' ? esriLayerName : undefined;\r\n }\r\n\r\n get layerName() {\r\n if (typeof this.esriLayerName == 'string') {\r\n return this.esriLayerName;\r\n } else {\r\n return this.layer.name;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * map popup class\r\n * @augments MapInteractionBase\r\n */\r\nexport class MapPopupCls extends MapInteractionBase {\r\n private _popupOpen: boolean;\r\n private _passThroughLayerFeatureArray: Array<FeatureLayerProperties>;\r\n private _currentPopupIndex: number;\r\n private _popupContentLength: number;\r\n private _esriMapServiceLayers: Array<LayerEsriMapServer>;\r\n private _$popupCloser: JQuery;\r\n private _$popupContent: JQuery;\r\n private _$popupContainer: JQuery;\r\n private _popupOverlay: ol.Overlay;\r\n private _arrPopupLayers: Array<LayerBaseVector>;\r\n private _popupCoordinate: ol.Coordinate;\r\n private _popupChangedFunctions: Array<popupChangedFunction>;\r\n private _mapClickFunctions: Array<Function>;\r\n private _selectionLayerLookup: {[s: string]: ol.layer.Vector};\r\n private _arrPopupLayerIds: Array<string>;\r\n // private _arrPopupOlLayers: Array<ol.layer.Vector>;\r\n private _arrPopupContentFunction: Array<popupCallback>;\r\n private _selectionLayers: Array<ol.layer.Vector>;\r\n\r\n /**\r\n * Definition for openlayers style function\r\n * @callback olStyleFunction\r\n * ¶m feature the openlayers vector feature\r\n * $param\r\n */\r\n\r\n\r\n /**\r\n * map popup constructor\r\n */\r\n constructor() {\r\n super('map popup');\r\n this._arrPopupLayerIds = [];\r\n this._arrPopupLayers = [];\r\n // this._arrPopupOlLayers = [];\r\n this._arrPopupContentFunction = [];\r\n this._$popupContainer = undefined;\r\n this._$popupContent = undefined;\r\n this._$popupCloser = undefined;\r\n this._popupOverlay = undefined;\r\n this._selectionLayers = [];\r\n this._selectionLayerLookup = {};\r\n this._mapClickFunctions = [];\r\n\r\n //let a = function($jqueryContent){console.log($jqueryContent)};\r\n //this._popupChangedLookup = {'a': a};\r\n this._popupChangedFunctions = [];\r\n this._esriMapServiceLayers = [];\r\n\r\n this._popupOpen = false;\r\n this._popupCoordinate = null;\r\n\r\n this._passThroughLayerFeatureArray = [];\r\n\r\n this._currentPopupIndex = -1;\r\n this._popupContentLength = 0;\r\n\r\n }\r\n\r\n /**\r\n * map popup initialization\r\n * @param {ol.Map} theMap - the ol map\r\n */\r\n init(theMap: ol.Map) {\r\n super.init(theMap);\r\n\r\n let $map;\r\n let target = this.map.getTarget();\r\n\r\n if (typeof target == 'string') {\r\n $map = $('#' + target);\r\n }\r\n else {\r\n $map = $(target);\r\n }\r\n\r\n $map.append(\r\n '<div class=\"ol-popup\">' +\r\n '<span class=\"ol-popup-closer\">X</span>' +\r\n '<div class=\"popup-content\"></div>' +\r\n '</div>'\r\n );\r\n\r\n this._$popupContainer = $map.find('.ol-popup');\r\n this._$popupContent = $map.find('.popup-content');\r\n this._$popupCloser = $map.find('.ol-popup-closer');\r\n\r\n let _ease = (n: number): number => {\r\n return ol.easing.inAndOut(n);\r\n };\r\n\r\n\r\n this._popupOverlay = new ol.Overlay({\r\n element: this._$popupContainer[0],\r\n autoPan: true,\r\n autoPanAnimation: {\r\n duration: 250,\r\n source: theMap.getView().getCenter(),\r\n easing: _ease\r\n }\r\n });\r\n\r\n this._map.addOverlay(this._popupOverlay);\r\n\r\n this._$popupCloser.click((evt) => {\r\n this.closePopup();\r\n });\r\n\r\n // display popup on click\r\n this._map.on('singleclick', (evt: {coordinate: [number, number], pixel: ol.Pixel}) => {\r\n\r\n this.closePopup();\r\n this._popupCoordinate = evt['coordinate'];\r\n\r\n // esri map service layers\r\n if (this._esriMapServiceLayers.length > 0) {\r\n\r\n let queryParams = {\r\n geometry: evt['coordinate'].join(','),\r\n geometryType: 'esriGeometryPoint',\r\n layers: 'all',\r\n sr: this._map.getView().getProjection().getCode().split(':')[1],\r\n mapExtent: (this._map.getView().calculateExtent(this._map.getSize()) as number[]).join(','),\r\n imageDisplay: (this._map.getSize() as number[]).join(',') + ',96',\r\n returnGeometry: true,\r\n tolerance: 15,\r\n f: 'pjson'\r\n };\r\n\r\n for (let l of this._esriMapServiceLayers) {\r\n l.getPopupInfo(queryParams);\r\n }\r\n }\r\n\r\n let layerFeatureObjectArray = this._featuresAtPixel(evt['pixel']);\r\n\r\n this._passThroughLayerFeatureArray = [];\r\n this._currentPopupIndex = -1;\r\n\r\n for (let i = 0; i < layerFeatureObjectArray.length; i++) {\r\n let featObj = layerFeatureObjectArray[i];\r\n\r\n let props = featObj.feature.getProperties();\r\n\r\n let popupContentResponse = this._arrPopupContentFunction[featObj.layerIndex](props, this._$popupContent);\r\n\r\n //skip if return was false\r\n if (popupContentResponse === false) {\r\n //continue;\r\n } else if (typeof popupContentResponse == 'string') {\r\n featObj.popupContent = popupContentResponse as string;\r\n this._passThroughLayerFeatureArray.push(featObj);\r\n } else {\r\n featObj.selectionLayer.getSource().addFeature(featObj.feature);\r\n }\r\n }\r\n\r\n this._popupContentLength = this._passThroughLayerFeatureArray.length;\r\n\r\n this._currentPopupIndex = -1;\r\n\r\n let popupHtml = '<div class=\"ol-popup-nav\">';\r\n popupHtml += '<span class=\"previous-popup ol-popup-nav-arrow\">◀</span>';\r\n popupHtml += '<span class=\"next-popup ol-popup-nav-arrow\">▶</span>';\r\n popupHtml += `<span class=\"current-popup-item-number\" style=\"font-weight: bold;\"></span>`;\r\n popupHtml += `<span> of </span>`;\r\n popupHtml += `<span class=\"popup-content-length\" style=\"font-weight: bold;\">${this._popupContentLength}</span>`;\r\n popupHtml += `<span> - </span>`;\r\n popupHtml += `<span class=\"current-popup-layer-name\"></span>`;\r\n popupHtml += '</div>';\r\n popupHtml += '<div class=\"ol-popup-inner\">';\r\n\r\n popupHtml += '</div>';\r\n\r\n this._$popupContent.html(popupHtml);\r\n\r\n this._$popupContent.find('.previous-popup').click(() => {\r\n if (this._popupContentLength == 1) {\r\n return;\r\n }\r\n\r\n if (this._currentPopupIndex == 0) {\r\n this._currentPopupIndex = this._popupContentLength - 1;\r\n } else {\r\n this._currentPopupIndex--;\r\n }\r\n this._triggerFeatSelect();\r\n });\r\n\r\n let nextPopup = this._$popupContent.find('.next-popup');\r\n\r\n nextPopup.click(() => {\r\n if (this._popupContentLength == 1 && this._currentPopupIndex > -1) {\r\n return;\r\n }\r\n\r\n if (this._currentPopupIndex == this._popupContentLength - 1) {\r\n this._currentPopupIndex = 0;\r\n } else {\r\n this._currentPopupIndex++;\r\n }\r\n this._triggerFeatSelect();\r\n });\r\n\r\n\r\n if (this._popupContentLength > 0) {\r\n nextPopup.trigger('click');\r\n this._popupOverlay.setPosition(this._popupCoordinate);\r\n this._$popupContent.scrollTop(0);\r\n this._popupOpen = true;\r\n }\r\n });\r\n\r\n //change mouse cursor when over marker\r\n this._map.on('pointermove', (evt) => {\r\n\r\n if (evt['dragging']) {\r\n return;\r\n }\r\n let pixel = this.map.getEventPixel(evt['originalEvent']);\r\n\r\n let hit = false;\r\n\r\n this.map.forEachFeatureAtPixel(pixel, (f, l) => {\r\n if (hit) {\r\n return;\r\n }\r\n\r\n for (let vLyr of this._arrPopupLayers){\r\n if (vLyr.olLayer == l){\r\n hit = true;\r\n break;\r\n }\r\n }\r\n });\r\n\r\n let mapElement = this.map.getTargetElement() as HTMLElement;\r\n mapElement.style.cursor = hit ? 'pointer' : '';\r\n });\r\n }\r\n\r\n /**\r\n * helper to select features\r\n * @private\r\n */\r\n _triggerFeatSelect() {\r\n let $currentPopupItemNumber = this._$popupContent.find('.current-popup-item-number');\r\n let $innerPopup = this._$popupContent.find('.ol-popup-inner');\r\n let $layerNameSpan = this._$popupContent.find('.current-popup-layer-name');\r\n this.clearSelection();\r\n let lyrFeatObj = this._passThroughLayerFeatureArray[this._currentPopupIndex];\r\n $currentPopupItemNumber.html((this._currentPopupIndex + 1).toFixed());\r\n $layerNameSpan.html(lyrFeatObj.layerName);\r\n $innerPopup.html(lyrFeatObj.popupContent);\r\n lyrFeatObj.selectionLayer.getSource().addFeature(lyrFeatObj.feature);\r\n for (let f of this._popupChangedFunctions) {\r\n f(this._$popupContent);\r\n }\r\n }\r\n\r\n\r\n /**\r\n *\r\n * @param feature - the ol feature\r\n * @param {LayerEsriMapServer} lyr - the map server layer\r\n * @param {string} popupContent - popup content\r\n * @param {string} esriName - esri layer name\r\n */\r\n addMapServicePopupContent(feature: ol.Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string) {\r\n\r\n let featLayerObject = new FeatureLayerProperties(\r\n feature, lyr, this._popupContentLength, this._selectionLayerLookup[lyr.id], esriName\r\n );\r\n featLayerObject.popupContent = popupContent;\r\n\r\n this._passThroughLayerFeatureArray.push(featLayerObject);\r\n this._popupContentLength++;\r\n\r\n $('.popup-content-length').html(this._popupContentLength.toFixed());\r\n\r\n if (!this._popupOpen) {\r\n this._$popupContent.find('.next-popup').trigger('click');\r\n\r\n this._popupOverlay.setPosition(this._popupCoordinate);\r\n this._$popupContent.scrollTop(0);\r\n this._popupOpen = true;\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param pixel - the ol pixel\r\n * @returns feature layer properties\r\n * @private\r\n */\r\n _featuresAtPixel(pixel: ol.Pixel): Array<FeatureLayerProperties> {\r\n let layerFeatureObjectArray: FeatureLayerProperties[] = [];\r\n\r\n this.map.forEachFeatureAtPixel(pixel, (feature: ol.Feature, layer: ol.layer.Vector) => {\r\n let hasLyr = false;\r\n\r\n let j;\r\n let lyr = null;\r\n\r\n for (j = 0; j < this._arrPopupLayers.length; j++){\r\n lyr = this._arrPopupLayers[j];\r\n\r\n if (lyr.olLayer === layer){\r\n hasLyr = true;\r\n break;\r\n }\r\n }\r\n\r\n if (hasLyr) {\r\n layerFeatureObjectArray.push(\r\n new FeatureLayerProperties(\r\n feature, lyr, j, this._selectionLayers[j]));\r\n }\r\n });\r\n\r\n return layerFeatureObjectArray;\r\n }\r\n\r\n closePopup() {\r\n this._checkInit();\r\n this._popupOpen = false;\r\n this._popupOverlay.setPosition(undefined);\r\n (this._$popupCloser[0] as HTMLSpanElement).blur();\r\n this.clearSelection();\r\n this._$popupContent.html('');\r\n\r\n return false;\r\n };\r\n\r\n\r\n /**\r\n *\r\n * @param chgFunction - popup change function\r\n */\r\n addPopupChangedFunction(chgFunction: popupChangedFunction) {\r\n this._popupChangedFunctions.push(chgFunction);\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - the layer being acted on\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns the new selection layer\r\n * @private\r\n */\r\n _addPopupLayer(lyr: LayerBaseVector|LayerEsriMapServer, selectionStyle: {color?: string, width?: number, olStyle?: ol.style.Style}): ol.layer.Vector {\r\n this._checkInit();\r\n\r\n selectionStyle = selectionStyle || {};\r\n selectionStyle.color = selectionStyle.color || 'rgba(255,170,0,0.5)';\r\n selectionStyle.width = selectionStyle.width || 10;\r\n\r\n let theStyle;\r\n\r\n if (selectionStyle.olStyle) {\r\n theStyle = selectionStyle.olStyle;\r\n } else {\r\n theStyle = new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: selectionStyle.color,\r\n width: selectionStyle.width\r\n }),\r\n image: new ol.style.Circle({\r\n radius: 7,\r\n fill: new ol.style.Fill({color: selectionStyle.color}),\r\n stroke: new ol.style.Stroke({color: selectionStyle.color, width: 1})\r\n }),\r\n fill: new ol.style.Fill({\r\n color: selectionStyle.color\r\n })\r\n });\r\n }\r\n\r\n let selectionLayer = new ol.layer.Vector(\r\n {\r\n source: new ol.source.Vector(),\r\n style: theStyle\r\n }\r\n );\r\n\r\n selectionLayer.setZIndex(100);\r\n\r\n this._selectionLayers.push(selectionLayer);\r\n this._selectionLayerLookup[lyr.id] = selectionLayer;\r\n this.map.addLayer(selectionLayer);\r\n\r\n return selectionLayer;\r\n }\r\n\r\n\r\n /**\r\n * Add popup to the map\r\n * @param {LayerBase|*} lyr The layer that the popup with act on\r\n * @param {popupCallback} popupContentFunction - popup content function that makes popup info\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns {object} a reference to the ol selection layer\r\n */\r\n addVectorPopup(lyr: LayerBaseVector, popupContentFunction: popupCallback,\r\n selectionStyle?: {color?: string, width?: number, olStyle?: ol.style.Style}) {\r\n let selectionLayer = this._addPopupLayer(lyr, selectionStyle);\r\n this._arrPopupLayerIds.push(lyr.id);\r\n this._arrPopupLayers.push(lyr);\r\n // this._arrPopupOlLayers.push(lyr.olLayer);\r\n this._arrPopupContentFunction.push(popupContentFunction);\r\n\r\n return selectionLayer;\r\n };\r\n\r\n\r\n /**\r\n *\r\n * @param {LayerBase} lyr - layer\r\n */\r\n removeVectorPopup(lyr: LayerBaseVector) {\r\n let idx = this._arrPopupLayerIds.indexOf(lyr.id);\r\n\r\n if (idx > -1) {\r\n this._arrPopupLayerIds.splice(idx, 1);\r\n this._arrPopupLayers.splice(idx, 1);\r\n // this._arrPopupOlLayers.splice(idx, 1);\r\n this._arrPopupContentFunction.splice(idx, 1);\r\n this._selectionLayers.splice(idx, 1);\r\n delete this._selectionLayerLookup[lyr.id];\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerEsriMapServer} lyr - map server layer\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns {object} a reference to the ol selection layer\r\n */\r\n addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: ol.style.Style|ol.style.Style[]) {\r\n let selectionLayer = this._addPopupLayer(lyr, {olStyle: (selectionStyle as ol.style.Style)});\r\n this._esriMapServiceLayers.push(lyr);\r\n\r\n return selectionLayer;\r\n }\r\n\r\n\r\n clearSelection() {\r\n this._checkInit();\r\n for (let i = 0; i < this._selectionLayers.length; i++) {\r\n this._selectionLayers[i].getSource().clear();\r\n }\r\n for (let f of this._mapClickFunctions) {\r\n f();\r\n }\r\n };\r\n\r\n /**\r\n * Add a function to be called when the map is clicked but before any popups are implemented\r\n * @param {function} func - the map click function\r\n */\r\n addMapClickFunction(func: Function) {\r\n this._mapClickFunctions.push(func);\r\n }\r\n}\r\nnm.MapPopupCls = MapPopupCls;\r\nexport default MapPopupCls;\r\n"]} \ No newline at end of file +{"version":3,"file":"mapPopupCls.js","sourceRoot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,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC;SAChD;QACD,KAAc,UAAuB,EAAvB,KAAA,IAAI,CAAC,kBAAkB,EAAvB,cAAuB,EAAvB,IAAuB,EAAE;YAAlC,IAAI,CAAC,SAAA;YACN,CAAC,EAAE,CAAC;SACP;IACL,CAAC;IAAA,CAAC;IAEF;;;OAGG;IACH,yCAAmB,GAAnB,UAAoB,IAAc;QAC9B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACL,kBAAC;AAAD,CAAC,AAvdD,CAAiC,4BAAkB,GAudlD;AAvdY,kCAAW;AAwdxB,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC;AAC7B,kBAAe,WAAW,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 11/3/2015.\r\n */\r\n\r\nimport MapInteractionBase from './mapInteractionBase';\r\nimport propertiesZoomStyle from '../olHelpers/propertiesZoomStyle';\r\nimport provide from '../util/provide';\r\nimport {LayerBaseVector} from \"../layers/LayerBaseVector\";\r\nimport {LayerBase} from \"../layers/LayerBase\";\r\nimport LayerEsriMapServer from \"../layers/LayerEsriMapServer\";\r\nimport $ = require('jquery');\r\nimport Map from 'ol/Map';\r\n// import * as ol from \"custom-ol\";\r\nimport Vector from 'ol/layer/Vector';\r\nimport VectorSource from 'ol/source/Vector';\r\nimport Feature from 'ol/Feature';\r\nimport Overlay from 'ol/Overlay';\r\nimport * as easing from 'ol/easing';\r\n\r\n\r\nimport {Style, Circle, Fill, Stroke} from 'ol/style';\r\n\r\n\r\n\r\nconst nm = provide('olHelpers');\r\n\r\nexport interface popupChangedFunction {\r\n ($popContent: JQuery): any;\r\n}\r\n\r\n/**\r\n *\r\n */\r\nexport interface popupCallback {\r\n /**\r\n * Callback function for the popup\r\n * @param featureProperties\r\n * @param jqRef\r\n */\r\n (featureProperties: Object, jqRef?: JQuery): string | boolean;\r\n}\r\n\r\ninterface mapEvent {\r\n coordinate: [number, number];\r\n pixel: [number, number];\r\n dragging: boolean|any;\r\n originalEvent: Event;\r\n}\r\n\r\n\r\nexport class FeatureLayerProperties {\r\n\r\n feature: Feature;\r\n layer: LayerBaseVector|LayerEsriMapServer;\r\n layerIndex: number;\r\n selectionLayer: Vector;\r\n popupContent: string;\r\n esriLayerName: string;\r\n\r\n /**\r\n *\r\n * @param feature the feature\r\n * @param layer - the layer in the popup\r\n * @param layerIndex - index of the layer\r\n * @param selectionLayer - the ol selection layer\r\n * @param [esriLayerName=undefined] - esri layer name\r\n */\r\n constructor(feature: Feature, layer: LayerBaseVector|LayerEsriMapServer, layerIndex: number, selectionLayer: Vector, esriLayerName?: string) {\r\n this.feature = feature;\r\n this.layer = layer;\r\n this.layerIndex = layerIndex;\r\n this.selectionLayer = selectionLayer;\r\n this.popupContent = '';\r\n this.esriLayerName = typeof esriLayerName == 'string' ? esriLayerName : undefined;\r\n }\r\n\r\n get layerName() {\r\n if (typeof this.esriLayerName == 'string') {\r\n return this.esriLayerName;\r\n } else {\r\n return this.layer.name;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * map popup class\r\n * @augments MapInteractionBase\r\n */\r\nexport class MapPopupCls extends MapInteractionBase {\r\n private _popupOpen: boolean;\r\n private _passThroughLayerFeatureArray: Array<FeatureLayerProperties>;\r\n private _currentPopupIndex: number;\r\n private _popupContentLength: number;\r\n private _esriMapServiceLayers: Array<LayerEsriMapServer>;\r\n private _$popupCloser: JQuery;\r\n private _$popupContent: JQuery;\r\n private _$popupContainer: JQuery;\r\n private _popupOverlay: Overlay;\r\n private _arrPopupLayers: Array<LayerBaseVector>;\r\n private _popupCoordinate: [number, number];\r\n private _popupChangedFunctions: Array<popupChangedFunction>;\r\n private _mapClickFunctions: Array<Function>;\r\n private _selectionLayerLookup: {[s: string]: Vector};\r\n private _arrPopupLayerIds: Array<string>;\r\n private _arrPopupContentFunction: Array<popupCallback>;\r\n private _selectionLayers: Array<Vector>;\r\n\r\n /**\r\n * Definition for openlayers style function\r\n * @callback olStyleFunction\r\n * ¶m feature the openlayers vector feature\r\n * $param\r\n */\r\n\r\n\r\n /**\r\n * map popup constructor\r\n */\r\n constructor() {\r\n super('map popup');\r\n this._arrPopupLayerIds = [];\r\n this._arrPopupLayers = [];\r\n // this._arrPopupOlLayers = [];\r\n this._arrPopupContentFunction = [];\r\n this._$popupContainer = undefined;\r\n this._$popupContent = undefined;\r\n this._$popupCloser = undefined;\r\n this._popupOverlay = undefined;\r\n this._selectionLayers = [];\r\n this._selectionLayerLookup = {};\r\n this._mapClickFunctions = [];\r\n\r\n //let a = function($jqueryContent){console.log($jqueryContent)};\r\n //this._popupChangedLookup = {'a': a};\r\n this._popupChangedFunctions = [];\r\n this._esriMapServiceLayers = [];\r\n\r\n this._popupOpen = false;\r\n this._popupCoordinate = null;\r\n\r\n this._passThroughLayerFeatureArray = [];\r\n\r\n this._currentPopupIndex = -1;\r\n this._popupContentLength = 0;\r\n\r\n }\r\n\r\n /**\r\n * map popup initialization\r\n * @param theMap - the ol map\r\n */\r\n init(theMap: Map) {\r\n super.init(theMap);\r\n\r\n let $map;\r\n let target = this.map.getTarget();\r\n\r\n if (typeof target == 'string') {\r\n $map = $('#' + target);\r\n }\r\n else {\r\n $map = $(target);\r\n }\r\n\r\n $map.append(\r\n '<div class=\"ol-popup\">' +\r\n '<span class=\"ol-popup-closer\">X</span>' +\r\n '<div class=\"popup-content\"></div>' +\r\n '</div>'\r\n );\r\n\r\n this._$popupContainer = $map.find('.ol-popup');\r\n this._$popupContent = $map.find('.popup-content');\r\n this._$popupCloser = $map.find('.ol-popup-closer');\r\n\r\n let _ease = (n: number): number => {\r\n return easing['inAndOut'](n);\r\n };\r\n\r\n\r\n this._popupOverlay = new Overlay({\r\n element: this._$popupContainer[0],\r\n autoPan: true,\r\n autoPanAnimation: {\r\n duration: 250,\r\n source: theMap.getView().getCenter(),\r\n easing: _ease\r\n }\r\n });\r\n\r\n this._map.addOverlay(this._popupOverlay);\r\n\r\n this._$popupCloser.click((evt) => {\r\n this.closePopup();\r\n });\r\n\r\n // display popup on click\r\n this._map.on('singleclick', (evt) => {\r\n\r\n this.closePopup();\r\n this._popupCoordinate = evt['coordinate'] as [number, number];\r\n\r\n // esri map service layers\r\n if (this._esriMapServiceLayers.length > 0) {\r\n\r\n let queryParams = {\r\n geometry: evt['coordinate'].join(','),\r\n geometryType: 'esriGeometryPoint',\r\n layers: 'all',\r\n sr: this._map.getView().getProjection().getCode().split(':')[1],\r\n mapExtent: (this._map.getView().calculateExtent(this._map.getSize()) as number[]).join(','),\r\n imageDisplay: (this._map.getSize() as number[]).join(',') + ',96',\r\n returnGeometry: true,\r\n tolerance: 15,\r\n f: 'pjson'\r\n };\r\n\r\n for (let l of this._esriMapServiceLayers) {\r\n l.getPopupInfo(queryParams);\r\n }\r\n }\r\n\r\n let layerFeatureObjectArray = this._featuresAtPixel(evt['pixel'] as [number, number]);\r\n\r\n this._passThroughLayerFeatureArray = [];\r\n this._currentPopupIndex = -1;\r\n\r\n for (let i = 0; i < layerFeatureObjectArray.length; i++) {\r\n let featObj = layerFeatureObjectArray[i];\r\n\r\n let props = featObj.feature.getProperties();\r\n\r\n let popupContentResponse = this._arrPopupContentFunction[featObj.layerIndex](props, this._$popupContent);\r\n\r\n //skip if return was false\r\n if (popupContentResponse === false) {\r\n //continue;\r\n } else if (typeof popupContentResponse == 'string') {\r\n featObj.popupContent = popupContentResponse as string;\r\n this._passThroughLayerFeatureArray.push(featObj);\r\n } else {\r\n featObj.selectionLayer.getSource().addFeature(featObj.feature);\r\n }\r\n }\r\n\r\n this._popupContentLength = this._passThroughLayerFeatureArray.length;\r\n\r\n this._currentPopupIndex = -1;\r\n\r\n let popupHtml = '<div class=\"ol-popup-nav\">';\r\n popupHtml += '<span class=\"previous-popup ol-popup-nav-arrow\">◀</span>';\r\n popupHtml += '<span class=\"next-popup ol-popup-nav-arrow\">▶</span>';\r\n popupHtml += `<span class=\"current-popup-item-number\" style=\"font-weight: bold;\"></span>`;\r\n popupHtml += `<span> of </span>`;\r\n popupHtml += `<span class=\"popup-content-length\" style=\"font-weight: bold;\">${this._popupContentLength}</span>`;\r\n popupHtml += `<span> - </span>`;\r\n popupHtml += `<span class=\"current-popup-layer-name\"></span>`;\r\n popupHtml += '</div>';\r\n popupHtml += '<div class=\"ol-popup-inner\">';\r\n\r\n popupHtml += '</div>';\r\n\r\n this._$popupContent.html(popupHtml);\r\n\r\n this._$popupContent.find('.previous-popup').click(() => {\r\n if (this._popupContentLength == 1) {\r\n return;\r\n }\r\n\r\n if (this._currentPopupIndex == 0) {\r\n this._currentPopupIndex = this._popupContentLength - 1;\r\n } else {\r\n this._currentPopupIndex--;\r\n }\r\n this._triggerFeatSelect();\r\n });\r\n\r\n let nextPopup = this._$popupContent.find('.next-popup');\r\n\r\n nextPopup.click(() => {\r\n if (this._popupContentLength == 1 && this._currentPopupIndex > -1) {\r\n return;\r\n }\r\n\r\n if (this._currentPopupIndex == this._popupContentLength - 1) {\r\n this._currentPopupIndex = 0;\r\n } else {\r\n this._currentPopupIndex++;\r\n }\r\n this._triggerFeatSelect();\r\n });\r\n\r\n\r\n if (this._popupContentLength > 0) {\r\n nextPopup.trigger('click');\r\n this._popupOverlay.setPosition(this._popupCoordinate);\r\n this._$popupContent.scrollTop(0);\r\n this._popupOpen = true;\r\n }\r\n });\r\n\r\n //change mouse cursor when over marker\r\n this._map.on('pointermove', (evt) => {\r\n\r\n if (evt['dragging']) {\r\n return;\r\n }\r\n let pixel = this.map.getEventPixel(evt['originalEvent']);\r\n\r\n let hit = false;\r\n\r\n this.map.forEachFeatureAtPixel(pixel, (f, l) => {\r\n if (hit) {\r\n return;\r\n }\r\n\r\n for (let vLyr of this._arrPopupLayers){\r\n if (vLyr.olLayer == l){\r\n hit = true;\r\n break;\r\n }\r\n }\r\n });\r\n\r\n let mapElement = this.map.getTargetElement() as HTMLElement;\r\n mapElement.style.cursor = hit ? 'pointer' : '';\r\n });\r\n }\r\n\r\n /**\r\n * helper to select features\r\n * @private\r\n */\r\n _triggerFeatSelect() {\r\n let $currentPopupItemNumber = this._$popupContent.find('.current-popup-item-number');\r\n let $innerPopup = this._$popupContent.find('.ol-popup-inner');\r\n let $layerNameSpan = this._$popupContent.find('.current-popup-layer-name');\r\n this.clearSelection();\r\n let lyrFeatObj = this._passThroughLayerFeatureArray[this._currentPopupIndex];\r\n $currentPopupItemNumber.html((this._currentPopupIndex + 1).toFixed());\r\n $layerNameSpan.html(lyrFeatObj.layerName);\r\n $innerPopup.html(lyrFeatObj.popupContent);\r\n lyrFeatObj.selectionLayer.getSource().addFeature(lyrFeatObj.feature);\r\n for (let f of this._popupChangedFunctions) {\r\n f(this._$popupContent);\r\n }\r\n }\r\n\r\n\r\n /**\r\n *\r\n * @param feature - the ol feature\r\n * @param {LayerEsriMapServer} lyr - the map server layer\r\n * @param {string} popupContent - popup content\r\n * @param {string} esriName - esri layer name\r\n */\r\n addMapServicePopupContent(feature: Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string) {\r\n\r\n let featLayerObject = new FeatureLayerProperties(\r\n feature, lyr, this._popupContentLength, this._selectionLayerLookup[lyr.id], esriName\r\n );\r\n featLayerObject.popupContent = popupContent;\r\n\r\n this._passThroughLayerFeatureArray.push(featLayerObject);\r\n this._popupContentLength++;\r\n\r\n $('.popup-content-length').html(this._popupContentLength.toFixed());\r\n\r\n if (!this._popupOpen) {\r\n this._$popupContent.find('.next-popup').trigger('click');\r\n\r\n this._popupOverlay.setPosition(this._popupCoordinate);\r\n this._$popupContent.scrollTop(0);\r\n this._popupOpen = true;\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param pixel - the ol pixel\r\n * @returns feature layer properties\r\n * @private\r\n */\r\n _featuresAtPixel(pixel: [number, number]): Array<FeatureLayerProperties> {\r\n let layerFeatureObjectArray: FeatureLayerProperties[] = [];\r\n\r\n this.map.forEachFeatureAtPixel(pixel, (feature: Feature, layer: Vector) => {\r\n let hasLyr = false;\r\n\r\n let j;\r\n let lyr = null;\r\n\r\n for (j = 0; j < this._arrPopupLayers.length; j++){\r\n lyr = this._arrPopupLayers[j];\r\n\r\n if (lyr.olLayer === layer){\r\n hasLyr = true;\r\n break;\r\n }\r\n }\r\n\r\n if (hasLyr) {\r\n layerFeatureObjectArray.push(\r\n new FeatureLayerProperties(\r\n feature, lyr, j, this._selectionLayers[j]));\r\n }\r\n });\r\n\r\n return layerFeatureObjectArray;\r\n }\r\n\r\n closePopup() {\r\n this._checkInit();\r\n this._popupOpen = false;\r\n this._popupOverlay.setPosition(undefined);\r\n (this._$popupCloser[0] as HTMLSpanElement).blur();\r\n this.clearSelection();\r\n this._$popupContent.html('');\r\n\r\n return false;\r\n };\r\n\r\n\r\n /**\r\n *\r\n * @param chgFunction - popup change function\r\n */\r\n addPopupChangedFunction(chgFunction: popupChangedFunction) {\r\n this._popupChangedFunctions.push(chgFunction);\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerBase|*} lyr - the layer being acted on\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns the new selection layer\r\n * @private\r\n */\r\n _addPopupLayer(lyr: LayerBaseVector|LayerEsriMapServer, selectionStyle: {color?: string, width?: number, olStyle?: Style}): Vector {\r\n this._checkInit();\r\n\r\n selectionStyle = selectionStyle || {};\r\n selectionStyle.color = selectionStyle.color || 'rgba(255,170,0,0.5)';\r\n selectionStyle.width = selectionStyle.width || 10;\r\n\r\n let theStyle;\r\n\r\n if (selectionStyle.olStyle) {\r\n theStyle = selectionStyle.olStyle;\r\n } else {\r\n theStyle = new Style({\r\n stroke: new Stroke({\r\n color: selectionStyle.color,\r\n width: selectionStyle.width\r\n }),\r\n image: new Circle({\r\n radius: 7,\r\n fill: new Fill({color: selectionStyle.color}),\r\n stroke: new Stroke({color: selectionStyle.color, width: 1})\r\n }),\r\n fill: Fill({\r\n color: selectionStyle.color\r\n })\r\n });\r\n }\r\n\r\n let selectionLayer = new Vector(\r\n {\r\n source: new VectorSource(),\r\n style: theStyle\r\n }\r\n );\r\n\r\n selectionLayer.setZIndex(100);\r\n\r\n this._selectionLayers.push(selectionLayer);\r\n this._selectionLayerLookup[lyr.id] = selectionLayer;\r\n this.map.addLayer(selectionLayer);\r\n\r\n return selectionLayer;\r\n }\r\n\r\n\r\n /**\r\n * Add popup to the map\r\n * @param {LayerBase|*} lyr The layer that the popup with act on\r\n * @param {popupCallback} popupContentFunction - popup content function that makes popup info\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns {object} a reference to the ol selection layer\r\n */\r\n addVectorPopup(lyr: LayerBaseVector, popupContentFunction: popupCallback,\r\n selectionStyle?: {color?: string, width?: number, olStyle?: Style}) {\r\n let selectionLayer = this._addPopupLayer(lyr, selectionStyle);\r\n this._arrPopupLayerIds.push(lyr.id);\r\n this._arrPopupLayers.push(lyr);\r\n // this._arrPopupOlLayers.push(lyr.olLayer);\r\n this._arrPopupContentFunction.push(popupContentFunction);\r\n\r\n return selectionLayer;\r\n };\r\n\r\n\r\n /**\r\n *\r\n * @param {LayerBase} lyr - layer\r\n */\r\n removeVectorPopup(lyr: LayerBaseVector) {\r\n let idx = this._arrPopupLayerIds.indexOf(lyr.id);\r\n\r\n if (idx > -1) {\r\n this._arrPopupLayerIds.splice(idx, 1);\r\n this._arrPopupLayers.splice(idx, 1);\r\n // this._arrPopupOlLayers.splice(idx, 1);\r\n this._arrPopupContentFunction.splice(idx, 1);\r\n this._selectionLayers.splice(idx, 1);\r\n delete this._selectionLayerLookup[lyr.id];\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param {LayerEsriMapServer} lyr - map server layer\r\n * @param {object} [selectionStyle={}] the selection style configuration\r\n * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color\r\n * @param {number} [selectionStyle.width=10] the selection width for linear features\r\n * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function\r\n * @returns {object} a reference to the ol selection layer\r\n */\r\n addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: Style|Style[]) {\r\n let selectionLayer = this._addPopupLayer(lyr, {olStyle: (selectionStyle as Style)});\r\n this._esriMapServiceLayers.push(lyr);\r\n\r\n return selectionLayer;\r\n }\r\n\r\n\r\n clearSelection() {\r\n this._checkInit();\r\n for (let i = 0; i < this._selectionLayers.length; i++) {\r\n this._selectionLayers[i].getSource().clear();\r\n }\r\n for (let f of this._mapClickFunctions) {\r\n f();\r\n }\r\n };\r\n\r\n /**\r\n * Add a function to be called when the map is clicked but before any popups are implemented\r\n * @param {function} func - the map click function\r\n */\r\n addMapClickFunction(func: Function) {\r\n this._mapClickFunctions.push(func);\r\n }\r\n}\r\nnm.MapPopupCls = MapPopupCls;\r\nexport default MapPopupCls;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/mapToBase64.d.ts b/dist/olHelpers/mapToBase64.d.ts index cd8b52f..9215d62 100644 --- a/dist/olHelpers/mapToBase64.d.ts +++ b/dist/olHelpers/mapToBase64.d.ts @@ -1,5 +1,5 @@ -import ol = require('custom-ol'); -import { LayerBaseVector } from "../layers/LayerBaseVector"; +import { LayerBaseVector } from "../layers"; +import Map from 'ol/Map'; export interface iMapToBase64Options { resize?: { width: number; @@ -8,12 +8,5 @@ export interface iMapToBase64Options { layers?: LayerBaseVector[] | LayerBaseVector[]; delay?: number; } -/** - * - * @param {ol.Map} map - * @param {(imgData) => string} callback - * @param {iMapToBase64Options} options - * @returns {any} - */ -export declare function mapToBase64(map: ol.Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any; +export declare function mapToBase64(map: Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any; export default mapToBase64; diff --git a/dist/olHelpers/mapToBase64.js b/dist/olHelpers/mapToBase64.js index 3eae5f9..b2da64e 100644 --- a/dist/olHelpers/mapToBase64.js +++ b/dist/olHelpers/mapToBase64.js @@ -1,13 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var extentUtil_1 = require("../olHelpers/extentUtil"); -/** - * - * @param {ol.Map} map - * @param {(imgData) => string} callback - * @param {iMapToBase64Options} options - * @returns {any} - */ function mapToBase64(map, callback, options) { options = options || {}; if (typeof options.delay === 'number') { diff --git a/dist/olHelpers/mapToBase64.js.map b/dist/olHelpers/mapToBase64.js.map index 7a1535f..672631e 100644 --- a/dist/olHelpers/mapToBase64.js.map +++ b/dist/olHelpers/mapToBase64.js.map @@ -1 +1 @@ -{"version":3,"file":"mapToBase64.js","sourceRoot":"","sources":["../../src/olHelpers/mapToBase64.ts"],"names":[],"mappings":";;AAEA,sDAAiD;AAYjD;;;;;;GAMG;AACH,qBAA4B,GAAW,EAAE,QAAkC,EAAE,OAA6B;IACtG,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;QACnC,MAAM;KACT;SAAM,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;QACzC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;KACxB;SAAM;QACH,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;KACrB;IAED,IAAI,SAAS,GAAmB,GAAG,CAAC,gBAAgB,EAAoB,CAAC;IAEzE,IAAI,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;IAC5C,IAAI,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1C,IAAI,gBAAgB,GAAG,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;IAChD,IAAI,cAAc,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,C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AAG,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;qBACvC;oBAED,IAAI,OAAO,CAAC,MAAM,EAAE;wBAChB,qBAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;qBACjC;iBACJ;YACL,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,UAAU,EAAE,CAAC;QACrB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,UAAU,EAAE,CAAC;AACrB,CAAC;AAjED,kCAiEC;AAED,kBAAe,WAAW,CAAC","sourcesContent":["import ol = require('custom-ol');\r\nimport {LayerBaseVector} from \"../layers/LayerBaseVector\";\r\nimport {fitToMap} from '../olHelpers/extentUtil';\r\nimport {layers} from \"../\";\r\n\r\ndeclare const glob: Object;\r\n\r\nexport interface iMapToBase64Options {\r\n resize?: { width: number, height: number };\r\n layers?: LayerBaseVector[] | LayerBaseVector[];\r\n delay?: number;\r\n}\r\n\r\n\r\n/**\r\n *\r\n * @param {ol.Map} map\r\n * @param {(imgData) => string} callback\r\n * @param {iMapToBase64Options} options\r\n * @returns {any}\r\n */\r\nexport function mapToBase64(map: ol.Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any {\r\n options = options || {};\r\n\r\n if (typeof options.delay === 'number') {\r\n //pass\r\n } else if (options.layers || options.resize) {\r\n options.delay = 2000;\r\n } else {\r\n options.delay = 1;\r\n }\r\n\r\n let mapTarget: HTMLDivElement = map.getTargetElement() as HTMLDivElement;\r\n\r\n let originalHeight = mapTarget.style.height;\r\n let originalWidth = mapTarget.style.width;\r\n let originalPosition = mapTarget.style.position;\r\n let originalCenter = map.getView().getCenter();\r\n let originalZoom = map.getView().getZoom();\r\n\r\n // let mapTimeout = 1;\r\n\r\n if (options.resize) {\r\n mapTarget.style.height = `${options.resize.height}px`;\r\n mapTarget.style.width = `${options.resize.width}px`;\r\n mapTarget.style.position = 'absolute';\r\n map.updateSize();\r\n }\r\n\r\n map.once('postrender', () => {\r\n\r\n if (options.layers) {\r\n fitToMap(options.layers, map);\r\n }\r\n\r\n setTimeout(() => {\r\n map.once('postcompose', (event) => {\r\n try {\r\n let canvas: HTMLCanvasElement = event['context'].canvas;\r\n let imgData = canvas.toDataURL('image/png');\r\n callback(imgData);\r\n }\r\n catch (ex) {\r\n console.log(ex);\r\n // reportParams['imgData'] = null;\r\n } finally {\r\n if (options.resize) {\r\n mapTarget.style.height = originalHeight;\r\n mapTarget.style.width = originalWidth;\r\n mapTarget.style.position = originalPosition;\r\n\r\n map.updateSize();\r\n map.getView().setCenter(originalCenter);\r\n map.getView().setZoom(originalZoom);\r\n }\r\n\r\n if (options.layers) {\r\n fitToMap(options.layers, map);\r\n }\r\n }\r\n });\r\n map.renderSync();\r\n }, options.delay);\r\n });\r\n\r\n map.updateSize();\r\n}\r\n\r\nexport default mapToBase64;\r\n"]} \ No newline at end of file +{"version":3,"file":"mapToBase64.js","sourceRoot":"","sources":["../../src/olHelpers/mapToBase64.ts"],"names":[],"mappings":";;AACA,sDAAiD;AAcjD,qBAA4B,GAAQ,EAAE,QAAkC,EAAE,OAA6B;IACnG,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;QACnC,MAAM;KACT;SAAM,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;QACzC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;KACxB;SAAM;QACH,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;KACrB;IAED,IAAI,SAAS,GAAmB,GAAG,CAAC,gBAAgB,EAAoB,CAAC;IAEzE,IAAI,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;IAC5C,IAAI,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1C,IAAI,gBAAgB,GAAG,SAAS,CAAC,KAAK,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AAE,CAAC;wBACjB,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;wBACxC,GAAG,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;qBACvC;oBAED,IAAI,OAAO,CAAC,MAAM,EAAE;wBAChB,qBAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;qBACjC;iBACJ;YACL,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,UAAU,EAAE,CAAC;QACrB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,UAAU,EAAE,CAAC;AACrB,CAAC;AAjED,kCAiEC;AAED,kBAAe,WAAW,CAAC","sourcesContent":["import {LayerBaseVector} from \"../layers\";\r\nimport {fitToMap} from '../olHelpers/extentUtil';\r\nimport {layers} from \"../\";\r\nimport Map from 'ol/Map';\r\n\r\ndeclare const glob: Object;\r\n\r\nexport interface iMapToBase64Options {\r\n resize?: { width: number, height: number };\r\n layers?: LayerBaseVector[] | LayerBaseVector[];\r\n delay?: number;\r\n}\r\n\r\n\r\n\r\nexport function mapToBase64(map: Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any {\r\n options = options || {};\r\n\r\n if (typeof options.delay === 'number') {\r\n //pass\r\n } else if (options.layers || options.resize) {\r\n options.delay = 2000;\r\n } else {\r\n options.delay = 1;\r\n }\r\n\r\n let mapTarget: HTMLDivElement = map.getTargetElement() as HTMLDivElement;\r\n\r\n let originalHeight = mapTarget.style.height;\r\n let originalWidth = mapTarget.style.width;\r\n let originalPosition = mapTarget.style.position;\r\n let originalCenter = map.getView().getCenter();\r\n let originalZoom = map.getView().getZoom();\r\n\r\n // let mapTimeout = 1;\r\n\r\n if (options.resize) {\r\n mapTarget.style.height = `${options.resize.height}px`;\r\n mapTarget.style.width = `${options.resize.width}px`;\r\n mapTarget.style.position = 'absolute';\r\n map.updateSize();\r\n }\r\n\r\n map.once('postrender', () => {\r\n\r\n if (options.layers) {\r\n fitToMap(options.layers, map);\r\n }\r\n\r\n setTimeout(() => {\r\n map.once('postcompose', (event) => {\r\n try {\r\n let canvas: HTMLCanvasElement = event['context'].canvas;\r\n let imgData = canvas.toDataURL('image/png');\r\n callback(imgData);\r\n }\r\n catch (ex) {\r\n console.log(ex);\r\n // reportParams['imgData'] = null;\r\n } finally {\r\n if (options.resize) {\r\n mapTarget.style.height = originalHeight;\r\n mapTarget.style.width = originalWidth;\r\n mapTarget.style.position = originalPosition;\r\n\r\n map.updateSize();\r\n map.getView().setCenter(originalCenter);\r\n map.getView().setZoom(originalZoom);\r\n }\r\n\r\n if (options.layers) {\r\n fitToMap(options.layers, map);\r\n }\r\n }\r\n });\r\n map.renderSync();\r\n }, options.delay);\r\n });\r\n\r\n map.updateSize();\r\n}\r\n\r\nexport default mapToBase64;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/projections.d.ts b/dist/olHelpers/projections.d.ts index d4978d5..47c389b 100644 --- a/dist/olHelpers/projections.d.ts +++ b/dist/olHelpers/projections.d.ts @@ -1,7 +1,7 @@ /** * Created by gavorhes on 10/3/2016. */ -import ol = require('custom-ol'); -export declare const proj4326: ol.proj.Projection; -export declare const proj3857: ol.proj.Projection; -export declare const proj3070: ol.proj.Projection; +import Projection from 'ol/proj/Projection'; +export declare const proj4326: Projection; +export declare const proj3857: Projection; +export declare const proj3070: Projection; diff --git a/dist/olHelpers/projections.js b/dist/olHelpers/projections.js index 3ba10d2..9ab9d7f 100644 --- a/dist/olHelpers/projections.js +++ b/dist/olHelpers/projections.js @@ -1,10 +1,10 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /** * Created by gavorhes on 10/3/2016. */ -var ol = require("custom-ol"); -exports.proj4326 = new ol.proj.Projection({ code: 'EPSG:4326' }); -exports.proj3857 = new ol.proj.Projection({ code: 'EPSG:3857' }); -exports.proj3070 = new ol.proj.Projection({ code: 'EPSG:3070' }); +Object.defineProperty(exports, "__esModule", { value: true }); +var Projection_1 = require("ol/proj/Projection"); +exports.proj4326 = new Projection_1.default({ code: 'EPSG:4326' }); +exports.proj3857 = new Projection_1.default({ code: 'EPSG:3857' }); +exports.proj3070 = new Projection_1.default({ code: 'EPSG:3070' }); //# sourceMappingURL=projections.js.map \ No newline at end of file diff --git a/dist/olHelpers/projections.js.map b/dist/olHelpers/projections.js.map index e821223..ccb51f3 100644 --- a/dist/olHelpers/projections.js.map +++ b/dist/olHelpers/projections.js.map @@ -1 +1 @@ -{"version":3,"file":"projections.js","sourceRoot":"","sources":["../../src/olHelpers/projections.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,8BAAiC;AAGpB,QAAA,QAAQ,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;AACvD,QAAA,QAAQ,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;AACvD,QAAA,QAAQ,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 10/3/2016.\r\n */\r\nimport ol = require('custom-ol');\r\n\r\n\r\nexport const proj4326 = new ol.proj.Projection({code: 'EPSG:4326'});\r\nexport const proj3857 = new ol.proj.Projection({code: 'EPSG:3857'});\r\nexport const proj3070 = new ol.proj.Projection({code: 'EPSG:3070'});\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"projections.js","sourceRoot":"","sources":["../../src/olHelpers/projections.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,iDAA4C;AAG/B,QAAA,QAAQ,GAAG,IAAI,oBAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;AAC/C,QAAA,QAAQ,GAAG,IAAI,oBAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;AAC/C,QAAA,QAAQ,GAAG,IAAI,oBAAU,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 10/3/2016.\r\n */\r\n\r\nimport Projection from 'ol/proj/Projection';\r\n\r\n\r\nexport const proj4326 = new Projection({code: 'EPSG:4326'});\r\nexport const proj3857 = new Projection({code: 'EPSG:3857'});\r\nexport const proj3070 = new Projection({code: 'EPSG:3070'});\r\n\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/propertiesZoomStyle.d.ts b/dist/olHelpers/propertiesZoomStyle.d.ts index 0eec031..f6978c4 100644 --- a/dist/olHelpers/propertiesZoomStyle.d.ts +++ b/dist/olHelpers/propertiesZoomStyle.d.ts @@ -1,7 +1,8 @@ /** * Created by gavorhes on 12/14/2015. */ -import ol = require('custom-ol'); +import Feature from 'ol/Feature'; +import Style from 'ol/style/Style'; /** * A style function based on properties and zoom level, wraps normal feature, resolution function * @callback propertiesZoomStyle @@ -14,5 +15,5 @@ import ol = require('custom-ol'); * @param {propertiesZoomStyle|*} styleFunc - style function * @returns {function|*} new function */ -declare function propertiesZoomStyle(styleFunc: (f: ol.Feature, res: number) => ol.style.Style | ol.style.Style[]): (feature: ol.Feature, zoom: number) => ol.style.Style | ol.style.Style[]; +declare function propertiesZoomStyle(styleFunc: (f: Feature, res: number) => Style | Style[]): (feature: Feature, zoom: number) => Style | Style[]; export default propertiesZoomStyle; diff --git a/dist/olHelpers/propertiesZoomStyle.js.map b/dist/olHelpers/propertiesZoomStyle.js.map index 3937e84..42b5e1b 100644 --- a/dist/olHelpers/propertiesZoomStyle.js.map +++ b/dist/olHelpers/propertiesZoomStyle.js.map @@ -1 +1 @@ -{"version":3,"file":"propertiesZoomStyle.js","sourceRoot":"","sources":["../../src/olHelpers/propertiesZoomStyle.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,2CAAsC;AACtC,+DAAiE;AAEjE,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAGhC;;;;;;GAMG;AAEH;;;;GAIG;AACH,6BAA6B,SAA0E;IAGnG,OAAO,UAAU,OAAmB,EAAE,IAAY;QAC9C,OAAO,SAAS,CAAC,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;AACN,CAAC;AAED,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC7C,kBAAe,mBAAmB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/14/2015.\r\n */\r\n\r\nimport provide from '../util/provide';\r\nimport * as zoomResolutionConvert from './zoomResolutionConvert';\r\nimport ol = require('custom-ol');\r\nconst nm = provide('olHelpers');\r\n\r\n\r\n/**\r\n * A style function based on properties and zoom level, wraps normal feature, resolution function\r\n * @callback propertiesZoomStyle\r\n * @param {object} properties the feature properties\r\n * @param {number} zoom level\r\n *\r\n */\r\n\r\n/**\r\n * wrapper to define a style function by properties and zoom level\r\n * @param {propertiesZoomStyle|*} styleFunc - style function\r\n * @returns {function|*} new function\r\n */\r\nfunction propertiesZoomStyle(styleFunc: (f: ol.Feature, res: number) => ol.style.Style|ol.style.Style[]):\r\n(feature: ol.Feature, zoom: number) => ol.style.Style|ol.style.Style[]\r\n{\r\n return function (feature: ol.Feature, zoom: number): ol.style.Style|ol.style.Style[] {\r\n return styleFunc(feature, zoomResolutionConvert.zoomToResolution(zoom));\r\n };\r\n}\r\n\r\nnm.propertiesZoomStyle = propertiesZoomStyle;\r\nexport default propertiesZoomStyle;\r\n"]} \ No newline at end of file +{"version":3,"file":"propertiesZoomStyle.js","sourceRoot":"","sources":["../../src/olHelpers/propertiesZoomStyle.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,2CAAsC;AACtC,+DAAiE;AAGjE,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAGhC;;;;;;GAMG;AAEH;;;;GAIG;AACH,6BAA6B,SAAqD;IAG9E,OAAO,UAAU,OAAgB,EAAE,IAAY;QAC3C,OAAO,SAAS,CAAC,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC;AACN,CAAC;AAED,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC7C,kBAAe,mBAAmB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/14/2015.\r\n */\r\n\r\nimport provide from '../util/provide';\r\nimport * as zoomResolutionConvert from './zoomResolutionConvert';\r\nimport Feature from 'ol/Feature';\r\nimport Style from 'ol/style/Style';\r\nconst nm = provide('olHelpers');\r\n\r\n\r\n/**\r\n * A style function based on properties and zoom level, wraps normal feature, resolution function\r\n * @callback propertiesZoomStyle\r\n * @param {object} properties the feature properties\r\n * @param {number} zoom level\r\n *\r\n */\r\n\r\n/**\r\n * wrapper to define a style function by properties and zoom level\r\n * @param {propertiesZoomStyle|*} styleFunc - style function\r\n * @returns {function|*} new function\r\n */\r\nfunction propertiesZoomStyle(styleFunc: (f: Feature, res: number) => Style|Style[]):\r\n(feature: Feature, zoom: number) => Style|Style[]\r\n{\r\n return function (feature: Feature, zoom: number): Style|Style[] {\r\n return styleFunc(feature, zoomResolutionConvert.zoomToResolution(zoom));\r\n };\r\n}\r\n\r\nnm.propertiesZoomStyle = propertiesZoomStyle;\r\nexport default propertiesZoomStyle;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/quickMap.d.ts b/dist/olHelpers/quickMap.d.ts index 3c7d747..32bcaf2 100644 --- a/dist/olHelpers/quickMap.d.ts +++ b/dist/olHelpers/quickMap.d.ts @@ -2,7 +2,7 @@ * Created by gavorhes on 12/15/2015. */ import { quickMapOptions } from './quickMapBase'; -import ol = require('custom-ol'); +import Map from 'ol/Map'; export { quickMapOptions } from './quickMapBase'; /** * Sets up a map with some default parameters and initializes @@ -20,5 +20,5 @@ export { quickMapOptions } from './quickMapBase'; * @param {boolean} [options.fullScreen=false] if add base map switcher * @returns {ol.Map} the ol map */ -export declare function quickMap(options?: quickMapOptions): ol.Map; +export declare function quickMap(options?: quickMapOptions): Map; export default quickMap; diff --git a/dist/olHelpers/quickMap.js.map b/dist/olHelpers/quickMap.js.map index dd0e39b..0f4b7b8 100644 --- a/dist/olHelpers/quickMap.js.map +++ b/dist/olHelpers/quickMap.js.map @@ -1 +1 @@ -{"version":3,"file":"quickMap.js","sourceRoot":"","sources":["../../src/olHelpers/quickMap.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,+CAA6D;AAC7D,2CAAsC;AACtC,qCAAgC;AAChC,uCAAkC;AAElC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAI9B;;;;;;;;;;;;;;;GAeG;AACH,kBAAyB,OAA8B;IAA9B,wBAAA,EAAA,YAA8B;IACnD,IAAI,CAAC,GAAG,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,kBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,CAAC;AACb,CAAC;AALD,4BAKC;AAGD,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACvB,kBAAe,QAAQ,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/15/2015.\r\n */\r\n\r\nimport {quickMapOptions, quickMapBase} from './quickMapBase';\r\nimport provide from '../util/provide';\r\nimport mapMove from './mapMove';\r\nimport mapPopup from './mapPopup';\r\nimport ol = require('custom-ol');\r\nlet nm = provide('olHelpers');\r\n\r\nexport {quickMapOptions} from './quickMapBase';\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param {object} [options={}] config options\r\n * @param {string} [options.divId=map] map div id\r\n * @param {object} [options.center={}] center config object\r\n * @param {number} [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param {number} [options.center.y=5574910] center y, web mercator y or lat\r\n * @param {number} [options.zoom=7] zoom level\r\n * @param {number} [options.minZoom=undefined] min zoom\r\n * @param {number} [options.maxZoom=undefined] max zoom\r\n * @param {boolean} [options.baseSwitcher=true] if add base map switcher\r\n * @param {boolean} [options.fullScreen=false] if add base map switcher\r\n * @returns {ol.Map} the ol map\r\n */\r\nexport function quickMap(options : quickMapOptions = {}): ol.Map {\r\n let m = quickMapBase(options);\r\n mapMove.init(m);\r\n mapPopup.init(m);\r\n return m;\r\n}\r\n\r\n\r\nnm.quickMap = quickMap;\r\nexport default quickMap;\r\n"]} \ No newline at end of file +{"version":3,"file":"quickMap.js","sourceRoot":"","sources":["../../src/olHelpers/quickMap.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,+CAA6D;AAC7D,2CAAsC;AACtC,qCAAgC;AAChC,uCAAkC;AAClC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAK9B;;;;;;;;;;;;;;;GAeG;AACH,kBAAyB,OAA8B;IAA9B,wBAAA,EAAA,YAA8B;IACnD,IAAI,CAAC,GAAG,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,kBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,CAAC;AACb,CAAC;AALD,4BAKC;AAGD,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACvB,kBAAe,QAAQ,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/15/2015.\r\n */\r\n\r\nimport {quickMapOptions, quickMapBase} from './quickMapBase';\r\nimport provide from '../util/provide';\r\nimport mapMove from './mapMove';\r\nimport mapPopup from './mapPopup';\r\nlet nm = provide('olHelpers');\r\nimport Map from 'ol/Map';\r\n\r\nexport {quickMapOptions} from './quickMapBase';\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param {object} [options={}] config options\r\n * @param {string} [options.divId=map] map div id\r\n * @param {object} [options.center={}] center config object\r\n * @param {number} [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param {number} [options.center.y=5574910] center y, web mercator y or lat\r\n * @param {number} [options.zoom=7] zoom level\r\n * @param {number} [options.minZoom=undefined] min zoom\r\n * @param {number} [options.maxZoom=undefined] max zoom\r\n * @param {boolean} [options.baseSwitcher=true] if add base map switcher\r\n * @param {boolean} [options.fullScreen=false] if add base map switcher\r\n * @returns {ol.Map} the ol map\r\n */\r\nexport function quickMap(options : quickMapOptions = {}): Map {\r\n let m = quickMapBase(options);\r\n mapMove.init(m);\r\n mapPopup.init(m);\r\n return m;\r\n}\r\n\r\n\r\nnm.quickMap = quickMap;\r\nexport default quickMap;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/quickMapBase.d.ts b/dist/olHelpers/quickMapBase.d.ts index 0c32bde..e4b66d3 100644 --- a/dist/olHelpers/quickMapBase.d.ts +++ b/dist/olHelpers/quickMapBase.d.ts @@ -1,7 +1,7 @@ /** * Created by gavorhes on 12/15/2015. */ -import ol = require('custom-ol'); +import Map from 'ol/Map'; export interface quickMapOptions { divId?: string; center?: { @@ -32,5 +32,5 @@ export interface quickMapOptions { * @param [options.fullScreen=false] if add base map switcher * @returns the ol map */ -export declare function quickMapBase(options?: quickMapOptions): ol.Map; +export declare function quickMapBase(options?: quickMapOptions): Map; export default quickMapBase; diff --git a/dist/olHelpers/quickMapBase.js b/dist/olHelpers/quickMapBase.js index 42f7950..02ec8df 100644 --- a/dist/olHelpers/quickMapBase.js +++ b/dist/olHelpers/quickMapBase.js @@ -4,7 +4,16 @@ */ Object.defineProperty(exports, "__esModule", { value: true }); var provide_1 = require("../util/provide"); -var ol = require("custom-ol"); +var Map_1 = require("ol/Map"); +var Tile_1 = require("ol/layer/Tile"); +var OSM_1 = require("ol/source/OSM"); +var Point_1 = require("ol/geom/Point"); +var Projection_1 = require("ol/proj/Projection"); +var View_1 = require("ol/View"); +var control_1 = require("ol/control"); +var Fullscreen_1 = require("ol/control/Fullscreen"); +var proj = require("ol/proj"); +// import ol = require('custom-ol'); var $ = require("jquery"); var geocode_1 = require("./geocode"); var nm = provide_1.default('olHelpers'); @@ -35,7 +44,7 @@ function quickMapBase(options) { options.addOsm = typeof options.addOsm === 'undefined' ? true : options.addOsm; var $mapDiv = $('#' + options.divId); $mapDiv.css('position', 'relative'); - var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); + var osmLayer = new Tile_1.default({ source: new OSM_1.default() }); // let satLayer = new ol.layer.Tile({visible: false, source: new ol.source.MapQuest({layer: 'sat'})}); var osmCss = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAADQ1NDk5OURFREtLS1FHSFlZWGJRVGJiYWdmZWxsbHRmaXBpanN0c3V0dHp5eX5+fIVzd4F3eeV0jud5juZ8k4aHhomHhoyGh5eGj5OVlJiVlZiYl5qZmJydnKOTlaKZmqKdnaOioaqqqKuzsbOvrrSysLa3tbW4uLm6ub27ub+/vbGXwbCZwbCgxLKlxrOqyLStybO3yrSxyrWzzbW2y7a1zbK4y7W6zbW8y760yrTAzbTFzrPKzrLOzrTJzrTOzr7CwbXC0LXK0LTO0L3I0bPQz7TQz7PS0bXQ0LnR0brW1bzT0r7U077V1Lzc2dqNqteUsdyXscaquuOHneaGmueHnOeJnuiBleiKn+eNoOiOoOWUpOiRo+iSpeiUpeqYpumaqOmdrPSynemgruSqtOmisOmlsuuqtequuOW1vOuxu+uxvOq1ve+xvPK0pvW3o/W5pfO5qvS7qfCwvMOuwc2/wNenxNyyzNe/0Nq31Nq51dy72Oy3wOu4wOu+xey4wO+6xO2+xfTAr/TCsvfFtPHLvvTJuMPDwMfHxcXKyc3DxMvFyMvLyM3PzcDV08DV1MTX1cbY1s7X1sjZ1sra2Mnd3M7b2c7c2tfH1tnB1t7F2d7M29fX1tLY1tDd2tHe3NTf3NnS19rZ1tva2Nnf3t3d28rh3tXg3Nnh3tzj393k39ni4N7k4N7n5uXDyOfLz+zAxu3CyOzEyezKzeDJ3eLM3uvP0u3P0ePf2+7R0u7Q1u/U0+7U1ezc0+7a2e/d2+3f3vbFzvLOwfHN0PPQw/TUx/LWyvLYzPDQ1fPe0ubc4vve4uHh3+nh3+/h2u/h3vHj2vHl3uHm4eTn4uDp5ebo4+Xo5ODq6ebq6OTv6+nl4+/j4O7l4e7n5ujp4+np5Ozq5e7s5urt6O7t6Orw6u7x6u3x7vPj5PDl4fDo4vDq5fDt5vDu6PDv7PTv6fDx6vHx7fH17fXw6fXy7fb07/bz8fT18vn38vr39fr48/r59Pr6+P3++//+/gAAALNTSk0AAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjlsM35OAAAFNElEQVRIS1VVCZxVUxi/9l0UIUT2bMnY43bVI2c0Y01kSWIaS0j2JEtkN41piomZrPPKQ2aQ7JKImOZlnm2493TJzDufuU1Zi+v/fee+mZ//793vnPOd7zvfes5zDBEZkBBjAcIjb+Iiotqgdhat8AMK0vl7/R9N7GiWtshqIr+EZ5gYKibyUsXY1l/mfFpssvUlWQ0FkU3gy4+RB/+kwYcO8pRSnldcOU/r2lAHARSwk2ORgEmOdC1EsuRiYSqMPwwroMIraZk5V2fYJQjCKfZrRmh3gSAZi2i4b7wSylWu8EqZwS59JkFUaW96JbNSc+CEUmt4rorwuZmWdDaoc+uZETuQlTCU5xYzR7muUnVUVo+BcRhre/VwUpasgJwhH7JkYIYA0sNxhmCwUK+lw6vCKBZehw01dEiyw4Q4aE0Z4ahDhKaFQsGnJ2BgqKoTBsNjFy0SlW6whRAZTdm8DB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ramRfQmJlQ2FhSWFlSWFlTmVlSWRmTGFoQWFpRWFsRmVpRWVtRmNsSmtlRGpqRmpsS2BmWGRsUmFrW2ptUmZyR2RxTGpxTWVyU2RyW2d5V2tzUmt0WW15VG15WXFuTHNtVnFxTXF4T3h0TnJzUnJ1XHJ4VXN6Wnp0VHx1W315VXp8XGR0YGx0YHVzZXJ0aHR9ZXV+aHl9YHOCXXqBXXeCYHyCY3iEaHyIYn+JaXqKcYB5WIN6Y4SCXoCDZIGEaYCIZoOLa4iCaImJbIOOdYuMco6OeIuVcpOKbZKPc5aQb5eXe5ufg6KjhAAAAAAAAAAAAAAAAOGCeQgAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjlsM35OAAAH80lEQVRISy1WbXQUVxm+6wqnk3Zmpxl2FG2EGg92C8GDlWptVTwa+uF3xcKmDfFzCUzDsJNsunXipglJXJbrtJWmwZNSnHD3jojRgUIm2UumIZ0JZ7JByrALbMWW0IBW8aRa4+cf76TeX3Nm3uc+z/s+7/vugl4r/aMTrT4e1pPTqnnmJNn5AyUzRnrRle/qE33dsvrBtAQVoxtpZNK3zSzYjUjviWO2Ag+R77dl7W36n/1Ep9KBPG/S+Py0PkjU/gPKQGqwTHryiWYFAXSvMairsio7SjyNsnCzh0qKImV9/7mhfHQZx2yN1O+7rXUm33MUPaboOkAJHaoIdXfJj2xWeyD8jMFEXkvIu5qzpU988gWB5zl+GS+sFe55trEVPdWZB2miq8bBVkNFO2R0qnrfkiXhcJhtDNXE6tbW97/s9O9/7ZfVhx86/CwrROpfvvxboMqeLsuqPr1j44qEwDNMOBximUiYoU8sw7BC/a7T72uEnyJDlGxZ9KcglZRyuqqrv/tSZErgOI4NgRBTIw9EmHAoFGZZnp6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vW/wBNTwU+CfUQAQAAAABJRU5ErkJggg==')"; @@ -62,23 +71,25 @@ function quickMapBase(options) { throw 'zoom out of range'; } if (options.center.x >= -180 && options.center.x <= 180 && options.center.y >= -90 && options.center.y <= 90) { - var p = new ol.geom.Point([options.center.x, options.center.y]); - new ol.proj.Projection({ code: "EPSG:4326" }); - p.transform(new ol.proj.Projection({ code: "EPSG:4326" }), new ol.proj.Projection({ code: "EPSG:3857" })); - var coordinates = p.getCoordinates(); + var p = new Point_1.default([options.center.x, options.center.y]); + // new Projection({code: "EPSG:4326"}); + // let coordinates = transform(p.getCoordinates(), "EPSG:4326", "EPSG:3857"); + // p.transform(new Projection({code: "EPSG:4326"}), new Projection({code: "EPSG:3857"})); + // let coordinates = p.getCoordinates(); + var coordinates = proj['transform'](p.getCoordinates(), new Projection_1.default({ code: "EPSG:4326" }), new Projection_1.default({ code: "EPSG:3857" })); options.center.x = coordinates[0]; options.center.y = coordinates[1]; } - var controls = ol.control.defaults({ + var controls = control_1.default.defaults({ attributionOptions: { collapsible: false } }); - var view = new ol.View({ + var view = new View_1.default({ center: [options.center.x, options.center.y], zoom: options.zoom, minZoom: options.minZoom, maxZoom: options.maxZoom }); - var map = new ol.Map({ + var map = new Map_1.default({ layers: [], target: options.divId, controls: controls, @@ -88,7 +99,7 @@ function quickMapBase(options) { map.addLayer(osmLayer); } if (options.fullScreen) { - map.addControl(new ol.control.FullScreen({})); + map.addControl(new Fullscreen_1.default({})); } if (options.addGeocode) { new geocode_1.Geocode(document.getElementById(options.divId), map); diff --git a/dist/olHelpers/quickMapBase.js.map b/dist/olHelpers/quickMapBase.js.map index 8604aa1..3c6745f 100644 --- a/dist/olHelpers/quickMapBase.js.map +++ b/dist/olHelpers/quickMapBase.js.map @@ -1 +1 @@ -{"version":3,"file":"quickMapBase.js","sourceRoot":"","sources":["../../src/olHelpers/quickMapBase.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;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on 12/15/2015.\r\n */\r\n\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {Geocode} from './geocode';\r\nconst nm = provide('olHelpers');\r\n\r\nexport interface quickMapOptions {\r\n divId?: string;\r\n center?: {x: number, y: number};\r\n zoom?: number;\r\n minZoom?: number;\r\n maxZoom?: number;\r\n baseSwitcher?: boolean;\r\n fullScreen?: boolean;\r\n addGeocode?: boolean;\r\n addOsm?: boolean\r\n}\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param [options={}] config options\r\n * @param [options.divId=map] map div id\r\n * @param [options.center={}] center config object\r\n * @param [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param [options.center.y=5574910] center y, web mercator y or lat\r\n * @param [options.zoom=7] zoom level\r\n * @param [options.minZoom=undefined] min zoom\r\n * @param [options.maxZoom=undefined] max zoom\r\n * @param [options.baseSwitcher=true] if add base map switcher\r\n * @param [options.fullScreen=false] if add base map switcher\r\n * @returns the ol map\r\n */\r\nexport function quickMapBase(options: quickMapOptions = {}): ol.Map {\r\n options.divId = options.divId || 'map';\r\n options.center = options.center || {x: -10018378, y: 5574910};\r\n options.zoom = typeof options.zoom == 'number' ? options.zoom : 7;\r\n options.baseSwitcher = typeof options.baseSwitcher == 'boolean' ? options.baseSwitcher : true;\r\n options.fullScreen = typeof options.fullScreen == 'boolean' ? options.fullScreen : false;\r\n options.addGeocode = options.addGeocode || false;\r\n options.addOsm = typeof options.addOsm === 'undefined' ? true : options.addOsm;\r\n\r\n\r\n let $mapDiv = $('#' + options.divId);\r\n $mapDiv.css('position', 'relative');\r\n\r\n let osmLayer = new ol.layer.Tile({source: new ol.source.OSM()});\r\n // let satLayer = new ol.layer.Tile({visible: false, source: new ol.source.MapQuest({layer: 'sat'})});\r\n\r\n let osmCss = \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs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AdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjlsM35OAAAFNElEQVRIS1VVCZxVUxi/9l0UIUT2bMnY43bVI2c0Y01kSWIaS0j2JEtkN41piomZrPPKQ2aQ7JKImOZlnm2493TJzDufuU1Zi+v/fee+mZ//793vnPOd7zvfes5zDBEZkBBjAcIjb+Iiotqgdhat8AMK0vl7/R9N7GiWtshqIr+EZ5gYKibyUsXY1l/mfFpssvUlWQ0FkU3gy4+RB/+kwYcO8pRSnldcOU/r2lAHARSwk2ORgEmOdC1EsuRiYSqMPwwroMIraZk5V2fYJQjCKfZrRmh3gSAZi2i4b7wSylWu8EqZwS59JkFUaW96JbNSc+CEUmt4rorwuZmWdDaoc+uZETuQlTCU5xYzR7muUnVUVo+BcRhre/VwUpasgJwhH7JkYIYA0sNxhmCwUK+lw6vCKBZehw01dEiyw4Q4aE0Z4ahDhKaFQsGnJ2BgqKoTBsNjFy0SlW6whRAZTdm8DBJmkBZhDi1j4xJQBk6ywrWUTymaCxac8lROcdauRGzQSNtA7EHUYhXyEwhhgjFUqRuO+rauhF1awFpzCsmwUbjIFBR0u1bKtyGpulW/H/cVVzkyGaIWTIR9pFAV6GK2gPMXMX8gPk9zzxXgI1kimcAltEYr+cjio1imlKpEa9rOipLm+p+CZ6Bw//qd1/f/O+GwMxbSLpyoZEcwkyh2jIks+3hmdd2jWUw4scxNysnHxU7nSspTRcJjCZGL3IsjsYJMMg5mwgx7gaIOLBFCogAgBBoNa9w+DE6I+Bs7FTgwwrJbHjWDgpYo2KwtBTcYEDuloC9geQw+k2RGnPGpTaOlq7AS+YICUz4DZVaX2TiNDhuYfTtY4geLi0IoCm3XccwM9hx4kU28StQEljDs3ZEpFGA+8dKzLmV9ymIwF5FO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GgkTFQoVGQsZFAwZHBMeDhIbFBEbHAwWIA4bIREcIQ4hCQwjFw4lHBgkDB8sDxUiExIiGhAoGxohFRshGRorHQcrKQsiIQwmKgooJA0pKQ81Jw8yLRMiIxImKxUrJREuKhslJB0rIhooKRUuMBMyLhkwJhozKh48LxUzMRM9MBwzMiUvFCMtGiMwEiwzFCgzHDI+GSIsISkvJSQxIiM2LiY5Jic+Lyk0JSo0Ky49JSs9KSU1NSM7NCs2NS8+NDM1JzU9Ljg7IDJCHS1DLSNAMitCMSxIOjREITZLIDZJKDlFIjpFKztKJT1LKzJBMzpHMD1JMjpKPD1RKjlQNC1DQj5QQEA8MEJGJkBKJUJNK0lLLEJMMkVMPEpONENSLUdZL0pTLkpaLkRUMkRSPEVZMktUM0pVOklZMklZNEpcNU1ZMk1ZNUxfMk5dNkxcOVFUM1RUOFJbNVFZOVNYPVFdOVJdPFVaOVVaPVVdOlVdPVpaNlpdO0phN01hOlBiN1NhPFNoP1piPWFbPmRjPENOQEtPSURTQkJVS0xVQk1VSkxbQkxcS0heUVFXRFRcQlJfTFxeQlpeS05lQk1kSFRjQVRjSlZpQ1tkQlxlSlxpRF1rSVVnUVtlU1llXF9tU1xoXlxwSl9ramRfQmJlQ2FhSWFlSWFlTmVlSWRmTGFoQWFpRWFsRmVpRWVtRmNsSmtlRGpqRmpsS2BmWGRsUmFrW2ptUmZyR2RxTGpxTWVyU2RyW2d5V2tzUmt0WW15VG15WXFuTHNtVnFxTXF4T3h0TnJzUnJ1XHJ4VXN6Wnp0VHx1W315VXp8XGR0YGx0YHVzZXJ0aHR9ZXV+aHl9YHOCXXqBXXeCYHyCY3iEaHyIYn+JaXqKcYB5WIN6Y4SCXoCDZIGEaYCIZoOLa4iCaImJbIOOdYuMco6OeIuVcpOKbZKPc5aQb5eXe5ufg6KjhAAAAAAAAAAAAAAAAOGCeQgAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjlsM35OAAAH80lEQVRISy1WbXQUVxm+6wqnk3Zmpxl2FG2EGg92C8GDlWptVTwa+uF3xcKmDfFzCUzDsJNsunXipglJXJbrtJWmwZNSnHD3jojRgUIm2UumIZ0JZ7JByrALbMWW0IBW8aRa4+cf76TeX3Nm3uc+z/s+7/vugl4r/aMTrT4e1pPTqnnmJNn5AyUzRnrRle/qE33dsvrBtAQVoxtpZNK3zSzYjUjviWO2Ag+R77dl7W36n/1Ep9KBPG/S+Py0PkjU/gPKQGqwTHryiWYFAXSvMairsio7SjyNsnCzh0qKImV9/7mhfHQZx2yN1O+7rXUm33MUPaboOkAJHaoIdXfJj2xWeyD8jMFEXkvIu5qzpU988gWB5zl+GS+sFe55trEVPdWZB2miq8bBVkNFO2R0qnrfkiXhcJhtDNXE6tbW97/s9O9/7ZfVhx86/CwrROpfvvxboMqeLsuqPr1j44qEwDNMOBximUiYoU8sw7BC/a7T72uEnyJDlGxZ9KcglZRyuqqrv/tSZErgOI4NgRBTIw9EmHAoFGZZnp6aGaJ2GTxfxYs8kKVUQh7WB5hQeC3LsUxoxVKW14l3BX2WcoUYPiZyLLe8teZ+iuT4GGhvV5KpKWkpyzxEr2MZgQ1xdRjfRBoH+2k6lIHjKTHPPBo8CSJISqqq4wGGOcWylIGlgvgNX1Gd8vF5f+IUIwb30ng+Gg2QfBRIMvy0jG8SVkYo4N0zvUXVRztbJ/L6xL7lUZEXBEHkuZqlS6gEAUgKJurnhFtfpACOYd8b/hVbJPqwi44a6KA0sPVjIi/SIyxb3u8KlAJ0S8jRVgrlW+nVHPdrhiXCxu42d86ByksDc80P3MkJFBFQ8Ho1lQegpWJRWFGsDsRwwv7pIyvuQW0ZkrX6NDVFbqcvaQI8vbyqzt5AARrsbKx5yhQEGs+wPO56bOK+0rcwMrOKkpUb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vUlU1702/+LPa1U9fvPi9qlA4XEUBJc3dFlpsR457IDl1iPqLp7o81NQgyV19iYU38uTiv975Pd3SiwQcsGjx+v4/6fl5T7EOOMTCtpbKxfemsQq/3olQZcminADAAI0cuGLHaHOFxbuGvRk/Z9u7CULqoVR6NE0yx1avj30oRhc/jWUoIALGxkz0dg1Dl9iaI7LqOOXKsXJFwjiuEAi70Jra2nW1PL08zLBhZsMABpW5csI7TPfew9ipFKcn5k1i+1KyCWKjC3W/8dF1d666+RaabBVTFTHacjoojBNDh0NDxk+IPTlwfqJkWpbnpFHXIbLbmpxEQ3ff/Z0g/mauXsoln9wDRjy/NHsQFw3P6vWuTJ43/+FZrk2cvAFRipCKdfD9y2+pjRj78s0KdCUDKJvdV91ChngV38T20TM+gghjpJaPlpFr2xbEz5g4A/NGt5rNwdwmYGeeeMXBSLHHUIc+6RsojRH9VTUm3/mLf/64b470XvoxoTKhlMBQ2jMEzo2PjxdGMppmn1RM24bWFJqaQv4BcuJa2Sam7Zokq1ldCsz06NCBHrhwqVQYpfFj42NZexz1EW9SR/kT58nEeQKJb2fPXjjp0u/YUkwHEgLeOnf2nOuf1TRTM02CLKLTPy60/x1CCztqn7Ev+BdsC3m+30decQvW/wBNTwU+CfUQAQAAAABJRU5ErkJggg==')\";\r\n\r\n if (options.baseSwitcher) {\r\n // let switcherContent = '<div class=\"base-map-switcher\" title=\"Toggle Base Layer\" style=\"';\r\n // switcherContent += 'position: absolute; top: 70px; left: 4px; border: solid black 1px; ';\r\n // switcherContent += `height: 50px; width: 50px; z-index: 10; border-radius: 4px; background: ${aerialCss};`;\r\n // switcherContent += '\"></div>';\r\n // $mapDiv.append(switcherContent);\r\n //\r\n // $mapDiv.find('.base-map-switcher').click(function() {\r\n // \"use strict\";\r\n // osmLayer.setVisible(!osmLayer.getVisible());\r\n // satLayer.setVisible(!satLayer.getVisible());\r\n //\r\n // if (osmLayer.getVisible()){\r\n // $(this).css('background', aerialCss);\r\n // } else {\r\n // $(this).css('background', osmCss);\r\n // }\r\n // });\r\n }\r\n\r\n if (options.zoom < 0 || options.zoom > 28) {\r\n throw 'zoom out of range';\r\n }\r\n\r\n if (options.center.x >= -180 && options.center.x <= 180 && options.center.y >= -90 && options.center.y <= 90) {\r\n let p = new ol.geom.Point([options.center.x, options.center.y]);\r\n new ol.proj.Projection({code: \"EPSG:4326\"});\r\n\r\n p.transform(new ol.proj.Projection({code: \"EPSG:4326\"}), new ol.proj.Projection({code: \"EPSG:3857\"}));\r\n let coordinates = p.getCoordinates();\r\n options.center.x = coordinates[0];\r\n options.center.y = coordinates[1];\r\n }\r\n\r\n const controls = ol.control.defaults({\r\n attributionOptions: {collapsible: false}\r\n }\r\n );\r\n\r\n const view = new ol.View({\r\n center: [options.center.x, options.center.y],\r\n zoom: options.zoom,\r\n minZoom: options.minZoom,\r\n maxZoom: options.maxZoom\r\n });\r\n\r\n let map = new ol.Map({\r\n layers: [],\r\n target: options.divId,\r\n controls: controls,\r\n view: view\r\n });\r\n\r\n if (options.addOsm){\r\n map.addLayer(osmLayer)\r\n }\r\n\r\n if (options.fullScreen) {\r\n map.addControl(new ol.control.FullScreen({}));\r\n }\r\n\r\n if (options.addGeocode){\r\n new Geocode(document.getElementById(options.divId) as HTMLDivElement, map);\r\n }\r\n\r\n return map;\r\n}\r\n\r\nnm.quickMapBase = quickMapBase;\r\nexport default quickMapBase;\r\n"]} \ No newline at end of file +{"version":3,"file":"quickMapBase.js","sourceRoot":"","sources":["../../src/olHelpers/quickMapBase.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,2CAAsC;AACtC,8BAAwB;AACxB,sCAAiC;AACjC,qCAAgC;AAChC,uCAAkC;AAClC,iDAA4C;AAC5C,gCAA2B;AAC3B,sCAAiC;AACjC,oDAA+C;AAC/C,8BAAgC;AAEhC,oCAAoC;AACpC,0BAA6B;AAC7B,qCAAkC;AAClC,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAchC;;;;;;;;;;;;;;;G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CAAC;IAEF,IAAM,IAAI,GAAG,IAAI,cAAI,CAAC;QAClB,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,OAAO,CAAC,OAAO;KAC3B,CAAC,CAAC;IAEH,IAAI,GAAG,GAAG,IAAI,aAAG,CAAC;QACd,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,MAAM,EAAC;QACf,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;KACzB;IAED,IAAI,OAAO,CAAC,UAAU,EAAE;QACpB,GAAG,CAAC,UAAU,CAAC,IAAI,oBAAU,CAAC,EAAE,CAAC,CAAC,CAAC;KACtC;IAED,IAAI,OAAO,CAAC,UAAU,EAAC;QACnB,IAAI,iBAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAmB,EAAE,GAAG,CAAC,CAAC;KAC9E;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAzFD,oCAyFC;AAED,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC;AAC/B,kBAAe,YAAY,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/15/2015.\r\n */\r\n\r\nimport provide from '../util/provide';\r\nimport Map from 'ol/Map'\r\nimport Tile from 'ol/layer/Tile';\r\nimport OSM from 'ol/source/OSM';\r\nimport Point from 'ol/geom/Point';\r\nimport Projection from 'ol/proj/Projection';\r\nimport View from 'ol/View';\r\nimport control from 'ol/control';\r\nimport FullScreen from 'ol/control/Fullscreen';\r\nimport * as proj from 'ol/proj';\r\n\r\n// import ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {Geocode} from './geocode';\r\nconst nm = provide('olHelpers');\r\n\r\nexport interface quickMapOptions {\r\n divId?: string;\r\n center?: {x: number, y: number};\r\n zoom?: number;\r\n minZoom?: number;\r\n maxZoom?: number;\r\n baseSwitcher?: boolean;\r\n fullScreen?: boolean;\r\n addGeocode?: boolean;\r\n addOsm?: boolean\r\n}\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param [options={}] config options\r\n * @param [options.divId=map] map div id\r\n * @param [options.center={}] center config object\r\n * @param [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param [options.center.y=5574910] center y, web mercator y or lat\r\n * @param [options.zoom=7] zoom level\r\n * @param [options.minZoom=undefined] min zoom\r\n * @param [options.maxZoom=undefined] max zoom\r\n * @param [options.baseSwitcher=true] if add base map switcher\r\n * @param [options.fullScreen=false] if add base map switcher\r\n * @returns the ol map\r\n */\r\nexport function quickMapBase(options: quickMapOptions = {}): Map {\r\n options.divId = options.divId || 'map';\r\n options.center = options.center || {x: -10018378, y: 5574910};\r\n options.zoom = typeof options.zoom == 'number' ? options.zoom : 7;\r\n options.baseSwitcher = typeof options.baseSwitcher == 'boolean' ? options.baseSwitcher : true;\r\n options.fullScreen = typeof options.fullScreen == 'boolean' ? options.fullScreen : false;\r\n options.addGeocode = options.addGeocode || false;\r\n options.addOsm = typeof options.addOsm === 'undefined' ? true : options.addOsm;\r\n\r\n\r\n let $mapDiv = $('#' + options.divId);\r\n $mapDiv.css('position', 'relative');\r\n\r\n let osmLayer = new Tile({source: new OSM()});\r\n // let satLayer = new ol.layer.Tile({visible: false, source: new ol.source.MapQuest({layer: 'sat'})});\r\n\r\n let osmCss = \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAADQ1NDk5OURFREtLS1FHSFlZWGJRVGJiYWdmZWxsbHRmaXBpanN0c3V0dHp5eX5+fIVzd4F3eeV0jud5juZ8k4aHhomHhoyGh5eGj5OVlJiVlZiYl5qZmJydnKOTlaKZmqKdnaOioaqqqKuzsbOvrrSysLa3tbW4uLm6ub27ub+/vbGXwbCZwbCgxLKlxrOqyLStybO3yrSxyrWzzbW2y7a1zbK4y7W6zbW8y760yrTAzbTFzrPKzrLOzrTJzrTOzr7CwbXC0LXK0LTO0L3I0bPQz7TQz7PS0bXQ0LnR0brW1bzT0r7U077V1Lzc2dqNqteUsdyXscaquuOHneaGmueHnOeJnuiBleiKn+eNoOiOoOWUpOiRo+iSpeiUpeqYpumaqOmdrPSynemgruSqtOmisOmlsuuqtequuOW1vOuxu+uxvOq1ve+xvPK0pvW3o/W5pfO5qvS7qfCwvMOuwc2/wNenxNyyzNe/0Nq31Nq51dy72Oy3wOu4wOu+xey4wO+6xO2+xfTAr/TCsvfFtPHLvvTJuMPDwMfHxcXKyc3DxMvFyMvLyM3PzcDV08DV1MTX1cbY1s7X1sjZ1sra2Mnd3M7b2c7c2tfH1tnB1t7F2d7M29fX1tLY1tDd2tHe3NTf3NnS19rZ1tva2Nnf3t3d28rh3tXg3Nnh3tzj393k39ni4N7k4N7n5uXDyOfLz+zAxu3CyOzEyezKzeDJ3eLM3uvP0u3P0ePf2+7R0u7Q1u/U0+7U1ezc0+7a2e/d2+3f3vbFzvLOwfHN0PPQw/TUx/LWyvLYzPDQ1fPe0ubc4vve4uHh3+nh3+/h2u/h3vHj2vHl3uHm4eTn4uDp5ebo4+Xo5ODq6ebq6OTv6+nl4+/j4O7l4e7n5ujp4+np5Ozq5e7s5urt6O7t6Orw6u7x6u3x7vPj5PDl4fDo4vDq5fDt5vDu6PDv7PTv6fDx6vHx7fH17fXw6fXy7fb07/bz8fT18vn38vr39fr48/r59Pr6+P3++//+/gAAALNTSk0AAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////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crKQsiIQwmKgooJA0pKQ81Jw8yLRMiIxImKxUrJREuKhslJB0rIhooKRUuMBMyLhkwJhozKh48LxUzMRM9MBwzMiUvFCMtGiMwEiwzFCgzHDI+GSIsISkvJSQxIiM2LiY5Jic+Lyk0JSo0Ky49JSs9KSU1NSM7NCs2NS8+NDM1JzU9Ljg7IDJCHS1DLSNAMitCMSxIOjREITZLIDZJKDlFIjpFKztKJT1LKzJBMzpHMD1JMjpKPD1RKjlQNC1DQj5QQEA8MEJGJkBKJUJNK0lLLEJMMkVMPEpONENSLUdZL0pTLkpaLkRUMkRSPEVZMktUM0pVOklZMklZNEpcNU1ZMk1ZNUxfMk5dNkxcOVFUM1RUOFJbNVFZOVNYPVFdOVJdPFVaOVVaPVVdOlVdPVpaNlpdO0phN01hOlBiN1NhPFNoP1piPWFbPmRjPENOQEtPSURTQkJVS0xVQk1VSkxbQkxcS0heUVFXRFRcQlJfTFxeQlpeS05lQk1kSFRjQVRjSlZpQ1tkQlxlSlxpRF1rSVVnUVtlU1llXF9tU1xoXlxwSl9ramRfQmJlQ2FhSWFlSWFlTmVlSWRmTGFoQWFpRWFsRmVpRWVtRmNsSmtlRGpqRmpsS2BmWGRsUmFrW2ptUmZyR2RxTGpxTWVyU2RyW2d5V2tzUmt0WW15VG15WXFuTHNtVnFxTXF4T3h0TnJzUnJ1XHJ4VXN6Wnp0VHx1W315VXp8XGR0YGx0YHVzZXJ0aHR9ZXV+aHl9YHOCXXqBXXeCYHyCY3iEaHyIYn+JaXqKcYB5WIN6Y4SCXoCDZIGEaYCIZoOLa4iCaImJbIOOdYuMco6OeIuVcpOKbZKPc5aQb5eXe5ufg6KjhAAAAAAAAAAAAAAAAOGCeQgAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZ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fl5T7EOOMTCtpbKxfemsQq/3olQZcminADAAI0cuGLHaHOFxbuGvRk/Z9u7CULqoVR6NE0yx1avj30oRhc/jWUoIALGxkz0dg1Dl9iaI7LqOOXKsXJFwjiuEAi70Jra2nW1PL08zLBhZsMABpW5csI7TPfew9ipFKcn5k1i+1KyCWKjC3W/8dF1d666+RaabBVTFTHacjoojBNDh0NDxk+IPTlwfqJkWpbnpFHXIbLbmpxEQ3ff/Z0g/mauXsoln9wDRjy/NHsQFw3P6vWuTJ43/+FZrk2cvAFRipCKdfD9y2+pjRj78s0KdCUDKJvdV91ChngV38T20TM+gghjpJaPlpFr2xbEz5g4A/NGt5rNwdwmYGeeeMXBSLHHUIc+6RsojRH9VTUm3/mLf/64b470XvoxoTKhlMBQ2jMEzo2PjxdGMppmn1RM24bWFJqaQv4BcuJa2Sam7Zokq1ldCsz06NCBHrhwqVQYpfFj42NZexz1EW9SR/kT58nEeQKJb2fPXjjp0u/YUkwHEgLeOnf2nOuf1TRTM02CLKLTPy60/x1CCztqn7Ev+BdsC3m+30decQvW/wBNTwU+CfUQAQAAAABJRU5ErkJggg==')\";\r\n\r\n if (options.baseSwitcher) {\r\n // let switcherContent = '<div class=\"base-map-switcher\" title=\"Toggle Base Layer\" style=\"';\r\n // switcherContent += 'position: absolute; top: 70px; left: 4px; border: solid black 1px; ';\r\n // switcherContent += `height: 50px; width: 50px; z-index: 10; border-radius: 4px; background: ${aerialCss};`;\r\n // switcherContent += '\"></div>';\r\n // $mapDiv.append(switcherContent);\r\n //\r\n // $mapDiv.find('.base-map-switcher').click(function() {\r\n // \"use strict\";\r\n // osmLayer.setVisible(!osmLayer.getVisible());\r\n // satLayer.setVisible(!satLayer.getVisible());\r\n //\r\n // if (osmLayer.getVisible()){\r\n // $(this).css('background', aerialCss);\r\n // } else {\r\n // $(this).css('background', osmCss);\r\n // }\r\n // });\r\n }\r\n\r\n if (options.zoom < 0 || options.zoom > 28) {\r\n throw 'zoom out of range';\r\n }\r\n\r\n if (options.center.x >= -180 && options.center.x <= 180 && options.center.y >= -90 && options.center.y <= 90) {\r\n let p = new Point([options.center.x, options.center.y]);\r\n // new Projection({code: \"EPSG:4326\"});\r\n\r\n // let coordinates = transform(p.getCoordinates(), \"EPSG:4326\", \"EPSG:3857\");\r\n // p.transform(new Projection({code: \"EPSG:4326\"}), new Projection({code: \"EPSG:3857\"}));\r\n // let coordinates = p.getCoordinates();\r\n let coordinates = proj['transform'](p.getCoordinates(), new Projection({code: \"EPSG:4326\"}), new Projection({code: \"EPSG:3857\"}));\r\n\r\n\r\n options.center.x = coordinates[0];\r\n options.center.y = coordinates[1];\r\n }\r\n\r\n const controls = control.defaults({\r\n attributionOptions: {collapsible: false}\r\n }\r\n );\r\n\r\n const view = new View({\r\n center: [options.center.x, options.center.y],\r\n zoom: options.zoom,\r\n minZoom: options.minZoom,\r\n maxZoom: options.maxZoom\r\n });\r\n\r\n let map = new Map({\r\n layers: [],\r\n target: options.divId,\r\n controls: controls,\r\n view: view\r\n });\r\n\r\n if (options.addOsm){\r\n map.addLayer(osmLayer)\r\n }\r\n\r\n if (options.fullScreen) {\r\n map.addControl(new FullScreen({}));\r\n }\r\n\r\n if (options.addGeocode){\r\n new Geocode(document.getElementById(options.divId) as HTMLDivElement, map);\r\n }\r\n\r\n return map;\r\n}\r\n\r\nnm.quickMapBase = quickMapBase;\r\nexport default quickMapBase;\r\n"]} \ No newline at end of file diff --git a/dist/olHelpers/quickMapMulti.d.ts b/dist/olHelpers/quickMapMulti.d.ts index c918d2e..8714cad 100644 --- a/dist/olHelpers/quickMapMulti.d.ts +++ b/dist/olHelpers/quickMapMulti.d.ts @@ -1,10 +1,10 @@ /** * Created by gavorhes on 12/15/2015. */ +import Map from 'ol/Map'; import { quickMapOptions } from './quickMapBase'; import MapMoveCls from './mapMoveCls'; import MapPopupCls from './mapPopupCls'; -import ol = require('custom-ol'); /** * @typedef {object} quickMapMultiReturn * @property {ol.Map} map The X Coordinate @@ -28,7 +28,7 @@ import ol = require('custom-ol'); * @returns return object with map, map move, and map popup objects */ declare function quickMapMulti(options: quickMapOptions): { - map: ol.Map; + map: Map; mapMove: MapMoveCls; mapPopup: MapPopupCls; }; diff --git a/dist/olHelpers/quickMapMulti.js.map b/dist/olHelpers/quickMapMulti.js.map index 7c034ed..28a6133 100644 --- a/dist/olHelpers/quickMapMulti.js.map +++ b/dist/olHelpers/quickMapMulti.js.map @@ -1 +1 @@ -{"version":3,"file":"quickMapMulti.js","sourceRoot":"","sources":["../../src/olHelpers/quickMapMulti.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,+CAA6D;AAC7D,2CAAsC;AACtC,2CAAsC;AACtC,6CAAwC;AAExC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAG9B;;;;;GAKG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,uBAAuB,OAAwB;IAC3C,IAAI,CAAC,GAAG,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,GAAG,GAAG,IAAI,oBAAU,EAAE,CAAC;IAC3B,IAAI,GAAG,GAAG,IAAI,qBAAW,EAAE,CAAC;IAC5B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEZ,OAAO,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAC,CAAC;AACjD,CAAC;AAED,EAAE,CAAC,aAAa,GAAG,aAAa,CAAC;AACjC,kBAAe,aAAa,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/15/2015.\r\n */\r\n\r\nimport {quickMapBase, quickMapOptions} from './quickMapBase';\r\nimport provide from '../util/provide';\r\nimport MapMoveCls from './mapMoveCls';\r\nimport MapPopupCls from './mapPopupCls';\r\nimport ol = require('custom-ol');\r\nlet nm = provide('olHelpers');\r\n\r\n\r\n/**\r\n * @typedef {object} quickMapMultiReturn\r\n * @property {ol.Map} map The X Coordinate\r\n * @property {MapMoveCls} mapMove The Y Coordinate\r\n * @property {MapPopupCls} mapPopup The Y Coordinate\r\n */\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param {object} [options={}] config options\r\n * @param {string} [options.divId=map] map div id\r\n * @param {object} [options.center={}] center config object\r\n * @param {number} [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param {number} [options.center.y=5574910] center y, web mercator y or lat\r\n * @param {number} [options.zoom=7] zoom level\r\n * @param {number} [options.minZoom=undefined] min zoom\r\n * @param {number} [options.maxZoom=undefined] max zoom\r\n * @param {boolean} [options.baseSwitcher=true] if add base map switcher\r\n * @param {boolean} [options.fullScreen=false] if add base map switcher\r\n * @returns return object with map, map move, and map popup objects\r\n */\r\nfunction quickMapMulti(options: quickMapOptions): {map: ol.Map, mapMove: MapMoveCls, mapPopup: MapPopupCls} {\r\n let m = quickMapBase(options);\r\n let mov = new MapMoveCls();\r\n let pop = new MapPopupCls();\r\n mov.init(m);\r\n pop.init(m);\r\n\r\n return {map: m, mapMove: mov, mapPopup: pop};\r\n}\r\n\r\nnm.quickMapMulti = quickMapMulti;\r\nexport default quickMapMulti;\r\n"]} \ No newline at end of file +{"version":3,"file":"quickMapMulti.js","sourceRoot":"","sources":["../../src/olHelpers/quickMapMulti.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAIH,+CAA6D;AAC7D,2CAAsC;AACtC,2CAAsC;AACtC,6CAAwC;AACxC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAG9B;;;;;GAKG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,uBAAuB,OAAwB;IAC3C,IAAI,CAAC,GAAG,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,GAAG,GAAG,IAAI,oBAAU,EAAE,CAAC;IAC3B,IAAI,GAAG,GAAG,IAAI,qBAAW,EAAE,CAAC;IAC5B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEZ,OAAO,EAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAC,CAAC;AACjD,CAAC;AAED,EAAE,CAAC,aAAa,GAAG,aAAa,CAAC;AACjC,kBAAe,aAAa,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/15/2015.\r\n */\r\n\r\nimport Map from 'ol/Map'\r\n\r\nimport {quickMapBase, quickMapOptions} from './quickMapBase';\r\nimport provide from '../util/provide';\r\nimport MapMoveCls from './mapMoveCls';\r\nimport MapPopupCls from './mapPopupCls';\r\nlet nm = provide('olHelpers');\r\n\r\n\r\n/**\r\n * @typedef {object} quickMapMultiReturn\r\n * @property {ol.Map} map The X Coordinate\r\n * @property {MapMoveCls} mapMove The Y Coordinate\r\n * @property {MapPopupCls} mapPopup The Y Coordinate\r\n */\r\n\r\n/**\r\n * Sets up a map with some default parameters and initializes\r\n * mapMove and mapPopup\r\n *\r\n * @param {object} [options={}] config options\r\n * @param {string} [options.divId=map] map div id\r\n * @param {object} [options.center={}] center config object\r\n * @param {number} [options.center.x=-10018378] center x, web mercator x or lon\r\n * @param {number} [options.center.y=5574910] center y, web mercator y or lat\r\n * @param {number} [options.zoom=7] zoom level\r\n * @param {number} [options.minZoom=undefined] min zoom\r\n * @param {number} [options.maxZoom=undefined] max zoom\r\n * @param {boolean} [options.baseSwitcher=true] if add base map switcher\r\n * @param {boolean} [options.fullScreen=false] if add base map switcher\r\n * @returns return object with map, map move, and map popup objects\r\n */\r\nfunction quickMapMulti(options: quickMapOptions): {map: Map, mapMove: MapMoveCls, mapPopup: MapPopupCls} {\r\n let m = quickMapBase(options);\r\n let mov = new MapMoveCls();\r\n let pop = new MapPopupCls();\r\n mov.init(m);\r\n pop.init(m);\r\n\r\n return {map: m, mapMove: mov, mapPopup: pop};\r\n}\r\n\r\nnm.quickMapMulti = quickMapMulti;\r\nexport default quickMapMulti;\r\n"]} \ No newline at end of file diff --git a/dist/reactComponents/SelectArea.d.ts b/dist/reactComponents/SelectArea.d.ts index 4e8c774..44b971b 100644 --- a/dist/reactComponents/SelectArea.d.ts +++ b/dist/reactComponents/SelectArea.d.ts @@ -3,17 +3,18 @@ */ /// <reference types="react" /> import { React } from './reactAndRedux'; -import ol = require('custom-ol'); import LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson'; +import Map from 'ol/Map'; +import Draw from 'ol/interaction/Draw'; export interface iSelectArea { - map: ol.Map | (() => ol.Map); + map: Map | (() => Map); callback: (coords: Array<number[]>) => any; } export declare class SelectArea extends React.Component<iSelectArea, null> { - map: ol.Map; + map: Map; callback: (coords: Array<number[]>) => any; areaOverlay: LayerBaseVectorGeoJson; - draw: ol.interaction.Draw; + draw: Draw; selectId: string; cancelId: string; selectButton: HTMLButtonElement; diff --git a/dist/reactComponents/SelectArea.js b/dist/reactComponents/SelectArea.js index 729c4d3..b2bfcef 100644 --- a/dist/reactComponents/SelectArea.js +++ b/dist/reactComponents/SelectArea.js @@ -14,11 +14,14 @@ var __extends = (this && this.__extends) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); var reactAndRedux_1 = require("./reactAndRedux"); -var ol = require("custom-ol"); var LayerBaseVectorGeoJson_1 = require("../layers/LayerBaseVectorGeoJson"); var projections_1 = require("../olHelpers/projections"); var makeGuid_1 = require("../util/makeGuid"); var get_map_1 = require("./helpers/get_map"); +var Draw_1 = require("ol/interaction/Draw"); +var Style_1 = require("ol/style/Style"); +var Stroke_1 = require("ol/style/Stroke"); +var Fill_1 = require("ol/style/Fill"); var SelectArea = /** @class */ (function (_super) { __extends(SelectArea, _super); function SelectArea(props, context) { @@ -27,25 +30,26 @@ var SelectArea = /** @class */ (function (_super) { _this.cancelId = makeGuid_1.default(); _this.callback = _this.props.callback; _this.areaOverlay = new LayerBaseVectorGeoJson_1.default('', { - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style_1.default({ + fill: new Fill_1.default({ color: 'rgba(255, 0, 237, 0.1)' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke_1.default({ color: 'rgb(255, 0, 237)', width: 2 }) }), transform: { dataProjection: projections_1.proj4326, featureProjection: projections_1.proj3857 } }); - _this.draw = new ol.interaction.Draw({ + _this.draw = new Draw_1.default({ source: _this.areaOverlay.source, type: 'Polygon' }); + // this.draw.on('drawend', (evt: {feature: {getGeometry: () => Polygon}}) => { _this.draw.on('drawend', function (evt) { _this.selectButton.style.display = ''; _this.cancelButton.style.display = 'none'; - var geom = evt.feature.getGeometry(); + var geom = evt['feature'].getGeometry(); var geomClone = geom.clone(); geomClone.transform('EPSG:3857', 'EPSG:4326'); setTimeout(function () { diff --git a/dist/reactComponents/SelectArea.js.map b/dist/reactComponents/SelectArea.js.map index 95a9983..9cb1088 100644 --- a/dist/reactComponents/SelectArea.js.map +++ b/dist/reactComponents/SelectArea.js.map @@ -1 +1 @@ -{"version":3,"file":"SelectArea.js","sourceRoot":"","sources":["../../src/reactComponents/SelectArea.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,iDAAsC;AACtC,8BAAiC;AACjC,2EAAsE;AACtE,wDAA2D;AAC3D,6CAAwC;AACxC,6CAAuC;AAOvC;IAAgC,8BAAkC;IAW9D,oBAAY,KAAkB,EAAE,OAAe;QAA/C,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAgDxB;QA9CG,KAAI,CAAC,QAAQ,GAAG,kBAAQ,EAAE,CAAC;QAC3B,KAAI,CAAC,QAAQ,GAAG,kBAAQ,EAAE,CAAC;QAE3B,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAEpC,KAAI,CAAC,WAAW,GAAG,IAAI,gCAAsB,CAAC,EAAE,EAC5C;YACI,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtB,IAAI,EAAE,IAA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,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAEzC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,2BAAM,GAAN;QAAA,iBAWC;QAVG,OAAO,6CAAK,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC;YAC1D,gDAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;oBAChC,KAAI,CAAC,OAAO,EAAE,CAAA;gBAClB,CAAC,kBACQ;YACT,gDAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;oBAChC,KAAI,CAAC,MAAM,EAAE,CAAA;gBACjB,CAAC,EAAE,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,aAClB,CACP,CAAA;IACV,CAAC;IACL,iBAAC;AAAD,CAAC,AA5GD,CAAgC,qBAAK,CAAC,SAAS,GA4G9C;AA5GY,gCAAU","sourcesContent":["/**\r\n * Created by glenn on 6/12/2017.\r\n */\r\n\r\nimport {React} from './reactAndRedux';\r\nimport ol = require('custom-ol');\r\nimport LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson';\r\nimport {proj4326, proj3857} from '../olHelpers/projections'\r\nimport makeGuid from '../util/makeGuid';\r\nimport getMap from './helpers/get_map';\r\n\r\nexport interface iSelectArea{\r\n map: ol.Map | (() => ol.Map);\r\n callback: (coords: Array<number[]>) => any\r\n}\r\n\r\nexport class SelectArea extends React.Component<iSelectArea, null> {\r\n map: ol.Map;\r\n callback: (coords: Array<number[]>) => any;\r\n areaOverlay: LayerBaseVectorGeoJson;\r\n draw: ol.interaction.Draw;\r\n selectId: string;\r\n cancelId: string;\r\n selectButton: HTMLButtonElement;\r\n cancelButton: HTMLButtonElement;\r\n\r\n\r\n constructor(props: iSelectArea, context: Object) {\r\n super(props, context);\r\n\r\n this.selectId = makeGuid();\r\n this.cancelId = makeGuid();\r\n\r\n this.callback = this.props.callback;\r\n\r\n this.areaOverlay = new LayerBaseVectorGeoJson('',\r\n {\r\n style: new ol.style.Style({\r\n fill: new ol.style.Fill({\r\n color: 'rgba(255, 0, 237, 0.1)'\r\n }),\r\n stroke: new ol.style.Stroke({\r\n color: 'rgb(255, 0, 237)',\r\n width: 2\r\n })\r\n }),\r\n transform: {dataProjection: proj4326, featureProjection: proj3857}\r\n });\r\n\r\n this.draw = new ol.interaction.Draw({\r\n source: this.areaOverlay.source,\r\n type: 'Polygon'\r\n });\r\n\r\n this.draw.on('drawend', (evt: {feature: {getGeometry: () => ol.geom.Polygon}}) => {\r\n this.selectButton.style.display = '';\r\n this.cancelButton.style.display = 'none';\r\n\r\n let geom = evt.feature.getGeometry();\r\n let geomClone = geom.clone();\r\n\r\n geomClone.transform('EPSG:3857', 'EPSG:4326');\r\n\r\n setTimeout(() => {\r\n this.map.removeInteraction(this.draw);\r\n }, 100);\r\n\r\n let outCoords = [];\r\n let ccc = geomClone.getCoordinates()[0];\r\n\r\n for (let cc of ccc) {\r\n outCoords.push([Math.round(cc[0] * 1000000) / 1000000, Math.round(cc[1] * 1000000) / 1000000]);\r\n }\r\n\r\n this.callback(outCoords);\r\n });\r\n }\r\n\r\n\r\n componentDidMount() {\r\n this.selectButton = document.getElementById(this.selectId) as HTMLButtonElement;\r\n this.cancelButton = document.getElementById(this.cancelId) as HTMLButtonElement;\r\n getMap(this.props.map, this.areaOverlay.olLayer).then((m) => {this.map = m})\r\n }\r\n\r\n\r\n setArea() {\r\n if (!this.map) {\r\n return;\r\n }\r\n\r\n this.selectButton.style.display = 'none';\r\n this.cancelButton.style.display = '';\r\n\r\n this.areaOverlay.source.clear();\r\n this.map.addInteraction(this.draw);\r\n this.callback(null);\r\n }\r\n\r\n cancel() {\r\n if (!this.map) {\r\n return;\r\n }\r\n this.selectButton.style.display = '';\r\n this.cancelButton.style.display = 'none';\r\n\r\n this.areaOverlay.source.clear();\r\n this.map.removeInteraction(this.draw);\r\n\r\n this.callback(null);\r\n }\r\n\r\n render() {\r\n return <div className=\"ol-select-area\" style={{margin: '10px'}}>\r\n <button id={this.selectId} onClick={() => {\r\n this.setArea()\r\n }}>Select Area\r\n </button>\r\n <button id={this.cancelId} onClick={() => {\r\n this.cancel()\r\n }} style={{display: 'none'}}>Cancel\r\n </button>\r\n </div>\r\n }\r\n}\r\n"]} \ No newline at end of file +{"version":3,"file":"SelectArea.js","sourceRoot":"","sources":["../../src/reactComponents/SelectArea.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,iDAAsC;AACtC,2EAAsE;AACtE,wDAA2D;AAC3D,6CAAwC;AACxC,6CAAuC;AAEvC,4CAAuC;AACvC,wCAAmC;AACnC,0CAAqC;AACrC,sCAAiC;AASjC;IAAgC,8BAAkC;IAW9D,oBAAY,KAAkB,EAAE,OAAe;QAA/C,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAmDxB;QAjDG,KAAI,CAAC,QAAQ,GAAG,kBAAQ,EAAE,CAAC;QAC3B,KAAI,CAAC,QAAQ,GAAG,kBAAQ,EAAE,CAAC;QAE3B,KAAI,CAAC,QAAQ,GAAG,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAEpC,KAAI,CAAC,WAAW,GAAG,IAAI,gCAAsB,CAAC,EAAE,EAC5C;YACI,KAAK,EAAE,IAAI,eAAK,CAAC;gBACb,IAAI,EAAE,IAAI,cAAI,CAAC;oBACX,KAAK,EAAE,wBAAwB;iBAClC,CAAC;gBACF,MAAM,EAAE,IAAI,gBAAM,CAAC;oBACf,KAAK,EAAE,kBAAkB;oBACzB,KAAK,EAAE,CAAC;iBACX,CAAC;aACL,CAAC;YACF,SAAS,EAAE,EAAC,cAAc,EAAE,sBAAQ,EAAE,iBAAi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AVG,OAAO,6CAAK,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,MAAM,EAAC;YAC1D,gDAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;oBAChC,KAAI,CAAC,OAAO,EAAE,CAAA;gBAClB,CAAC,kBACQ;YACT,gDAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;oBAChC,KAAI,CAAC,MAAM,EAAE,CAAA;gBACjB,CAAC,EAAE,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,aAClB,CACP,CAAA;IACV,CAAC;IACL,iBAAC;AAAD,CAAC,AA/GD,CAAgC,qBAAK,CAAC,SAAS,GA+G9C;AA/GY,gCAAU","sourcesContent":["/**\r\n * Created by glenn on 6/12/2017.\r\n */\r\n\r\nimport {React} from './reactAndRedux';\r\nimport LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson';\r\nimport {proj4326, proj3857} from '../olHelpers/projections'\r\nimport makeGuid from '../util/makeGuid';\r\nimport getMap from './helpers/get_map';\r\nimport Map from 'ol/Map'\r\nimport Draw from 'ol/interaction/Draw';\r\nimport Style from 'ol/style/Style';\r\nimport Stroke from 'ol/style/Stroke';\r\nimport Fill from 'ol/style/Fill';\r\nimport Polygon from 'ol/geom/Polygon';\r\nimport Feature from 'ol/Feature';\r\n\r\nexport interface iSelectArea{\r\n map: Map | (() => Map);\r\n callback: (coords: Array<number[]>) => any\r\n}\r\n\r\nexport class SelectArea extends React.Component<iSelectArea, null> {\r\n map: Map;\r\n callback: (coords: Array<number[]>) => any;\r\n areaOverlay: LayerBaseVectorGeoJson;\r\n draw: Draw;\r\n selectId: string;\r\n cancelId: string;\r\n selectButton: HTMLButtonElement;\r\n cancelButton: HTMLButtonElement;\r\n\r\n\r\n constructor(props: iSelectArea, context: Object) {\r\n super(props, context);\r\n\r\n this.selectId = makeGuid();\r\n this.cancelId = makeGuid();\r\n\r\n this.callback = this.props.callback;\r\n\r\n this.areaOverlay = new LayerBaseVectorGeoJson('',\r\n {\r\n style: new Style({\r\n fill: new Fill({\r\n color: 'rgba(255, 0, 237, 0.1)'\r\n }),\r\n stroke: new Stroke({\r\n color: 'rgb(255, 0, 237)',\r\n width: 2\r\n })\r\n }),\r\n transform: {dataProjection: proj4326, featureProjection: proj3857}\r\n });\r\n\r\n this.draw = new Draw({\r\n source: this.areaOverlay.source,\r\n type: 'Polygon'\r\n });\r\n\r\n // this.draw.on('drawend', (evt: {feature: {getGeometry: () => Polygon}}) => {\r\n this.draw.on('drawend', (evt) => {\r\n this.selectButton.style.display = '';\r\n this.cancelButton.style.display = 'none';\r\n\r\n\r\n\r\n let geom = (evt['feature'] as Feature).getGeometry() as Polygon;\r\n let geomClone = geom.clone();\r\n\r\n geomClone.transform('EPSG:3857', 'EPSG:4326');\r\n\r\n setTimeout(() => {\r\n this.map.removeInteraction(this.draw);\r\n }, 100);\r\n\r\n let outCoords = [];\r\n let ccc = geomClone.getCoordinates()[0];\r\n\r\n for (let cc of ccc) {\r\n outCoords.push([Math.round(cc[0] * 1000000) / 1000000, Math.round(cc[1] * 1000000) / 1000000]);\r\n }\r\n\r\n this.callback(outCoords);\r\n });\r\n }\r\n\r\n\r\n componentDidMount() {\r\n this.selectButton = document.getElementById(this.selectId) as HTMLButtonElement;\r\n this.cancelButton = document.getElementById(this.cancelId) as HTMLButtonElement;\r\n getMap(this.props.map, this.areaOverlay.olLayer).then((m) => {this.map = m})\r\n }\r\n\r\n\r\n setArea() {\r\n if (!this.map) {\r\n return;\r\n }\r\n\r\n this.selectButton.style.display = 'none';\r\n this.cancelButton.style.display = '';\r\n\r\n this.areaOverlay.source.clear();\r\n this.map.addInteraction(this.draw);\r\n this.callback(null);\r\n }\r\n\r\n cancel() {\r\n if (!this.map) {\r\n return;\r\n }\r\n this.selectButton.style.display = '';\r\n this.cancelButton.style.display = 'none';\r\n\r\n this.areaOverlay.source.clear();\r\n this.map.removeInteraction(this.draw);\r\n\r\n this.callback(null);\r\n }\r\n\r\n render() {\r\n return <div className=\"ol-select-area\" style={{margin: '10px'}}>\r\n <button id={this.selectId} onClick={() => {\r\n this.setArea()\r\n }}>Select Area\r\n </button>\r\n <button id={this.cancelId} onClick={() => {\r\n this.cancel()\r\n }} style={{display: 'none'}}>Cancel\r\n </button>\r\n </div>\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/dist/reactComponents/helpers/get_map.d.ts b/dist/reactComponents/helpers/get_map.d.ts index a221906..19ed71b 100644 --- a/dist/reactComponents/helpers/get_map.d.ts +++ b/dist/reactComponents/helpers/get_map.d.ts @@ -1,5 +1,6 @@ /** * Created by glenn on 7/6/2017. */ -import ol = require('custom-ol'); -export default function (map: ol.Map | (() => ol.Map), layer: ol.layer.Base): Promise<ol.Map>; +import Map from 'ol/Map'; +import Base from 'ol/layer/Base'; +export default function (map: Map | (() => Map), layer: Base): Promise<Map>; diff --git a/dist/reactComponents/helpers/get_map.js.map b/dist/reactComponents/helpers/get_map.js.map index a555f7c..eb7cb77 100644 --- a/dist/reactComponents/helpers/get_map.js.map +++ b/dist/reactComponents/helpers/get_map.js.map @@ -1 +1 @@ -{"version":3,"file":"get_map.js","sourceRoot":"","sources":["../../../src/reactComponents/helpers/get_map.ts"],"names":[],"mappings":";;AAKA,mBAAyB,GAA4B,EAAE,KAAoB;IACvE,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAE/B,IAAI,OAAO,GAAG,IAAI,UAAU,EAAE;YAC1B,IAAI,QAAM,GAAG,GAAmB,CAAC;YAEjC,IAAI,GAAC,GAAG,WAAW,CAAC;gBAChB,IAAI,CAAC,GAAG,QAAM,EAAE,CAAC;gBAEjB,IAAI,CAAC,EAAE;oBACH,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAClB,aAAa,CAAC,GAAC,CAAC,CAAC;oBACjB,OAAO,CAAC,CAAC,CAAC,CAAC;oBAC/B;mDAC+B;iBACd;YACL,CAAC,EAAE,EAAE,CAAC,CAAC;SACV;aAAM;YACH,IAAI,CAAC,GAAG,GAAa,CAAC;YACtB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,OAAO,CAAC,CAAC,CAAC,CAAC;SACd;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAvBD,4BAuBC","sourcesContent":["/**\r\n * Created by glenn on 7/6/2017.\r\n */\r\nimport ol = require('custom-ol');\r\n\r\nexport default function (map: ol.Map | (() => ol.Map), layer: ol.layer.Base): Promise<ol.Map> {\r\n return new Promise((resolve, reject) => {\r\n\r\n if (typeof map == 'function') {\r\n let getMap = map as () => ol.Map;\r\n\r\n let g = setInterval(() => {\r\n let m = getMap();\r\n\r\n if (m) {\r\n m.addLayer(layer);\r\n clearInterval(g);\r\n resolve(m);\r\n/* console.log(m);\r\n return m;*/\r\n }\r\n }, 15);\r\n } else {\r\n let m = map as ol.Map;\r\n m.addLayer(layer);\r\n resolve(m);\r\n }\r\n });\r\n}\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"get_map.js","sourceRoot":"","sources":["../../../src/reactComponents/helpers/get_map.ts"],"names":[],"mappings":";;AAMA,mBAAyB,GAAsB,EAAE,KAAW;IACxD,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAE/B,IAAI,OAAO,GAAG,IAAI,UAAU,EAAE;YAC1B,IAAI,QAAM,GAAG,GAAgB,CAAC;YAE9B,IAAI,GAAC,GAAG,WAAW,CAAC;gBAChB,IAAI,CAAC,GAAG,QAAM,EAAE,CAAC;gBAEjB,IAAI,CAAC,EAAE;oBACH,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAClB,aAAa,CAAC,GAAC,CAAC,CAAC;oBACjB,OAAO,CAAC,CAAC,CAAC,CAAC;oBAC/B;mDAC+B;iBACd;YACL,CAAC,EAAE,EAAE,CAAC,CAAC;SACV;aAAM;YACH,IAAI,CAAC,GAAG,GAAU,CAAC;YACnB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,OAAO,CAAC,CAAC,CAAC,CAAC;SACd;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAvBD,4BAuBC","sourcesContent":["/**\r\n * Created by glenn on 7/6/2017.\r\n */\r\nimport Map from 'ol/Map';\r\nimport Base from 'ol/layer/Base';\r\n\r\nexport default function (map: Map | (() => Map), layer: Base): Promise<Map> {\r\n return new Promise((resolve, reject) => {\r\n\r\n if (typeof map == 'function') {\r\n let getMap = map as () => Map;\r\n\r\n let g = setInterval(() => {\r\n let m = getMap();\r\n\r\n if (m) {\r\n m.addLayer(layer);\r\n clearInterval(g);\r\n resolve(m);\r\n/* console.log(m);\r\n return m;*/\r\n }\r\n }, 15);\r\n } else {\r\n let m = map as Map;\r\n m.addLayer(layer);\r\n resolve(m);\r\n }\r\n });\r\n}\r\n\r\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 22e71c6..4d82096 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "typedoc": "RD /S /Q doc & typedoc --excludePrivate --mode file --out doc src", "webpack": "node_modules\\.bin\\webpack -w", "webpack-prod": "node_modules\\.bin\\webpack -p -w", - "tsc": "RD /S /Q dist & node_modules\\.bin\\tsc -d -w", + "tsc": "RD /S /Q dist & tsc -d -w", "karma": "node_modules\\.bin\\karma start" }, "author": "TOPS Lab", @@ -29,7 +29,6 @@ "@types/jqueryui": "^1.11.32", "@types/react": "^15.0.15", "@types/react-dom": "^0.14.23", - "custom-ol": "github:glennvorhes/custom-ol", "jasmine": "^2.5.3", "jasmine-core": "^2.5.2", "jquery": "^3.1.1", @@ -41,9 +40,7 @@ "karma-jasmine": "^1.1.0", "karma-phantomjs-launcher": "^1.0.2", "karma-sourcemap-loader": "^0.3.7", - "karma-typescript": "monounity/karma-typescript", "karma-webpack": "^2.0.2", - "ol": "^5.3.1", "phantomjs-prebuilt": "^2.1.14", "source-map-loader": "^0.2.0", "ts-loader": "^2.0.1", @@ -57,8 +54,10 @@ }, "dependencies": { "@types/es6-promise": "0.0.32", + "@types/ol": "^4.6.5", "axios": "^0.15.3", "es6-promise": "^4.1.1", + "ol": "^5.3.2", "react": "^15.6.1", "react-dom": "^15.6.1", "react-redux": "^5.0.5", diff --git a/src/_tests/demos/mapPopup.ts b/src/_tests/demos/mapPopup.ts index 15900de..eda1f14 100644 --- a/src/_tests/demos/mapPopup.ts +++ b/src/_tests/demos/mapPopup.ts @@ -3,12 +3,12 @@ */ -import ItsLayerCollection from '../../collections/ItsLayerCollection'; -import LayerLegend from '../../collections/LayerLegend'; import quickMap from '../../olHelpers/quickMap'; -import {LayerBaseVectorGeoJson} from '../../layers/LayerBaseVectorGeoJson'; -import ol = require("custom-ol"); +import {LayerBaseVectorGeoJson} from '../../layers'; import {mapPopup} from '../../olHelpers/mapPopup'; +import Style from 'ol/style/Style'; +import Stroke from 'ol/style/Stroke'; +import Fill from 'ol/style/Fill'; @@ -54,11 +54,11 @@ let regionLayer = new LayerBaseVectorGeoJson( minZoom: 6, maxZoom: 12, name: 'WisDOT Regions', - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style({ + fill: new Fill({ color: 'blue' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke({ color: 'yellow', width: 5 }) @@ -71,11 +71,11 @@ let regionLayer2 = new LayerBaseVectorGeoJson( minZoom: 6, maxZoom: 12, name: 'WisDOT Regions', - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style({ + fill: new Fill({ color: 'red' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke({ color: 'yellow', width: 5 }) @@ -106,4 +106,4 @@ window['map'] = map; // let legend = new LayerLegend(layerArray, 'legend-container', {}); -console.log('it works'); +// console.log('it works'); diff --git a/src/_tests/demos/my_little_test.ts b/src/_tests/demos/my_little_test.ts index d983fea..7fc618b 100644 --- a/src/_tests/demos/my_little_test.ts +++ b/src/_tests/demos/my_little_test.ts @@ -1,4 +1,4 @@ -import ol = require('custom-ol'); +// import ol = require('custom-ol'); // let g = new diff --git a/src/_tests/demos/slider-test.ts b/src/_tests/demos/slider-test.ts index cfa22eb..3bb084a 100644 --- a/src/_tests/demos/slider-test.ts +++ b/src/_tests/demos/slider-test.ts @@ -3,7 +3,8 @@ */ import {TipSliders, TipPresetConfig, TipSliderConfig} from '../../collections/Sliders'; import $ = require('jquery'); -import ol = require('custom-ol'); +// import ol = require('custom-ol'); +import Map from 'ol/Map'; import 'jquery-ui'; @@ -13,7 +14,7 @@ export interface ITipConfig{ presetConfig: Array<TipPresetConfig>; tipSegmentLayerMinZoom: number; sliders: TipSliders; - _map: ol.Map; + _map: Map; $loadingGif: JQuery; $presetSelector: JQuery; $regionSelector: JQuery; diff --git a/src/collections/ItsLayerCollection.ts b/src/collections/ItsLayerCollection.ts index 88bfee1..f84a401 100644 --- a/src/collections/ItsLayerCollection.ts +++ b/src/collections/ItsLayerCollection.ts @@ -4,9 +4,9 @@ import * as colors from '../util/colors'; import provide from '../util/provide'; -import ol = require('custom-ol'); import LayerItsInventory from "../layers/LayerItsInventory"; let nm = provide('collections'); +import Map from 'ol/Map'; let itsConfig = [ @@ -98,13 +98,13 @@ let itsConfig = [ export class ItsLayerCollection { - _map: ol.Map; + _map: Map; _layers: Array<LayerItsInventory>; /** * Create a collection of all ITS layers - * @param {ol.Map} theMap the openlayers map + * @param theMap the openlayers map * @param {Array} [exclude=[]] array of Its layer identifiers to exclude * * BLUE Bluetooth Detector - Bluetooth Detector @@ -125,7 +125,7 @@ export class ItsLayerCollection { * TOWER Tower - The towers * TRENCH */ - constructor(theMap: ol.Map, exclude?: Array<string>) { + constructor(theMap: Map, exclude?: Array<string>) { this._map = theMap; this._layers = []; diff --git a/src/layers/LayerBase.ts b/src/layers/LayerBase.ts index 56d1bcc..81c35e0 100644 --- a/src/layers/LayerBase.ts +++ b/src/layers/LayerBase.ts @@ -1,7 +1,8 @@ import * as zoomResolutionConvert from '../olHelpers/zoomResolutionConvert'; import provide from '../util/provide'; -import ol = require('custom-ol'); import makeGuid from '../util/makeGuid'; +import {Vector, Source} from 'ol/source'; +import Layer from 'ol/layer/Layer'; import $ = require('jquery'); const nm = provide('layers'); @@ -41,14 +42,14 @@ export abstract class LayerBase { protected _params: any; protected _id: string; protected _name: string; - protected _source: ol.source.Source; + protected _source: Source; protected _animate: boolean; protected _legendCollapse: boolean; protected _maxResolution: number; protected _minResolution: number; protected _$legendDiv: JQuery; loadCallback: Function; - protected _olLayer: ol.layer.Layer; + protected _olLayer: Layer; protected _applyCollapseCalled: boolean; @@ -70,7 +71,7 @@ export abstract class LayerBase { * @param {boolean} [options.legendCheckbox=true] - if the legend item should have a checkbox for visibility * @param {boolean} [options.legendContent=undefined] - additional content to add to the legend */ - constructor(url: string, options: LayerBaseOptions = {}) { + protected constructor(url: string, options: LayerBaseOptions = {}) { options = options || {} as LayerBaseOptions; if (typeof url !== 'string') { @@ -398,12 +399,12 @@ export abstract class LayerBase { * get the layer source * @type {*} */ - get source(): ol.source.Source { + get source(): Source { return this.getSource(); } - protected getSource(): ol.source.Source{ + protected getSource(): Source{ return this._source; } @@ -428,11 +429,11 @@ export abstract class LayerBase { /** * the the ol layer */ - get olLayer(): ol.layer.Layer { + get olLayer(): Layer { return this.getOlLayer(); } - protected getOlLayer(): ol.layer.Layer{ + protected getOlLayer(): Layer{ return this._olLayer; } } diff --git a/src/layers/LayerBaseVector.ts b/src/layers/LayerBaseVector.ts index a31464b..768b270 100644 --- a/src/layers/LayerBaseVector.ts +++ b/src/layers/LayerBaseVector.ts @@ -2,8 +2,14 @@ import {LayerBase, LayerBaseOptions} from './LayerBase'; import mapMove from '../olHelpers/mapMove'; import MapMoveCls from '../olHelpers/mapMoveCls' import provide from '../util/provide'; -import ol = require('custom-ol'); +// import ol = require('custom-ol'); import $ = require('jquery'); +import Style from 'ol/style/Style'; +import Feature from 'ol/Feature'; +import Vector from 'ol/layer/Vector' +import VectorSource from 'ol/source/Vector'; +import Projection from 'ol/proj/Projection'; +import {iStyleFunc} from "../olHelpers/esriToOlStyle"; const nm = provide('layers'); @@ -21,12 +27,12 @@ export interface makeMapMoveParams { export interface LayerBaseVectorOptions extends LayerBaseOptions{ autoLoad?: boolean; - style?: ol.style.Style|Array<ol.style.Style>|ol.StyleFunction; + style?: Style|Style[]|iStyleFunc; onDemand?: boolean; onDemandDelay?: number; mapMoveMakeGetParams?: makeMapMoveParams; mapMoveObj?: MapMoveCls; - renderOrder?: (a: ol.Feature, b: ol.Feature) => number; + renderOrder?: (a: Feature, b: Feature) => number; } @@ -38,17 +44,17 @@ export interface LayerBaseVectorOptions extends LayerBaseOptions{ * @abstract */ export class LayerBaseVector extends LayerBase { - _olLayer: ol.layer.Vector; - _source: ol.source.Vector; - _style: ol.style.Style|Array<ol.style.Style>|ol.StyleFunction; + _olLayer: Vector; + _source: VectorSource; + _style: Style|Array<Style>|iStyleFunc; _autoLoad: boolean; _onDemand: boolean; _onDemandDelay: number; _mapMoveMakeGetParams: makeMapMoveParams; _mapMoveParams: any; _mapMove: MapMoveCls; - _projectionMap: ol.proj.Projection; - _projection4326: ol.proj.Projection; + _projectionMap: Projection; + _projection4326: Projection; @@ -115,10 +121,10 @@ export class LayerBaseVector extends LayerBase { this._mapMove.addVectorLayer(this); } - this._source = new ol.source.Vector(); + this._source = new VectorSource(); - this._olLayer = new ol.layer.Vector( + this._olLayer = new Vector( { source: this._source, visible: this.visible, @@ -132,7 +138,7 @@ export class LayerBaseVector extends LayerBase { this.olLayer.setZIndex(this._zIndex); this._projectionMap = null; - this._projection4326 = new ol.proj.Projection({code: "EPSG:4326"}); + this._projection4326 = new Projection({code: "EPSG:4326"}); this._olLayer.setOpacity(this.opacity) } @@ -217,7 +223,7 @@ export class LayerBaseVector extends LayerBase { /** * get the style definition */ - get style(): ol.StyleFunction|Array<ol.style.Style>|ol.style.Style { + get style(): Array<Style>|Style|iStyleFunc { return this._style; } @@ -225,9 +231,9 @@ export class LayerBaseVector extends LayerBase { * set the style * @param style - the style or function */ - set style(style: ol.StyleFunction|Array<ol.style.Style>|ol.style.Style) { + set style(style: Style[]|Style|iStyleFunc) { this._style = style; - this.olLayer.setStyle(this._style as ol.style.Style); + this.olLayer.setStyle(this._style as Style); } /** @@ -237,7 +243,7 @@ export class LayerBaseVector extends LayerBase { return this.mapProj == null ? null : this.mapProj.getCode(); } - get mapProj(): ol.proj.Projection{ + get mapProj(): Projection{ if (this._projectionMap != null){ return this._projectionMap; } @@ -288,22 +294,22 @@ export class LayerBaseVector extends LayerBase { * get the layer vector source * @override */ - get source(): ol.source.Vector { - return this.getSource() as ol.source.Vector; + get source(): VectorSource { + return this.getSource() as VectorSource; } /** * array of ol features */ - get features(): Array<ol.Feature> { + get features(): Array<Feature> { return this.source.getFeatures(); } /** * */ - get olLayer(): ol.layer.Vector { - return super.getOlLayer() as ol.layer.Vector; + get olLayer(): Vector { + return super.getOlLayer() as Vector; } protected setZIndex(newZ: number) { diff --git a/src/layers/LayerBaseVectorEsri.ts b/src/layers/LayerBaseVectorEsri.ts index c1e679f..64a98a5 100644 --- a/src/layers/LayerBaseVectorEsri.ts +++ b/src/layers/LayerBaseVectorEsri.ts @@ -5,9 +5,9 @@ import {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector'; import * as esriToOl from '../olHelpers/esriToOlStyle'; import provide from '../util/provide'; -import ol = require('custom-ol'); import $ = require('jquery'); let nm = provide('layers'); +import EsriJSON from 'ol/format/EsriJSON'; /** @@ -82,7 +82,7 @@ export class LayerBaseVectorEsri extends LayerBaseVector { super(url, options); this._outSR = this.params['outSR']; - this._esriFormat = new ol.format.EsriJSON(); + this._esriFormat = new EsriJSON(); if (this._url[this._url.length - 1] !== '/') { this._url += '/'; diff --git a/src/layers/LayerBaseVectorGeoJson.ts b/src/layers/LayerBaseVectorGeoJson.ts index 7fb04dd..dfd33a5 100644 --- a/src/layers/LayerBaseVectorGeoJson.ts +++ b/src/layers/LayerBaseVectorGeoJson.ts @@ -4,17 +4,18 @@ import {LayerBaseVector, LayerBaseVectorOptions} from './LayerBaseVector'; import provide from '../util/provide'; -import ol = require('custom-ol'); import $ = require('jquery'); import {MapMoveCls} from "../olHelpers/mapMoveCls"; import * as proj from '../olHelpers/projections'; import {proj3857} from "../olHelpers/projections"; +import Projection from 'ol/proj/Projection'; +import GeoJSON from 'ol/format/GeoJSON' let nm = provide('layers'); export interface crsTransform { - dataProjection?: ol.proj.Projection; - featureProjection?: ol.proj.Projection; + dataProjection?: Projection; + featureProjection?: Projection; } @@ -28,7 +29,7 @@ export interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions { * @augments LayerBaseVector */ export class LayerBaseVectorGeoJson extends LayerBaseVector { - _geoJsonFormat: ol.format.GeoJSON; + _geoJsonFormat: GeoJSON; _transform: crsTransform; /** @@ -62,7 +63,7 @@ export class LayerBaseVectorGeoJson extends LayerBaseVector { url = typeof url == 'string' ? url : ''; super(url, options); - this._geoJsonFormat = new ol.format.GeoJSON(); + this._geoJsonFormat = new GeoJSON(); this._transform = options.transform || {}; this._transform.dataProjection = this._transform.dataProjection || proj.proj4326; diff --git a/src/layers/LayerBaseXyzTile.ts b/src/layers/LayerBaseXyzTile.ts index 1388e69..116cf9e 100644 --- a/src/layers/LayerBaseXyzTile.ts +++ b/src/layers/LayerBaseXyzTile.ts @@ -3,8 +3,9 @@ */ import {LayerBase, LayerBaseOptions} from './LayerBase'; import provide from '../util/provide'; -import ol = require('custom-ol'); const nm = provide('layers'); +import XYZ from 'ol/source/XYZ'; +import Tile from 'ol/layer/Tile'; /** @@ -34,10 +35,10 @@ export class LayerBaseXyzTile extends LayerBase { */ constructor(url: string, options: LayerBaseOptions = {}) { super(url, options); - this._source = new ol.source.XYZ({url: this.url == '' ? undefined : this.url}); + this._source = new XYZ({url: this.url == '' ? undefined : this.url}); - this._olLayer = new ol.layer.Tile({ - source: this._source as ol.source.XYZ, + this._olLayer = new Tile({ + source: this._source as XYZ, visible: this.visible, opacity: this.opacity, minResolution: this._minResolution, @@ -47,20 +48,14 @@ export class LayerBaseXyzTile extends LayerBase { this._olLayer.setZIndex(this._zIndex); } - /** - * - * @returns {ol.source.XYZ} the vector source - */ - get source(): ol.source.XYZ { - return this._source as ol.source.XYZ; + + get source(): XYZ { + return this._source as XYZ; } - /** - * - * @returns {ol.layer.Tile|ol.layer.Base|undefined} the ol layer - */ - get olLayer() : ol.layer.Tile { - return this._olLayer as ol.layer.Tile; + + get olLayer() : Tile { + return this._olLayer as Tile; } } diff --git a/src/layers/LayerEsriMapServer.ts b/src/layers/LayerEsriMapServer.ts index 06e90f2..f0f995e 100644 --- a/src/layers/LayerEsriMapServer.ts +++ b/src/layers/LayerEsriMapServer.ts @@ -5,13 +5,15 @@ import {LayerBase, LayerBaseOptions} from './LayerBase'; import * as esriToOl from '../olHelpers/esriToOlStyle'; import mapPopup from '../olHelpers/mapPopup'; import provide from '../util/provide'; -import ol = require('custom-ol'); import $ = require('jquery'); +import EsriJSON from 'ol/format/EsriJSON'; +import TileArcGISRestSource from 'ol/source/TileArcGISRest' +import TileLayer from 'ol/layer/Tile'; +import TileSource from 'ol/source/Tile'; const nm = provide('layers'); - /** * Helper to return the url to the service on the production server * @param {string} folder @@ -56,7 +58,7 @@ export interface LayerEsriMapServerOptions extends LayerBaseOptions { * @augments LayerBase */ export class LayerEsriMapServer extends LayerBase { - _esriFormat: ol.format.EsriJSON; + _esriFormat: EsriJSON; _popupRequest: JQueryXHR; _showLayers: number[]; @@ -82,7 +84,7 @@ export class LayerEsriMapServer extends LayerBase { constructor(url: string, options: LayerEsriMapServerOptions = {}) { super(url, options); - this._source = new ol.source.TileArcGISRest( + this._source = new TileArcGISRestSource( { url: this.url == '' ? undefined : this.url, params: typeof options.showLayers == 'undefined' ? undefined : {layers: 'show:' + options.showLayers.join(',')} @@ -91,8 +93,8 @@ export class LayerEsriMapServer extends LayerBase { this._showLayers = options.showLayers || []; - this._olLayer = new ol.layer.Tile({ - source: this._source as ol.source.Tile, + this._olLayer = new TileLayer({ + source: this._source as TileSource, visible: this.visible, opacity: this.opacity, minResolution: this._minResolution, @@ -104,7 +106,7 @@ export class LayerEsriMapServer extends LayerBase { options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false; - this._esriFormat = new ol.format.EsriJSON(); + this._esriFormat = new EsriJSON(); this._popupRequest = null; options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true; @@ -192,20 +194,14 @@ export class LayerEsriMapServer extends LayerBase { } - /** - * - * @returns {ol.source.TileArcGISRest} the vector source - */ - get source(): ol.source.TileArcGISRest { - return super.getSource() as ol.source.TileArcGISRest; + + get source(): TileArcGISRestSource { + return super.getSource() as TileArcGISRestSource; } - /** - * - * @returns the ol layer - */ - get olLayer(): ol.layer.Tile { - return super.getOlLayer() as ol.layer.Tile; + + get olLayer(): TileLayer { + return super.getOlLayer() as TileLayer; } } nm.LayerEsriMapServer = LayerEsriMapServer; diff --git a/src/layers/LayerEsriTile.ts b/src/layers/LayerEsriTile.ts index df7ef5a..5084cb8 100644 --- a/src/layers/LayerEsriTile.ts +++ b/src/layers/LayerEsriTile.ts @@ -71,6 +71,7 @@ export class LayerEsriTile extends LayerBaseXyzTile { return; } + if (urlCopy[urlCopy.length - 1] !== '/') { urlCopy += '/'; } diff --git a/src/layers/LayerItsInventory.ts b/src/layers/LayerItsInventory.ts index 70b8bb0..21c13a3 100644 --- a/src/layers/LayerItsInventory.ts +++ b/src/layers/LayerItsInventory.ts @@ -5,9 +5,16 @@ import {LayerBaseVectorGeoJson, LayerBaseVectorGeoJsonOptions} from './LayerBaseVectorGeoJson'; import mapPopup from '../olHelpers/mapPopup'; import provide from '../util/provide'; -import ol = require('custom-ol'); import $ = require('jquery'); -import {proj4326, proj3857} from '../olHelpers/projections' +import {proj4326, proj3857} from '../olHelpers/projections'; +import Style from 'ol/style/Style'; +import Icon from 'ol/style/Icon'; +import Stroke from 'ol/style/Stroke'; +import Fill from 'ol/style/Fill'; +import Feature from 'ol/Feature'; +import Point from 'ol/geom/Point'; +import {iStyleFunc} from "../olHelpers/esriToOlStyle"; + let nm = provide('layers'); @@ -117,15 +124,15 @@ function checkStyleNumber(itsIcon: string, itsLineStyle: iLineStyle, itsIconConf * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width] * @returns {*} undefined, style, or style function */ -function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig): ol.style.Style | Array<ol.style.Style> | ol.StyleFunction { +function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: iIconConfig, itsLineConfig: iLineConfig): Style |Style[]|iStyleFunc { "use strict"; checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig); let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/'; if (itsIcon) { - return new ol.style.Style({ - image: new ol.style.Icon( + return new Style({ + image: new Icon( { src: _iconUrlRoot + itsIcon, crossOrigin: 'anonymous' @@ -133,14 +140,14 @@ function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: i ) }); } else if (itsLineStyle) { - return new ol.style.Style({ - stroke: new ol.style.Stroke({ + return new Style({ + stroke: new Stroke({ color: itsLineStyle.color, width: itsLineStyle.width }) }); } else if (itsIconConfig) { - return function (feature: ol.Feature) { + return function (feature: Feature) { let symbolProp = feature.getProperties()[itsIconConfig.prop]; let iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon; @@ -153,8 +160,8 @@ function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: i } } - return [new ol.style.Style({ - image: new ol.style.Icon( + return [new Style({ + image: new Icon( { src: iconUrl, crossOrigin: 'anonymous' @@ -163,7 +170,7 @@ function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: i })]; }; } else if (itsLineConfig) { - return function (feature: ol.Feature) { + return function (feature: Feature) { let symbolProp = feature.getProperties()[itsLineConfig.prop]; let colr = itsLineConfig.defaultColor || 'red'; let width = itsLineConfig.defaultWidth || 5; @@ -178,8 +185,8 @@ function defineStyle(itsIcon: string, itsLineStyle: iLineStyle, itsIconConfig: i } } - return [new ol.style.Style({ - stroke: new ol.style.Stroke({ + return [new Style({ + stroke: new Stroke({ color: colr, width: width }) @@ -334,10 +341,10 @@ export class LayerItsInventory extends LayerBaseVectorGeoJson { */ mapMoveMakeGetParams(extent: { minX: number, minY: number, maxX: number, maxY: number }, zoomLevel: number) { super.mapMoveMakeGetParams(extent, zoomLevel); - let lowerLeft = new ol.geom.Point([extent.minX, extent.minY]); + let lowerLeft = new Point([extent.minX, extent.minY]); lowerLeft.transform(this.mapProj, this._projection4326); let lowerLeftCoordinates = lowerLeft.getCoordinates(); - let upperRight = new ol.geom.Point([extent.maxX, extent.maxY]); + let upperRight = new Point([extent.maxX, extent.maxY]); upperRight.transform(this.mapProj, this._projection4326); let upperRightCoordinates = upperRight.getCoordinates(); diff --git a/src/layers/LayerRealEarthTile.ts b/src/layers/LayerRealEarthTile.ts index 2d93120..691c8d5 100644 --- a/src/layers/LayerRealEarthTile.ts +++ b/src/layers/LayerRealEarthTile.ts @@ -16,6 +16,7 @@ export interface LayerRealEarthTileOptions extends LayerBaseOptions { } + /** * Real earth tile * @augments LayerBaseXyzTile diff --git a/src/mixin/RealEarthAnimateTile.ts b/src/mixin/RealEarthAnimateTile.ts index 81e2390..f9c75d8 100644 --- a/src/mixin/RealEarthAnimateTile.ts +++ b/src/mixin/RealEarthAnimateTile.ts @@ -3,9 +3,10 @@ */ import RealEarthAnimate from './RealEarthAnimate'; import provide from '../util/provide'; -import ol = require('custom-ol'); import LayerRealEarthTile from "../layers/LayerRealEarthTile"; const nm = provide('mixin'); +import XYZ from 'ol/source/XYZ'; +import Tile from 'ol/layer/Tile'; /** * Animate real earth tile @@ -13,8 +14,8 @@ const nm = provide('mixin'); */ class RealEarthAnimateTile extends RealEarthAnimate { _sourceUrls: string[]; - _source: ol.source.XYZ; - _olLayer: ol.layer.Tile; + _source: XYZ; + _olLayer: Tile; constructor(layer: LayerRealEarthTile, loadCallback?: (lyr: LayerRealEarthTile) => void){ super(layer, loadCallback); diff --git a/src/mixin/RealEarthAnimateVector.ts b/src/mixin/RealEarthAnimateVector.ts index e2f9ac4..5ef7022 100644 --- a/src/mixin/RealEarthAnimateVector.ts +++ b/src/mixin/RealEarthAnimateVector.ts @@ -3,10 +3,11 @@ */ import RealEarthAnimate from './RealEarthAnimate'; import provide from '../util/provide'; -import ol = require('custom-ol'); import {LayerVectorRealEarth} from "../layers/LayerRealEarthVector"; import $ = require('jquery'); const nm = provide('mixin'); +import VectorSource from 'ol/source/Vector'; +import VectorLayer from 'ol/layer/Vector'; /** @@ -15,10 +16,10 @@ const nm = provide('mixin'); */ class RealEarthAnimateVector extends RealEarthAnimate { _dataCache: Array<Array<Object>|Object>; - _source: ol.source.Vector; + _source: VectorSource; _rawTimesLookup: {[s: string]: any}; _currentIndex: number; - _olLayer: ol.layer.Vector; + _olLayer: VectorLayer; _lyr: LayerVectorRealEarth; constructor(layer: LayerVectorRealEarth, loadCallback?: (lyr: LayerVectorRealEarth) => void){ diff --git a/src/olHelpers/SortedFeatures.ts b/src/olHelpers/SortedFeatures.ts index d9812ae..be4903b 100644 --- a/src/olHelpers/SortedFeatures.ts +++ b/src/olHelpers/SortedFeatures.ts @@ -2,23 +2,23 @@ * Created by gavorhes on 12/23/2015. */ import provide from '../util/provide'; -import ol = require('custom-ol'); +import Feature from 'ol/Feature'; let nm = provide('olHelpers'); /** * take an array of features and sort by a given property name */ export class SortedFeatures { - sortedFeatures: Array<ol.Feature>; + sortedFeatures: Array<Feature>; propertyName: string; _propertyType: string; /** * - * @param {Array<ol.Feature>} features array of ol features + * @param {Array<Feature>} features array of ol features * @param {string} propertyName - the property name to use for lookup */ - constructor(features: ol.Feature[], propertyName: string) { + constructor(features: Feature[], propertyName: string) { this.sortedFeatures = features; this.propertyName = propertyName; @@ -55,9 +55,9 @@ export class SortedFeatures { * @param {number|string} propertyValue - the property value to search for * @param {boolean} [exactMatch=false] if only an exact match should be returned * @param {Array} [sortedFeatures=this.sortedFeatures] - the candidate features - * @returns {ol.Feature|undefined} the feature matching the lookup + * @returns {Feature|undefined} the feature matching the lookup */ - getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<ol.Feature>): ol.Feature { + getFeature(propertyValue: number|string, exactMatch: boolean = false, sortedFeatures? :Array<Feature>): Feature { if (typeof sortedFeatures == 'undefined'){ sortedFeatures = this.sortedFeatures; } diff --git a/src/olHelpers/esriToOlStyle.ts b/src/olHelpers/esriToOlStyle.ts index e3f9cff..eea0cfc 100644 --- a/src/olHelpers/esriToOlStyle.ts +++ b/src/olHelpers/esriToOlStyle.ts @@ -2,10 +2,16 @@ * Created by gavorhes on 1/4/2016. */ import provide from '../util/provide'; -import ol = require('custom-ol'); +import Style from 'ol/style/Style'; +import Circle from 'ol/style/Circle'; +import Stroke from 'ol/style/Stroke'; +import Fill from 'ol/style/Fill'; +import Icon from "ol/style/Icon"; +import Feature from 'ol/Feature' const nm = provide('olHelpers.esriToOlStyle'); + /** * * @param {Array<number>} colorArray - input color array @@ -71,7 +77,7 @@ class CommonSymbol { legendHtml: string; opacity: number; symbolObj: iEsriSymbol; - olStyle: ol.style.Style; + olStyle: Style; /** * @@ -102,20 +108,20 @@ class PointSymbol extends CommonSymbol { let radius = this.symbolObj.size; - this.olStyle = new ol.style.Style({ - image: new ol.style.Circle({ + this.olStyle = new Style({ + image: new Circle({ radius: radius, - fill: new ol.style.Fill({ + fill: new Fill({ color: innerColor }), - stroke: new ol.style.Stroke({color: outerColor, width: outlineWidth}) + stroke: new Stroke({color: outerColor, width: outlineWidth}) }) }); this.legendHtml = `<span class="legend-layer-icon" style="color: ${innerColor}">●</span>`; break; case 'esriPMS': - this.olStyle = new ol.style.Style({ - image: new ol.style.Icon({src: `data:image/png;base64,${this.symbolObj['imageData']}`}) + this.olStyle = new Style({ + image: new Icon({src: `data:image/png;base64,${this.symbolObj['imageData']}`}) }); this.legendHtml = `<img class="legend-layer-icon" height="17" src="data:image/png;base64,${this.symbolObj['imageData']}">`; break; @@ -134,8 +140,8 @@ class LineSymbol extends CommonSymbol { let innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity); let lineWidth = this.symbolObj.width; - this.olStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + this.olStyle = new Style({ + stroke: new Stroke({ color: innerColor, //lineDash: [4], width: lineWidth @@ -168,13 +174,13 @@ class PolygonSymbol extends CommonSymbol { let outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity); let outlineWidth = this.symbolObj.outline.width; - this.olStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + this.olStyle = new Style({ + stroke: new Stroke({ color: outerColor, //lineDash: [4], width: outlineWidth }), - fill: new ol.style.Fill({ + fill: new Fill({ color: innerColor }) }); @@ -199,14 +205,14 @@ class PolygonSymbol extends CommonSymbol { } export interface iStyleFunc{ - (f: ol.Feature): ol.style.Style| ol.style.Style[] + (f: Feature): Style| Style[] } class SymbolGenerator { opacity: number; renderer: iEsriRenderer; legendHtml: string; - olStyle: iStyleFunc | ol.style.Style; + olStyle: iStyleFunc | Style; constructor(esriResponse: iEsriResponse) { this.opacity = (100 - (esriResponse['drawingInfo']['transparency'] || 0)) / 100; @@ -236,11 +242,11 @@ class UniqueValueSymbol extends SymbolGenerator { propertyName: string; defaultSymbol: iEsriSymbol; - defaultStyle: ol.style.Style; + defaultStyle: Style; defaultLabelHtml: string; labelArray: Array<string>; legendArray: Array<string>; - propertyStyleLookup: {[s: string]: ol.style.Style}; + propertyStyleLookup: {[s: string]: Style}; valueArray: Array<any>; uniqueValueInfos: Array<{label: string, value: any, symbol: iEsriSymbol}>; @@ -278,7 +284,7 @@ class UniqueValueSymbol extends SymbolGenerator { this.propertyStyleLookup[uniqueVal['value']] = uniqueSym.olStyle; } - this.olStyle = (feature: ol.Feature): ol.style.Style[] => { + this.olStyle = (feature: Feature): Style[] => { let checkProperties = feature.getProperties(); let checkProperty = checkProperties[this.propertyName]; @@ -301,7 +307,7 @@ class UniqueValueSymbol extends SymbolGenerator { } } -export function makeFeatureServiceLegendAndSymbol(esriResponse: iEsriResponse): {style: iStyleFunc | ol.style.Style, legend: string} { +export function makeFeatureServiceLegendAndSymbol(esriResponse: iEsriResponse): {style: iStyleFunc | Style, legend: string} { "use strict"; let renderer = esriResponse.drawingInfo.renderer; let symbolLegendOut: SymbolGenerator = null; diff --git a/src/olHelpers/extentUtil.ts b/src/olHelpers/extentUtil.ts index bd7e989..d75d29b 100644 --- a/src/olHelpers/extentUtil.ts +++ b/src/olHelpers/extentUtil.ts @@ -2,18 +2,14 @@ * Created by gavorhes on 7/18/2016. */ import provide from '../util/provide'; -import ol = require('custom-ol'); -import {LayerBaseVector} from "../layers/LayerBaseVector"; +import {LayerBaseVector} from "../layers"; +import Vector from 'ol/layer/Vector'; +import Map from 'ol/Map'; const nm = provide('util'); -/** - * - * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector|*} layers - array of layers or single - * @returns {ol.Extent|Array<number>|*} - collective extent - */ -export function calculateExtent(layers: ol.layer.Vector[]|LayerBaseVector[]): ol.Extent|Array<number>| ol.Extent| number[] { +export function calculateExtent(layers: Vector[]|LayerBaseVector[]): number[] { "use strict"; let hasExtent = false; @@ -25,7 +21,7 @@ export function calculateExtent(layers: ol.layer.Vector[]|LayerBaseVector[]): ol for (let lyr of layers) { - let olLayer: ol.layer.Vector = (lyr as LayerBaseVector).olLayer || lyr as ol.layer.Vector; + let olLayer: Vector = (lyr as LayerBaseVector).olLayer || lyr as Vector; if (olLayer.getSource().getFeatures().length > 0) { @@ -54,7 +50,7 @@ nm.calculateExtent = calculateExtent; * @param mp - the map to fit * @param [zoomOut=undefined] - levels to zoom out after fit */ -export function fitToMap(layers: ol.layer.Vector[]|LayerBaseVector[], mp: ol.Map, zoomOut?: number){ +export function fitToMap(layers: Vector[]|LayerBaseVector[], mp: Map, zoomOut?: number){ "use strict"; let ext = calculateExtent(layers); @@ -63,7 +59,7 @@ export function fitToMap(layers: ol.layer.Vector[]|LayerBaseVector[], mp: ol.Map return; } - mp.getView().fit(ext as ol.Extent, {size: mp.getSize()}); + mp.getView().fit(ext as [number, number, number, number], {size: mp.getSize()}); if (typeof zoomOut == 'number'){ mp.getView().setZoom(mp.getView().getZoom() - zoomOut); diff --git a/src/olHelpers/geocode.ts b/src/olHelpers/geocode.ts index f2f42a6..5c0380f 100644 --- a/src/olHelpers/geocode.ts +++ b/src/olHelpers/geocode.ts @@ -1,11 +1,20 @@ import $ = require('jquery') import {makeGuid} from '../util/makeGuid'; -import ol = require('custom-ol'); import {proj3857, proj4326} from './projections'; +import Vector from 'ol/layer/Vector'; +import VectorSource from 'ol/source/Vector'; +import Circle from 'ol/style/Circle'; +import Fill from 'ol/style/Fill'; +import Stroke from 'ol/style/Stroke'; +import Point from 'ol/geom/Point'; +import Feature from 'ol/Feature'; + let invalidClass = 'geocoder-invalid'; let geocoderLoadingClass = 'geocoder-loading'; +import Map from 'ol/Map'; +import Style from "ol/style/Style"; // let testAddress = '65 7th Street, Prairie du Sac, WI'; @@ -13,21 +22,21 @@ let geocoderLoadingClass = 'geocoder-loading'; export class Geocode { private theButton: HTMLButtonElement; private theInput: HTMLInputElement; - private map: ol.Map; + private map: Map; private indicationLayer; - constructor(mapDiv: HTMLDivElement, map: ol.Map) { + constructor(mapDiv: HTMLDivElement, map: Map) { let inputGuid = makeGuid(); let buttonGuid = makeGuid(); this.map = map; - this.indicationLayer = new ol.layer.Vector({ - source: new ol.source.Vector(), - style: new ol.style.Style({ - image: new ol.style.Circle({ + this.indicationLayer = new Vector({ + source: new VectorSource(), + style: new Style({ + image: new Circle({ radius: 12, - fill: new ol.style.Fill({color: 'rgba(255,0,0,0.5)'}), - stroke: new ol.style.Stroke({color: 'red', width: 1}) + fill: new Fill({color: 'rgba(255,0,0,0.5)'}), + stroke: new Stroke({color: 'red', width: 1}) }) }) }); @@ -68,8 +77,8 @@ export class Geocode { } else { let v = this.map.getView(); - let p = new ol.geom.Point([lon, lat]); - let feat = new ol.Feature(p); + let p = new Point([lon, lat]); + let feat = new Feature(p); this.indicationLayer.getSource().addFeature(feat); p.transform(proj4326, proj3857); diff --git a/src/olHelpers/layerSwipe.ts b/src/olHelpers/layerSwipe.ts index c7addc0..17e2d52 100644 --- a/src/olHelpers/layerSwipe.ts +++ b/src/olHelpers/layerSwipe.ts @@ -4,8 +4,7 @@ import provide from '../util/provide'; -import {LayerBase} from "../layers/LayerBase"; -import ol = require('custom-ol'); +import {LayerBase} from "../layers"; import $ = require('jquery'); let nm = provide('collections.layerSwipe'); @@ -90,8 +89,8 @@ class LayerSwipe { return; } - lyr.olLayer.on('precompose', (event: {context: CanvasRenderingContext2D}) => { - let ctx = event['context']; + lyr.olLayer.on('precompose', (event) => { + let ctx = event['context'] as CanvasRenderingContext2D; let width = ctx.canvas.width * (this.percentRight / 100); ctx.save(); @@ -100,8 +99,8 @@ class LayerSwipe { ctx.clip(); }); - lyr.olLayer.on('postcompose', function (event: {context: CanvasRenderingContext2D}) { - let ctx = event['context']; + lyr.olLayer.on('postcompose', function (event) { + let ctx = event['context'] as CanvasRenderingContext2D; ctx.restore(); }); @@ -119,8 +118,8 @@ class LayerSwipe { return; } - lyr.olLayer.on('precompose', (event: {context: CanvasRenderingContext2D}) => { - let ctx = event['context']; + lyr.olLayer.on('precompose', (event) => { + let ctx = event['context'] as CanvasRenderingContext2D; let width = ctx.canvas.width * (this.percentRight / 100); ctx.save(); @@ -129,8 +128,8 @@ class LayerSwipe { ctx.clip(); }); - lyr.olLayer.on('postcompose', function (event: {context: CanvasRenderingContext2D}) { - let ctx = event['context']; + lyr.olLayer.on('postcompose', function (event) { + let ctx = event['context'] as CanvasRenderingContext2D; ctx.restore(); }); diff --git a/src/olHelpers/mapInteractionBase.ts b/src/olHelpers/mapInteractionBase.ts index 7bfc0c8..5abffe4 100644 --- a/src/olHelpers/mapInteractionBase.ts +++ b/src/olHelpers/mapInteractionBase.ts @@ -2,16 +2,18 @@ * Created by gavorhes on 12/8/2015. */ import provide from '../util/provide'; -import ol = require('custom-ol'); +// import ol = require('custom-ol'); const nm = provide('olHelpers'); +import Map from 'ol/Map' + /** * base interaction */ export class MapInteractionBase { - _map: ol.Map; + _map: Map; _initialized: boolean; _subtype: string; @@ -30,7 +32,7 @@ export class MapInteractionBase { * @param theMap - the ol Map * @returns true for already initialized */ - init(theMap: ol.Map){ + init(theMap: Map){ if (!this._initialized){ this._map = theMap; this._initialized = true; diff --git a/src/olHelpers/mapMoveCls.ts b/src/olHelpers/mapMoveCls.ts index 4bff55b..d70e254 100644 --- a/src/olHelpers/mapMoveCls.ts +++ b/src/olHelpers/mapMoveCls.ts @@ -3,8 +3,9 @@ import MapInteractionBase from './mapInteractionBase'; import * as checkDefined from '../util/checkDefined'; import provide from '../util/provide'; import makeGuid from '../util/makeGuid'; -import ol = require('custom-ol'); +import {} from 'ol/coordinate'; import $ = require('jquery'); +import Map from 'ol/Map'; const nm = provide('olHelpers'); @@ -68,7 +69,7 @@ export class MapMoveCls extends MapInteractionBase { * initialize the map move object * @param theMap - the ol map */ - init(theMap: ol.Map){ + init(theMap: Map){ super.init(theMap); this.map.getView().on(['change:center', 'change:resolution'], (e: {type: string}) =>{ diff --git a/src/olHelpers/mapPopupCls.ts b/src/olHelpers/mapPopupCls.ts index 3f318c3..509bf7c 100644 --- a/src/olHelpers/mapPopupCls.ts +++ b/src/olHelpers/mapPopupCls.ts @@ -5,11 +5,22 @@ import MapInteractionBase from './mapInteractionBase'; import propertiesZoomStyle from '../olHelpers/propertiesZoomStyle'; import provide from '../util/provide'; -import ol = require('custom-ol'); import {LayerBaseVector} from "../layers/LayerBaseVector"; import {LayerBase} from "../layers/LayerBase"; import LayerEsriMapServer from "../layers/LayerEsriMapServer"; import $ = require('jquery'); +import Map from 'ol/Map'; +// import * as ol from "custom-ol"; +import Vector from 'ol/layer/Vector'; +import VectorSource from 'ol/source/Vector'; +import Feature from 'ol/Feature'; +import Overlay from 'ol/Overlay'; +import * as easing from 'ol/easing'; + + +import {Style, Circle, Fill, Stroke} from 'ol/style'; + + const nm = provide('olHelpers'); @@ -30,8 +41,8 @@ export interface popupCallback { } interface mapEvent { - coordinate: ol.Coordinate; - pixel: ol.Pixel; + coordinate: [number, number]; + pixel: [number, number]; dragging: boolean|any; originalEvent: Event; } @@ -39,10 +50,10 @@ interface mapEvent { export class FeatureLayerProperties { - feature: ol.Feature; + feature: Feature; layer: LayerBaseVector|LayerEsriMapServer; layerIndex: number; - selectionLayer: ol.layer.Vector; + selectionLayer: Vector; popupContent: string; esriLayerName: string; @@ -54,7 +65,7 @@ export class FeatureLayerProperties { * @param selectionLayer - the ol selection layer * @param [esriLayerName=undefined] - esri layer name */ - constructor(feature: ol.Feature, layer: LayerBaseVector|LayerEsriMapServer, layerIndex: number, selectionLayer: ol.layer.Vector, esriLayerName?: string) { + constructor(feature: Feature, layer: LayerBaseVector|LayerEsriMapServer, layerIndex: number, selectionLayer: Vector, esriLayerName?: string) { this.feature = feature; this.layer = layer; this.layerIndex = layerIndex; @@ -85,16 +96,15 @@ export class MapPopupCls extends MapInteractionBase { private _$popupCloser: JQuery; private _$popupContent: JQuery; private _$popupContainer: JQuery; - private _popupOverlay: ol.Overlay; + private _popupOverlay: Overlay; private _arrPopupLayers: Array<LayerBaseVector>; - private _popupCoordinate: ol.Coordinate; + private _popupCoordinate: [number, number]; private _popupChangedFunctions: Array<popupChangedFunction>; private _mapClickFunctions: Array<Function>; - private _selectionLayerLookup: {[s: string]: ol.layer.Vector}; + private _selectionLayerLookup: {[s: string]: Vector}; private _arrPopupLayerIds: Array<string>; - // private _arrPopupOlLayers: Array<ol.layer.Vector>; private _arrPopupContentFunction: Array<popupCallback>; - private _selectionLayers: Array<ol.layer.Vector>; + private _selectionLayers: Array<Vector>; /** * Definition for openlayers style function @@ -138,9 +148,9 @@ export class MapPopupCls extends MapInteractionBase { /** * map popup initialization - * @param {ol.Map} theMap - the ol map + * @param theMap - the ol map */ - init(theMap: ol.Map) { + init(theMap: Map) { super.init(theMap); let $map; @@ -165,11 +175,11 @@ export class MapPopupCls extends MapInteractionBase { this._$popupCloser = $map.find('.ol-popup-closer'); let _ease = (n: number): number => { - return ol.easing.inAndOut(n); + return easing['inAndOut'](n); }; - this._popupOverlay = new ol.Overlay({ + this._popupOverlay = new Overlay({ element: this._$popupContainer[0], autoPan: true, autoPanAnimation: { @@ -186,10 +196,10 @@ export class MapPopupCls extends MapInteractionBase { }); // display popup on click - this._map.on('singleclick', (evt: {coordinate: [number, number], pixel: ol.Pixel}) => { + this._map.on('singleclick', (evt) => { this.closePopup(); - this._popupCoordinate = evt['coordinate']; + this._popupCoordinate = evt['coordinate'] as [number, number]; // esri map service layers if (this._esriMapServiceLayers.length > 0) { @@ -211,7 +221,7 @@ export class MapPopupCls extends MapInteractionBase { } } - let layerFeatureObjectArray = this._featuresAtPixel(evt['pixel']); + let layerFeatureObjectArray = this._featuresAtPixel(evt['pixel'] as [number, number]); this._passThroughLayerFeatureArray = []; this._currentPopupIndex = -1; @@ -345,7 +355,7 @@ export class MapPopupCls extends MapInteractionBase { * @param {string} popupContent - popup content * @param {string} esriName - esri layer name */ - addMapServicePopupContent(feature: ol.Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string) { + addMapServicePopupContent(feature: Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string) { let featLayerObject = new FeatureLayerProperties( feature, lyr, this._popupContentLength, this._selectionLayerLookup[lyr.id], esriName @@ -372,10 +382,10 @@ export class MapPopupCls extends MapInteractionBase { * @returns feature layer properties * @private */ - _featuresAtPixel(pixel: ol.Pixel): Array<FeatureLayerProperties> { + _featuresAtPixel(pixel: [number, number]): Array<FeatureLayerProperties> { let layerFeatureObjectArray: FeatureLayerProperties[] = []; - this.map.forEachFeatureAtPixel(pixel, (feature: ol.Feature, layer: ol.layer.Vector) => { + this.map.forEachFeatureAtPixel(pixel, (feature: Feature, layer: Vector) => { let hasLyr = false; let j; @@ -430,7 +440,7 @@ export class MapPopupCls extends MapInteractionBase { * @returns the new selection layer * @private */ - _addPopupLayer(lyr: LayerBaseVector|LayerEsriMapServer, selectionStyle: {color?: string, width?: number, olStyle?: ol.style.Style}): ol.layer.Vector { + _addPopupLayer(lyr: LayerBaseVector|LayerEsriMapServer, selectionStyle: {color?: string, width?: number, olStyle?: Style}): Vector { this._checkInit(); selectionStyle = selectionStyle || {}; @@ -442,25 +452,25 @@ export class MapPopupCls extends MapInteractionBase { if (selectionStyle.olStyle) { theStyle = selectionStyle.olStyle; } else { - theStyle = new ol.style.Style({ - stroke: new ol.style.Stroke({ + theStyle = new Style({ + stroke: new Stroke({ color: selectionStyle.color, width: selectionStyle.width }), - image: new ol.style.Circle({ + image: new Circle({ radius: 7, - fill: new ol.style.Fill({color: selectionStyle.color}), - stroke: new ol.style.Stroke({color: selectionStyle.color, width: 1}) + fill: new Fill({color: selectionStyle.color}), + stroke: new Stroke({color: selectionStyle.color, width: 1}) }), - fill: new ol.style.Fill({ + fill: Fill({ color: selectionStyle.color }) }); } - let selectionLayer = new ol.layer.Vector( + let selectionLayer = new Vector( { - source: new ol.source.Vector(), + source: new VectorSource(), style: theStyle } ); @@ -486,7 +496,7 @@ export class MapPopupCls extends MapInteractionBase { * @returns {object} a reference to the ol selection layer */ addVectorPopup(lyr: LayerBaseVector, popupContentFunction: popupCallback, - selectionStyle?: {color?: string, width?: number, olStyle?: ol.style.Style}) { + selectionStyle?: {color?: string, width?: number, olStyle?: Style}) { let selectionLayer = this._addPopupLayer(lyr, selectionStyle); this._arrPopupLayerIds.push(lyr.id); this._arrPopupLayers.push(lyr); @@ -523,8 +533,8 @@ export class MapPopupCls extends MapInteractionBase { * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function * @returns {object} a reference to the ol selection layer */ - addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: ol.style.Style|ol.style.Style[]) { - let selectionLayer = this._addPopupLayer(lyr, {olStyle: (selectionStyle as ol.style.Style)}); + addMapServicePopup(lyr: LayerEsriMapServer, selectionStyle?: Style|Style[]) { + let selectionLayer = this._addPopupLayer(lyr, {olStyle: (selectionStyle as Style)}); this._esriMapServiceLayers.push(lyr); return selectionLayer; diff --git a/src/olHelpers/mapToBase64.ts b/src/olHelpers/mapToBase64.ts index 9f7aa24..7b0b679 100644 --- a/src/olHelpers/mapToBase64.ts +++ b/src/olHelpers/mapToBase64.ts @@ -1,7 +1,7 @@ -import ol = require('custom-ol'); -import {LayerBaseVector} from "../layers/LayerBaseVector"; +import {LayerBaseVector} from "../layers"; import {fitToMap} from '../olHelpers/extentUtil'; import {layers} from "../"; +import Map from 'ol/Map'; declare const glob: Object; @@ -12,14 +12,8 @@ export interface iMapToBase64Options { } -/** - * - * @param {ol.Map} map - * @param {(imgData) => string} callback - * @param {iMapToBase64Options} options - * @returns {any} - */ -export function mapToBase64(map: ol.Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any { + +export function mapToBase64(map: Map, callback: (imgData: string) => any, options?: iMapToBase64Options): any { options = options || {}; if (typeof options.delay === 'number') { diff --git a/src/olHelpers/projections.ts b/src/olHelpers/projections.ts index 726b0c5..9255e2b 100644 --- a/src/olHelpers/projections.ts +++ b/src/olHelpers/projections.ts @@ -1,10 +1,11 @@ /** * Created by gavorhes on 10/3/2016. */ -import ol = require('custom-ol'); +import Projection from 'ol/proj/Projection'; -export const proj4326 = new ol.proj.Projection({code: 'EPSG:4326'}); -export const proj3857 = new ol.proj.Projection({code: 'EPSG:3857'}); -export const proj3070 = new ol.proj.Projection({code: 'EPSG:3070'}); + +export const proj4326 = new Projection({code: 'EPSG:4326'}); +export const proj3857 = new Projection({code: 'EPSG:3857'}); +export const proj3070 = new Projection({code: 'EPSG:3070'}); diff --git a/src/olHelpers/propertiesZoomStyle.ts b/src/olHelpers/propertiesZoomStyle.ts index 5db6993..8c70f99 100644 --- a/src/olHelpers/propertiesZoomStyle.ts +++ b/src/olHelpers/propertiesZoomStyle.ts @@ -4,7 +4,8 @@ import provide from '../util/provide'; import * as zoomResolutionConvert from './zoomResolutionConvert'; -import ol = require('custom-ol'); +import Feature from 'ol/Feature'; +import Style from 'ol/style/Style'; const nm = provide('olHelpers'); @@ -21,10 +22,10 @@ const nm = provide('olHelpers'); * @param {propertiesZoomStyle|*} styleFunc - style function * @returns {function|*} new function */ -function propertiesZoomStyle(styleFunc: (f: ol.Feature, res: number) => ol.style.Style|ol.style.Style[]): -(feature: ol.Feature, zoom: number) => ol.style.Style|ol.style.Style[] +function propertiesZoomStyle(styleFunc: (f: Feature, res: number) => Style|Style[]): +(feature: Feature, zoom: number) => Style|Style[] { - return function (feature: ol.Feature, zoom: number): ol.style.Style|ol.style.Style[] { + return function (feature: Feature, zoom: number): Style|Style[] { return styleFunc(feature, zoomResolutionConvert.zoomToResolution(zoom)); }; } diff --git a/src/olHelpers/quickMap.ts b/src/olHelpers/quickMap.ts index 76ece41..88fa8c4 100644 --- a/src/olHelpers/quickMap.ts +++ b/src/olHelpers/quickMap.ts @@ -6,8 +6,8 @@ import {quickMapOptions, quickMapBase} from './quickMapBase'; import provide from '../util/provide'; import mapMove from './mapMove'; import mapPopup from './mapPopup'; -import ol = require('custom-ol'); let nm = provide('olHelpers'); +import Map from 'ol/Map'; export {quickMapOptions} from './quickMapBase'; @@ -27,7 +27,7 @@ export {quickMapOptions} from './quickMapBase'; * @param {boolean} [options.fullScreen=false] if add base map switcher * @returns {ol.Map} the ol map */ -export function quickMap(options : quickMapOptions = {}): ol.Map { +export function quickMap(options : quickMapOptions = {}): Map { let m = quickMapBase(options); mapMove.init(m); mapPopup.init(m); diff --git a/src/olHelpers/quickMapBase.ts b/src/olHelpers/quickMapBase.ts index 8abc1cc..9ea2449 100644 --- a/src/olHelpers/quickMapBase.ts +++ b/src/olHelpers/quickMapBase.ts @@ -3,7 +3,17 @@ */ import provide from '../util/provide'; -import ol = require('custom-ol'); +import Map from 'ol/Map' +import Tile from 'ol/layer/Tile'; +import OSM from 'ol/source/OSM'; +import Point from 'ol/geom/Point'; +import Projection from 'ol/proj/Projection'; +import View from 'ol/View'; +import control from 'ol/control'; +import FullScreen from 'ol/control/Fullscreen'; +import * as proj from 'ol/proj'; + +// import ol = require('custom-ol'); import $ = require('jquery'); import {Geocode} from './geocode'; const nm = provide('olHelpers'); @@ -36,7 +46,7 @@ export interface quickMapOptions { * @param [options.fullScreen=false] if add base map switcher * @returns the ol map */ -export function quickMapBase(options: quickMapOptions = {}): ol.Map { +export function quickMapBase(options: quickMapOptions = {}): Map { options.divId = options.divId || 'map'; options.center = options.center || {x: -10018378, y: 5574910}; options.zoom = typeof options.zoom == 'number' ? options.zoom : 7; @@ -49,7 +59,7 @@ export function quickMapBase(options: quickMapOptions = {}): ol.Map { let $mapDiv = $('#' + options.divId); $mapDiv.css('position', 'relative'); - let osmLayer = new ol.layer.Tile({source: new ol.source.OSM()}); + let osmLayer = new Tile({source: new OSM()}); // let satLayer = new ol.layer.Tile({visible: false, source: new ol.source.MapQuest({layer: 'sat'})}); let osmCss = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAADQ1NDk5OURFREtLS1FHSFlZWGJRVGJiYWdmZWxsbHRmaXBpanN0c3V0dHp5eX5+fIVzd4F3eeV0jud5juZ8k4aHhomHhoyGh5eGj5OVlJiVlZiYl5qZmJydnKOTlaKZmqKdnaOioaqqqKuzsbOvrrSysLa3tbW4uLm6ub27ub+/vbGXwbCZwbCgxLKlxrOqyLStybO3yrSxyrWzzbW2y7a1zbK4y7W6zbW8y760yrTAzbTFzrPKzrLOzrTJzrTOzr7CwbXC0LXK0LTO0L3I0bPQz7TQz7PS0bXQ0LnR0brW1bzT0r7U077V1Lzc2dqNqteUsdyXscaquuOHneaGmueHnOeJnuiBleiKn+eNoOiOoOWUpOiRo+iSpeiUpeqYpumaqOmdrPSynemgruSqtOmisOmlsuuqtequuOW1vOuxu+uxvOq1ve+xvPK0pvW3o/W5pfO5qvS7qfCwvMOuwc2/wNenxNyyzNe/0Nq31Nq51dy72Oy3wOu4wOu+xey4wO+6xO2+xfTAr/TCsvfFtPHLvvTJuMPDwMfHxcXKyc3DxMvFyMvLyM3PzcDV08DV1MTX1cbY1s7X1sjZ1sra2Mnd3M7b2c7c2tfH1tnB1t7F2d7M29fX1tLY1tDd2tHe3NTf3NnS19rZ1tva2Nnf3t3d28rh3tXg3Nnh3tzj393k39ni4N7k4N7n5uXDyOfLz+zAxu3CyOzEyezKzeDJ3eLM3uvP0u3P0ePf2+7R0u7Q1u/U0+7U1ezc0+7a2e/d2+3f3vbFzvLOwfHN0PPQw/TUx/LWyvLYzPDQ1fPe0ubc4vve4uHh3+nh3+/h2u/h3vHj2vHl3uHm4eTn4uDp5ebo4+Xo5ODq6ebq6OTv6+nl4+/j4O7l4e7n5ujp4+np5Ozq5e7s5urt6O7t6Orw6u7x6u3x7vPj5PDl4fDo4vDq5fDt5vDu6PDv7PTv6fDx6vHx7fH17fXw6fXy7fb07/bz8fT18vn38vr39fr48/r59Pr6+P3++//+/gAAALNTSk0AAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjlsM35OAAAFNElEQVRIS1VVCZxVUxi/9l0UIUT2bMnY43bVI2c0Y01kSWIaS0j2JEtkN41piomZrPPKQ2aQ7JKImOZlnm2493TJzDufuU1Zi+v/fee+mZ//793vnPOd7zvfes5zDBEZkBBjAcIjb+Iiotqgdhat8AMK0vl7/R9N7GiWtshqIr+EZ5gYKibyUsXY1l/mfFpssvUlWQ0FkU3gy4+RB/+kwYcO8pRSnldcOU/r2lAHARSwk2ORgEmOdC1EsuRiYSqMPwwroMIraZk5V2fYJQjCKfZrRmh3gSAZi2i4b7wSylWu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nMKzcGuB0tAyzFhdCKOYWv4HwOQVwIxLG99a6uvH3sJCyO3h+k4EZ+G7+xj5f4XXksoaGrdMRzSc8ARA8+cdOuk2x6fffNNt5x+Ro1omPlrT/CQDlcNlpx4NBIWXhkx7Y3Zp3ofNR7Uv89Om/beW0TLIynHv3vs1VsOFpSWSXvfuPUf9BrRFyxgXdHoKJnQFegPOovvzz59ntrzye240ig8UQ3lDI2VqwagrKIQcLXNFL3wglN2OHdBQ6/vI3kENDVBwRb3k1XtczFbjWn4EzMYi7CF3129+JTYuRSdrGuS92g5dpqn6qXoJQs5xmL8p+Wt4hLbt0mx2OLNZR2bbPy8zJNQGFM/f/CfXZekRYFjGCWjIJpM+WiCzGBPWHhoyaAsjRT/B2Gy5yzYJkwUAAAAAElFTkSuQmCC')"; @@ -80,28 +90,32 @@ export function quickMapBase(options: quickMapOptions = {}): ol.Map { } if (options.center.x >= -180 && options.center.x <= 180 && options.center.y >= -90 && options.center.y <= 90) { - let p = new ol.geom.Point([options.center.x, options.center.y]); - new ol.proj.Projection({code: "EPSG:4326"}); + let p = new Point([options.center.x, options.center.y]); + // new Projection({code: "EPSG:4326"}); + + // let coordinates = transform(p.getCoordinates(), "EPSG:4326", "EPSG:3857"); + // p.transform(new Projection({code: "EPSG:4326"}), new Projection({code: "EPSG:3857"})); + // let coordinates = p.getCoordinates(); + let coordinates = proj['transform'](p.getCoordinates(), new Projection({code: "EPSG:4326"}), new Projection({code: "EPSG:3857"})); + - p.transform(new ol.proj.Projection({code: "EPSG:4326"}), new ol.proj.Projection({code: "EPSG:3857"})); - let coordinates = p.getCoordinates(); options.center.x = coordinates[0]; options.center.y = coordinates[1]; } - const controls = ol.control.defaults({ + const controls = control.defaults({ attributionOptions: {collapsible: false} } ); - const view = new ol.View({ + const view = new View({ center: [options.center.x, options.center.y], zoom: options.zoom, minZoom: options.minZoom, maxZoom: options.maxZoom }); - let map = new ol.Map({ + let map = new Map({ layers: [], target: options.divId, controls: controls, @@ -113,7 +127,7 @@ export function quickMapBase(options: quickMapOptions = {}): ol.Map { } if (options.fullScreen) { - map.addControl(new ol.control.FullScreen({})); + map.addControl(new FullScreen({})); } if (options.addGeocode){ diff --git a/src/olHelpers/quickMapMulti.ts b/src/olHelpers/quickMapMulti.ts index ea52811..63c227b 100644 --- a/src/olHelpers/quickMapMulti.ts +++ b/src/olHelpers/quickMapMulti.ts @@ -2,11 +2,12 @@ * Created by gavorhes on 12/15/2015. */ +import Map from 'ol/Map' + import {quickMapBase, quickMapOptions} from './quickMapBase'; import provide from '../util/provide'; import MapMoveCls from './mapMoveCls'; import MapPopupCls from './mapPopupCls'; -import ol = require('custom-ol'); let nm = provide('olHelpers'); @@ -33,7 +34,7 @@ let nm = provide('olHelpers'); * @param {boolean} [options.fullScreen=false] if add base map switcher * @returns return object with map, map move, and map popup objects */ -function quickMapMulti(options: quickMapOptions): {map: ol.Map, mapMove: MapMoveCls, mapPopup: MapPopupCls} { +function quickMapMulti(options: quickMapOptions): {map: Map, mapMove: MapMoveCls, mapPopup: MapPopupCls} { let m = quickMapBase(options); let mov = new MapMoveCls(); let pop = new MapPopupCls(); diff --git a/src/reactComponents/SelectArea.tsx b/src/reactComponents/SelectArea.tsx index 999c729..89dbf36 100644 --- a/src/reactComponents/SelectArea.tsx +++ b/src/reactComponents/SelectArea.tsx @@ -3,22 +3,28 @@ */ import {React} from './reactAndRedux'; -import ol = require('custom-ol'); import LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson'; import {proj4326, proj3857} from '../olHelpers/projections' import makeGuid from '../util/makeGuid'; import getMap from './helpers/get_map'; +import Map from 'ol/Map' +import Draw from 'ol/interaction/Draw'; +import Style from 'ol/style/Style'; +import Stroke from 'ol/style/Stroke'; +import Fill from 'ol/style/Fill'; +import Polygon from 'ol/geom/Polygon'; +import Feature from 'ol/Feature'; export interface iSelectArea{ - map: ol.Map | (() => ol.Map); + map: Map | (() => Map); callback: (coords: Array<number[]>) => any } export class SelectArea extends React.Component<iSelectArea, null> { - map: ol.Map; + map: Map; callback: (coords: Array<number[]>) => any; areaOverlay: LayerBaseVectorGeoJson; - draw: ol.interaction.Draw; + draw: Draw; selectId: string; cancelId: string; selectButton: HTMLButtonElement; @@ -35,11 +41,11 @@ export class SelectArea extends React.Component<iSelectArea, null> { this.areaOverlay = new LayerBaseVectorGeoJson('', { - style: new ol.style.Style({ - fill: new ol.style.Fill({ + style: new Style({ + fill: new Fill({ color: 'rgba(255, 0, 237, 0.1)' }), - stroke: new ol.style.Stroke({ + stroke: new Stroke({ color: 'rgb(255, 0, 237)', width: 2 }) @@ -47,16 +53,19 @@ export class SelectArea extends React.Component<iSelectArea, null> { transform: {dataProjection: proj4326, featureProjection: proj3857} }); - this.draw = new ol.interaction.Draw({ + this.draw = new Draw({ source: this.areaOverlay.source, type: 'Polygon' }); - this.draw.on('drawend', (evt: {feature: {getGeometry: () => ol.geom.Polygon}}) => { + // this.draw.on('drawend', (evt: {feature: {getGeometry: () => Polygon}}) => { + this.draw.on('drawend', (evt) => { this.selectButton.style.display = ''; this.cancelButton.style.display = 'none'; - let geom = evt.feature.getGeometry(); + + + let geom = (evt['feature'] as Feature).getGeometry() as Polygon; let geomClone = geom.clone(); geomClone.transform('EPSG:3857', 'EPSG:4326'); diff --git a/src/reactComponents/helpers/get_map.ts b/src/reactComponents/helpers/get_map.ts index 00c063c..109b8ee 100644 --- a/src/reactComponents/helpers/get_map.ts +++ b/src/reactComponents/helpers/get_map.ts @@ -1,13 +1,14 @@ /** * Created by glenn on 7/6/2017. */ -import ol = require('custom-ol'); +import Map from 'ol/Map'; +import Base from 'ol/layer/Base'; -export default function (map: ol.Map | (() => ol.Map), layer: ol.layer.Base): Promise<ol.Map> { +export default function (map: Map | (() => Map), layer: Base): Promise<Map> { return new Promise((resolve, reject) => { if (typeof map == 'function') { - let getMap = map as () => ol.Map; + let getMap = map as () => Map; let g = setInterval(() => { let m = getMap(); @@ -21,7 +22,7 @@ export default function (map: ol.Map | (() => ol.Map), layer: ol.layer.Base): Pr } }, 15); } else { - let m = map as ol.Map; + let m = map as Map; m.addLayer(layer); resolve(m); } diff --git a/tsconfig.json b/tsconfig.json index ba05c8a..ccb36ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,12 @@ { "compileOnSave": true, - "version": "2.2.1", + "version": "3.4.3", "compilerOptions": { +// "checkJs": true, + "declaration": true, +// "maxNodeModuleJsDepth": 5, +// "allowJs": true, + "baseUrl": "./", "module": "commonjs", "target": "es5", "sourceMap": true, @@ -10,9 +15,19 @@ "noEmitOnError": true, "rootDir": "./src", "outDir": "./dist", - "noImplicitAny": false + "noImplicitAny": false, + "paths": { + "ol": ["./node_modules/ol/src"], + "ol/*": ["./node_modules/ol/src/*"] + } }, - "include": [ - "./src/**/*" - ] +// "files": [ +// "./src/layers/LayerBase.ts", +// "./src/layers/LayerBaseVector.ts" +// ] +// "include": [ +// "./src/**/*" +//// "node_modules/ol/**/*.js" +// ], + "exclude": ["test/*", "dist/*"] } \ No newline at end of file -- GitLab